Code GenerationΒΆ

Python code generationΒΆ

pyrometheus.codegen.python.gen_thermochem_code(sol: Solution) strΒΆ

For the mechanism given by sol, return Python source code for a class conforming to a module containing a class called Thermochemistry adhering to the Thermochemistry interface.

pyrometheus.codegen.python.get_thermochem_class(sol: Solution)ΒΆ

For the mechanism given by sol, return a class conforming to the Thermochemistry interface.

C++ code generationΒΆ

pyrometheus.codegen.cpp.gen_thermochem_code(sol: Solution, namespace='pyrometheus') strΒΆ

For the mechanism given by sol, return Python source code for a class conforming to a module containing a class called Thermochemistry adhering to the Thermochemistry interface.

Fortran code generationΒΆ

pyrometheus.codegen.fortran90.gen_thermochem_code(sol: Solution, real_type='real(dp)', module_name='thermochem') strΒΆ

For the mechanism given by sol, return Fortran source code.

Interface of the Generated Per-Mechanism CodeΒΆ

class pyrometheus.thermochem_example.Thermochemistry(usr_np=<module 'numpy' from '/opt/homebrew/lib/python3.13/site-packages/numpy/__init__.py'>)ΒΆ
model_nameΒΆ
num_elementsΒΆ
num_speciesΒΆ
num_reactionsΒΆ
num_falloffΒΆ
one_atmΒΆ

Returns 1 atm in SI units of pressure (Pa).

gas_constantΒΆ
species_namesΒΆ
species_indicesΒΆ
get_specific_gas_constant(mass_fractions)ΒΆ
get_density(p, temperature, mass_fractions)ΒΆ
get_pressure(rho, temperature, mass_fractions)ΒΆ
get_mix_molecular_weight(mass_fractions)ΒΆ
get_concentrations(rho, mass_fractions)ΒΆ
get_mixture_specific_heat_cp_mass(temperature, mass_fractions)ΒΆ
get_mixture_specific_heat_cv_mass(temperature, mass_fractions)ΒΆ
get_mixture_enthalpy_mass(temperature, mass_fractions)ΒΆ
get_mixture_internal_energy_mass(temperature, mass_fractions)ΒΆ
get_species_specific_heats_r(temperature)ΒΆ
get_species_enthalpies_rt(temperature)ΒΆ
get_species_entropies_r(temperature)ΒΆ
get_species_gibbs_rt(temperature)ΒΆ
get_equilibrium_constants(temperature)ΒΆ
get_temperature(enthalpy_or_energy, t_guess, y, do_energy=False)ΒΆ
__init__(usr_np=<module 'numpy' from '/opt/homebrew/lib/python3.13/site-packages/numpy/__init__.py'>)ΒΆ

Initialize thermochemistry object for a mechanism.

Parameters:

usr_np –

numpy-like namespace providing at least the following functions, for any array X of the bulk array type:

where the β€œbulk array type” is a type that offers arithmetic analogous to numpy.ndarray and is used to hold all types of (potentialy volumetric) β€œbulk data”, such as temperature, pressure, mass fractions, etc. This parameter defaults to actual numpy, so it can be ignored unless it is needed by the user (e.g. for purposes of GPU processing or automatic differentiation).

Canonical NamesΒΆ

class cantera.composite.SolutionΒΆ

See cantera.Solution.

class cantera._cantera.ReactionΒΆ

See cantera.Reaction.

class cantera._cantera.ArrheniusΒΆ

See cantera.Arrhenius.