Chemistry solvers¶
Setup and initialization¶
- pecans.chemistry.chem_setup.get_initial_conditions(config, specie)[source]¶
Get the initial conditions for a given chemical specie based on how the configuration specifies it
- Parameters:
config (
BetterConfig) – the configuration objectspecie (str) – the name of the chemical specie to load
- Returns:
the array of initial concentrations
- Return type:
numpy.ndarray
- pecans.chemistry.chem_setup.setup_chemistry(config)[source]¶
Return the driver function that, when called, will calculate the change in concentrations due to chemistry.
- Parameters:
config (
BetterConfig) – the configuration object. Must include the option “mechanism” in the “CHEMISTRY” section- Returns:
1) the driver function. All driver functions must be called with dt, temperature, and number density of air followed by keyword-value pairs of all the chemical species in the mechanism. 2) the tuple of species names required by the mechanism.
- Return type:
function, tuple of str
Ideal chemical mechanisms¶
The ideal module contains the functions necessary to initialize and solve idealized chemistry cases. These are very
simplified chemical models that, rather that explicitly simulating a full chemical mechanism, instead impose some ideal
kinetic model on just a few species. For example, one is a simple first-order loss, where it is just specified that the
only chemical specie in the model has some lifetime.
- pecans.chemistry.ideal.init_explicit_first_order_chem_solver(lifetime_seconds, species_name='A', **kwargs)[source]¶
Initialization function for the idealized first-order chemistry solver.
- Parameters:
lifetime_seconds (int or float) – the first-order lifetime in seconds, i.e. how long it would take the concentration to decrease to \(1/e\) of its original value.
species_name – optional, the name that the specie in this mechanism will be referred to by. Default is “A”. Changing this has no real effect on the mechanism, just what it is called in the output.
kwargs – extra keyword arguments not used in this function.
- Returns:
the solver function and a tuple of species names.
- Return type:
function and tuple of str