# rmgpy.solver.SurfaceReactor¶

class rmgpy.solver.SurfaceReactor(T, P_initial, initial_gas_mole_fractions, initial_surface_coverages, surface_volume_ratio, surface_site_density, n_sims=None, termination=None, sensitive_species=None, sensitivity_threshold=0.001, sens_conditions=None, coverage_dependence=False)

A reaction system consisting of a heterogeneous, isothermal, constant volume batch reactor.

Keq

numpy.ndarray

Type:

Keq

P_initial

rmgpy.quantity.ScalarQuantity

Type:

P_initial

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

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)
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.

constant_volume

‘bool’

Type:

constant_volume

convert_initial_keys_to_species_objects(self, species_dict)

Convert the initial_gas_mole_fractions and initial_surface_coverages dictionaries 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

coverage_dependence

‘bool’

Type:

coverage_dependence

coverage_dependencies

dict

Type:

coverage_dependencies

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 kf, kb and equilibriumConstants 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_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_gas_mole_fractions

dict

Type:

initial_gas_mole_fractions

initial_surface_coverages

dict

Type:

initial_surface_coverages

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=[], list surface_reactions=[], 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_matrix

numpy.ndarray

Type:

jacobian_matrix

kb

numpy.ndarray

Type:

kb

kf

numpy.ndarray

Type:

kf

log_conversions(self, species_index, y0)

log_initial_conditions(self, number=None)

Should correspond to the calculations done in set_initial_conditions.

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

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

reactions_on_surface

numpy.ndarray

Type:

reactions_on_surface

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 N, ndarray dNdt, 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_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 gas phase core species at start.

The total surface sites are calculated from surface_volume_ratio and surface_site_density allowing initial_surface_coverages to determine the number of moles of surface species. The number of moles of gas phase species is taken from initial_gas_mole_fractions.

The core_species_concentrations array is then determined, in mol/m3 for gas phase and mol/m2 for surface species.

The initial number of moles of a species j in the reactor 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

species_on_surface

numpy.ndarray

Type:

species_on_surface

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_site_density

rmgpy.quantity.ScalarQuantity

Type:

surface_site_density

surface_species_indices

numpy.ndarray

Type:

surface_species_indices

surface_volume_ratio

rmgpy.quantity.ScalarQuantity

Type:

surface_volume_ratio

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