Cantera 2.6.0
InterfaceKinetics.h
Go to the documentation of this file.
1/**
2 * @file InterfaceKinetics.h
3 * @ingroup chemkinetics
4 */
5
6// This file is part of Cantera. See License.txt in the top-level directory or
7// at https://cantera.org/license.txt for license and copyright information.
8
9#ifndef CT_IFACEKINETICS_H
10#define CT_IFACEKINETICS_H
11
12#include "Kinetics.h"
13#include "RateCoeffMgr.h"
14
15namespace Cantera
16{
17
18// forward declarations
19class SurfPhase;
20class ImplicitSurfChem;
21class InterfaceReaction2;
22
23//! A kinetics manager for heterogeneous reaction mechanisms. The reactions are
24//! assumed to occur at a 2D interface between two 3D phases.
25/*!
26 * There are some important additions to the behavior of the kinetics class due
27 * to the presence of multiple phases and a heterogeneous interface. If a
28 * reactant phase doesn't exists, that is, has a mole number of zero, a
29 * heterogeneous reaction can not proceed from reactants to products. Note it
30 * could perhaps proceed from products to reactants if all of the product phases
31 * exist.
32 *
33 * In order to make the determination of whether a phase exists or not actually
34 * involves the specification of additional information to the kinetics object.,
35 * which heretofore has only had access to intrinsic field information about the
36 * phases (for example, temperature, pressure, and mole fraction).
37 *
38 * The extrinsic specification of whether a phase exists or not must be
39 * specified on top of the intrinsic calculation of the reaction rate. This
40 * class carries a set of booleans indicating whether a phase in the
41 * heterogeneous mechanism exists or not.
42 *
43 * Additionally, the class carries a set of booleans around indicating whether a
44 * product phase is stable or not. If a phase is not thermodynamically stable,
45 * it may be the case that a particular reaction in a heterogeneous mechanism
46 * will create a product species in the unstable phase. However, other reactions
47 * in the mechanism will destruct that species. This may cause oscillations in
48 * the formation of the unstable phase from time step to time step within a ODE
49 * solver, in practice. In order to avoid this situation, a set of booleans is
50 * tracked which sets the stability of a phase. If a phase is deemed to be
51 * unstable, then species in that phase will not be allowed to be birthed by the
52 * kinetics operator. Nonexistent phases are deemed to be unstable by default,
53 * but this can be changed.
54 *
55 * @ingroup chemkinetics
56 */
58{
59public:
60 //! Constructor
61 /*!
62 * @param thermo The optional parameter may be used to initialize the object
63 * with one ThermoPhase object.
64 * HKM Note -> Since the interface kinetics object will
65 * probably require multiple ThermoPhase objects, this is
66 * probably not a good idea to have this parameter.
67 */
69
70 virtual ~InterfaceKinetics();
71
72 virtual void resizeReactions();
73
74 virtual std::string kineticsType() const {
75 return "Surf";
76 }
77
78 //! Set the electric potential in the nth phase
79 /*!
80 * @param n phase Index in this kinetics object.
81 * @param V Electric potential (volts)
82 */
83 void setElectricPotential(int n, doublereal V);
84
85 //! @name Reaction Rates Of Progress
86 //! @{
87
88 //! Equilibrium constant for all reactions including the voltage term
89 /*!
90 * Kc = exp(deltaG/RT)
91 *
92 * where deltaG is the electrochemical potential difference between
93 * products minus reactants.
94 */
95 virtual void getEquilibriumConstants(doublereal* kc);
96
97 //! values needed to convert from exchange current density to surface
98 //! reaction rate.
99 /*!
100 * @deprecated To be removed after Cantera 2.6.
101 */
103
104 virtual void getDeltaGibbs(doublereal* deltaG);
105
106 virtual void getDeltaElectrochemPotentials(doublereal* deltaM);
107 virtual void getDeltaEnthalpy(doublereal* deltaH);
108 virtual void getDeltaEntropy(doublereal* deltaS);
109
110 virtual void getDeltaSSGibbs(doublereal* deltaG);
111 virtual void getDeltaSSEnthalpy(doublereal* deltaH);
112 virtual void getDeltaSSEntropy(doublereal* deltaS);
113
114 //! @}
115 //! @name Reaction Mechanism Informational Query Routines
116 //! @{
117
118 virtual void getActivityConcentrations(doublereal* const conc);
119
120 //! Return the charge transfer rxn Beta parameter for the ith reaction
121 /*!
122 * Returns the beta parameter for a charge transfer reaction. This
123 * parameter is not important for non-charge transfer reactions.
124 * Note, the parameter defaults to zero. However, a value of 0.5
125 * should be supplied for every charge transfer reaction if
126 * no information is known, as a value of 0.5 pertains to a
127 * symmetric transition state. The value can vary between 0 to 1.
128 *
129 * @param irxn Reaction number in the kinetics mechanism
130 *
131 * @return Beta parameter. This defaults to zero, even for charge
132 * transfer reactions.
133 *
134 * @deprecated To be removed after Cantera 2.6. Parameter should be accessed
135 * from ReactionRate object instead.
136 */
137 doublereal electrochem_beta(size_t irxn) const;
138
139 virtual bool isReversible(size_t i) {
140 if (std::find(m_revindex.begin(), m_revindex.end(), i)
141 < m_revindex.end()) {
142 return true;
143 } else {
144 return false;
145 }
146 }
147
148 virtual void getFwdRateConstants(doublereal* kfwd);
149 virtual void getRevRateConstants(doublereal* krev,
150 bool doIrreversible = false);
151
152 //! Return effective preexponent for the specified reaction
153 /*!
154 * Returns effective preexponent, accounting for surface coverage
155 * dependencies.
156 *
157 * @param irxn Reaction number in the kinetics mechanism
158 * @return Effective preexponent
159 *
160 * @deprecated To be removed after Cantera 2.6.
161 */
162 double effectivePreExponentialFactor(size_t irxn) {
163 if (m_interfaceRates.size()) {
165 "InterfaceKinetics::effectivePreExponentialFactor",
166 "Only implemented for legacy CTI/XML framework.");
167 }
168 return m_rates.effectivePreExponentialFactor(irxn);
169 }
170
171 //! Return effective activation energy for the specified reaction
172 /*!
173 * Returns effective activation energy, accounting for surface coverage
174 * dependencies.
175 *
176 * @param irxn Reaction number in the kinetics mechanism
177 * @return Effective activation energy divided by the gas constant
178 *
179 * @deprecated To be removed after Cantera 2.6.
180 */
181 double effectiveActivationEnergy_R(size_t irxn) {
182 if (m_interfaceRates.size()) {
184 "InterfaceKinetics::effectiveActivationEnergy_R",
185 "Only implemented for legacy CTI/XML framework.");
186 }
187 return m_rates.effectiveActivationEnergy_R(irxn);
188 }
189
190 //! Return effective temperature exponent for the specified reaction
191 /*!
192 * Returns effective temperature exponent, accounting for surface coverage
193 * dependencies. Current parameterization in SurfaceArrhenius does not
194 * change this parameter with the change in surface coverages.
195 *
196 * @param irxn Reaction number in the kinetics mechanism
197 * @return Effective temperature exponent
198 *
199 * @deprecated To be removed after Cantera 2.6.
200 */
201 double effectiveTemperatureExponent(size_t irxn) {
202 if (m_interfaceRates.size()) {
204 "InterfaceKinetics::effectiveTemperatureExponent",
205 "Only implemented for legacy CTI/XML framework.");
206 }
207 return m_rates.effectiveTemperatureExponent(irxn);
208 }
209
210 //! @}
211 //! @name Reaction Mechanism Construction
212 //! @{
213
214 //! Add a phase to the kinetics manager object.
215 /*!
216 * This must be done before the function init() is called or
217 * before any reactions are input.
218 *
219 * This function calls Kinetics::addPhase(). It also sets the following
220 * fields:
221 *
222 * m_phaseExists[]
223 *
224 * @param thermo Reference to the ThermoPhase to be added.
225 */
226 virtual void addPhase(ThermoPhase& thermo);
227
228 virtual void init();
229 virtual void resizeSpecies();
230 virtual bool addReaction(shared_ptr<Reaction> r, bool resize=true);
231 virtual void modifyReaction(size_t i, shared_ptr<Reaction> rNew);
232 //! @}
233
234 //! Internal routine that updates the Rates of Progress of the reactions
235 /*!
236 * This is actually the guts of the functionality of the object
237 */
238 virtual void updateROP();
239
240 //! Update properties that depend on temperature
241 /*!
242 * Current objects that this function updates:
243 * m_kdata->m_logtemp
244 * m_kdata->m_rfn
245 * m_rates.
246 * updateKc();
247 */
248 void _update_rates_T();
249
250 //! Update properties that depend on the electric potential
251 void _update_rates_phi();
252
253 //! Update properties that depend on the species mole fractions and/or
254 //! concentration,
255 /*!
256 * This method fills out the array of generalized concentrations by calling
257 * method getActivityConcentrations for each phase, which classes
258 * representing phases should overload to return the appropriate quantities.
259 */
260 void _update_rates_C();
261
262 //! Advance the surface coverages in time
263 /*!
264 * This method carries out a time-accurate advancement of the
265 * surface coverages for a specified amount of time.
266 *
267 * \f[
268 * \dot {\theta}_k = \dot s_k (\sigma_k / s_0)
269 * \f]
270 *
271 * @param tstep Time value to advance the surface coverages
272 * @param rtol The relative tolerance for the integrator
273 * @param atol The absolute tolerance for the integrator
274 * @param maxStepSize The maximum step-size the integrator is allowed to take.
275 * If zero, this option is disabled.
276 * @param maxSteps The maximum number of time-steps the integrator can take.
277 * If not supplied, uses the default value in CVodeIntegrator (20000).
278 * @param maxErrTestFails the maximum permissible number of error test failures
279 * If not supplied, uses the default value in CVODES (7).
280 */
281 void advanceCoverages(doublereal tstep, double rtol=1.e-7,
282 double atol=1.e-14, double maxStepSize=0,
283 size_t maxSteps=20000, size_t maxErrTestFails=7);
284
285 //! Solve for the pseudo steady-state of the surface problem
286 /*!
287 * This is the same thing as the advanceCoverages() function,
288 * but at infinite times.
289 *
290 * Note, a direct solve is carried out under the hood here,
291 * to reduce the computational time.
292 *
293 * @param ifuncOverride One of the values defined in @ref solvesp_methods.
294 * The default is -1, which means that the program will decide.
295 * @param timeScaleOverride When a pseudo transient is selected this value
296 * can be used to override the default time scale for
297 * integration which is one. When SFLUX_TRANSIENT is used, this
298 * is equal to the time over which the equations are integrated.
299 * When SFLUX_INITIALIZE is used, this is equal to the time used
300 * in the initial transient algorithm, before the equation
301 * system is solved directly.
302 */
303 void solvePseudoSteadyStateProblem(int ifuncOverride = -1,
304 doublereal timeScaleOverride = 1.0);
305
306 void setIOFlag(int ioFlag);
307
308 //! Update the standard state chemical potentials and species equilibrium
309 //! constant entries
310 /*!
311 * Virtual because it is overridden when dealing with experimental open
312 * circuit voltage overrides
313 */
314 virtual void updateMu0();
315
316 //! Update the equilibrium constants and stored electrochemical potentials
317 //! in molar units for all reversible reactions and for all species.
318 /*!
319 * Irreversible reactions have their equilibrium constant set
320 * to zero. For reactions involving charged species the equilibrium
321 * constant is adjusted according to the electrostatic potential.
322 */
323 void updateKc();
324
325 //! Apply modifications for the forward reaction rate for interfacial charge
326 //! transfer reactions
327 /*!
328 * For reactions that transfer charge across a potential difference,
329 * the activation energies are modified by the potential difference.
330 * (see, for example, ...). This method applies this correction.
331 *
332 * @param kfwd Vector of forward reaction rate constants on which to have
333 * the voltage correction applied
334 *
335 * @deprecated To be removed after Cantera 2.6.
336 */
337 void applyVoltageKfwdCorrection(doublereal* const kfwd);
338
339 //! When an electrode reaction rate is optionally specified in terms of its
340 //! exchange current density, adjust kfwd to the standard reaction rate
341 //! constant form and units. When the BV reaction types are used, keep the
342 //! exchange current density form.
343 /*!
344 * For a reaction rate constant that was given in units of Amps/m2
345 * (exchange current density formulation with iECDFormulation == true),
346 * convert the rate to kmoles/m2/s.
347 *
348 * For a reaction rate constant that was given in units of kmol/m2/sec when
349 * the reaction type is a Butler-Volmer form, convert it to exchange
350 * current density form (amps/m2).
351 *
352 * @param kfwd Vector of forward reaction rate constants, given in either
353 * normal form or in exchange current density form.
354 *
355 * @deprecated To be removed after Cantera 2.6.
356 */
357 void convertExchangeCurrentDensityFormulation(doublereal* const kfwd);
358
359 //! Set the existence of a phase in the reaction object
360 /*!
361 * Tell the kinetics object whether a phase in the object exists. This is
362 * actually an extrinsic specification that must be carried out on top of
363 * the intrinsic calculation of the reaction rate. The routine will also
364 * flip the IsStable boolean within the kinetics object as well.
365 *
366 * @param iphase Index of the phase. This is the order within the
367 * internal thermo vector object
368 * @param exists Boolean indicating whether the phase exists or not
369 */
370 void setPhaseExistence(const size_t iphase, const int exists);
371
372 //! Set the stability of a phase in the reaction object
373 /*!
374 * Tell the kinetics object whether a phase in the object is stable.
375 * Species in an unstable phase will not be allowed to have a positive
376 * rate of formation from this kinetics object. This is actually an
377 * extrinsic specification that must be carried out on top of the
378 * intrinsic calculation of the reaction rate.
379 *
380 * While conceptually not needed since kinetics is consistent with thermo
381 * when taken as a whole, in practice it has found to be very useful to
382 * turn off the creation of phases which shouldn't be forming. Typically
383 * this can reduce the oscillations in phase formation and destruction
384 * which are observed.
385 *
386 * @param iphase Index of the phase. This is the order within the
387 * internal thermo vector object
388 * @param isStable Flag indicating whether the phase is stable or not
389 */
390 void setPhaseStability(const size_t iphase, const int isStable);
391
392 //! Gets the phase existence int for the ith phase
393 /*!
394 * @param iphase Phase Id
395 * @return The int specifying whether the kinetics object thinks the phase
396 * exists or not. If it exists, then species in that phase can be
397 * a reactant in reactions.
398 */
399 int phaseExistence(const size_t iphase) const;
400
401 //! Gets the phase stability int for the ith phase
402 /*!
403 * @param iphase Phase Id
404 * @return The int specifying whether the kinetics object thinks the phase
405 * is stable with nonzero mole numbers. If it stable, then the
406 * kinetics object will allow for rates of production of of
407 * species in that phase that are positive.
408 */
409 int phaseStability(const size_t iphase) const;
410
411protected:
412 //! Build a SurfaceArrhenius object from a Reaction, taking into account
413 //! the possible sticking coefficient form and coverage dependencies
414 //! @param i Reaction number
415 //! @param r Reaction object containing rate coefficient parameters
416 //! @param replace True if replacing an existing reaction
417 //! @deprecated To be removed after Cantera 2.6.
419 bool replace);
420
421 //! Temporary work vector of length m_kk
423
424 //! List of reactions numbers which are reversible reactions
425 /*!
426 * This is a vector of reaction numbers. Each reaction in the list is
427 * reversible. Length = number of reversible reactions
428 */
429 std::vector<size_t> m_revindex;
430
431 //! Templated class containing the vector of reactions for this interface
432 /*!
433 * The templated class is described in RateCoeffMgr.h
434 * The class SurfaceArrhenius is described in RxnRates.h
435 */
437
438 bool m_redo_rates;
439
440 //! Vector of rate handlers for interface reactions
441 std::vector<unique_ptr<MultiRateBase>> m_interfaceRates;
442 std::map<std::string, size_t> m_interfaceTypes; //!< Rate handler mapping
443
444 //! Vector of irreversible reaction numbers
445 /*!
446 * vector containing the reaction numbers of irreversible reactions.
447 */
448 std::vector<size_t> m_irrev;
449
450 //! Array of concentrations for each species in the kinetics mechanism
451 /*!
452 * An array of generalized concentrations \f$ C_k \f$ that are defined
453 * such that \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ is a standard
454 * concentration/ These generalized concentrations are used by this
455 * kinetics manager class to compute the forward and reverse rates of
456 * elementary reactions. The "units" for the concentrations of each phase
457 * depend upon the implementation of kinetics within that phase. The order
458 * of the species within the vector is based on the order of listed
459 * ThermoPhase objects in the class, and the order of the species within
460 * each ThermoPhase class.
461 */
463
464 //! Array of activity concentrations for each species in the kinetics object
465 /*!
466 * An array of activity concentrations \f$ Ca_k \f$ that are defined
467 * such that \f$ a_k = Ca_k / C^0_k, \f$ where \f$ C^0_k \f$ is a standard
468 * concentration. These activity concentrations are used by this
469 * kinetics manager class to compute the forward and reverse rates of
470 * elementary reactions. The "units" for the concentrations of each phase
471 * depend upon the implementation of kinetics within that phase. The order
472 * of the species within the vector is based on the order of listed
473 * ThermoPhase objects in the class, and the order of the species within
474 * each ThermoPhase class.
475 */
477
478 //! Vector of standard state chemical potentials for all species
479 /*!
480 * This vector contains a temporary vector of standard state chemical
481 * potentials for all of the species in the kinetics object
482 *
483 * Length = m_kk. Units = J/kmol.
484 */
486
487 //! Vector of chemical potentials for all species
488 /*!
489 * This vector contains a vector of chemical potentials for all of the
490 * species in the kinetics object
491 *
492 * Length = m_kk. Units = J/kmol.
493 */
495
496 //! Vector of standard state electrochemical potentials modified by a
497 //! standard concentration term.
498 /*!
499 * This vector contains a temporary vector of standard state electrochemical
500 * potentials + RTln(Cs) for all of the species in the kinetics object
501 *
502 * In order to get the units correct for the concentration equilibrium
503 * constant, each species needs to have an RT ln(Cs) added to its
504 * contribution to the equilibrium constant Cs is the standard concentration
505 * for the species. Frequently, for solid species, Cs is equal to 1.
506 * However, for gases Cs is P/RT. Length = m_kk. Units = J/kmol.
507 */
509
510 //! Vector of phase electric potentials
511 /*!
512 * Temporary vector containing the potential of each phase in the kinetics
513 * object. length = number of phases. Units = Volts.
514 */
516
517 //! Vector of potential energies due to Voltages
518 /*!
519 * Length is the number of species in kinetics mech. It's used to store the
520 * potential energy due to the voltage.
521 */
523
524 //! Storage for the net electric energy change due to reaction.
525 /*!
526 * Length is number of reactions. It's used to store the net electric
527 * potential energy change due to the reaction.
528 *
529 * deltaElectricEnergy_[jrxn] = sum_i ( F V_i z_i nu_ij)
530 *
531 * @deprecated To be removed after Cantera 2.6.
532 */
534
535 //! Pointer to the single surface phase
537
538 //! Pointer to the Implicit surface chemistry object
539 /*!
540 * Note this object is owned by this InterfaceKinetics object. It may only
541 * be used to solve this single InterfaceKinetics object's surface problem
542 * uncoupled from other surface phases.
543 */
545
546 //! Electrochemical transfer coefficient for the forward direction
547 /*!
548 * Electrochemical transfer coefficient for all reactions that have
549 * transfer reactions the reaction is given by m_ctrxn[i]
550 *
551 * @deprecated To be removed after Cantera 2.6.
552 */
554
555 //! Vector of reaction indexes specifying the id of the charge transfer
556 //! reactions in the mechanism
557 /*!
558 * Vector of reaction indices which involve charge transfers. This provides
559 * an index into the m_beta array.
560 *
561 * irxn = m_ctrxn[i]
562 *
563 * @deprecated To be removed after Cantera 2.6.
564 */
565 std::vector<size_t> m_ctrxn;
566
567 //! Vector of booleans indicating whether the charge transfer reaction rate constant
568 //! is described by an exchange current density rate constant expression
569 /*!
570 * Length is equal to the number of reactions with charge transfer coefficients, m_ctrxn[]
571 *
572 * m_ctrxn_ecdf[irxn] = 0 This means that the rate coefficient calculator will calculate
573 * the rate constant as a chemical forward rate constant, a standard format.
574 * m_ctrxn_ecdf[irxn] = 1 this means that the rate coefficient calculator will calculate
575 * the rate constant as an exchange current density rate constant expression.
576 *
577 * @deprecated To be removed after Cantera 2.6.
578 */
580
581 //! Vector of standard concentrations
582 /*!
583 * Length number of kinetic species
584 * units depend on the definition of the standard concentration within each phase
585 *
586 * @deprecated To be removed after Cantera 2.6.
587 */
589
590 //! Vector of delta G^0, the standard state Gibbs free energies for each reaction
591 /*!
592 * Length is the number of reactions
593 * units are Joule kmol-1
594 *
595 * @deprecated To be removed after Cantera 2.6.
596 */
598
599 //! Vector of deltaG[] of reaction, the delta Gibbs free energies for each reaction
600 /*!
601 * Length is the number of reactions
602 * units are Joule kmol-1
603 *
604 * @deprecated To be removed after Cantera 2.6.
605 */
607
608 //! Vector of the products of the standard concentrations of the reactants
609 /*!
610 * Units vary wrt what the units of the standard concentrations are
611 * Length = number of reactions.
612 *
613 * @deprecated To be removed after Cantera 2.6.
614 */
616
617 bool m_ROP_ok;
618
619 //! Current temperature of the data
620 doublereal m_temp;
621
622 //! Current log of the temperature
623 doublereal m_logtemp;
624
625 //! Boolean flag indicating whether any reaction in the mechanism
626 //! has a coverage dependent forward reaction rate
627 /*!
628 * If this is true, then the coverage dependence is multiplied into
629 * the forward reaction rates constant
630 */
632
633 //! Boolean flag indicating whether any reaction in the mechanism
634 //! has a beta electrochemical parameter.
635 /*!
636 * If this is true, the Butler-Volmer correction is applied
637 * to the forward reaction rate for those reactions.
638 *
639 * fac = exp ( - beta * (delta_phi))
640 *
641 * @deprecated To be removed after Cantera 2.6.
642 */
644
645 //! Boolean flag indicating whether any reaction in the mechanism
646 //! is described by an exchange current density expression
647 /*!
648 * If this is true, the standard state Gibbs free energy of the reaction
649 * and the product of the reactant standard concentrations must be
650 * precalculated in order to calculate the rate constant.
651 *
652 * @deprecated To be removed after Cantera 2.6.
653 */
655
656 //! Int flag to indicate that some phases in the kinetics mechanism are
657 //! non-existent.
658 /*!
659 * We change the ROP vectors to make sure that non-existent phases are
660 * treated correctly in the kinetics operator. The value of this is equal
661 * to the number of phases which don't exist.
662 */
664
665 //! Vector of booleans indicating whether phases exist or not
666 /*!
667 * Vector of booleans indicating whether a phase exists or not. We use this
668 * to set the ROP's so that unphysical things don't happen. For example, a
669 * reaction can't go in the forwards direction if a phase in which a
670 * reactant is present doesn't exist. Because InterfaceKinetics deals with
671 * intrinsic quantities only normally, nowhere else is this extrinsic
672 * concept introduced except here.
673 *
674 * length = number of phases in the object. By default all phases exist.
675 */
676 std::vector<bool> m_phaseExists;
677
678 //! Vector of int indicating whether phases are stable or not
679 /*!
680 * Vector of booleans indicating whether a phase is stable or not under
681 * the current conditions. We use this to set the ROP's so that
682 * unphysical things don't happen.
683 *
684 * length = number of phases in the object. By default all phases are stable.
685 */
687
688 //! Vector of vector of booleans indicating whether a phase participates in
689 //! a reaction as a reactant
690 /*!
691 * m_rxnPhaseIsReactant[j][p] indicates whether a species in phase p
692 * participates in reaction j as a reactant.
693 */
694 std::vector<std::vector<bool> > m_rxnPhaseIsReactant;
695
696 //! Vector of vector of booleans indicating whether a phase participates in a
697 //! reaction as a product
698 /*!
699 * m_rxnPhaseIsReactant[j][p] indicates whether a species in phase p
700 * participates in reaction j as a product.
701 */
702 std::vector<std::vector<bool> > m_rxnPhaseIsProduct;
703
704 //! Values used for converting sticking coefficients into rate constants
705 struct StickData {
706 size_t index; //!< index of the sticking reaction in the full reaction list
707 double order; //!< exponent applied to site density term
708 double multiplier; //!< multiplicative factor in rate expression
709 bool use_motz_wise; //!< 'true' if Motz & Wise correction is being used
710 };
711
712 //! Data for sticking reactions
713 std::vector<StickData> m_stickingData;
714
715 void applyStickingCorrection(double T, double* kf);
716
717 int m_ioFlag;
718
719 //! Number of dimensions of reacting phase (2 for InterfaceKinetics, 1 for
720 //! EdgeKinetics)
721 size_t m_nDim;
722};
723
724}
725
726#endif
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Advances the surface coverages of the associated set of SurfacePhase objects in time.
A kinetics manager for heterogeneous reaction mechanisms.
virtual void resizeReactions()
Finalize Kinetics object and associated objects.
virtual void init()
Prepare the class for the addition of reactions, after all phases have been added.
virtual void getDeltaSSGibbs(doublereal *deltaG)
Return the vector of values for the reaction standard state Gibbs free energy change.
std::vector< size_t > m_revindex
List of reactions numbers which are reversible reactions.
int phaseExistence(const size_t iphase) const
Gets the phase existence int for the ith phase.
SurfPhase * m_surf
Pointer to the single surface phase.
vector_fp m_beta
Electrochemical transfer coefficient for the forward direction.
virtual void getRevRateConstants(doublereal *krev, bool doIrreversible=false)
Return the reverse rate constants.
double effectiveTemperatureExponent(size_t irxn)
Return effective temperature exponent for the specified reaction.
void applyVoltageKfwdCorrection(doublereal *const kfwd)
Apply modifications for the forward reaction rate for interfacial charge transfer reactions.
size_t m_nDim
Number of dimensions of reacting phase (2 for InterfaceKinetics, 1 for EdgeKinetics)
virtual bool isReversible(size_t i)
True if reaction i has been declared to be reversible.
vector_fp m_deltaG0
Vector of delta G^0, the standard state Gibbs free energies for each reaction.
void setPhaseStability(const size_t iphase, const int isStable)
Set the stability of a phase in the reaction object.
vector_fp m_StandardConc
Vector of standard concentrations.
SurfaceArrhenius buildSurfaceArrhenius(size_t i, InterfaceReaction2 &r, bool replace)
Build a SurfaceArrhenius object from a Reaction, taking into account the possible sticking coefficien...
vector_fp m_deltaG
Vector of deltaG[] of reaction, the delta Gibbs free energies for each reaction.
vector_fp m_phi
Vector of phase electric potentials.
virtual void getDeltaElectrochemPotentials(doublereal *deltaM)
Return the vector of values for the reaction electrochemical free energy change.
void convertExchangeCurrentDensityFormulation(doublereal *const kfwd)
When an electrode reaction rate is optionally specified in terms of its exchange current density,...
void _update_rates_phi()
Update properties that depend on the electric potential.
doublereal m_temp
Current temperature of the data.
std::vector< std::vector< bool > > m_rxnPhaseIsReactant
Vector of vector of booleans indicating whether a phase participates in a reaction as a reactant.
virtual void getDeltaEnthalpy(doublereal *deltaH)
Return the vector of values for the reactions change in enthalpy.
bool m_has_electrochem_rxns
Boolean flag indicating whether any reaction in the mechanism has a beta electrochemical parameter.
virtual void getFwdRateConstants(doublereal *kfwd)
Return the forward rate constants.
std::vector< unique_ptr< MultiRateBase > > m_interfaceRates
Vector of rate handlers for interface reactions.
virtual void addPhase(ThermoPhase &thermo)
Add a phase to the kinetics manager object.
std::vector< size_t > m_ctrxn
Vector of reaction indexes specifying the id of the charge transfer reactions in the mechanism.
std::vector< StickData > m_stickingData
Data for sticking reactions.
virtual bool addReaction(shared_ptr< Reaction > r, bool resize=true)
Add a single reaction to the mechanism.
vector_fp m_actConc
Array of activity concentrations for each species in the kinetics object.
void setElectricPotential(int n, doublereal V)
Set the electric potential in the nth phase.
vector_int m_ctrxn_ecdf
Vector of booleans indicating whether the charge transfer reaction rate constant is described by an e...
vector_fp m_conc
Array of concentrations for each species in the kinetics mechanism.
void updateKc()
Update the equilibrium constants and stored electrochemical potentials in molar units for all reversi...
void setPhaseExistence(const size_t iphase, const int exists)
Set the existence of a phase in the reaction object.
std::vector< size_t > m_irrev
Vector of irreversible reaction numbers.
vector_fp m_mu0
Vector of standard state chemical potentials for all species.
virtual void getActivityConcentrations(doublereal *const conc)
Get the vector of activity concentrations used in the kinetics object.
vector_fp m_pot
Vector of potential energies due to Voltages.
void _update_rates_C()
Update properties that depend on the species mole fractions and/or concentration,.
virtual void modifyReaction(size_t i, shared_ptr< Reaction > rNew)
Modify the rate expression associated with a reaction.
vector_fp m_mu
Vector of chemical potentials for all species.
vector_fp m_grt
Temporary work vector of length m_kk.
double effectiveActivationEnergy_R(size_t irxn)
Return effective activation energy for the specified reaction.
vector_fp deltaElectricEnergy_
Storage for the net electric energy change due to reaction.
doublereal m_logtemp
Current log of the temperature.
int phaseStability(const size_t iphase) const
Gets the phase stability int for the ith phase.
ImplicitSurfChem * m_integrator
Pointer to the Implicit surface chemistry object.
virtual void getEquilibriumConstants(doublereal *kc)
Equilibrium constant for all reactions including the voltage term.
virtual void getDeltaSSEntropy(doublereal *deltaS)
Return the vector of values for the change in the standard state entropies for each reaction.
virtual void getDeltaEntropy(doublereal *deltaS)
Return the vector of values for the reactions change in entropy.
void solvePseudoSteadyStateProblem(int ifuncOverride=-1, doublereal timeScaleOverride=1.0)
Solve for the pseudo steady-state of the surface problem.
void _update_rates_T()
Update properties that depend on temperature.
double effectivePreExponentialFactor(size_t irxn)
Return effective preexponent for the specified reaction.
virtual void updateROP()
Internal routine that updates the Rates of Progress of the reactions.
virtual void getDeltaSSEnthalpy(doublereal *deltaH)
Return the vector of values for the change in the standard state enthalpies of reaction.
bool m_has_coverage_dependence
Boolean flag indicating whether any reaction in the mechanism has a coverage dependent forward reacti...
virtual void updateMu0()
Update the standard state chemical potentials and species equilibrium constant entries.
InterfaceKinetics(ThermoPhase *thermo=0)
Constructor.
std::vector< std::vector< bool > > m_rxnPhaseIsProduct
Vector of vector of booleans indicating whether a phase participates in a reaction as a product.
vector_fp m_mu0_Kc
Vector of standard state electrochemical potentials modified by a standard concentration term.
vector_int m_phaseIsStable
Vector of int indicating whether phases are stable or not.
void updateExchangeCurrentQuantities()
values needed to convert from exchange current density to surface reaction rate.
std::vector< bool > m_phaseExists
Vector of booleans indicating whether phases exist or not.
virtual void getDeltaGibbs(doublereal *deltaG)
Return the vector of values for the reaction Gibbs free energy change.
virtual std::string kineticsType() const
Identifies the Kinetics manager type.
int m_phaseExistsCheck
Int flag to indicate that some phases in the kinetics mechanism are non-existent.
std::map< std::string, size_t > m_interfaceTypes
Rate handler mapping.
vector_fp m_ProdStanConcReac
Vector of the products of the standard concentrations of the reactants.
void advanceCoverages(doublereal 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.
doublereal electrochem_beta(size_t irxn) const
Return the charge transfer rxn Beta parameter for the ith reaction.
bool m_has_exchange_current_density_formulation
Boolean flag indicating whether any reaction in the mechanism is described by an exchange current den...
virtual void resizeSpecies()
Resize arrays with sizes that depend on the total number of species.
Rate1< SurfaceArrhenius > m_rates
Templated class containing the vector of reactions for this interface.
A reaction occurring on an interface (for example, a SurfPhase or an EdgePhase)
Definition: Reaction.h:419
Public interface for kinetics managers.
Definition: Kinetics.h:114
ThermoPhase & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism.
Definition: Kinetics.h:231
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
This rate coefficient manager supports one parameterization of the rate constant of any type.
Definition: RateCoeffMgr.h:28
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition: SurfPhase.h:125
An Arrhenius rate with coverage-dependent terms.
Definition: RxnRates.h:135
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
std::vector< int > vector_int
Vector of ints.
Definition: ct_defs.h:186
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:184
Values used for converting sticking coefficients into rate constants.
size_t index
index of the sticking reaction in the full reaction list
bool use_motz_wise
'true' if Motz & Wise correction is being used
double order
exponent applied to site density term
double multiplier
multiplicative factor in rate expression