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