| Cantera 3.0.0

Loading...
Searching...
No Matches
InterfaceKinetics.h
Go to the documentation of this file.
1/**
2 * @file InterfaceKinetics.h
3 */
4
5// This file is part of Cantera. See License.txt in the top-level directory or
6// at https://cantera.org/license.txt for license and copyright information.
7
8#ifndef CT_IFACEKINETICS_H
9#define CT_IFACEKINETICS_H
10
11#include "Kinetics.h"
12#include "MultiRate.h"
13
14 namespace Cantera
15{
16
17// forward declarations
18 class SurfPhase;
19 class ImplicitSurfChem;
20
21//! A kinetics manager for heterogeneous reaction mechanisms. The reactions are
22//! assumed to occur at a 2D interface between two 3D phases.
23/*!
24 * There are some important additions to the behavior of the kinetics class due
25 * to the presence of multiple phases and a heterogeneous interface. If a
26 * reactant phase doesn't exists, that is, has a mole number of zero, a
27 * heterogeneous reaction can not proceed from reactants to products. Note it
28 * could perhaps proceed from products to reactants if all of the product phases
29 * exist.
30 *
31 * In order to make the determination of whether a phase exists or not actually
32 * involves the specification of additional information to the kinetics object.,
33 * which heretofore has only had access to intrinsic field information about the
34 * phases (for example, temperature, pressure, and mole fraction).
35 *
36 * The extrinsic specification of whether a phase exists or not must be
37 * specified on top of the intrinsic calculation of the reaction rate. This
38 * class carries a set of booleans indicating whether a phase in the
39 * heterogeneous mechanism exists or not.
40 *
41 * Additionally, the class carries a set of booleans around indicating whether a
42 * product phase is stable or not. If a phase is not thermodynamically stable,
43 * it may be the case that a particular reaction in a heterogeneous mechanism
44 * will create a product species in the unstable phase. However, other reactions
45 * in the mechanism will destruct that species. This may cause oscillations in
46 * the formation of the unstable phase from time step to time step within a ODE
47 * solver, in practice. In order to avoid this situation, a set of booleans is
48 * tracked which sets the stability of a phase. If a phase is deemed to be
49 * unstable, then species in that phase will not be allowed to be birthed by the
50 * kinetics operator. Nonexistent phases are deemed to be unstable by default,
51 * but this can be changed.
52 *
53 * @ingroup kineticsmgr
54 */
55 class InterfaceKinetics : public Kinetics
56{
57 public:
58 //! Constructor
59 InterfaceKinetics() = default;
60
61 //! Constructor
62 /*!
63 * @param thermo The parameter may be used to initialize the object
64 * with one ThermoPhase object.
65 * HKM Note -> Since the interface kinetics object will
66 * probably require multiple ThermoPhase objects, this is
67 * probably not a good idea to have this parameter.
68 * @deprecated To be removed after %Cantera 3.0; code base only uses default.
69 */
70 InterfaceKinetics(ThermoPhase* thermo);
71
72 ~InterfaceKinetics() override;
73
74 void resizeReactions() override;
75
76 string kineticsType() const override {
77 return "surface";
78 }
79
80 //! Set the electric potential in the nth phase
81 /*!
82 * @param n phase Index in this kinetics object.
83 * @param V Electric potential (volts)
84 */
85 void setElectricPotential(int n, double V);
86
87 //! @name Reaction Rates Of Progress
88 //! @{
89
90 //! Equilibrium constant for all reactions including the voltage term
91 /*!
92 * Kc = exp(deltaG/RT)
93 *
94 * where deltaG is the electrochemical potential difference between
95 * products minus reactants.
96 */
97 void getEquilibriumConstants(double* kc) override;
98
99 void getDeltaGibbs(double* deltaG) override;
100
101 void getDeltaElectrochemPotentials(double* deltaM) override;
102 void getDeltaEnthalpy(double* deltaH) override;
103 void getDeltaEntropy(double* deltaS) override;
104
105 void getDeltaSSGibbs(double* deltaG) override;
106 void getDeltaSSEnthalpy(double* deltaH) override;
107 void getDeltaSSEntropy(double* deltaS) override;
108
109 //! @}
110 //! @name Reaction Mechanism Informational Query Routines
111 //! @{
112
113 void getActivityConcentrations(double* const conc) override;
114
115 bool isReversible(size_t i) override {
116 if (std::find(m_revindex.begin(), m_revindex.end(), i)
117 < m_revindex.end()) {
118 return true;
119 } else {
120 return false;
121 }
122 }
123
124 void getFwdRateConstants(double* kfwd) override;
125 void getRevRateConstants(double* krev, bool doIrreversible=false) override;
126
127 //! @}
128 //! @name Reaction Mechanism Construction
129 //! @{
130
131 //! Add a thermo phase to the kinetics manager object.
132 /*!
133 * This must be done before the function init() is called or
134 * before any reactions are input. The lowest dimensional phase, where reactions
135 * occur, must be added first.
136 *
137 * This function calls Kinetics::addPhase(). It also sets the following
138 * fields:
139 *
140 * m_phaseExists[]
141 *
142 * @param thermo Reference to the ThermoPhase to be added.
143 */
144 void addThermo(shared_ptr<ThermoPhase> thermo) override;
145
146 //! @see InterfaceKinetics::addThermo(shared_ptr<ThermoPhase>)
147 void addPhase(ThermoPhase& thermo) override;
148
149 void init() override;
150 void resizeSpecies() override;
151 bool addReaction(shared_ptr<Reaction> r, bool resize=true) override;
152 void modifyReaction(size_t i, shared_ptr<Reaction> rNew) override;
153 void setMultiplier(size_t i, double f) override;
154 //! @}
155
156 //! Internal routine that updates the Rates of Progress of the reactions
157 /*!
158 * This is actually the guts of the functionality of the object
159 */
160 void updateROP() override;
161
162 //! Update properties that depend on temperature
163 /*!
164 * Current objects that this function updates:
165 * m_kdata->m_rfn
166 * updateKc();
167 */
168 void _update_rates_T();
169
170 //! Update properties that depend on the electric potential
171 void _update_rates_phi();
172
173 //! Update properties that depend on the species mole fractions and/or
174 //! concentration,
175 /*!
176 * This method fills out the array of generalized concentrations by calling
177 * method getActivityConcentrations for each phase, which classes
178 * representing phases should overload to return the appropriate quantities.
179 */
180 void _update_rates_C();
181
182 //! Advance the surface coverages in time
183 /*!
184 * This method carries out a time-accurate advancement of the
185 * surface coverages for a specified amount of time.
186 *
187 * @f[
188 * \dot {\theta}_k = \dot s_k (\sigma_k / s_0)
189 * @f]
190 *
191 * @param tstep Time value to advance the surface coverages
192 * @param rtol The relative tolerance for the integrator
193 * @param atol The absolute tolerance for the integrator
194 * @param maxStepSize The maximum step-size the integrator is allowed to take.
195 * If zero, this option is disabled.
196 * @param maxSteps The maximum number of time-steps the integrator can take.
197 * If not supplied, uses the default value in CVodeIntegrator (20000).
198 * @param maxErrTestFails the maximum permissible number of error test failures
199 * If not supplied, uses the default value in CVODES (7).
200 */
201 void advanceCoverages(double tstep, double rtol=1.e-7,
202 double atol=1.e-14, double maxStepSize=0,
203 size_t maxSteps=20000, size_t maxErrTestFails=7);
204
205 //! Solve for the pseudo steady-state of the surface problem
206 /*!
207 * This is the same thing as the advanceCoverages() function,
208 * but at infinite times.
209 *
210 * Note, a direct solve is carried out under the hood here,
211 * to reduce the computational time.
212 *
213 * @param ifuncOverride One of the values defined in @ref solvesp_methods.
214 * The default is -1, which means that the program will decide.
215 * @param timeScaleOverride When a pseudo transient is selected this value
216 * can be used to override the default time scale for
217 * integration which is one. When SFLUX_TRANSIENT is used, this
218 * is equal to the time over which the equations are integrated.
219 * When SFLUX_INITIALIZE is used, this is equal to the time used
220 * in the initial transient algorithm, before the equation
221 * system is solved directly.
222 */
223 void solvePseudoSteadyStateProblem(int ifuncOverride = -1,
224 double timeScaleOverride = 1.0);
225
226 void setIOFlag(int ioFlag);
227
228 //! Update the standard state chemical potentials and species equilibrium
229 //! constant entries
230 /*!
231 * Virtual because it is overridden when dealing with experimental open
232 * circuit voltage overrides
233 */
234 virtual void updateMu0();
235
236 //! Update the equilibrium constants and stored electrochemical potentials
237 //! in molar units for all reversible reactions and for all species.
238 /*!
239 * Irreversible reactions have their equilibrium constant set
240 * to zero. For reactions involving charged species the equilibrium
241 * constant is adjusted according to the electrostatic potential.
242 */
243 void updateKc();
244
245 //! Set the existence of a phase in the reaction object
246 /*!
247 * Tell the kinetics object whether a phase in the object exists. This is
248 * actually an extrinsic specification that must be carried out on top of
249 * the intrinsic calculation of the reaction rate. The routine will also
250 * flip the IsStable boolean within the kinetics object as well.
251 *
252 * @param iphase Index of the phase. This is the order within the
253 * internal thermo vector object
254 * @param exists Boolean indicating whether the phase exists or not
255 */
256 void setPhaseExistence(const size_t iphase, const int exists);
257
258 //! Set the stability of a phase in the reaction object
259 /*!
260 * Tell the kinetics object whether a phase in the object is stable.
261 * Species in an unstable phase will not be allowed to have a positive
262 * rate of formation from this kinetics object. This is actually an
263 * extrinsic specification that must be carried out on top of the
264 * intrinsic calculation of the reaction rate.
265 *
266 * While conceptually not needed since kinetics is consistent with thermo
267 * when taken as a whole, in practice it has found to be very useful to
268 * turn off the creation of phases which shouldn't be forming. Typically
269 * this can reduce the oscillations in phase formation and destruction
270 * which are observed.
271 *
272 * @param iphase Index of the phase. This is the order within the
273 * internal thermo vector object
274 * @param isStable Flag indicating whether the phase is stable or not
275 */
276 void setPhaseStability(const size_t iphase, const int isStable);
277
278 //! Gets the phase existence int for the ith phase
279 /*!
280 * @param iphase Phase Id
281 * @return The int specifying whether the kinetics object thinks the phase
282 * exists or not. If it exists, then species in that phase can be
283 * a reactant in reactions.
284 */
285 int phaseExistence(const size_t iphase) const;
286
287 //! Gets the phase stability int for the ith phase
288 /*!
289 * @param iphase Phase Id
290 * @return The int specifying whether the kinetics object thinks the phase
291 * is stable with nonzero mole numbers. If it stable, then the
292 * kinetics object will allow for rates of production of of
293 * species in that phase that are positive.
294 */
295 int phaseStability(const size_t iphase) const;
296
297 //! Gets the interface current for the ith phase
298 /*!
299 * @param iphase Phase Id
300 * @return The double specifying the interface current. The interface current
301 * is useful when charge transfer reactions occur at an interface. It
302 * is defined here as the net positive charge entering the phase
303 * specified by the Phase Id. (Units: A/m^2 for a surface reaction,
304 * A/m for an edge reaction).
305 */
306 double interfaceCurrent(const size_t iphase);
307
308 void setDerivativeSettings(const AnyMap& settings) override;
309 void getDerivativeSettings(AnyMap& settings) const override;
310 Eigen::SparseMatrix<double> fwdRatesOfProgress_ddCi() override;
311 Eigen::SparseMatrix<double> revRatesOfProgress_ddCi() override;
312 Eigen::SparseMatrix<double> netRatesOfProgress_ddCi() override;
313
314 protected:
315 //! @name Internal service methods
316 //!
317 //! @note These methods are for internal use, and seek to avoid code duplication
318 //! while evaluating terms used for rate constants, rates of progress, and
319 //! their derivatives.
320 //! @{
321
322
323 //! Multiply rate with inverse equilibrium constant
324 void applyEquilibriumConstants(double* rop);
325
326 //! Process mole fraction derivative
327 //! @param stoich stoichiometry manager
328 //! @param in rate expression used for the derivative calculation
329 //! @return a sparse matrix of derivative contributions for each reaction of
330 //! dimensions nTotalReactions by nTotalSpecies
331 Eigen::SparseMatrix<double> calculateCompositionDerivatives(StoichManagerN& stoich,
332 const vector<double>& in);
333
334 //! Helper function ensuring that all rate derivatives can be calculated
335 //! @param name method name used for error output
336 //! @throw CanteraError if coverage dependence or electrochemical reactions are
337 //! included
338 void assertDerivativesValid(const string& name);
339
340 //! @}
341
342 //! Temporary work vector of length m_kk
343 vector<double> m_grt;
344
345 //! List of reactions numbers which are reversible reactions
346 /*!
347 * This is a vector of reaction numbers. Each reaction in the list is
348 * reversible. Length = number of reversible reactions
349 */
350 vector<size_t> m_revindex;
351
352 bool m_redo_rates = false;
353
354 //! Vector of rate handlers for interface reactions
355 vector<unique_ptr<MultiRateBase>> m_interfaceRates;
356 map<string, size_t> m_interfaceTypes; //!< Rate handler mapping
357
358 //! Vector of irreversible reaction numbers
359 /*!
360 * vector containing the reaction numbers of irreversible reactions.
361 */
362 vector<size_t> m_irrev;
363
364 //! Array of concentrations for each species in the kinetics mechanism
365 /*!
366 * An array of generalized concentrations @f$ C_k @f$ that are defined
367 * such that @f$ a_k = C_k / C^0_k, @f$ where @f$ C^0_k @f$ is a standard
368 * concentration/ These generalized concentrations are used by this
369 * kinetics manager class to compute the forward and reverse rates of
370 * elementary reactions. The "units" for the concentrations of each phase
371 * depend upon the implementation of kinetics within that phase. The order
372 * of the species within the vector is based on the order of listed
373 * ThermoPhase objects in the class, and the order of the species within
374 * each ThermoPhase class.
375 */
376 vector<double> m_conc;
377
378 //! Array of activity concentrations for each species in the kinetics object
379 /*!
380 * An array of activity concentrations @f$ Ca_k @f$ that are defined
381 * such that @f$ a_k = Ca_k / C^0_k, @f$ where @f$ C^0_k @f$ is a standard
382 * concentration. These activity concentrations are used by this
383 * kinetics manager class to compute the forward and reverse rates of
384 * elementary reactions. The "units" for the concentrations of each phase
385 * depend upon the implementation of kinetics within that phase. The order
386 * of the species within the vector is based on the order of listed
387 * ThermoPhase objects in the class, and the order of the species within
388 * each ThermoPhase class.
389 */
390 vector<double> m_actConc;
391
392 //! Vector of standard state chemical potentials for all species
393 /*!
394 * This vector contains a temporary vector of standard state chemical
395 * potentials for all of the species in the kinetics object
396 *
397 * Length = m_kk. Units = J/kmol.
398 */
399 vector<double> m_mu0;
400
401 //! Vector of chemical potentials for all species
402 /*!
403 * This vector contains a vector of chemical potentials for all of the
404 * species in the kinetics object
405 *
406 * Length = m_kk. Units = J/kmol.
407 */
408 vector<double> m_mu;
409
410 //! Vector of standard state electrochemical potentials modified by a
411 //! standard concentration term.
412 /*!
413 * This vector contains a temporary vector of standard state electrochemical
414 * potentials + RTln(Cs) for all of the species in the kinetics object
415 *
416 * In order to get the units correct for the concentration equilibrium
417 * constant, each species needs to have an RT ln(Cs) added to its
418 * contribution to the equilibrium constant Cs is the standard concentration
419 * for the species. Frequently, for solid species, Cs is equal to 1.
420 * However, for gases Cs is P/RT. Length = m_kk. Units = J/kmol.
421 */
422 vector<double> m_mu0_Kc;
423
424 //! Vector of phase electric potentials
425 /*!
426 * Temporary vector containing the potential of each phase in the kinetics
427 * object. length = number of phases. Units = Volts.
428 */
429 vector<double> m_phi;
430
431 //! Pointer to the single surface phase
432 SurfPhase* m_surf = nullptr;
433
434 //! Pointer to the Implicit surface chemistry object
435 /*!
436 * Note this object is owned by this InterfaceKinetics object. It may only
437 * be used to solve this single InterfaceKinetics object's surface problem
438 * uncoupled from other surface phases.
439 */
440 ImplicitSurfChem* m_integrator = nullptr;
441
442 bool m_ROP_ok = false;
443
444 //! Current temperature of the data
445 double m_temp = 0.0;
446
447 //! Int flag to indicate that some phases in the kinetics mechanism are
448 //! non-existent.
449 /*!
450 * We change the ROP vectors to make sure that non-existent phases are
451 * treated correctly in the kinetics operator. The value of this is equal
452 * to the number of phases which don't exist.
453 */
454 int m_phaseExistsCheck = false;
455
456 //! Vector of booleans indicating whether phases exist or not
457 /*!
458 * Vector of booleans indicating whether a phase exists or not. We use this
459 * to set the ROP's so that unphysical things don't happen. For example, a
460 * reaction can't go in the forwards direction if a phase in which a
461 * reactant is present doesn't exist. Because InterfaceKinetics deals with
462 * intrinsic quantities only normally, nowhere else is this extrinsic
463 * concept introduced except here.
464 *
465 * length = number of phases in the object. By default all phases exist.
466 */
467 vector<bool> m_phaseExists;
468
469 //! Vector of int indicating whether phases are stable or not
470 /*!
471 * Vector of booleans indicating whether a phase is stable or not under
472 * the current conditions. We use this to set the ROP's so that
473 * unphysical things don't happen.
474 *
475 * length = number of phases in the object. By default all phases are stable.
476 */
477 vector<int> m_phaseIsStable;
478
479 //! Vector of vector of booleans indicating whether a phase participates in
480 //! a reaction as a reactant
481 /*!
482 * m_rxnPhaseIsReactant[j][p] indicates whether a species in phase p
483 * participates in reaction j as a reactant.
484 */
485 vector<vector<bool>> m_rxnPhaseIsReactant;
486
487 //! Vector of vector of booleans indicating whether a phase participates in a
488 //! reaction as a product
489 /*!
490 * m_rxnPhaseIsReactant[j][p] indicates whether a species in phase p
491 * participates in reaction j as a product.
492 */
493 vector<vector<bool>> m_rxnPhaseIsProduct;
494
495 int m_ioFlag = 0;
496
497 //! Number of dimensions of reacting phase (2 for InterfaceKinetics, 1 for
498 //! EdgeKinetics)
499 size_t m_nDim = 2;
500
501 //! Buffers for partial rop results with length nReactions()
502 vector<double> m_rbuf0;
503 vector<double> m_rbuf1;
504
505 //! A flag used to neglect rate coefficient coverage dependence in derivative
506 //! formation
507 bool m_jac_skip_coverage_dependence = false;
508 //! A flag used to neglect electrochemical contributions in derivative formation
509 bool m_jac_skip_electrochemistry = false;
510 //! Relative tolerance used in developing numerical portions of specific derivatives
511 double m_jac_rtol_delta = 1e-8;
512 //! A flag stating if the object uses electrochemistry
513 bool m_has_electrochemistry = false;
514 //! A flag stating if the object has coverage dependent rates
515 bool m_has_coverage_dependence = false;
516};
517
518}
519
520#endif
Kinetics.h
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
MultiRate.h
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::ImplicitSurfChem
Advances the surface coverages of the associated set of SurfacePhase objects in time.
Definition ImplicitSurfChem.h:59
Cantera::InterfaceKinetics
A kinetics manager for heterogeneous reaction mechanisms.
Definition InterfaceKinetics.h:56
Cantera::InterfaceKinetics::addReaction
bool addReaction(shared_ptr< Reaction > r, bool resize=true) override
Add a single reaction to the mechanism.
Definition InterfaceKinetics.cpp:389
Cantera::InterfaceKinetics::phaseExistence
int phaseExistence(const size_t iphase) const
Gets the phase existence int for the ith phase.
Definition InterfaceKinetics.cpp:593
Cantera::InterfaceKinetics::interfaceCurrent
double interfaceCurrent(const size_t iphase)
Gets the interface current for the ith phase.
Definition InterfaceKinetics.cpp:615
Cantera::InterfaceKinetics::m_surf
SurfPhase * m_surf
Pointer to the single surface phase.
Definition InterfaceKinetics.h:432
Cantera::InterfaceKinetics::m_rxnPhaseIsReactant
vector< vector< bool > > m_rxnPhaseIsReactant
Vector of vector of booleans indicating whether a phase participates in a reaction as a reactant.
Definition InterfaceKinetics.h:485
Cantera::InterfaceKinetics::kineticsType
string kineticsType() const override
Identifies the Kinetics manager type.
Definition InterfaceKinetics.h:76
Cantera::InterfaceKinetics::m_phaseIsStable
vector< int > m_phaseIsStable
Vector of int indicating whether phases are stable or not.
Definition InterfaceKinetics.h:477
Cantera::InterfaceKinetics::addPhase
void addPhase(ThermoPhase &thermo) override
Definition InterfaceKinetics.cpp:503
Cantera::InterfaceKinetics::revRatesOfProgress_ddCi
Eigen::SparseMatrix< double > revRatesOfProgress_ddCi() override
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant...
Definition InterfaceKinetics.cpp:642
Cantera::InterfaceKinetics::m_nDim
size_t m_nDim
Number of dimensions of reacting phase (2 for InterfaceKinetics, 1 for EdgeKinetics)
Definition InterfaceKinetics.h:499
Cantera::InterfaceKinetics::getFwdRateConstants
void getFwdRateConstants(double *kfwd) override
Return the forward rate constants.
Definition InterfaceKinetics.cpp:186
Cantera::InterfaceKinetics::m_phaseExists
vector< bool > m_phaseExists
Vector of booleans indicating whether phases exist or not.
Definition InterfaceKinetics.h:467
Cantera::InterfaceKinetics::getDeltaSSGibbs
void getDeltaSSGibbs(double *deltaG) override
Return the vector of values for the reaction standard state Gibbs free energy change.
Definition InterfaceKinetics.cpp:342
Cantera::InterfaceKinetics::m_temp
double m_temp
Current temperature of the data.
Definition InterfaceKinetics.h:445
Cantera::InterfaceKinetics::setPhaseStability
void setPhaseStability(const size_t iphase, const int isStable)
Set the stability of a phase in the reaction object.
Definition InterfaceKinetics.cpp:605
Cantera::InterfaceKinetics::getDeltaGibbs
void getDeltaGibbs(double *deltaG) override
Return the vector of values for the reaction Gibbs free energy change.
Definition InterfaceKinetics.cpp:292
Cantera::InterfaceKinetics::m_jac_skip_coverage_dependence
bool m_jac_skip_coverage_dependence
A flag used to neglect rate coefficient coverage dependence in derivative formation.
Definition InterfaceKinetics.h:507
Cantera::InterfaceKinetics::m_interfaceTypes
map< string, size_t > m_interfaceTypes
Rate handler mapping.
Definition InterfaceKinetics.h:356
Cantera::InterfaceKinetics::isReversible
bool isReversible(size_t i) override
True if reaction i has been declared to be reversible.
Definition InterfaceKinetics.h:115
Cantera::InterfaceKinetics::_update_rates_phi
void _update_rates_phi()
Update properties that depend on the electric potential.
Definition InterfaceKinetics.cpp:89
Cantera::InterfaceKinetics::m_phi
vector< double > m_phi
Vector of phase electric potentials.
Definition InterfaceKinetics.h:429
Cantera::InterfaceKinetics::assertDerivativesValid
void assertDerivativesValid(const string &name)
Helper function ensuring that all rate derivatives can be calculated.
Definition InterfaceKinetics.cpp:700
Cantera::InterfaceKinetics::m_jac_rtol_delta
double m_jac_rtol_delta
Relative tolerance used in developing numerical portions of specific derivatives.
Definition InterfaceKinetics.h:511
Cantera::InterfaceKinetics::setMultiplier
void setMultiplier(size_t i, double f) override
Set the multiplier for reaction i to f.
Definition InterfaceKinetics.cpp:482
Cantera::InterfaceKinetics::getDeltaSSEntropy
void getDeltaSSEntropy(double *deltaS) override
Return the vector of values for the change in the standard state entropies for each reaction.
Definition InterfaceKinetics.cpp:373
Cantera::InterfaceKinetics::advanceCoverages
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:544
Cantera::InterfaceKinetics::InterfaceKinetics
InterfaceKinetics()=default
Constructor.
Cantera::InterfaceKinetics::getDeltaSSEnthalpy
void getDeltaSSEnthalpy(double *deltaH) override
Return the vector of values for the change in the standard state enthalpies of reaction.
Definition InterfaceKinetics.cpp:356
Cantera::InterfaceKinetics::resizeSpecies
void resizeSpecies() override
Resize arrays with sizes that depend on the total number of species.
Definition InterfaceKinetics.cpp:527
Cantera::InterfaceKinetics::m_grt
vector< double > m_grt
Temporary work vector of length m_kk.
Definition InterfaceKinetics.h:343
Cantera::InterfaceKinetics::getActivityConcentrations
void getActivityConcentrations(double *const conc) override
Get the vector of activity concentrations used in the kinetics object.
Definition InterfaceKinetics.cpp:119
Cantera::InterfaceKinetics::getRevRateConstants
void getRevRateConstants(double *krev, bool doIrreversible=false) override
Return the reverse rate constants.
Definition InterfaceKinetics.cpp:195
Cantera::InterfaceKinetics::getEquilibriumConstants
void getEquilibriumConstants(double *kc) override
Equilibrium constant for all reactions including the voltage term.
Definition InterfaceKinetics.cpp:175
Cantera::InterfaceKinetics::m_revindex
vector< size_t > m_revindex
List of reactions numbers which are reversible reactions.
Definition InterfaceKinetics.h:350
Cantera::InterfaceKinetics::m_has_electrochemistry
bool m_has_electrochemistry
A flag stating if the object uses electrochemistry.
Definition InterfaceKinetics.h:513
Cantera::InterfaceKinetics::updateKc
void updateKc()
Update the equilibrium constants and stored electrochemical potentials in molar units for all reversi...
Definition InterfaceKinetics.cpp:125
Cantera::InterfaceKinetics::setPhaseExistence
void setPhaseExistence(const size_t iphase, const int exists)
Set the existence of a phase in the reaction object.
Definition InterfaceKinetics.cpp:574
Cantera::InterfaceKinetics::updateROP
void updateROP() override
Internal routine that updates the Rates of Progress of the reactions.
Definition InterfaceKinetics.cpp:210
Cantera::InterfaceKinetics::applyEquilibriumConstants
void applyEquilibriumConstants(double *rop)
Multiply rate with inverse equilibrium constant.
Definition InterfaceKinetics.cpp:709
Cantera::InterfaceKinetics::getDerivativeSettings
void getDerivativeSettings(AnyMap &settings) const override
Retrieve derivative settings.
Definition InterfaceKinetics.cpp:684
Cantera::InterfaceKinetics::getDeltaEnthalpy
void getDeltaEnthalpy(double *deltaH) override
Return the vector of values for the reactions change in enthalpy.
Definition InterfaceKinetics.cpp:320
Cantera::InterfaceKinetics::fwdRatesOfProgress_ddCi
Eigen::SparseMatrix< double > fwdRatesOfProgress_ddCi() override
Calculate derivatives for forward rates-of-progress with respect to species concentration at constant...
Definition InterfaceKinetics.cpp:632
Cantera::InterfaceKinetics::modifyReaction
void modifyReaction(size_t i, shared_ptr< Reaction > rNew) override
Modify the rate expression associated with a reaction.
Definition InterfaceKinetics.cpp:455
Cantera::InterfaceKinetics::m_jac_skip_electrochemistry
bool m_jac_skip_electrochemistry
A flag used to neglect electrochemical contributions in derivative formation.
Definition InterfaceKinetics.h:509
Cantera::InterfaceKinetics::_update_rates_C
void _update_rates_C()
Update properties that depend on the species mole fractions and/or concentration,.
Definition InterfaceKinetics.cpp:100
Cantera::InterfaceKinetics::m_rbuf0
vector< double > m_rbuf0
Buffers for partial rop results with length nReactions()
Definition InterfaceKinetics.h:502
Cantera::InterfaceKinetics::phaseStability
int phaseStability(const size_t iphase) const
Gets the phase stability int for the ith phase.
Definition InterfaceKinetics.cpp:599
Cantera::InterfaceKinetics::m_interfaceRates
vector< unique_ptr< MultiRateBase > > m_interfaceRates
Vector of rate handlers for interface reactions.
Definition InterfaceKinetics.h:355
Cantera::InterfaceKinetics::m_mu0_Kc
vector< double > m_mu0_Kc
Vector of standard state electrochemical potentials modified by a standard concentration term.
Definition InterfaceKinetics.h:422
Cantera::InterfaceKinetics::m_integrator
ImplicitSurfChem * m_integrator
Pointer to the Implicit surface chemistry object.
Definition InterfaceKinetics.h:440
Cantera::InterfaceKinetics::_update_rates_T
void _update_rates_T()
Update properties that depend on temperature.
Definition InterfaceKinetics.cpp:52
Cantera::InterfaceKinetics::m_irrev
vector< size_t > m_irrev
Vector of irreversible reaction numbers.
Definition InterfaceKinetics.h:362
Cantera::InterfaceKinetics::solvePseudoSteadyStateProblem
void solvePseudoSteadyStateProblem(int ifuncOverride=-1, double timeScaleOverride=1.0)
Solve for the pseudo steady-state of the surface problem.
Definition InterfaceKinetics.cpp:560
Cantera::InterfaceKinetics::m_has_coverage_dependence
bool m_has_coverage_dependence
A flag stating if the object has coverage dependent rates.
Definition InterfaceKinetics.h:515
Cantera::InterfaceKinetics::updateMu0
virtual void updateMu0()
Update the standard state chemical potentials and species equilibrium constant entries.
Definition InterfaceKinetics.cpp:156
Cantera::InterfaceKinetics::addThermo
void addThermo(shared_ptr< ThermoPhase > thermo) override
Add a thermo phase to the kinetics manager object.
Definition InterfaceKinetics.cpp:496
Cantera::InterfaceKinetics::m_mu
vector< double > m_mu
Vector of chemical potentials for all species.
Definition InterfaceKinetics.h:408
Cantera::InterfaceKinetics::m_actConc
vector< double > m_actConc
Array of activity concentrations for each species in the kinetics object.
Definition InterfaceKinetics.h:390
Cantera::InterfaceKinetics::m_mu0
vector< double > m_mu0
Vector of standard state chemical potentials for all species.
Definition InterfaceKinetics.h:399
Cantera::InterfaceKinetics::getDeltaElectrochemPotentials
void getDeltaElectrochemPotentials(double *deltaM) override
Return the vector of values for the reaction electrochemical free energy change.
Definition InterfaceKinetics.cpp:309
Cantera::InterfaceKinetics::setElectricPotential
void setElectricPotential(int n, double V)
Set the electric potential in the nth phase.
Definition InterfaceKinetics.cpp:46
Cantera::InterfaceKinetics::init
void init() override
Prepare the class for the addition of reactions, after all phases have been added.
Definition InterfaceKinetics.cpp:510
Cantera::InterfaceKinetics::resizeReactions
void resizeReactions() override
Finalize Kinetics object and associated objects.
Definition InterfaceKinetics.cpp:30
Cantera::InterfaceKinetics::m_phaseExistsCheck
int m_phaseExistsCheck
Int flag to indicate that some phases in the kinetics mechanism are non-existent.
Definition InterfaceKinetics.h:454
Cantera::InterfaceKinetics::calculateCompositionDerivatives
Eigen::SparseMatrix< double > calculateCompositionDerivatives(StoichManagerN &stoich, const vector< double > &in)
Process mole fraction derivative.
Definition InterfaceKinetics.cpp:691
Cantera::InterfaceKinetics::netRatesOfProgress_ddCi
Eigen::SparseMatrix< double > netRatesOfProgress_ddCi() override
Calculate derivatives for net rates-of-progress with respect to species concentration at constant tem...
Definition InterfaceKinetics.cpp:653
Cantera::InterfaceKinetics::getDeltaEntropy
void getDeltaEntropy(double *deltaS) override
Return the vector of values for the reactions change in entropy.
Definition InterfaceKinetics.cpp:331
Cantera::InterfaceKinetics::m_rxnPhaseIsProduct
vector< vector< bool > > m_rxnPhaseIsProduct
Vector of vector of booleans indicating whether a phase participates in a reaction as a product.
Definition InterfaceKinetics.h:493
Cantera::InterfaceKinetics::setDerivativeSettings
void setDerivativeSettings(const AnyMap &settings) override
Set/modify derivative settings.
Definition InterfaceKinetics.cpp:668
Cantera::InterfaceKinetics::m_conc
vector< double > m_conc
Array of concentrations for each species in the kinetics mechanism.
Definition InterfaceKinetics.h:376
Cantera::Kinetics
Public interface for kinetics managers.
Definition Kinetics.h:126
Cantera::Kinetics::thermo
ThermoPhase & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism.
Definition Kinetics.h:254
Cantera::StoichManagerN
This class handles operations involving the stoichiometric coefficients on one side of a reaction (re...
Definition StoichManager.h:589
Cantera::SurfPhase
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition SurfPhase.h:98
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition ThermoPhase.h:390
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564