Cantera  2.5.1
Protected Member Functions | List of all members
GasKinetics Class Reference

Kinetics manager for elementary gas-phase chemistry. More...

#include <GasKinetics.h>

Inheritance diagram for GasKinetics:
[legend]
Collaboration diagram for GasKinetics:
[legend]

Public Member Functions

Constructors and General Information
 GasKinetics (thermo_t *thermo=0)
 Constructor. More...
 
virtual std::string kineticsType () const
 Identifies the Kinetics manager type. More...
 
Reaction Rates Of Progress
virtual void getEquilibriumConstants (doublereal *kc)
 Return a vector of Equilibrium constants. More...
 
virtual void getFwdRateConstants (doublereal *kfwd)
 Return the forward rate constants. More...
 
- Public Member Functions inherited from BulkKinetics
 BulkKinetics (thermo_t *thermo=0)
 
virtual bool isReversible (size_t i)
 True if reaction i has been declared to be reversible. More...
 
virtual void getDeltaGibbs (doublereal *deltaG)
 Return the vector of values for the reaction Gibbs free energy change. More...
 
virtual void getDeltaEnthalpy (doublereal *deltaH)
 Return the vector of values for the reactions change in enthalpy. More...
 
virtual void getDeltaEntropy (doublereal *deltaS)
 Return the vector of values for the reactions change in entropy. More...
 
virtual void getDeltaSSGibbs (doublereal *deltaG)
 Return the vector of values for the reaction standard state Gibbs free energy change. More...
 
virtual void getDeltaSSEnthalpy (doublereal *deltaH)
 Return the vector of values for the change in the standard state enthalpies of reaction. More...
 
virtual void getDeltaSSEntropy (doublereal *deltaS)
 Return the vector of values for the change in the standard state entropies for each reaction. More...
 
virtual void getRevRateConstants (doublereal *krev, bool doIrreversible=false)
 Return the reverse rate constants. More...
 
virtual void resizeSpecies ()
 Resize arrays with sizes that depend on the total number of species. More...
 
virtual void setMultiplier (size_t i, double f)
 Set the multiplier for reaction i to f. More...
 
- Public Member Functions inherited from Kinetics
 Kinetics ()
 Default constructor. More...
 
virtual ~Kinetics ()
 
 Kinetics (const Kinetics &)=delete
 Kinetics objects are not copyable or assignable. More...
 
Kineticsoperator= (const Kinetics &)=delete
 
size_t nReactions () const
 Number of reactions in the reaction mechanism. More...
 
void checkReactionIndex (size_t m) const
 Check that the specified reaction index is in range Throws an exception if i is greater than nReactions() More...
 
void checkReactionArraySize (size_t ii) const
 Check that an array size is at least nReactions() Throws an exception if ii is less than nReactions(). More...
 
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. More...
 
void checkSpeciesArraySize (size_t mm) const
 Check that an array size is at least nSpecies() Throws an exception if kk is less than nSpecies(). More...
 
size_t nPhases () const
 The number of phases participating in the reaction mechanism. More...
 
void checkPhaseIndex (size_t m) const
 Check that the specified phase index is in range Throws an exception if m is greater than nPhases() More...
 
void checkPhaseArraySize (size_t mm) const
 Check that an array size is at least nPhases() Throws an exception if mm is less than nPhases(). More...
 
size_t phaseIndex (const std::string &ph) const
 Return the phase index of a phase in the list of phases defined within the object. More...
 
size_t surfacePhaseIndex () const
 This returns the integer index of the phase which has ThermoPhase type cSurf. More...
 
size_t reactionPhaseIndex () const
 Phase where the reactions occur. More...
 
thermo_tthermo (size_t n=0)
 This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism. More...
 
const thermo_tthermo (size_t n=0) const
 
size_t nTotalSpecies () const
 The total number of species in all phases participating in the kinetics mechanism. More...
 
size_t kineticsSpeciesIndex (size_t k, size_t n) const
 The location of species k of phase n in species arrays. More...
 
std::string kineticsSpeciesName (size_t k) const
 Return the name of the kth species in the kinetics manager. More...
 
size_t kineticsSpeciesIndex (const std::string &nm) const
 This routine will look up a species number based on the input std::string nm. More...
 
size_t kineticsSpeciesIndex (const std::string &nm, const std::string &ph) const
 This routine will look up a species number based on the input std::string nm. More...
 
thermo_tspeciesPhase (const std::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. More...
 
const thermo_tspeciesPhase (const std::string &nm) const
 
thermo_tspeciesPhase (size_t k)
 This function takes as an argument the kineticsSpecies index (i.e., the list index in the list of species in the kinetics manager) and returns the species' owning ThermoPhase object. More...
 
size_t speciesPhaseIndex (size_t k) const
 This function takes as an argument the kineticsSpecies index (i.e., the list index in the list of species in the kinetics manager) and returns the index of the phase owning the species. More...
 
virtual void getFwdRatesOfProgress (doublereal *fwdROP)
 Return the forward rates of progress of the reactions. More...
 
virtual void getRevRatesOfProgress (doublereal *revROP)
 Return the Reverse rates of progress of the reactions. More...
 
virtual void getNetRatesOfProgress (doublereal *netROP)
 Net rates of progress. More...
 
virtual void getReactionDelta (const doublereal *property, doublereal *deltaProperty)
 Change in species properties. More...
 
virtual void getRevReactionDelta (const doublereal *g, doublereal *dg)
 Given an array of species properties 'g', return in array 'dg' the change in this quantity in the reversible reactions. More...
 
virtual void getDeltaElectrochemPotentials (doublereal *deltaM)
 Return the vector of values for the reaction electrochemical free energy change. More...
 
virtual void getCreationRates (doublereal *cdot)
 Species creation rates [kmol/m^3/s or kmol/m^2/s]. More...
 
virtual void getDestructionRates (doublereal *ddot)
 Species destruction rates [kmol/m^3/s or kmol/m^2/s]. More...
 
virtual void getNetProductionRates (doublereal *wdot)
 Species net production rates [kmol/m^3/s or kmol/m^2/s]. More...
 
virtual double reactantStoichCoeff (size_t k, size_t i) const
 Stoichiometric coefficient of species k as a reactant in reaction i. More...
 
virtual double productStoichCoeff (size_t k, size_t i) const
 Stoichiometric coefficient of species k as a product in reaction i. More...
 
virtual doublereal reactantOrder (size_t k, size_t i) const
 Reactant order of species k in reaction i. More...
 
virtual doublereal productOrder (int k, int i) const
 product Order of species k in reaction i. More...
 
virtual void getActivityConcentrations (doublereal *const conc)
 Get the vector of activity concentrations used in the kinetics object. More...
 
virtual int reactionType (size_t i) const
 Flag specifying the type of reaction. More...
 
std::string reactionString (size_t i) const
 Return a string representing the reaction. More...
 
std::string reactantString (size_t i) const
 Returns a string containing the reactants side of the reaction equation. More...
 
std::string productString (size_t i) const
 Returns a string containing the products side of the reaction equation. More...
 
virtual void addPhase (thermo_t &thermo)
 Add a phase to the kinetics manager object. More...
 
shared_ptr< Reactionreaction (size_t i)
 Return the Reaction object for reaction i. More...
 
shared_ptr< const Reactionreaction (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. More...
 
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. More...
 
bool skipUndeclaredThirdBodies () const
 
doublereal multiplier (size_t i) const
 The current value of the multiplier for reaction i. More...
 
virtual std::pair< size_t, size_t > checkDuplicates (bool throw_err=true) const
 Check for unmarked duplicate reactions and unmatched marked duplicates. More...
 
void selectPhase (const doublereal *data, const thermo_t *phase, doublereal *phase_data)
 
virtual void setRoot (std::shared_ptr< Solution > root)
 Set root Solution holding all phase information. More...
 

Protected Member Functions

void processFalloffReactions ()
 
void addThreeBodyReaction (ThreeBodyReaction &r)
 
void addFalloffReaction (FalloffReaction &r)
 
void addPlogReaction (PlogReaction &r)
 
void addChebyshevReaction (ChebyshevReaction &r)
 
void modifyThreeBodyReaction (size_t i, ThreeBodyReaction &r)
 
void modifyFalloffReaction (size_t i, FalloffReaction &r)
 
void modifyPlogReaction (size_t i, PlogReaction &r)
 
void modifyChebyshevReaction (size_t i, ChebyshevReaction &r)
 
void updateKc ()
 Update the equilibrium constants in molar units. More...
 
- Protected Member Functions inherited from BulkKinetics
virtual void addElementaryReaction (ElementaryReaction &r)
 
virtual void modifyElementaryReaction (size_t i, ElementaryReaction &rNew)
 
- Protected Member Functions inherited from Kinetics
double checkDuplicateStoich (std::map< int, double > &r1, std::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. More...
 
void checkReactionBalance (const Reaction &R)
 Check that the specified reaction is balanced (same number of atoms for each element in the reactants and products). More...
 

Protected Attributes

Reaction rate data
doublereal m_logp_ref
 
doublereal m_logc_ref
 
doublereal m_logStandConc
 
vector_fp m_rfn_low
 
vector_fp m_rfn_high
 
doublereal m_pres
 Last pressure at which rates were evaluated. More...
 
vector_fp falloff_work
 
vector_fp concm_3b_values
 
vector_fp concm_falloff_values
 
- Protected Attributes inherited from BulkKinetics
Rate1< Arrheniusm_rates
 
std::vector< size_t > m_revindex
 Indices of reversible reactions. More...
 
std::vector< size_t > m_irrev
 Indices of irreversible reactions. More...
 
vector_fp m_dn
 Difference between the global reactants order and the global products order. More...
 
vector_fp m_conc
 
vector_fp m_grt
 
bool m_ROP_ok
 
doublereal m_temp
 
- Protected Attributes inherited from Kinetics
StoichManagerN m_reactantStoich
 Stoichiometry manager for the reactants for each reaction. More...
 
StoichManagerN m_revProductStoich
 Stoichiometry manager for the products of reversible reactions. More...
 
StoichManagerN m_irrevProductStoich
 Stoichiometry manager for the products of irreversible reactions. More...
 
size_t m_kk
 The number of species in all of the phases that participate in this kinetics mechanism. More...
 
vector_fp m_perturb
 Vector of perturbation factors for each reaction's rate of progress vector. More...
 
std::vector< shared_ptr< Reaction > > m_reactions
 Vector of Reaction objects represented by this Kinetics manager. More...
 
std::vector< thermo_t * > m_thermo
 m_thermo is a vector of pointers to ThermoPhase objects that are involved with this kinetics operator More...
 
std::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. More...
 
std::map< std::string, size_t > m_phaseindex
 Mapping of the phase name to the position of the phase within the kinetics object. More...
 
size_t m_surfphase
 Index in the list of phases of the one surface phase. More...
 
size_t m_rxnphase
 Phase Index where reactions are assumed to be taking place. More...
 
size_t m_mindim
 number of spatial dimensions of lowest-dimensional phase. More...
 
vector_fp m_rfn
 Forward rate constant for each reaction. More...
 
vector_fp m_rkcn
 Reciprocal of the equilibrium constant in concentration units. More...
 
vector_fp m_ropf
 Forward rate-of-progress for each reaction. More...
 
vector_fp m_ropr
 Reverse rate-of-progress for each reaction. More...
 
vector_fp m_ropnet
 Net rate-of-progress for each reaction. More...
 
bool m_skipUndeclaredSpecies
 
bool m_skipUndeclaredThirdBodies
 
std::weak_ptr< Solutionm_root
 reference to Solution More...
 
ValueCache m_cache
 Cache for saved calculations within each Kinetics object. More...
 

Reaction Mechanism Setup Routines

std::vector< size_t > m_fallindx
 Reaction index of each falloff reaction. More...
 
std::map< size_t, size_t > m_rfallindx
 Map of reaction index to falloff reaction index (i.e indices in m_falloff_low_rates and m_falloff_high_rates) More...
 
Rate1< Arrheniusm_falloff_low_rates
 Rate expressions for falloff reactions at the low-pressure limit. More...
 
Rate1< Arrheniusm_falloff_high_rates
 Rate expressions for falloff reactions at the high-pressure limit. More...
 
FalloffMgr m_falloffn
 
ThirdBodyCalc m_3b_concm
 
ThirdBodyCalc m_falloff_concm
 
Rate1< Plogm_plog_rates
 
Rate1< ChebyshevRatem_cheb_rates
 
virtual void init ()
 Prepare the class for the addition of reactions, after all phases have been added. More...
 
virtual bool addReaction (shared_ptr< Reaction > r)
 Add a single reaction to the mechanism. More...
 
virtual void modifyReaction (size_t i, shared_ptr< Reaction > rNew)
 Modify the rate expression associated with a reaction. More...
 
virtual void invalidateCache ()
 
void updateROP ()
 
virtual void update_rates_T ()
 Update temperature-dependent portions of reaction rates and falloff functions. More...
 
virtual void update_rates_C ()
 Update properties that depend on concentrations. More...
 

Detailed Description

Kinetics manager for elementary gas-phase chemistry.

This kinetics manager implements standard mass-action reaction rate expressions for low-density gases.

Definition at line 26 of file GasKinetics.h.

Constructor & Destructor Documentation

◆ GasKinetics()

GasKinetics ( thermo_t thermo = 0)

Constructor.

Parameters
thermoPointer to the gas ThermoPhase (optional)

Definition at line 14 of file GasKinetics.cpp.

Member Function Documentation

◆ kineticsType()

virtual std::string kineticsType ( ) const
inlinevirtual

Identifies the Kinetics manager type.

Each class derived from Kinetics should override this method to return a meaningful identifier.

Reimplemented from Kinetics.

Definition at line 38 of file GasKinetics.h.

◆ getEquilibriumConstants()

void getEquilibriumConstants ( doublereal *  kc)
virtual

Return a vector of Equilibrium constants.

Return the equilibrium constants of the reactions in concentration units in array kc, which must be dimensioned at least as large as the total number of reactions.

\[ Kc_i = exp [ \Delta G_{ss,i} ] prod(Cs_k) exp(\sum_k \nu_{k,i} F \phi_n) ] \]

Parameters
kcOutput vector containing the equilibrium constants. Length: nReactions().

Reimplemented from Kinetics.

Definition at line 111 of file GasKinetics.cpp.

References Kinetics::getReactionDelta(), ThermoPhase::getStandardChemPotentials(), BulkKinetics::m_dn, Kinetics::m_rkcn, Kinetics::nReactions(), ThermoPhase::RT(), Kinetics::thermo(), and GasKinetics::update_rates_T().

◆ getFwdRateConstants()

void getFwdRateConstants ( doublereal *  kfwd)
virtual

Return the forward rate constants.

The computed values include all temperature-dependent, pressure-dependent, and third body contributions. Length is the number of reactions. Units are a combination of kmol, m^3 and s, that depend on the rate expression for the reaction.

Parameters
kfwdOutput vector containing the forward reaction rate constants. Length: nReactions().

Reimplemented from Kinetics.

Definition at line 202 of file GasKinetics.cpp.

References GasKinetics::m_falloff_high_rates, Kinetics::m_perturb, Kinetics::m_rfn, Kinetics::m_ropf, Kinetics::nReactions(), GasKinetics::update_rates_C(), and GasKinetics::update_rates_T().

◆ init()

void init ( )
virtual

Prepare the class for the addition of reactions, after all phases have been added.

This method is called automatically when the first reaction is added. It needs to be called directly only in the degenerate case where there are no reactions. The base class method does nothing, but derived classes may use this to perform any initialization (allocating arrays, etc.) that requires knowing the phases.

Reimplemented from Kinetics.

Definition at line 377 of file GasKinetics.cpp.

References Cantera::GasConstant, Kinetics::init(), and Kinetics::thermo().

◆ addReaction()

bool addReaction ( shared_ptr< Reaction r)
virtual

Add a single reaction to the mechanism.

Derived classes should call the base class method in addition to handling their own specialized behavior.

Parameters
rPointer to the Reaction object to be added.
Returns
true if the reaction is added or false if it was skipped

Reimplemented from BulkKinetics.

Definition at line 225 of file GasKinetics.cpp.

References BulkKinetics::addReaction(), Cantera::CHEBYSHEV_RXN, Cantera::CHEMACT_RXN, Cantera::ELEMENTARY_RXN, Cantera::FALLOFF_RXN, Cantera::PLOG_RXN, and Cantera::THREE_BODY_RXN.

◆ modifyReaction()

void modifyReaction ( size_t  i,
shared_ptr< Reaction rNew 
)
virtual

Modify the rate expression associated with a reaction.

The stoichiometric equation, type of the reaction, reaction orders, third body efficiencies, reversibility, etc. must be unchanged.

Parameters
iIndex of the reaction to be modified
rNewReaction with the new rate expressions

Reimplemented from Kinetics.

Definition at line 321 of file GasKinetics.cpp.

References Cantera::CHEBYSHEV_RXN, Cantera::CHEMACT_RXN, Cantera::ELEMENTARY_RXN, Cantera::FALLOFF_RXN, GasKinetics::m_pres, Kinetics::modifyReaction(), Cantera::PLOG_RXN, and Cantera::THREE_BODY_RXN.

◆ update_rates_T()

void update_rates_T ( )
virtual

Update temperature-dependent portions of reaction rates and falloff functions.

Definition at line 23 of file GasKinetics.cpp.

Referenced by GasKinetics::getEquilibriumConstants(), and GasKinetics::getFwdRateConstants().

◆ update_rates_C()

void update_rates_C ( )
virtual

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

References ThermoPhase::getActivityConcentrations(), Phase::molarDensity(), and Kinetics::thermo().

Referenced by GasKinetics::getFwdRateConstants().

◆ updateKc()

void updateKc ( )
protected

Member Data Documentation

◆ m_fallindx

std::vector<size_t> m_fallindx
protected

Reaction index of each falloff reaction.

Definition at line 72 of file GasKinetics.h.

◆ m_rfallindx

std::map<size_t, size_t> m_rfallindx
protected

Map of reaction index to falloff reaction index (i.e indices in m_falloff_low_rates and m_falloff_high_rates)

Definition at line 76 of file GasKinetics.h.

◆ m_falloff_low_rates

Rate1<Arrhenius> m_falloff_low_rates
protected

Rate expressions for falloff reactions at the low-pressure limit.

Definition at line 79 of file GasKinetics.h.

◆ m_falloff_high_rates

Rate1<Arrhenius> m_falloff_high_rates
protected

Rate expressions for falloff reactions at the high-pressure limit.

Definition at line 82 of file GasKinetics.h.

Referenced by GasKinetics::getFwdRateConstants().

◆ m_pres

doublereal m_pres
protected

Last pressure at which rates were evaluated.

Definition at line 100 of file GasKinetics.h.

Referenced by GasKinetics::modifyReaction().


The documentation for this class was generated from the following files: