Cantera
3.0.0
|
Kinetics manager for elementary gas-phase chemistry. More...
#include <GasKinetics.h>
Kinetics manager for elementary gas-phase chemistry.
This kinetics manager implements standard mass-action reaction rate expressions for low-density gases.
Definition at line 29 of file GasKinetics.h.
Public Member Functions | |
GasKinetics () | |
Constructor. | |
GasKinetics (ThermoPhase *thermo) | |
string | kineticsType () const override |
Identifies the Kinetics manager type. | |
virtual void | update_rates_T () |
Update temperature-dependent portions of reaction rates and falloff functions. | |
virtual void | update_rates_C () |
Update properties that depend on concentrations. | |
Public Member Functions inherited from BulkKinetics | |
BulkKinetics (ThermoPhase *thermo) | |
bool | isReversible (size_t i) override |
True if reaction i has been declared to be reversible. | |
bool | addReaction (shared_ptr< Reaction > r, bool resize=true) override |
Add a single reaction to the mechanism. | |
void | addThirdBody (shared_ptr< Reaction > r) |
void | modifyReaction (size_t i, shared_ptr< Reaction > rNew) override |
Modify the rate expression associated with a reaction. | |
void | resizeSpecies () override |
Resize arrays with sizes that depend on the total number of species. | |
void | resizeReactions () override |
Finalize Kinetics object and associated objects. | |
void | setMultiplier (size_t i, double f) override |
Set the multiplier for reaction i to f. | |
void | invalidateCache () override |
void | getFwdRateConstants (double *kfwd) override |
Return the forward rate constants. | |
void | getEquilibriumConstants (double *kc) override |
Return a vector of Equilibrium constants. | |
void | getRevRateConstants (double *krev, bool doIrreversible=false) override |
Return the reverse rate constants. | |
void | getDeltaGibbs (double *deltaG) override |
Return the vector of values for the reaction Gibbs free energy change. | |
void | getDeltaEnthalpy (double *deltaH) override |
Return the vector of values for the reactions change in enthalpy. | |
void | getDeltaEntropy (double *deltaS) override |
Return the vector of values for the reactions change in entropy. | |
void | getDeltaSSGibbs (double *deltaG) override |
Return the vector of values for the reaction standard state Gibbs free energy change. | |
void | getDeltaSSEnthalpy (double *deltaH) override |
Return the vector of values for the change in the standard state enthalpies of reaction. | |
void | getDeltaSSEntropy (double *deltaS) override |
Return the vector of values for the change in the standard state entropies for each reaction. | |
void | getDerivativeSettings (AnyMap &settings) const override |
Retrieve derivative settings. | |
void | setDerivativeSettings (const AnyMap &settings) override |
Set/modify derivative settings. | |
void | getFwdRateConstants_ddT (double *dkfwd) override |
Calculate derivatives for forward rate constants with respect to temperature at constant pressure, molar concentration and mole fractions. | |
void | getFwdRatesOfProgress_ddT (double *drop) override |
Calculate derivatives for forward rates-of-progress with respect to temperature at constant pressure, molar concentration and mole fractions. | |
void | getRevRatesOfProgress_ddT (double *drop) override |
Calculate derivatives for reverse rates-of-progress with respect to temperature at constant pressure, molar concentration and mole fractions. | |
void | getNetRatesOfProgress_ddT (double *drop) override |
Calculate derivatives for net rates-of-progress with respect to temperature at constant pressure, molar concentration and mole fractions. | |
void | getFwdRateConstants_ddP (double *dkfwd) override |
Calculate derivatives for forward rate constants with respect to pressure at constant temperature, molar concentration and mole fractions. | |
void | getFwdRatesOfProgress_ddP (double *drop) override |
Calculate derivatives for forward rates-of-progress with respect to pressure at constant temperature, molar concentration and mole fractions. | |
void | getRevRatesOfProgress_ddP (double *drop) override |
Calculate derivatives for reverse rates-of-progress with respect to pressure at constant temperature, molar concentration and mole fractions. | |
void | getNetRatesOfProgress_ddP (double *drop) override |
Calculate derivatives for net rates-of-progress with respect to pressure at constant temperature, molar concentration and mole fractions. | |
void | getFwdRateConstants_ddC (double *dkfwd) override |
Calculate derivatives for forward rate constants with respect to molar concentration at constant temperature, pressure and mole fractions. | |
void | getFwdRatesOfProgress_ddC (double *drop) override |
Calculate derivatives for forward rates-of-progress with respect to molar concentration at constant temperature, pressure and mole fractions. | |
void | getRevRatesOfProgress_ddC (double *drop) override |
Calculate derivatives for reverse rates-of-progress with respect to molar concentration at constant temperature, pressure and mole fractions. | |
void | getNetRatesOfProgress_ddC (double *drop) override |
Calculate derivatives for net rates-of-progress with respect to molar concentration at constant temperature, pressure and mole fractions. | |
Eigen::SparseMatrix< double > | fwdRatesOfProgress_ddX () override |
Calculate derivatives for forward rates-of-progress with respect to species mole fractions at constant temperature, pressure and molar concentration. | |
Eigen::SparseMatrix< double > | revRatesOfProgress_ddX () override |
Calculate derivatives for reverse rates-of-progress with respect to species mole fractions at constant temperature, pressure and molar concentration. | |
Eigen::SparseMatrix< double > | netRatesOfProgress_ddX () override |
Calculate derivatives for net rates-of-progress with respect to species mole fractions at constant temperature, pressure and molar concentration. | |
Eigen::SparseMatrix< double > | fwdRatesOfProgress_ddCi () override |
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant temperature, pressure and remaining species concentrations. | |
Eigen::SparseMatrix< double > | revRatesOfProgress_ddCi () override |
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant temperature, pressure and remaining species concentrations. | |
Eigen::SparseMatrix< double > | netRatesOfProgress_ddCi () override |
Calculate derivatives for net rates-of-progress with respect to species concentration at constant temperature, pressure, and remaining species concentrations. | |
void | updateROP () override |
void | getThirdBodyConcentrations (double *concm) override |
Return a vector of values of effective concentrations of third-body collision partners of any reaction. | |
const vector< double > & | thirdBodyConcentrations () const override |
Provide direct access to current third-body concentration values. | |
Public Member Functions inherited from Kinetics | |
virtual pair< size_t, size_t > | checkDuplicates (bool throw_err=true) const |
Check for unmarked duplicate reactions and unmatched marked duplicates. | |
void | selectPhase (const double *data, const ThermoPhase *phase, double *phase_data) |
Takes as input an array of properties for all species in the mechanism and copies those values belonging to a particular phase to the output array. | |
virtual void | setRoot (shared_ptr< Solution > root) |
Set root Solution holding all phase information. | |
shared_ptr< Solution > | root () const |
Get the Solution object containing this Kinetics object and associated ThermoPhase objects. | |
virtual double | reactionEnthalpy (const Composition &reactants, const Composition &products) |
Calculate the reaction enthalpy of a reaction which has not necessarily been added into the Kinetics object. | |
Kinetics ()=default | |
Default constructor. | |
Kinetics (const Kinetics &)=delete | |
Kinetics objects are not copyable or assignable. | |
Kinetics & | operator= (const Kinetics &)=delete |
size_t | nReactions () const |
Number of reactions in the reaction mechanism. | |
void | checkReactionIndex (size_t m) const |
Check that the specified reaction index is in range Throws an exception if i is greater than nReactions() | |
void | checkReactionArraySize (size_t ii) const |
Check that an array size is at least nReactions() Throws an exception if ii is less than nReactions(). | |
void | checkSpeciesIndex (size_t k) const |
Check that the specified species index is in range Throws an exception if k is greater than nSpecies()-1. | |
void | checkSpeciesArraySize (size_t mm) const |
Check that an array size is at least nSpecies() Throws an exception if kk is less than nSpecies(). | |
size_t | nPhases () const |
The number of phases participating in the reaction mechanism. | |
void | checkPhaseIndex (size_t m) const |
Check that the specified phase index is in range Throws an exception if m is greater than nPhases() | |
void | checkPhaseArraySize (size_t mm) const |
Check that an array size is at least nPhases() Throws an exception if mm is less than nPhases(). | |
size_t | phaseIndex (const string &ph) const |
Return the phase index of a phase in the list of phases defined within the object. | |
size_t | surfacePhaseIndex () const |
This returns the integer index of the phase which has ThermoPhase type cSurf. | |
size_t | reactionPhaseIndex () const |
Phase where the reactions occur. | |
shared_ptr< ThermoPhase > | reactionPhase () const |
Return pointer to phase where the reactions occur. | |
ThermoPhase & | thermo (size_t n=0) |
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism. | |
const ThermoPhase & | thermo (size_t n=0) const |
size_t | nTotalSpecies () const |
The total number of species in all phases participating in the kinetics mechanism. | |
size_t | kineticsSpeciesIndex (size_t k, size_t n) const |
The location of species k of phase n in species arrays. | |
string | kineticsSpeciesName (size_t k) const |
Return the name of the kth species in the kinetics manager. | |
size_t | kineticsSpeciesIndex (const string &nm) const |
This routine will look up a species number based on the input string nm. | |
size_t | kineticsSpeciesIndex (const string &nm, const string &ph) const |
This routine will look up a species number based on the input string nm. | |
ThermoPhase & | speciesPhase (const string &nm) |
This function looks up the name of a species and returns a reference to the ThermoPhase object of the phase where the species resides. | |
const ThermoPhase & | speciesPhase (const string &nm) const |
ThermoPhase & | speciesPhase (size_t k) |
This function takes as an argument the kineticsSpecies index (that is, the list index in the list of species in the kinetics manager) and returns the species' owning ThermoPhase object. | |
size_t | speciesPhaseIndex (size_t k) const |
This function takes as an argument the kineticsSpecies index (that is, the list index in the list of species in the kinetics manager) and returns the index of the phase owning the species. | |
virtual void | getFwdRatesOfProgress (double *fwdROP) |
Return the forward rates of progress of the reactions. | |
virtual void | getRevRatesOfProgress (double *revROP) |
Return the Reverse rates of progress of the reactions. | |
virtual void | getNetRatesOfProgress (double *netROP) |
Net rates of progress. | |
virtual void | getReactionDelta (const double *property, double *deltaProperty) const |
Change in species properties. | |
virtual void | getRevReactionDelta (const double *g, double *dg) const |
Given an array of species properties 'g', return in array 'dg' the change in this quantity in the reversible reactions. | |
virtual void | getDeltaElectrochemPotentials (double *deltaM) |
Return the vector of values for the reaction electrochemical free energy change. | |
virtual void | getCreationRates (double *cdot) |
Species creation rates [kmol/m^3/s or kmol/m^2/s]. | |
virtual void | getDestructionRates (double *ddot) |
Species destruction rates [kmol/m^3/s or kmol/m^2/s]. | |
virtual void | getNetProductionRates (double *wdot) |
Species net production rates [kmol/m^3/s or kmol/m^2/s]. | |
void | getCreationRates_ddT (double *dwdot) |
Calculate derivatives for species creation rates with respect to temperature at constant pressure, molar concentration and mole fractions. | |
void | getCreationRates_ddP (double *dwdot) |
Calculate derivatives for species creation rates with respect to pressure at constant temperature, molar concentration and mole fractions. | |
void | getCreationRates_ddC (double *dwdot) |
Calculate derivatives for species creation rates with respect to molar concentration at constant temperature, pressure and mole fractions. | |
Eigen::SparseMatrix< double > | creationRates_ddX () |
Calculate derivatives for species creation rates with respect to species mole fractions at constant temperature, pressure and molar concentration. | |
Eigen::SparseMatrix< double > | creationRates_ddCi () |
Calculate derivatives for species creation rates with respect to species concentration at constant temperature, pressure, and concentration of all other species. | |
void | getDestructionRates_ddT (double *dwdot) |
Calculate derivatives for species destruction rates with respect to temperature at constant pressure, molar concentration and mole fractions. | |
void | getDestructionRates_ddP (double *dwdot) |
Calculate derivatives for species destruction rates with respect to pressure at constant temperature, molar concentration and mole fractions. | |
void | getDestructionRates_ddC (double *dwdot) |
Calculate derivatives for species destruction rates with respect to molar concentration at constant temperature, pressure and mole fractions. | |
Eigen::SparseMatrix< double > | destructionRates_ddX () |
Calculate derivatives for species destruction rates with respect to species mole fractions at constant temperature, pressure and molar concentration. | |
Eigen::SparseMatrix< double > | destructionRates_ddCi () |
Calculate derivatives for species destruction rates with respect to species concentration at constant temperature, pressure, and concentration of all other species. | |
void | getNetProductionRates_ddT (double *dwdot) |
Calculate derivatives for species net production rates with respect to temperature at constant pressure, molar concentration and mole fractions. | |
void | getNetProductionRates_ddP (double *dwdot) |
Calculate derivatives for species net production rates with respect to pressure at constant temperature, molar concentration and mole fractions. | |
void | getNetProductionRates_ddC (double *dwdot) |
Calculate derivatives for species net production rates with respect to molar concentration at constant temperature, pressure and mole fractions. | |
Eigen::SparseMatrix< double > | netProductionRates_ddX () |
Calculate derivatives for species net production rates with respect to species mole fractions at constant temperature, pressure and molar concentration. | |
Eigen::SparseMatrix< double > | netProductionRates_ddCi () |
Calculate derivatives for species net production rates with respect to species concentration at constant temperature, pressure, and concentration of all other species. | |
virtual double | reactantStoichCoeff (size_t k, size_t i) const |
Stoichiometric coefficient of species k as a reactant in reaction i. | |
Eigen::SparseMatrix< double > | reactantStoichCoeffs () const |
Stoichiometric coefficient matrix for reactants. | |
virtual double | productStoichCoeff (size_t k, size_t i) const |
Stoichiometric coefficient of species k as a product in reaction i. | |
Eigen::SparseMatrix< double > | productStoichCoeffs () const |
Stoichiometric coefficient matrix for products. | |
Eigen::SparseMatrix< double > | revProductStoichCoeffs () const |
Stoichiometric coefficient matrix for products of reversible reactions. | |
virtual double | reactantOrder (size_t k, size_t i) const |
Reactant order of species k in reaction i. | |
virtual double | productOrder (int k, int i) const |
product Order of species k in reaction i. | |
virtual void | getActivityConcentrations (double *const conc) |
Get the vector of activity concentrations used in the kinetics object. | |
virtual string | reactionType (size_t i) const |
String specifying the type of reaction. | |
virtual string | reactionTypeStr (size_t i) const |
String specifying the type of reaction. | |
string | reactionString (size_t i) const |
Return a string representing the reaction. | |
string | reactantString (size_t i) const |
Returns a string containing the reactants side of the reaction equation. | |
string | productString (size_t i) const |
Returns a string containing the products side of the reaction equation. | |
virtual void | addThermo (shared_ptr< ThermoPhase > thermo) |
Add a phase to the kinetics manager object. | |
virtual void | addPhase (ThermoPhase &thermo) |
virtual void | init () |
Prepare the class for the addition of reactions, after all phases have been added. | |
AnyMap | parameters () |
Return the parameters for a phase definition which are needed to reconstruct an identical object using the newKinetics function. | |
shared_ptr< Reaction > | reaction (size_t i) |
Return the Reaction object for reaction i. | |
shared_ptr< const Reaction > | reaction (size_t i) const |
void | skipUndeclaredSpecies (bool skip) |
Determine behavior when adding a new reaction that contains species not defined in any of the phases associated with this kinetics manager. | |
bool | skipUndeclaredSpecies () const |
void | skipUndeclaredThirdBodies (bool skip) |
Determine behavior when adding a new reaction that contains third-body efficiencies for species not defined in any of the phases associated with this kinetics manager. | |
bool | skipUndeclaredThirdBodies () const |
double | multiplier (size_t i) const |
The current value of the multiplier for reaction i. | |
Additional Inherited Members | |
Protected Member Functions inherited from BulkKinetics | |
void | processThirdBodies (double *rop) |
Multiply rate with third-body collider concentrations. | |
void | applyEquilibriumConstants (double *rop) |
Multiply rate with inverse equilibrium constant. | |
void | applyEquilibriumConstants_ddT (double *drkcn) |
Multiply rate with scaled temperature derivatives of the inverse equilibrium constant. | |
void | process_ddT (const vector< double > &in, double *drop) |
Process temperature derivative. | |
void | process_ddP (const vector< double > &in, double *drop) |
Process pressure derivative. | |
void | process_ddC (StoichManagerN &stoich, const vector< double > &in, double *drop, bool mass_action=true) |
Process concentration (molar density) derivative. | |
Eigen::SparseMatrix< double > | calculateCompositionDerivatives (StoichManagerN &stoich, const vector< double > &in, bool ddX=true) |
Process derivatives. | |
void | assertDerivativesValid (const string &name) |
Helper function ensuring that all rate derivatives can be calculated. | |
Protected Member Functions inherited from Kinetics | |
virtual void | updateROP () |
double | checkDuplicateStoich (map< int, double > &r1, map< int, double > &r2) const |
Check whether r1 and r2 represent duplicate stoichiometries This function returns a ratio if two reactions are duplicates of one another, and 0.0 otherwise. | |
Protected Attributes inherited from BulkKinetics | |
vector< unique_ptr< MultiRateBase > > | m_bulk_rates |
Vector of rate handlers. | |
map< string, size_t > | m_bulk_types |
Mapping of rate handlers. | |
vector< size_t > | m_revindex |
Indices of reversible reactions. | |
vector< size_t > | m_irrev |
Indices of irreversible reactions. | |
vector< double > | m_dn |
Difference between the global reactants order and the global products order. | |
ThirdBodyCalc | m_multi_concm |
used with MultiRate evaluator | |
vector< double > | m_concm |
Third body concentrations. | |
vector< double > | m_act_conc |
Activity concentrations, as calculated by ThermoPhase::getActivityConcentrations. | |
vector< double > | m_phys_conc |
Physical concentrations, as calculated by ThermoPhase::getConcentrations. | |
bool | m_jac_skip_third_bodies |
Derivative settings. | |
bool | m_jac_skip_falloff |
double | m_jac_rtol_delta |
bool | m_ROP_ok = false |
vector< double > | m_rbuf0 |
Buffers for partial rop results with length nReactions() | |
vector< double > | m_rbuf1 |
vector< double > | m_rbuf2 |
vector< double > | m_kf0 |
Forward rate constants without perturbation. | |
vector< double > | m_sbuf0 |
vector< double > | m_state |
vector< double > | m_grt |
Standard chemical potentials for each species. | |
Protected Attributes inherited from Kinetics | |
ValueCache | m_cache |
Cache for saved calculations within each Kinetics object. | |
bool | m_ready = false |
Boolean indicating whether Kinetics object is fully configured. | |
size_t | m_kk = 0 |
The number of species in all of the phases that participate in this kinetics mechanism. | |
vector< double > | m_perturb |
Vector of perturbation factors for each reaction's rate of progress vector. | |
vector< shared_ptr< Reaction > > | m_reactions |
Vector of Reaction objects represented by this Kinetics manager. | |
vector< ThermoPhase * > | m_thermo |
m_thermo is a vector of pointers to ThermoPhase objects that are involved with this kinetics operator | |
vector< shared_ptr< ThermoPhase > > | m_sharedThermo |
vector of shared pointers, | |
vector< size_t > | m_start |
m_start is a vector of integers specifying the beginning position for the species vector for the n'th phase in the kinetics class. | |
map< string, size_t > | m_phaseindex |
Mapping of the phase name to the position of the phase within the kinetics object. | |
size_t | m_surfphase = npos |
Index in the list of phases of the one surface phase. | |
size_t | m_rxnphase = npos |
Phase Index where reactions are assumed to be taking place. | |
size_t | m_mindim = 4 |
number of spatial dimensions of lowest-dimensional phase. | |
vector< double > | m_rfn |
Forward rate constant for each reaction. | |
vector< double > | m_delta_gibbs0 |
Delta G^0 for all reactions. | |
vector< double > | m_rkcn |
Reciprocal of the equilibrium constant in concentration units. | |
vector< double > | m_ropf |
Forward rate-of-progress for each reaction. | |
vector< double > | m_ropr |
Reverse rate-of-progress for each reaction. | |
vector< double > | m_ropnet |
Net rate-of-progress for each reaction. | |
vector< double > | m_dH |
The enthalpy change for each reaction to calculate Blowers-Masel rates. | |
vector< double > | m_rbuf |
Buffer used for storage of intermediate reaction-specific results. | |
bool | m_skipUndeclaredSpecies = false |
See skipUndeclaredSpecies() | |
bool | m_skipUndeclaredThirdBodies = false |
See skipUndeclaredThirdBodies() | |
bool | m_hasUndeclaredThirdBodies = false |
Flag indicating whether reactions include undeclared third bodies. | |
std::weak_ptr< Solution > | m_root |
reference to Solution | |
StoichManagerN | m_reactantStoich |
Stoichiometry manager for the reactants for each reaction. | |
StoichManagerN | m_productStoich |
Stoichiometry manager for the products for each reaction. | |
StoichManagerN | m_revProductStoich |
Stoichiometry manager for the products of reversible reactions. | |
Eigen::SparseMatrix< double > | m_stoichMatrix |
Net stoichiometry (products - reactants) | |
|
inline |
Constructor.
Definition at line 34 of file GasKinetics.h.
|
inline |
Definition at line 37 of file GasKinetics.h.
|
inlineoverridevirtual |
Identifies the Kinetics manager type.
Each class derived from Kinetics should override this method to return a meaningful identifier.
Reimplemented from BulkKinetics.
Definition at line 43 of file GasKinetics.h.
|
inlinevirtual |
Update temperature-dependent portions of reaction rates and falloff functions.
Definition at line 49 of file GasKinetics.h.
|
inlinevirtual |
Update properties that depend on concentrations.
Currently the enhanced collision partner concentrations are updated here, as well as the pressure-dependent portion of P-log and Chebyshev reactions.
Definition at line 61 of file GasKinetics.h.