rmgpy.solver.LiquidReactor

class rmgpy.solver.LiquidReactor(T, initial_concentrations, 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, constant volume 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

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

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_concentrations 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 forwardRateCoefficients, reverseRateCoefficients and equilibriumConstants arrays with the values computed at the temperature and (effective) pressure of the reacion 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.

model_settings is not used here, but is needed so that the method matches the one in simpleReactor.

initial_concentrations

dict

Type:

initial_concentrations

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 liquid 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

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

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

The volume is set to the value in m3 required to contain one mole total of core species at start.

The core_species_concentrations array is set to the values stored in the initial concentrations dictionary.

The initial number of moles of a species j is computed and stored in the y0 instance attribute.

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

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

viscosity

‘double’

Type:

viscosity

y0

numpy.ndarray

Type:

y0