BulkKinetics.cpp Source File#
BulkKinetics.cpp
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
double getDouble(const string &key, double default_) const
If key exists, return it as a double, otherwise return default_.
Definition AnyMap.cpp:1520
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Definition AnyMap.cpp:1423
bool getBool(const string &key, bool default_) const
If key exists, return it as a bool, otherwise return default_.
Definition AnyMap.cpp:1515
bool addReaction(shared_ptr< Reaction > r, bool resize=true) override
Add a single reaction to the mechanism.
Definition BulkKinetics.cpp:19
void getNetRatesOfProgress_ddC(double *drop) override
Calculate derivatives for net rates-of-progress with respect to molar concentration at constant tempe...
Definition BulkKinetics.cpp:375
Eigen::SparseMatrix< double > netRatesOfProgress_ddX() override
Calculate derivatives for net rates-of-progress with respect to species mole fractions at constant te...
Definition BulkKinetics.cpp:408
void getNetRatesOfProgress_ddP(double *drop) override
Calculate derivatives for net rates-of-progress with respect to pressure at constant temperature,...
Definition BulkKinetics.cpp:347
Eigen::SparseMatrix< double > revRatesOfProgress_ddCi() override
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant...
Definition BulkKinetics.cpp:432
void getFwdRateConstants(double *kfwd) override
Return the forward rate constants.
Definition BulkKinetics.cpp:159
void getDeltaSSGibbs(double *deltaG) override
Return the vector of values for the reaction standard state Gibbs free energy change.
Definition BulkKinetics.cpp:228
Eigen::SparseMatrix< double > fwdRatesOfProgress_ddX() override
Calculate derivatives for forward rates-of-progress with respect to species mole fractions at constan...
Definition BulkKinetics.cpp:387
void getDeltaGibbs(double *deltaG) override
Return the vector of values for the reaction Gibbs free energy change.
Definition BulkKinetics.cpp:204
vector< double > m_phys_conc
Physical concentrations, as calculated by ThermoPhase::getConcentrations.
Definition BulkKinetics.h:172
Eigen::SparseMatrix< double > revRatesOfProgress_ddX() override
Calculate derivatives for reverse rates-of-progress with respect to species mole fractions at constan...
Definition BulkKinetics.cpp:397
bool isReversible(size_t i) override
True if reaction i has been declared to be reversible.
Definition BulkKinetics.cpp:15
void getFwdRatesOfProgress_ddT(double *drop) override
Calculate derivatives for forward rates-of-progress with respect to temperature at constant pressure,...
Definition BulkKinetics.cpp:291
void assertDerivativesValid(const string &name)
Helper function ensuring that all rate derivatives can be calculated.
Definition BulkKinetics.cpp:694
void getFwdRatesOfProgress_ddP(double *drop) override
Calculate derivatives for forward rates-of-progress with respect to pressure at constant temperature,...
Definition BulkKinetics.cpp:333
void getFwdRateConstants_ddT(double *dkfwd) override
Calculate derivatives for forward rate constants with respect to temperature at constant pressure,...
Definition BulkKinetics.cpp:284
void setMultiplier(size_t i, double f) override
Set the multiplier for reaction i to f.
Definition BulkKinetics.cpp:147
void getDeltaSSEntropy(double *deltaS) override
Return the vector of values for the change in the standard state entropies for each reaction.
Definition BulkKinetics.cpp:250
vector< double > m_dn
Difference between the global reactants order and the global products order.
Definition BulkKinetics.h:161
void getDeltaSSEnthalpy(double *deltaH) override
Return the vector of values for the change in the standard state enthalpies of reaction.
Definition BulkKinetics.cpp:239
Eigen::SparseMatrix< double > calculateCompositionDerivatives(StoichManagerN &stoich, const vector< double > &in, bool ddX=true)
Process derivatives.
Definition BulkKinetics.cpp:652
void resizeSpecies() override
Resize arrays with sizes that depend on the total number of species.
Definition BulkKinetics.cpp:118
vector< double > m_act_conc
Activity concentrations, as calculated by ThermoPhase::getActivityConcentrations.
Definition BulkKinetics.h:169
void getRevRateConstants(double *krev, bool doIrreversible=false) override
Return the reverse rate constants.
Definition BulkKinetics.cpp:185
void getEquilibriumConstants(double *kc) override
Return a vector of Equilibrium constants.
Definition BulkKinetics.cpp:168
void getNetRatesOfProgress_ddT(double *drop) override
Calculate derivatives for net rates-of-progress with respect to temperature at constant pressure,...
Definition BulkKinetics.cpp:312
void processThirdBodies(double *rop)
Multiply rate with third-body collider concentrations.
Definition BulkKinetics.cpp:547
void applyEquilibriumConstants(double *rop)
Multiply rate with inverse equilibrium constant.
Definition BulkKinetics.cpp:555
void getDerivativeSettings(AnyMap &settings) const override
Retrieve derivative settings.
Definition BulkKinetics.cpp:263
void process_ddT(const vector< double > &in, double *drop)
Process temperature derivative.
Definition BulkKinetics.cpp:599
void getDeltaEnthalpy(double *deltaH) override
Return the vector of values for the reactions change in enthalpy.
Definition BulkKinetics.cpp:212
vector< unique_ptr< MultiRateBase > > m_bulk_rates
Vector of rate handlers.
Definition BulkKinetics.h:152
void getRevRatesOfProgress_ddT(double *drop) override
Calculate derivatives for reverse rates-of-progress with respect to temperature at constant pressure,...
Definition BulkKinetics.cpp:298
Eigen::SparseMatrix< double > fwdRatesOfProgress_ddCi() override
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant...
Definition BulkKinetics.cpp:422
void modifyReaction(size_t i, shared_ptr< Reaction > rNew) override
Modify the rate expression associated with a reaction.
Definition BulkKinetics.cpp:93
void getFwdRatesOfProgress_ddC(double *drop) override
Calculate derivatives for forward rates-of-progress with respect to molar concentration at constant t...
Definition BulkKinetics.cpp:361
void process_ddC(StoichManagerN &stoich, const vector< double > &in, double *drop, bool mass_action=true)
Process concentration (molar density) derivative.
Definition BulkKinetics.cpp:617
void process_ddP(const vector< double > &in, double *drop)
Process pressure derivative.
Definition BulkKinetics.cpp:608
void getFwdRateConstants_ddP(double *dkfwd) override
Calculate derivatives for forward rate constants with respect to pressure at constant temperature,...
Definition BulkKinetics.cpp:326
void getRevRatesOfProgress_ddP(double *drop) override
Calculate derivatives for reverse rates-of-progress with respect to pressure at constant temperature,...
Definition BulkKinetics.cpp:340
void getRevRatesOfProgress_ddC(double *drop) override
Calculate derivatives for reverse rates-of-progress with respect to molar concentration at constant t...
Definition BulkKinetics.cpp:368
vector< double > m_rbuf0
Buffers for partial rop results with length nReactions()
Definition BulkKinetics.h:182
void applyEquilibriumConstants_ddT(double *drkcn)
Multiply rate with scaled temperature derivatives of the inverse equilibrium constant.
Definition BulkKinetics.cpp:564
void resizeReactions() override
Finalize Kinetics object and associated objects.
Definition BulkKinetics.cpp:129
Eigen::SparseMatrix< double > netRatesOfProgress_ddCi() override
Calculate derivatives for net rates-of-progress with respect to species concentration at constant tem...
Definition BulkKinetics.cpp:443
void getThirdBodyConcentrations(double *concm) override
Return a vector of values of effective concentrations of third-body collision partners of any reactio...
Definition BulkKinetics.cpp:541
void getDeltaEntropy(double *deltaS) override
Return the vector of values for the reactions change in entropy.
Definition BulkKinetics.cpp:220
void setDerivativeSettings(const AnyMap &settings) override
Set/modify derivative settings.
Definition BulkKinetics.cpp:270
void getFwdRateConstants_ddC(double *dkfwd) override
Calculate derivatives for forward rate constants with respect to molar concentration at constant temp...
Definition BulkKinetics.cpp:354
Base class for exceptions thrown by Cantera classes.
Definition ctexceptions.h:66
virtual void resizeReactions()
Finalize Kinetics object and associated objects.
Definition Kinetics.cpp:35
ThermoPhase & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism.
Definition Kinetics.h:242
ValueCache m_cache
Cache for saved calculations within each Kinetics object.
Definition Kinetics.h:1403
vector< double > m_perturb
Vector of perturbation factors for each reaction's rate of progress vector.
Definition Kinetics.h:1452
bool m_ready
Boolean indicating whether Kinetics object is fully configured.
Definition Kinetics.h:1444
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...
Definition Kinetics.cpp:329
vector< double > m_rkcn
Reciprocal of the equilibrium constant in concentration units.
Definition Kinetics.h:1493
size_t m_kk
The number of species in all of the phases that participate in this kinetics mechanism.
Definition Kinetics.h:1448
virtual void getReactionDelta(const double *property, double *deltaProperty) const
Change in species properties.
Definition Kinetics.cpp:320
size_t nPhases() const
The number of phases participating in the reaction mechanism.
Definition Kinetics.h:184
virtual bool addReaction(shared_ptr< Reaction > r, bool resize=true)
Add a single reaction to the mechanism.
Definition Kinetics.cpp:565
virtual void modifyReaction(size_t i, shared_ptr< Reaction > rNew)
Modify the rate expression associated with a reaction.
Definition Kinetics.cpp:653
StoichManagerN m_revProductStoich
Stoichiometry manager for the products of reversible reactions.
Definition Kinetics.h:1437
bool m_hasUndeclaredThirdBodies
Flag indicating whether reactions include undeclared third bodies.
Definition Kinetics.h:1517
size_t kineticsSpeciesIndex(size_t k, size_t n) const
The location of species k of phase n in species arrays.
Definition Kinetics.h:276
virtual void setMultiplier(size_t i, double f)
Set the multiplier for reaction i to f.
Definition Kinetics.h:1369
StoichManagerN m_reactantStoich
Stoichiometry manager for the reactants for each reaction.
Definition Kinetics.h:1431
virtual void resizeSpecies()
Resize arrays with sizes that depend on the total number of species.
Definition Kinetics.cpp:553
size_t nTotalSpecies() const
The total number of species in all phases participating in the kinetics mechanism.
Definition Kinetics.h:254
An error indicating that an unimplemented function has been called.
Definition ctexceptions.h:195
virtual void getConcentrations(double *const c) const
Get the species concentrations (kmol/m^3).
Definition Phase.cpp:482
void restoreState(const vector< double > &state)
Restore a state saved on a previous call to saveState.
Definition Phase.cpp:260
void saveState(vector< double > &state) const
Save the current internal state of the phase.
Definition Phase.cpp:236
This class handles operations involving the stoichiometric coefficients on one side of a reaction (re...
Definition StoichManager.h:589
Eigen::SparseMatrix< double > derivatives(const double *conc, const double *rates)
Calculate derivatives with respect to species concentrations.
Definition StoichManager.h:780
void scale(const double *in, double *out, double factor) const
Scale input by reaction order and factor.
Definition StoichManager.h:795
virtual void getPartialMolarEnthalpies(double *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition ThermoPhase.h:801
virtual void getEntropy_R(double *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition ThermoPhase.h:880
virtual void setState_TP(double t, double p)
Set the temperature (K) and pressure (Pa)
Definition ThermoPhase.cpp:121
double RT() const
Return the Gas Constant multiplied by the current temperature.
Definition ThermoPhase.h:1062
virtual void getActivityConcentrations(double *c) const
This method returns an array of generalized concentrations.
Definition ThermoPhase.h:697
virtual void getStandardChemPotentials(double *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition ThermoPhase.h:860
virtual void getEnthalpy_RT(double *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition ThermoPhase.h:870
virtual void getChemPotentials(double *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition ThermoPhase.h:775
virtual void getPartialMolarEntropies(double *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition ThermoPhase.h:811
void scaleM(const double *in, double *out, const double *concm, double factor) const
Scale entries involving third-body collider in rate expression by third-body concentration and factor...
Definition ThirdBodyCalc.h:112
bool empty() const
Return boolean indicating whether ThirdBodyCalc is empty.
Definition ThirdBodyCalc.h:122
void install(size_t rxnNumber, const map< size_t, double > &efficiencies, double default_efficiency, bool mass_action)
Install reaction that uses third-body effects in ThirdBodyCalc manager.
Definition ThirdBodyCalc.h:23
void multiply(double *output, const double *concm)
Multiply output with effective third-body concentration.
Definition ThirdBodyCalc.h:86
void update(const vector< double > &conc, double ctot, double *concm) const
Update third-body concentrations in full vector.
Definition ThirdBodyCalc.h:75
Eigen::SparseMatrix< double > derivatives(const double *product)
Calculate derivatives with respect to species concentrations.
Definition ThirdBodyCalc.h:97
void scale(const double *in, double *out, double factor) const
Scale entries involving third-body collider in law of mass action by factor.
Definition ThirdBodyCalc.h:103
void resizeCoeffs(size_t nSpc, size_t nRxn)
Resize the sparse coefficient matrix.
Definition ThirdBodyCalc.h:47
CachedScalar getScalar(int id)
Get a reference to a CachedValue object representing a scalar (double) with the given id.
Definition ValueCache.h:161
#define AssertFinite(expr, procedure,...)
Throw an exception if the specified exception is not a finite number.
Definition ctexceptions.h:286
bool legacy_rate_constants_used()
Returns true if legacy rate constant definition is used.
Definition global.cpp:107
A cached property value and the state at which it was evaluated.
Definition ValueCache.h:33
double state2
Value of the second state variable for the state at which value was evaluated, for example density or...
Definition ValueCache.h:106
bool validate(double state1New)
Check whether the currently cached value is valid based on a single state variable.
Definition ValueCache.h:39
double state1
Value of the first state variable for the state at which value was evaluated, for example temperature...
Definition ValueCache.h:102
Generated by 1.9.7