Cantera
2.2.1
|
Partial specialization of Kinetics for chemistry in a single bulk phase. More...
#include <BulkKinetics.h>
Public Member Functions | |
BulkKinetics (thermo_t *thermo=0) | |
virtual Kinetics * | duplMyselfAsKinetics (const std::vector< thermo_t * > &tpVector) const |
Duplication routine for objects which inherit from Kinetics. More... | |
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 | addReaction (ReactionData &r) |
Add a single reaction to the mechanism. More... | |
virtual bool | addReaction (shared_ptr< Reaction > r) |
Add a single reaction to the mechanism. More... | |
virtual void | init () |
Prepare the class for the addition of reactions. More... | |
virtual void | finalize () |
Finish adding reactions and prepare for use. More... | |
virtual bool | ready () const |
Returns true if the kinetics manager has been properly initialized and finalized. More... | |
virtual void | setMultiplier (size_t i, double f) |
Set the multiplier for reaction i to f. More... | |
Public Member Functions inherited from Kinetics | |
void | incrementRxnCount () |
Increment the number of reactions in the mechanism by one. More... | |
virtual std::pair< size_t, size_t > | checkDuplicates (bool throw_err=true) const |
Check for duplicate reactions. More... | |
void | selectPhase (const doublereal *data, const thermo_t *phase, doublereal *phase_data) |
Kinetics () | |
Default constructor. More... | |
virtual | ~Kinetics () |
Destructor. More... | |
Kinetics (const Kinetics &) | |
Copy Constructor for the Kinetics object. More... | |
Kinetics & | operator= (const Kinetics &right) |
Assignment operator. More... | |
virtual void | assignShallowPointers (const std::vector< thermo_t * > &tpVector) |
Reassign the pointers within the Kinetics object. More... | |
virtual int | type () const |
Identifies the kinetics manager type. More... | |
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) |
Return the phase index of a phase in the list of phases defined within the object. More... | |
size_t | surfacePhaseIndex () |
This returns the integer index of the phase which has ThermoPhase type cSurf. More... | |
size_t | reactionPhaseIndex () |
Phase where the reactions occur. More... | |
thermo_t & | thermo (size_t n=0) |
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism. More... | |
const thermo_t & | thermo (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_t & | speciesPhase (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... | |
thermo_t & | speciesPhase (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) |
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 | getEquilibriumConstants (doublereal *kc) |
Return a vector of Equilibrium constants. 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 const std::vector < size_t > & | reactants (size_t i) const |
Returns a read-only reference to the vector of reactant index numbers for reaction i. More... | |
virtual const std::vector < size_t > & | products (size_t i) const |
Returns a read-only reference to the vector of product index numbers for reaction i. More... | |
virtual int | reactionType (size_t i) const |
Flag specifying the type of reaction. More... | |
const std::string & | reactionString (size_t i) const |
Return a string representing the reaction. More... | |
const std::string & | reactantString (size_t i) const |
Returns a string containing the reactants side of the reaction equation. More... | |
const std::string & | productString (size_t i) const |
Returns a string containing the products side of the reaction equation. More... | |
virtual void | getFwdRateConstants (doublereal *kfwd) |
Return the forward rate constants. More... | |
virtual void | addPhase (thermo_t &thermo) |
Add a phase to the kinetics manager object. More... | |
virtual void | modifyReaction (size_t i, shared_ptr< Reaction > rNew) |
Modify the rate expression associated with a reaction. More... | |
shared_ptr< Reaction > | reaction (size_t i) |
Return the Reaction object for reaction i. More... | |
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... | |
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... | |
virtual void | installReagents (const ReactionData &r) |
virtual void | installGroups (size_t irxn, const std::vector< grouplist_t > &r, const std::vector< grouplist_t > &p) |
virtual const std::vector < grouplist_t > & | reactantGroups (size_t i) |
virtual const std::vector < grouplist_t > & | productGroups (size_t i) |
doublereal | multiplier (size_t i) const |
The current value of the multiplier for reaction i. More... | |
Protected Member Functions | |
virtual void | addElementaryReaction (ReactionData &r) |
virtual void | addElementaryReaction (ElementaryReaction &r) |
virtual void | modifyElementaryReaction (size_t i, ElementaryReaction &rNew) |
Protected Member Functions inherited from Kinetics | |
virtual void | updateROP () |
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 | |
Rate1< Arrhenius > | m_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 |
bool | m_finalized |
Protected Attributes inherited from Kinetics | |
ValueCache | m_cache |
Cache for saved calculations within each Kinetics object. More... | |
size_t | m_ii |
Number of reactions in the mechanism. 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< std::vector < size_t > > | m_reactants |
This is a vector of vectors containing the reactants for each reaction. More... | |
std::vector< std::vector < size_t > > | m_products |
This is a vector of vectors containing the products for each reaction. More... | |
std::vector< std::map< size_t, doublereal > > | m_rrxn |
m_rrxn is a vector of maps, containing the reactant stoichiometric coefficient information More... | |
std::vector< std::map< size_t, doublereal > > | m_prxn |
m_prxn is a vector of maps, containing the reactant stoichiometric coefficient information More... | |
std::vector< int > | m_rxntype |
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 id, i.e., the id attribute in the XML phase element 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... | |
std::vector< std::string > | m_rxneqn |
Representation of each reaction equation. More... | |
std::vector< std::string > | m_reactantStrings |
Representation of the reactant side of each reaction equation. More... | |
std::vector< std::string > | m_productStrings |
Representation of the product side of each reaction equation. 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 |
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... | |
Partial specialization of Kinetics for chemistry in a single bulk phase.
Definition at line 18 of file BulkKinetics.h.
Duplication routine for objects which inherit from Kinetics.
This function can be used to duplicate objects derived from Kinetics even if the application only has a pointer to Kinetics to work with.
These routines are basically wrappers around the derived copy constructor.
tpVector | Vector of pointers to ThermoPhase objects. this is the m_thermo vector within this object |
Reimplemented from Kinetics.
Reimplemented in AqueousKinetics, and GasKinetics.
Definition at line 18 of file BulkKinetics.cpp.
References Kinetics::assignShallowPointers().
|
virtual |
True if reaction i has been declared to be reversible.
If isReversible(i) is false, then the reverse rate of progress for reaction i is always zero.
i | reaction index |
Reimplemented from Kinetics.
Definition at line 25 of file BulkKinetics.cpp.
References BulkKinetics::m_revindex.
|
virtual |
Return the vector of values for the reaction Gibbs free energy change.
(virtual from Kinetics.h) These values depend upon the concentration of the solution.
units = J kmol-1
deltaG | Output vector of deltaG's for reactions Length: m_ii. |
Reimplemented from Kinetics.
Definition at line 35 of file BulkKinetics.cpp.
References ThermoPhase::getChemPotentials(), Kinetics::getReactionDelta(), and Kinetics::thermo().
|
virtual |
Return the vector of values for the reactions change in enthalpy.
These values depend upon the concentration of the solution.
units = J kmol-1
deltaH | Output vector of deltaH's for reactions Length: m_ii. |
Reimplemented from Kinetics.
Definition at line 43 of file BulkKinetics.cpp.
References ThermoPhase::getPartialMolarEnthalpies(), Kinetics::getReactionDelta(), and Kinetics::thermo().
|
virtual |
Return the vector of values for the reactions change in entropy.
These values depend upon the concentration of the solution.
units = J kmol-1 Kelvin-1
deltaS | Output vector of deltaS's for reactions Length: m_ii. |
Reimplemented from Kinetics.
Definition at line 51 of file BulkKinetics.cpp.
References ThermoPhase::getPartialMolarEntropies(), Kinetics::getReactionDelta(), and Kinetics::thermo().
|
virtual |
Return the vector of values for the reaction standard state Gibbs free energy change.
These values don't depend upon the concentration of the solution.
units = J kmol-1
deltaG | Output vector of ss deltaG's for reactions Length: m_ii. |
Reimplemented from Kinetics.
Definition at line 59 of file BulkKinetics.cpp.
References Kinetics::getReactionDelta(), ThermoPhase::getStandardChemPotentials(), and Kinetics::thermo().
|
virtual |
Return the vector of values for the change in the standard state enthalpies of reaction.
These values don't depend upon the concentration of the solution.
units = J kmol-1
deltaH | Output vector of ss deltaH's for reactions Length: m_ii. |
Reimplemented from Kinetics.
Definition at line 70 of file BulkKinetics.cpp.
References Cantera::GasConstant, ThermoPhase::getEnthalpy_RT(), Kinetics::getReactionDelta(), Kinetics::m_kk, Phase::temperature(), and Kinetics::thermo().
|
virtual |
Return the vector of values for the change in the standard state entropies for each reaction.
These values don't depend upon the concentration of the solution.
units = J kmol-1 Kelvin-1
deltaS | Output vector of ss deltaS's for reactions Length: m_ii. |
Reimplemented from Kinetics.
Definition at line 82 of file BulkKinetics.cpp.
References Cantera::GasConstant, ThermoPhase::getEntropy_R(), Kinetics::getReactionDelta(), Kinetics::m_kk, and Kinetics::thermo().
|
virtual |
Return the reverse rate constants.
length is the number of reactions. units depends on many issues. Note, this routine will return rate constants for irreversible reactions if the default for doIrreversible is overridden.
krev | Output vector of reverse rate constants. |
doIrreversible | boolean indicating whether irreversible reactions should be included. |
Reimplemented from Kinetics.
Definition at line 96 of file BulkKinetics.cpp.
References Kinetics::getEquilibriumConstants(), Kinetics::getFwdRateConstants(), Kinetics::m_ii, Kinetics::m_rkcn, and Kinetics::m_ropnet.
|
virtual |
Add a single reaction to the mechanism.
This routine must be called after init() and before finalize(). Derived classes should call the base class method in addition to handling their own specialized behavior.
r | Reference to the ReactionData object for the reaction to be added. |
Reimplemented from Kinetics.
Reimplemented in AqueousKinetics, and GasKinetics.
Definition at line 118 of file BulkKinetics.cpp.
References Kinetics::addReaction(), BulkKinetics::m_dn, BulkKinetics::m_irrev, BulkKinetics::m_revindex, Kinetics::nReactions(), ReactionData::pstoich, ReactionData::reversible, and ReactionData::rstoich.
Referenced by GasKinetics::addReaction(), and AqueousKinetics::addReaction().
|
virtual |
Add a single reaction to the mechanism.
Derived classes should call the base class method in addition to handling their own specialized behavior.
r | Pointer to the Reaction object to be added. |
true
if the reaction is added or false
if it was skipped Reimplemented from Kinetics.
Reimplemented in AqueousKinetics, and GasKinetics.
Definition at line 131 of file BulkKinetics.cpp.
References Kinetics::addReaction(), BulkKinetics::m_dn, BulkKinetics::m_irrev, BulkKinetics::m_revindex, and Kinetics::nReactions().
|
virtual |
Prepare the class for the addition of reactions.
This method is called by importKinetics() after all phases have been added but before any reactions have been. The base class method does nothing, but derived classes may use this to perform any initialization (allocating arrays, etc.) that requires knowing the phases and species, but before any reactions are added.
Reimplemented from Kinetics.
Reimplemented in GasKinetics.
Definition at line 174 of file BulkKinetics.cpp.
References Kinetics::m_kk, Kinetics::m_prxn, Kinetics::m_rrxn, Phase::nSpecies(), and Kinetics::thermo().
Referenced by GasKinetics::init().
|
virtual |
Finish adding reactions and prepare for use.
This method is called by importKinetics() after all reactions have been entered into the mechanism and before the mechanism is used to calculate reaction rates. The base class method does nothing, but derived classes may use this to perform any initialization (allocating arrays, etc.) that must be done after the reactions are entered.
Reimplemented from Kinetics.
Reimplemented in GasKinetics.
Definition at line 183 of file BulkKinetics.cpp.
References Kinetics::m_ii, Kinetics::m_perturb, Kinetics::m_rkcn, Kinetics::m_ropf, Kinetics::m_ropnet, and Kinetics::m_ropr.
Referenced by GasKinetics::finalize().
|
virtual |
Returns true if the kinetics manager has been properly initialized and finalized.
Reimplemented from Kinetics.
Reimplemented in GasKinetics, and IdealGasMix.
Definition at line 198 of file BulkKinetics.cpp.
|
virtual |
Set the multiplier for reaction i to f.
i | index of the reaction |
f | value of the multiplier. |
Reimplemented from Kinetics.
Definition at line 203 of file BulkKinetics.cpp.
References Kinetics::setMultiplier().
|
protected |
Indices of reversible reactions.
Definition at line 52 of file BulkKinetics.h.
Referenced by BulkKinetics::addReaction(), BulkKinetics::isReversible(), AqueousKinetics::updateKc(), and GasKinetics::updateKc().
|
protected |
Indices of irreversible reactions.
Definition at line 53 of file BulkKinetics.h.
Referenced by BulkKinetics::addReaction(), AqueousKinetics::updateKc(), and GasKinetics::updateKc().
|
protected |
Difference between the global reactants order and the global products order.
Of type "double" to account for the fact that we can have real- valued stoichiometries.
Definition at line 58 of file BulkKinetics.h.
Referenced by BulkKinetics::addReaction(), GasKinetics::getEquilibriumConstants(), and GasKinetics::updateKc().