9.5. Simulation and Sensitivity/Uncertainty Analysis¶
For sensitivity analysis, RMG-Py must be compiled with the DASPK solver, which is done by default but has some dependency restrictions. (See License Restrictions on Dependencies for more details.) Sensitivity analysis or a simulation (without sensitivity) can be conducted in a standalone system for an existing kinetics model in Chemkin format.
To run a simulation and/or sensitivity analysis, use the simulate module in RMG-Py/scripts:
python simulate.py input.py chem.inp species_dictionary.txt
where chem.inp
is the CHEMKIN file and the species_dictionary.txt
contains the dictionary of
species associated with the CHEMKIN file. input.py
is an input file similar to one used for an RMG job but
does not generate a RMG job. See the following input.py
example file found under the
$RMGPy/examples/sensitivity/input.py
folder
# Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
kineticsEstimator = 'rate rules',
)
# Constraints on generated species
generatedSpeciesConstraints(
maximumRadicalElectrons = 2,
)
# List of species
species(
label='ethane',
reactive=True,
structure=SMILES("CC"),
)
# Reaction systems
simpleReactor(
temperature=(1350,'K'),
pressure=(1.0,'bar'),
initialMoleFractions={
"ethane": 1.0,
},
terminationConversion={
'ethane': 0.9,
},
terminationTime=(1e6,'s'),
sensitivity=['ethane'],
sensitivityThreshold=0.01,
)
simulator(
atol=1e-16,
rtol=1e-8,
sens_atol=1e-6,
sens_rtol=1e-4,
)
model(
toleranceKeepInEdge=0.0,
toleranceMoveToCore=0.1,
toleranceInterruptSimulation=0.1,
maximumEdgeSpecies=100000
)
options(
units='si',
saveSimulationProfiles=False,
generateOutputHTML=False,
generatePlots=False,
)
The names of species named in the input file must coincide with the names specified in the CHEMKIN file.
Other options that can be specified for the simulate.py
scripts are:
--no-dlim Turn off diffusion-limited rates for LiquidReactor
-f, --foreign Not an RMG generated Chemkin file (will be checked for duplicates)
Sensitivity analysis is conducted for the list of species given for the sensitivity
argument in the input file.
The normalized concentration sensitivities with respect to the reaction rate coefficients dln(C_i)/dln(k_j) are saved to a csv file
with the file name sensitivity_1_SPC_1.csv
with the first index value indicating the reactor system and the second naming the index of the species
the sensitivity analysis is conducted for. Sensitivities to thermo of individual species is also saved as semi normalized sensitivities
dln(C_i)/d(G_j) where the units are given in 1/(kcal mol-1). The sensitivityThreshold is set to some value so that only
sensitivities for dln(C_i)/dln(k_j) > sensitivityThreshold or dlnC_i/d(G_j) > sensitivityThreshold are saved to this file.
Uncertainty analysis can also be requested via input file options. For more details, see Uncertainty Analysis.
The results of the analysis will be printed in the simulate.log
file which is generated.