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 theThermochemistry
interface.
- pyrometheus.codegen.python.get_thermochem_class(sol: Solution)#
For the mechanism given by sol, return a class conforming to the
Thermochemistry
interface.
Interface of the Generated Per-Mechanism Code#
- class pyrometheus.thermochem_example.Thermochemistry(usr_np=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyrometheus/envs/latest/lib/python3.10/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 '/home/docs/checkouts/readthedocs.org/user_builds/pyrometheus/envs/latest/lib/python3.10/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 arrayX
of the bulk array type:usr_np.log(X)
(likenumpy.log
)usr_np.log10(X)
(likenumpy.log10
)usr_np.exp(X)
(likenumpy.exp
)usr_np.where(X > 0, X_yes, X_no)
(likenumpy.where()
)usr_np.linalg.norm(X, np.inf)
(likenumpy.linalg.norm()
)
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
.