InterfaceKinetics.cpp Source File#
InterfaceKinetics.cpp
Go to the documentation of this file.
Declarations for the implicit integration of surface site density equations (see Kinetics Managers an...
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
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
Base class for exceptions thrown by Cantera classes.
Definition ctexceptions.h:66
Advances the surface coverages of the associated set of SurfacePhase objects in time.
Definition ImplicitSurfChem.h:59
void initialize(double t0=0.0)
Must be called before calling method 'advance'.
Definition ImplicitSurfChem.cpp:124
void integrate(double t0, double t1)
Integrate from t0 to t1. The integrator is reinitialized first.
Definition ImplicitSurfChem.cpp:133
void setTolerances(double rtol=1.e-7, double atol=1.e-14)
Set the relative and absolute integration tolerances.
Definition ImplicitSurfChem.cpp:105
void setMaxStepSize(double maxstep=0.0)
Set the maximum integration step-size.
Definition ImplicitSurfChem.cpp:97
void setMaxSteps(size_t maxsteps=20000)
Set the maximum number of CVODES integration steps.
Definition ImplicitSurfChem.cpp:112
void solvePseudoSteadyStateProblem(int ifuncOverride=-1, double timeScaleOverride=1.0)
Solve for the pseudo steady-state of the surface problem.
Definition ImplicitSurfChem.cpp:176
void setMaxErrTestFails(size_t maxErrTestFails=7)
Set the maximum number of CVODES error test failures.
Definition ImplicitSurfChem.cpp:118
bool addReaction(shared_ptr< Reaction > r, bool resize=true) override
Add a single reaction to the mechanism.
Definition InterfaceKinetics.cpp:380
int phaseExistence(const size_t iphase) const
Gets the phase existence int for the ith phase.
Definition InterfaceKinetics.cpp:567
double interfaceCurrent(const size_t iphase)
Gets the interface current for the ith phase.
Definition InterfaceKinetics.cpp:589
vector< vector< bool > > m_rxnPhaseIsReactant
Vector of vector of booleans indicating whether a phase participates in a reaction as a reactant.
Definition InterfaceKinetics.h:471
vector< int > m_phaseIsStable
Vector of int indicating whether phases are stable or not.
Definition InterfaceKinetics.h:463
Eigen::SparseMatrix< double > revRatesOfProgress_ddCi() override
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant...
Definition InterfaceKinetics.cpp:616
void getFwdRateConstants(double *kfwd) override
Return the forward rate constants.
Definition InterfaceKinetics.cpp:177
vector< bool > m_phaseExists
Vector of booleans indicating whether phases exist or not.
Definition InterfaceKinetics.h:453
void getDeltaSSGibbs(double *deltaG) override
Return the vector of values for the reaction standard state Gibbs free energy change.
Definition InterfaceKinetics.cpp:333
void setPhaseStability(const size_t iphase, const int isStable)
Set the stability of a phase in the reaction object.
Definition InterfaceKinetics.cpp:579
void getDeltaGibbs(double *deltaG) override
Return the vector of values for the reaction Gibbs free energy change.
Definition InterfaceKinetics.cpp:283
bool m_jac_skip_coverage_dependence
A flag used to neglect rate coefficient coverage dependence in derivative formation.
Definition InterfaceKinetics.h:493
void _update_rates_phi()
Update properties that depend on the electric potential.
Definition InterfaceKinetics.cpp:81
void assertDerivativesValid(const string &name)
Helper function ensuring that all rate derivatives can be calculated.
Definition InterfaceKinetics.cpp:674
double m_jac_rtol_delta
Relative tolerance used in developing numerical portions of specific derivatives.
Definition InterfaceKinetics.h:497
void setMultiplier(size_t i, double f) override
Set the multiplier for reaction i to f.
Definition InterfaceKinetics.cpp:473
void getDeltaSSEntropy(double *deltaS) override
Return the vector of values for the change in the standard state entropies for each reaction.
Definition InterfaceKinetics.cpp:364
void advanceCoverages(double tstep, double rtol=1.e-7, double atol=1.e-14, double maxStepSize=0, size_t maxSteps=20000, size_t maxErrTestFails=7)
Advance the surface coverages in time.
Definition InterfaceKinetics.cpp:518
void getDeltaSSEnthalpy(double *deltaH) override
Return the vector of values for the change in the standard state enthalpies of reaction.
Definition InterfaceKinetics.cpp:347
void resizeSpecies() override
Resize arrays with sizes that depend on the total number of species.
Definition InterfaceKinetics.cpp:501
void getActivityConcentrations(double *const conc) override
Get the vector of activity concentrations used in the kinetics object.
Definition InterfaceKinetics.cpp:111
void getRevRateConstants(double *krev, bool doIrreversible=false) override
Return the reverse rate constants.
Definition InterfaceKinetics.cpp:186
void getEquilibriumConstants(double *kc) override
Equilibrium constant for all reactions including the voltage term.
Definition InterfaceKinetics.cpp:166
vector< size_t > m_revindex
List of reactions numbers which are reversible reactions.
Definition InterfaceKinetics.h:336
bool m_has_electrochemistry
A flag stating if the object uses electrochemistry.
Definition InterfaceKinetics.h:499
void updateKc()
Update the equilibrium constants and stored electrochemical potentials in molar units for all reversi...
Definition InterfaceKinetics.cpp:117
void setPhaseExistence(const size_t iphase, const int exists)
Set the existence of a phase in the reaction object.
Definition InterfaceKinetics.cpp:548
void updateROP() override
Internal routine that updates the Rates of Progress of the reactions.
Definition InterfaceKinetics.cpp:201
void applyEquilibriumConstants(double *rop)
Multiply rate with inverse equilibrium constant.
Definition InterfaceKinetics.cpp:683
void getDerivativeSettings(AnyMap &settings) const override
Retrieve derivative settings.
Definition InterfaceKinetics.cpp:658
void getDeltaEnthalpy(double *deltaH) override
Return the vector of values for the reactions change in enthalpy.
Definition InterfaceKinetics.cpp:311
Eigen::SparseMatrix< double > fwdRatesOfProgress_ddCi() override
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant...
Definition InterfaceKinetics.cpp:606
void modifyReaction(size_t i, shared_ptr< Reaction > rNew) override
Modify the rate expression associated with a reaction.
Definition InterfaceKinetics.cpp:446
bool m_jac_skip_electrochemistry
A flag used to neglect electrochemical contributions in derivative formation.
Definition InterfaceKinetics.h:495
void _update_rates_C()
Update properties that depend on the species mole fractions and/or concentration,.
Definition InterfaceKinetics.cpp:92
vector< double > m_rbuf0
Buffers for partial rop results with length nReactions()
Definition InterfaceKinetics.h:488
int phaseStability(const size_t iphase) const
Gets the phase stability int for the ith phase.
Definition InterfaceKinetics.cpp:573
vector< unique_ptr< MultiRateBase > > m_interfaceRates
Vector of rate handlers for interface reactions.
Definition InterfaceKinetics.h:341
vector< double > m_mu0_Kc
Vector of standard state electrochemical potentials modified by a standard concentration term.
Definition InterfaceKinetics.h:408
ImplicitSurfChem * m_integrator
Pointer to the Implicit surface chemistry object.
Definition InterfaceKinetics.h:426
void _update_rates_T()
Update properties that depend on temperature.
Definition InterfaceKinetics.cpp:44
void solvePseudoSteadyStateProblem(int ifuncOverride=-1, double timeScaleOverride=1.0)
Solve for the pseudo steady-state of the surface problem.
Definition InterfaceKinetics.cpp:534
bool m_has_coverage_dependence
A flag stating if the object has coverage dependent rates.
Definition InterfaceKinetics.h:501
virtual void updateMu0()
Update the standard state chemical potentials and species equilibrium constant entries.
Definition InterfaceKinetics.cpp:148
void addThermo(shared_ptr< ThermoPhase > thermo) override
Add a thermo phase to the kinetics manager object.
Definition InterfaceKinetics.cpp:487
vector< double > m_mu
Vector of chemical potentials for all species.
Definition InterfaceKinetics.h:394
vector< double > m_actConc
Array of activity concentrations for each species in the kinetics object.
Definition InterfaceKinetics.h:376
vector< double > m_mu0
Vector of standard state chemical potentials for all species.
Definition InterfaceKinetics.h:385
void getDeltaElectrochemPotentials(double *deltaM) override
Return the vector of values for the reaction electrochemical free energy change.
Definition InterfaceKinetics.cpp:300
void setElectricPotential(int n, double V)
Set the electric potential in the nth phase.
Definition InterfaceKinetics.cpp:38
void init() override
Prepare the class for the addition of reactions, after all phases have been added.
Definition InterfaceKinetics.cpp:494
void resizeReactions() override
Finalize Kinetics object and associated objects.
Definition InterfaceKinetics.cpp:22
int m_phaseExistsCheck
Int flag to indicate that some phases in the kinetics mechanism are non-existent.
Definition InterfaceKinetics.h:440
Eigen::SparseMatrix< double > calculateCompositionDerivatives(StoichManagerN &stoich, const vector< double > &in)
Process mole fraction derivative.
Definition InterfaceKinetics.cpp:665
Eigen::SparseMatrix< double > netRatesOfProgress_ddCi() override
Calculate derivatives for net rates-of-progress with respect to species concentration at constant tem...
Definition InterfaceKinetics.cpp:627
void getDeltaEntropy(double *deltaS) override
Return the vector of values for the reactions change in entropy.
Definition InterfaceKinetics.cpp:322
vector< vector< bool > > m_rxnPhaseIsProduct
Vector of vector of booleans indicating whether a phase participates in a reaction as a product.
Definition InterfaceKinetics.h:479
void setDerivativeSettings(const AnyMap &settings) override
Set/modify derivative settings.
Definition InterfaceKinetics.cpp:642
vector< double > m_conc
Array of concentrations for each species in the kinetics mechanism.
Definition InterfaceKinetics.h:362
virtual void resizeReactions()
Finalize Kinetics object and associated objects.
Definition Kinetics.cpp:35
void checkPhaseIndex(size_t m) const
Check that the specified phase index is in range Throws an exception if m is greater than nPhases()
Definition Kinetics.cpp:62
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
vector< double > m_perturb
Vector of perturbation factors for each reaction's rate of progress vector.
Definition Kinetics.h:1452
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< size_t > m_start
m_start is a vector of integers specifying the beginning position for the species vector for the n'th...
Definition Kinetics.h:1473
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
vector< double > m_dH
The enthalpy change for each reaction to calculate Blowers-Masel rates.
Definition Kinetics.h:1505
size_t nPhases() const
The number of phases participating in the reaction mechanism.
Definition Kinetics.h:184
vector< shared_ptr< ThermoPhase > > m_thermo
m_thermo is a vector of pointers to ThermoPhase objects that are involved with this kinetics operator
Definition Kinetics.h:1467
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
virtual void addThermo(shared_ptr< ThermoPhase > thermo)
Add a phase to the kinetics manager object.
Definition Kinetics.cpp:520
vector< double > m_rbuf
Buffer used for storage of intermediate reaction-specific results.
Definition Kinetics.h:1508
StoichManagerN m_revProductStoich
Stoichiometry manager for the products of reversible reactions.
Definition Kinetics.h:1437
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
virtual void getNetProductionRates(double *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
Definition Kinetics.cpp:363
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 ...
Definition Kinetics.cpp:281
An error indicating that an unimplemented function has been called.
Definition ctexceptions.h:195
void getCharges(double *charges) const
Copy the vector of species charges into array charges.
Definition Phase.cpp:405
double charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Definition Phase.h:538
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
virtual void getPartialMolarEnthalpies(double *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition ThermoPhase.h:801
double electricPotential() const
Returns the electric potential of this phase (V).
Definition ThermoPhase.h:621
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 double logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition ThermoPhase.cpp:55
double RT() const
Return the Gas Constant multiplied by the current temperature.
Definition ThermoPhase.h:1062
void getElectrochemPotentials(double *mu) const
Get the species electrochemical potentials.
Definition ThermoPhase.cpp:76
void setElectricPotential(double v)
Set the electric potential of this phase (V).
Definition ThermoPhase.h:612
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 getPartialMolarEntropies(double *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition ThermoPhase.h:811
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...
Generated by 1.9.7