rmgpy.solver.MBSampledReactor

class rmgpy.solver.MBSampledReactor

A reaction system consisting of a homogeneous, isothermal, isobaric batch reactor that is being sample by a molecular beam. The sampling process is modeled as a unimolecular reaction. These assumptions allow for a number of optimizations that enable this solver to complete very rapidly, even for large kinetic models.

This is currently only intended for use with the simulate.py script, and cannot be used for a standard RMG job.

add_reactions_to_surface()

moves new surface reactions to the surface done after the while loop before the simulate call ends

advance()

Simulate from the current value of the independent variable to a specified value tout, taking as many steps as necessary. The resulting values of \(t\), \(\mathbf{y}\), and \(\frac{d \mathbf{y}}{dt}\) can then be accessed via the t, y, and dydt attributes.

calculate_effective_pressure()

Computes the effective pressure for a reaction as:

\[P_{eff} = P * \sum_i \frac{y_i * eff_i}{\sum_j y_j}\]
with:
  • P the pressure of the reactor,

  • y the array of initial moles of the core species

or as:

\[P_{eff} = \frac{P * y_{specific_collider}}{\sum_j y_j}\]

if a specific_collider is mentioned.

compute_network_variables()

Initialize the arrays containing network information:

  • NetworkLeakCoefficients is a n x 1 array with

    n the number of pressure-dependent networks.

  • NetworkIndices is a n x 3 matrix with

    n the number of pressure-dependent networks and 3 the maximum number of molecules allowed in either the reactant or product side of a reaction.

compute_rate_derivative()

Returns derivative vector df/dk_j where dy/dt = f(y, t, k) and k_j is the rate parameter for the jth core reaction.

convert_initial_keys_to_species_objects()

Convert the initial_mole_fractions dictionary from species names into species objects, using the given dictionary of species.

generate_rate_coefficients()

Populates the forward rate coefficients (kf), reverse rate coefficients (kb) and equilibrium constants (Keq) arrays with the values computed at the temperature and (effective) pressure of the reaction system.

generate_reactant_product_indices()

Creates a matrix for the reactants and products.

generate_reaction_indices()

Assign an index to each reaction (core first, then edge) and store the (reaction, index) pair in a dictionary.

generate_species_indices()

Assign an index to each species (core first, then edge) and store the (species, index) pair in a dictionary.

get_layering_indices()

determines the edge reaction indices that indicate reactions that are valid for movement from edge to surface based on the layering constraint

get_species_index()

Retrieves the index that is associated with the parameter species from the species index dictionary.

initialize()

Initialize the DASPK solver by setting the initial values of the independent variable t0, dependent variables y0, and first derivatives dydt0. If provided, the derivatives must be consistent with the other initial conditions; if not provided, DASPK will attempt to estimate a consistent set of initial values for the derivatives. You can also set the absolute and relative tolerances atol and rtol, respectively, either as single values for all dependent variables or individual values for each dependent variable.

initialize_model()

Initialize a simulation of the reaction system using the provided kinetic model. You will probably want to create your own version of this method in the derived class; don’t forget to also call the base class version, too.

initialize_surface()
removes surface_species and surface_reactions from until they are self consistent:
  1. every reaction has one species in the surface

  2. every species participates in a surface reaction

initiate_tolerances()

Computes the number of differential equations and initializes the tolerance arrays.

log_conversions()

Log information about the current conversion values.

log_rates()

Log information about the current maximum species and network rates.

reset_max_edge_species_rate_ratios()

This function sets max_edge_species_rate_ratios back to zero for pruning of ranged reactors it is important to avoid doing this every initialization

residual()

Return the residual function for the governing DAE system for the simple reaction system.

set_colliders()

Store collider efficiencies and reaction indices for pdep reactions that have collider efficiencies, and store specific collider indices

set_initial_conditions()

Sets the initial conditions of the rate equations that represent the current reactor model.

The volume is set to the value derived from the ideal gas law, using the user-defined pressure, temperature, and the number of moles of initial species.

The species moles array (y0) is set to the values stored in the initial mole fractions dictionary.

The initial species concentration is computed and stored in the core_species_concentrations array.

set_initial_derivative()

Sets the derivative of the species moles with respect to the independent variable (time) equal to the residual.

simulate()

Simulate the reaction system with the provided reaction model, consisting of lists of core species, core reactions, edge species, and edge reactions. As the simulation proceeds the system is monitored for validity. If the model becomes invalid (e.g. due to an excessively large edge flux), the simulation is interrupted and the object causing the model to be invalid is returned. If the simulation completes to the desired termination criteria and the model remains valid throughout, None is returned.

step()

Perform one simulation step from the current value of the independent variable toward (but not past) a specified value tout. The resulting values of \(t\), \(\mathbf{y}\), and \(\frac{d \mathbf{y}}{dt}\) can then be accessed via the t, y, and dydt attributes.