306 const std::string& ph)
const;
403 virtual void getReactionDelta(
const double* property,
double* deltaProperty)
const;
524 "Not applicable/implemented for Kinetics object of type '{}'",
534 "Not applicable/implemented for Kinetics object of type '{}'",
607 "Not implemented for kinetics type '{}'.",
kineticsType());
618 "Not implemented for kinetics type '{}'.",
kineticsType());
629 "Not implemented for kinetics type '{}'.",
kineticsType());
640 "Not implemented for kinetics type '{}'.",
kineticsType());
654 "Not implemented for kinetics type '{}'.",
kineticsType());
665 "Not implemented for kinetics type '{}'.",
kineticsType());
676 "Not implemented for kinetics type '{}'.",
kineticsType());
690 "Not implemented for kinetics type '{}'.",
kineticsType());
707 "Not implemented for kinetics type '{}'.",
kineticsType());
718 "Not implemented for kinetics type '{}'.",
kineticsType());
729 "Not implemented for kinetics type '{}'.",
kineticsType());
743 "Not implemented for kinetics type '{}'.",
kineticsType());
760 "Not implemented for kinetics type '{}'.",
kineticsType());
771 "Not implemented for kinetics type '{}'.",
kineticsType());
782 "Not implemented for kinetics type '{}'.",
kineticsType());
796 "Not implemented for kinetics type '{}'.",
kineticsType());
813 "Not implemented for kinetics type '{}'.",
kineticsType());
1091 bool doIrreversible =
false) {
1146 virtual bool addReaction(shared_ptr<Reaction> r,
bool resize=
true);
1156 virtual void modifyReaction(
size_t i, shared_ptr<Reaction> rNew);
1163 shared_ptr<Reaction>
reaction(
size_t i);
1165 shared_ptr<const Reaction>
reaction(
size_t i)
const;
1174 bool skipUndeclaredSpecies()
const {
1186 bool skipUndeclaredThirdBodies()
const {
1219 virtual void invalidateCache() {};
1232 virtual std::pair<size_t, size_t>
checkDuplicates(
bool throw_err=
true)
const;
1244 void selectPhase(
const double* data,
const ThermoPhase* phase,
1245 double* phase_data);
1248 virtual void setRoot(std::shared_ptr<Solution> root) {
1262 virtual void updateROP() {
1280 std::map<int, double>& r2)
const;
A map of string keys to values whose type can vary at runtime.
Public interface for kinetics managers.
size_t reactionPhaseIndex() const
Phase where the reactions occur.
virtual void getEquilibriumConstants(doublereal *kc)
Return a vector of Equilibrium constants.
virtual void resizeReactions()
Finalize Kinetics object and associated objects.
Eigen::SparseMatrix< double > reactantStoichCoeffs() const
Stoichiometric coefficient matrix for reactants.
vector_fp m_delta_gibbs0
Delta G^0 for all reactions.
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 checkSpeciesArraySize(size_t mm) const
Check that an array size is at least nSpecies() Throws an exception if kk is less than nSpecies().
virtual void getDeltaGibbs(doublereal *deltaG)
Return the vector of values for the reaction Gibbs free energy change.
Kinetics(const Kinetics &)=delete
Kinetics objects are not copyable or assignable.
ThermoPhase & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism.
virtual void setDerivativeSettings(const AnyMap &settings)
Set/modify derivative settings.
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...
void checkSpeciesIndex(size_t k) const
Check that the specified species index is in range Throws an exception if k is greater than nSpecies(...
virtual doublereal reactantOrder(size_t k, size_t i) const
Reactant order of species k in reaction i.
ValueCache m_cache
Cache for saved calculations within each Kinetics object.
virtual bool isReversible(size_t i)
True if reaction i has been declared to be reversible.
virtual void getDeltaEntropy(doublereal *deltaS)
Return the vector of values for the reactions change in entropy.
virtual void getActivityConcentrations(doublereal *const conc)
Get the vector of activity concentrations used in the kinetics object.
shared_ptr< Reaction > reaction(size_t i)
Return the Reaction object for reaction i.
bool m_ready
Boolean indicating whether Kinetics object is fully configured.
virtual void getDeltaSSEntropy(doublereal *deltaS)
Return the vector of values for the change in the standard state entropies for each reaction.
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 rev...
virtual void getDeltaElectrochemPotentials(doublereal *deltaM)
Return the vector of values for the reaction electrochemical free energy change.
vector_fp m_ropnet
Net rate-of-progress for each reaction.
void selectPhase(const double *data, const ThermoPhase *phase, double *phase_data)
void getCreationRates_ddT(double *dwdot)
Calculate derivatives for species creation rates with respect to temperature at constant pressure,...
virtual void getDeltaEnthalpy(doublereal *deltaH)
Return the vector of values for the reactions change in enthalpy.
virtual Eigen::SparseMatrix< double > netRatesOfProgress_ddX()
Calculate derivatives for net rates-of-progress with respect to species mole fractions at constant te...
Eigen::SparseMatrix< double > destructionRates_ddX()
Calculate derivatives for species destruction rates with respect to species mole fractions at constan...
size_t m_kk
The number of species in all of the phases that participate in this kinetics mechanism.
ThermoPhase & speciesPhase(const std::string &nm)
This function looks up the name of a species and returns a reference to the ThermoPhase object of the...
size_t m_rxnphase
Phase Index where reactions are assumed to be taking place.
void getCreationRates_ddC(double *dwdot)
Calculate derivatives for species creation rates with respect to molar concentration at constant temp...
void getDestructionRates_ddP(double *dwdot)
Calculate derivatives for species destruction rates with respect to pressure at constant temperature,...
size_t phaseIndex(const std::string &ph) const
Return the phase index of a phase in the list of phases defined within the object.
doublereal multiplier(size_t i) const
The current value of the multiplier for reaction i.
virtual void getReactionDelta(const double *property, double *deltaProperty) const
Change in species properties.
void checkPhaseArraySize(size_t mm) const
Check that an array size is at least nPhases() Throws an exception if mm is less than nPhases().
vector_fp m_perturb
Vector of perturbation factors for each reaction's rate of progress vector.
void getNetProductionRates_ddC(double *dwdot)
Calculate derivatives for species net production rates with respect to molar concentration at constan...
size_t nPhases() const
The number of phases participating in the reaction mechanism.
void getDestructionRates_ddT(double *dwdot)
Calculate derivatives for species destruction rates with respect to temperature at constant pressure,...
std::string productString(size_t i) const
Returns a string containing the products side of the reaction equation.
virtual void addPhase(ThermoPhase &thermo)
Add a phase to the kinetics manager object.
virtual void getFwdRatesOfProgress_ddP(double *drop)
Calculate derivatives for forward rates-of-progress with respect to pressure at constant temperature,...
Eigen::SparseMatrix< double > netProductionRates_ddX()
Calculate derivatives for species net production rates with respect to species mole fractions at cons...
vector_fp m_rkcn
Reciprocal of the equilibrium constant in concentration units.
vector_fp m_rbuf
Buffer used for storage of intermediate reaction-specific results.
Eigen::SparseMatrix< double > creationRates_ddX()
Calculate derivatives for species creation rates with respect to species mole fractions at constant t...
vector_fp m_ropf
Forward rate-of-progress for each reaction.
vector_fp m_dH
The enthalpy change for each reaction to calculate Blowers-Masel rates.
void getNetProductionRates_ddT(double *dwdot)
Calculate derivatives for species net production rates with respect to temperature at constant pressu...
vector_fp m_ropr
Reverse rate-of-progress for each reaction.
virtual Eigen::SparseMatrix< double > fwdRatesOfProgress_ddX()
Calculate derivatives for forward rates-of-progress with respect to species mole fractions at constan...
virtual void getRevRatesOfProgress_ddT(double *drop)
Calculate derivatives for reverse rates-of-progress with respect to temperature at constant pressure,...
virtual bool addReaction(shared_ptr< Reaction > r, bool resize=true)
Add a single reaction to the mechanism.
virtual void getThirdBodyConcentrations(double *concm)
Return a vector of values of effective concentrations of third-body collision partners of any reactio...
virtual void setMultiplier(size_t i, doublereal f)
Set the multiplier for reaction i to f.
void skipUndeclaredSpecies(bool skip)
Determine behavior when adding a new reaction that contains species not defined in any of the phases ...
std::string kineticsSpeciesName(size_t k) const
Return the name of the kth species in the kinetics manager.
virtual void setRoot(std::shared_ptr< Solution > root)
Set root Solution holding all phase information.
std::vector< ThermoPhase * > m_thermo
m_thermo is a vector of pointers to ThermoPhase objects that are involved with this kinetics operator
virtual void getFwdRateConstants_ddP(double *dkfwd)
Calculate derivatives for forward rate constants with respect to pressure at constant temperature,...
AnyMap parameters()
Return the parameters for a phase definition which are needed to reconstruct an identical object usin...
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
virtual void getFwdRateConstants_ddT(double *dkfwd)
Calculate derivatives for forward rate constants with respect to temperature at constant pressure,...
virtual void init()
Prepare the class for the addition of reactions, after all phases have been added.
virtual void getFwdRateConstants(double *kfwd)
Return the forward rate constants.
void getCreationRates_ddP(double *dwdot)
Calculate derivatives for species creation rates with respect to pressure at constant temperature,...
bool m_skipUndeclaredThirdBodies
virtual void getNetRatesOfProgress_ddT(double *drop)
Calculate derivatives for net rates-of-progress with respect to temperature at constant pressure,...
virtual void modifyReaction(size_t i, shared_ptr< Reaction > rNew)
Modify the rate expression associated with a reaction.
void skipUndeclaredThirdBodies(bool skip)
Determine behavior when adding a new reaction that contains third-body efficiencies for species not d...
virtual double productStoichCoeff(size_t k, size_t i) const
Stoichiometric coefficient of species k as a product in reaction i.
std::map< std::string, size_t > m_phaseindex
Mapping of the phase name to the position of the phase within the kinetics object.
Eigen::SparseMatrix< double > productStoichCoeffs() const
Stoichiometric coefficient matrix for products.
Eigen::SparseMatrix< double > m_stoichMatrix
Net stoichiometry (products - reactants)
bool m_skipUndeclaredSpecies
virtual void getRevRatesOfProgress_ddP(double *drop)
Calculate derivatives for reverse rates-of-progress with respect to pressure at constant temperature,...
size_t m_mindim
number of spatial dimensions of lowest-dimensional phase.
StoichManagerN m_productStoich
Stoichiometry manager for the products for each reaction.
std::weak_ptr< Solution > m_root
reference to Solution
StoichManagerN m_revProductStoich
Stoichiometry manager for the products of reversible reactions.
virtual void getRevRatesOfProgress_ddC(double *drop)
Calculate derivatives for reverse rates-of-progress with respect to molar concentration at constant t...
Eigen::SparseMatrix< double > revProductStoichCoeffs() const
Stoichiometric coefficient matrix for products of reversible reactions.
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 ...
size_t nReactions() const
Number of reactions in the reaction mechanism.
virtual void getDerivativeSettings(AnyMap &settings) const
Retrieve derivative settings.
virtual const vector_fp & thirdBodyConcentrations() const
Provide direct access to current third-body concentration values.
virtual void getDestructionRates(doublereal *ddot)
Species destruction rates [kmol/m^3/s or kmol/m^2/s].
virtual int reactionType(size_t i) const
Flag specifying the type of reaction.
size_t kineticsSpeciesIndex(size_t k, size_t n) const
The location of species k of phase n in species arrays.
size_t m_surfphase
Index in the list of phases of the one surface phase.
virtual void getFwdRatesOfProgress(doublereal *fwdROP)
Return the forward rates of progress of the reactions.
void getNetProductionRates_ddP(double *dwdot)
Calculate derivatives for species net production rates with respect to pressure at constant temperatu...
virtual void getNetRatesOfProgress_ddP(double *drop)
Calculate derivatives for net rates-of-progress with respect to pressure at constant temperature,...
vector_fp m_rfn
Forward rate constant for each reaction.
virtual std::string reactionTypeStr(size_t i) const
String specifying the type of reaction.
virtual std::string kineticsType() const
Identifies the Kinetics manager type.
virtual doublereal productOrder(int k, int i) const
product Order of species k in reaction i.
virtual void getDeltaSSGibbs(doublereal *deltaG)
Return the vector of values for the reaction standard state Gibbs free energy change.
virtual std::pair< size_t, size_t > checkDuplicates(bool throw_err=true) const
Check for unmarked duplicate reactions and unmatched marked duplicates.
void checkReactionBalance(const Reaction &R)
Check that the specified reaction is balanced (same number of atoms for each element in the reactants...
std::string reactantString(size_t i) const
Returns a string containing the reactants side of the reaction equation.
virtual void getFwdRatesOfProgress_ddT(double *drop)
Calculate derivatives for forward rates-of-progress with respect to temperature at constant pressure,...
void getDestructionRates_ddC(double *dwdot)
Calculate derivatives for species destruction rates with respect to molar concentration at constant t...
StoichManagerN m_reactantStoich
Stoichiometry manager for the reactants for each reaction.
virtual void getNetRatesOfProgress(doublereal *netROP)
Net rates of progress.
std::string reactionString(size_t i) const
Return a string representing the reaction.
Kinetics()
Default constructor.
virtual void getNetRatesOfProgress_ddC(double *drop)
Calculate derivatives for net rates-of-progress with respect to molar concentration at constant tempe...
virtual void getCreationRates(doublereal *cdot)
Species creation rates [kmol/m^3/s or kmol/m^2/s].
size_t surfacePhaseIndex() const
This returns the integer index of the phase which has ThermoPhase type cSurf.
virtual Eigen::SparseMatrix< double > revRatesOfProgress_ddX()
Calculate derivatives for reverse rates-of-progress with respect to species mole fractions at constan...
virtual void getRevRateConstants(double *krev, bool doIrreversible=false)
Return the reverse rate constants.
virtual void resizeSpecies()
Resize arrays with sizes that depend on the total number of species.
virtual void getFwdRateConstants_ddC(double *dkfwd)
Calculate derivatives for forward rate constants with respect to molar concentration at constant temp...
std::vector< shared_ptr< Reaction > > m_reactions
Vector of Reaction objects represented by this Kinetics manager.
void checkReactionArraySize(size_t ii) const
Check that an array size is at least nReactions() Throws an exception if ii is less than nReactions()...
size_t nTotalSpecies() const
The total number of species in all phases participating in the kinetics mechanism.
virtual double reactantStoichCoeff(size_t k, size_t i) const
Stoichiometric coefficient of species k as a reactant in reaction i.
void checkReactionIndex(size_t m) const
Check that the specified reaction index is in range Throws an exception if i is greater than nReactio...
virtual void getDeltaSSEnthalpy(doublereal *deltaH)
Return the vector of values for the change in the standard state enthalpies of reaction.
virtual void getRevRatesOfProgress(doublereal *revROP)
Return the Reverse rates of progress of the reactions.
virtual void getFwdRatesOfProgress_ddC(double *drop)
Calculate derivatives for forward rates-of-progress with respect to molar concentration at constant t...
ThermoPhase & speciesPhase(size_t k)
This function takes as an argument the kineticsSpecies index (that is, the list index in the list of ...
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 ...
An error indicating that an unimplemented function has been called.
Abstract base class which stores data about a reaction and its rate parameterization so that it can b...
const Eigen::SparseMatrix< double > & stoichCoeffs() const
Return matrix containing stoichiometric coefficients.
Base class for a phase with thermodynamic properties.
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 reac...
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
std::map< std::string, double > Composition
Map from string names to doubles.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.