rmgpy.solver.SimpleReactor

class rmgpy.solver.SimpleReactor(T, P, initial_mole_fractions, n_sims=1, termination=None, sensitive_species=None, sensitivity_threshold=0.001, sens_conditions=None, const_spc_names=None)

A reaction system consisting of a homogeneous, isothermal, isobaric batch reactor. These assumptions allow for a number of optimizations that enable this solver to complete very rapidly, even for large kinetic models.

Keq

numpy.ndarray

Type:

Keq

P

rmgpy.quantity.ScalarQuantity

Type:

P

Prange

list

Type:

Prange

T

rmgpy.quantity.ScalarQuantity

Type:

T

Trange

list

Type:

Trange

V

‘double’

Type:

V

add_reactions_to_surface(self, list new_surface_reactions, list new_surface_reaction_inds, list surface_species, list surface_reactions, list edge_species)

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.

atol_array

numpy.ndarray

Type:

atol_array

bimolecular_threshold

numpy.ndarray

Type:

bimolecular_threshold

calculate_effective_pressure(self, rxn)

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.

collider_efficiencies

numpy.ndarray

Type:

collider_efficiencies

compute_network_variables(self, pdep_networks=None)

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(self)

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.

const_spc_indices

list

Type:

const_spc_indices

const_spc_names

list

Type:

const_spc_names

constant_volume

‘bool’

Type:

constant_volume

convert_initial_keys_to_species_objects(self, species_dict)

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

core_reaction_rates

numpy.ndarray

Type:

core_reaction_rates

core_species_concentrations

numpy.ndarray

Type:

core_species_concentrations

core_species_consumption_rates

numpy.ndarray

Type:

core_species_consumption_rates

core_species_production_rates

numpy.ndarray

Type:

core_species_production_rates

core_species_rates

numpy.ndarray

Type:

core_species_rates

dydt0

numpy.ndarray

Type:

dydt0

edge_reaction_rates

numpy.ndarray

Type:

edge_reaction_rates

edge_species_rates

numpy.ndarray

Type:

edge_species_rates

generate_rate_coefficients(self, core_reactions, edge_reactions)

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(self, core_reactions, edge_reactions)

Creates a matrix for the reactants and products.

generate_reaction_indices(self, core_reactions, edge_reactions)

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

generate_species_indices(self, core_species, edge_species)

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

get_const_spc_indices(self, core_species)

Allow to identify constant Species position in solver

get_layering_indices(self)

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(self, spc)

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

get_threshold_rate_constants(self, model_settings)

Get the threshold rate constants for reaction filtering.

initial_mole_fractions

dict

Type:

initial_mole_fractions

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(self, list core_species, list core_reactions, list edge_species, list edge_reactions, list surface_species=None, list surface_reactions=None, list pdep_networks=None, atol=1e-16, rtol=1e-8, sensitivity=False, sens_atol=1e-6, sens_rtol=1e-4, filter_reactions=False, dict conditions=None)

Initialize a simulation of the simple reactor using the provided kinetic model.

initialize_solver(self)
initialize_surface(self, list core_species, list core_reactions, list surface_species, list surface_reactions)
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(self, atol=1e-16, rtol=1e-08, sensitivity=False, sens_atol=1e-06, sens_rtol=0.0001)

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

jacobian(self, double t, ndarray y, ndarray dydt, double cj, ndarray senpar=np.zeros(1, np.float64))

Return the analytical Jacobian for the reaction system.

jacobian_matrix

numpy.ndarray

Type:

jacobian_matrix

kb

numpy.ndarray

Type:

kb

kf

numpy.ndarray

Type:

kf

log_conversions(self, species_index, y0)

Log information about the current conversion values.

log_rates(self, double char_rate, species, double species_rate, double max_dif_ln_accum_num, network, double network_rate)

Log information about the current maximum species and network rates.

max_edge_species_rate_ratios

numpy.ndarray

Type:

max_edge_species_rate_ratios

max_network_leak_rate_ratios

numpy.ndarray

Type:

max_network_leak_rate_ratios

n_sims

‘int’

Type:

n_sims

neq

‘Py_ssize_t’

Type:

neq

network_indices

numpy.ndarray

Type:

network_indices

network_leak_coefficients

numpy.ndarray

Type:

network_leak_coefficients

network_leak_rates

numpy.ndarray

Type:

network_leak_rates

num_core_reactions

‘Py_ssize_t’

Type:

num_core_reactions

num_core_species

‘Py_ssize_t’

Type:

num_core_species

num_edge_reactions

‘Py_ssize_t’

Type:

num_edge_reactions

num_edge_species

‘Py_ssize_t’

Type:

num_edge_species

num_pdep_networks

‘Py_ssize_t’

Type:

num_pdep_networks

pdep_collider_kinetics

list

Type:

pdep_collider_kinetics

pdep_collision_reaction_indices

numpy.ndarray

Type:

pdep_collision_reaction_indices

pdep_specific_collider_kinetics

list

Type:

pdep_specific_collider_kinetics

pdep_specific_collider_reaction_indices

numpy.ndarray

Type:

pdep_specific_collider_reaction_indices

product_indices

numpy.ndarray

Type:

product_indices

prunable_network_indices

numpy.ndarray

Type:

prunable_network_indices

prunable_networks

list

Type:

prunable_networks

prunable_species

list

Type:

prunable_species

prunable_species_indices

numpy.ndarray

Type:

prunable_species_indices

reactant_indices

numpy.ndarray

Type:

reactant_indices

reaction_index

dict

Type:

reaction_index

reset_max_edge_species_rate_ratios(self)

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(self, double t, ndarray y, ndarray dydt, ndarray senpar=np.zeros(1, np.float64))

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

rtol_array

numpy.ndarray

Type:

rtol_array

sens_conditions

dict

Type:

sens_conditions

sensitive_species

list

Type:

sensitive_species

sensitivity_coefficients

numpy.ndarray

Type:

sensitivity_coefficients

sensitivity_threshold

‘double’

Type:

sensitivity_threshold

set_colliders(self, core_reactions, edge_reactions, core_species)

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

set_initial_conditions(self)

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(self)

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

set_initial_reaction_thresholds(self)
set_prunable_indices(self, edge_species, pdep_networks)
simulate(self, list core_species, list core_reactions, list edge_species, list edge_reactions, list surface_species, list surface_reactions, list pdep_networks=None, bool prune=False, bool sensitivity=False, list sens_worksheet=None, model_settings=None, simulator_settings=None, dict conditions=None)

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.

snapshots

list

Type:

snapshots

species_index

dict

Type:

species_index

specific_collider_species

list

Type:

specific_collider_species

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.

surface_reaction_indices

numpy.ndarray

Type:

surface_reaction_indices

surface_species_indices

numpy.ndarray

Type:

surface_species_indices

t0

‘float’

Type:

t0

termination

list

Type:

termination

trimolecular

‘bool’

Type:

trimolecular

trimolecular_threshold

numpy.ndarray

Type:

trimolecular_threshold

unimolecular_threshold

numpy.ndarray

Type:

unimolecular_threshold

valid_layering_indices

numpy.ndarray

Type:

valid_layering_indices

y0

numpy.ndarray

Type:

y0