Cantera  2.0
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 
11 #include <fstream>
12 #include <map>
13 
14 #include "cantera/thermo/mix_defs.h"
15 #include "Kinetics.h"
16 
17 #include "cantera/base/utilities.h"
18 #include "RateCoeffMgr.h"
19 #include "ReactionStoichMgr.h"
20 
21 #include <cmath>
22 #include <cstdlib>
23 
24 namespace Cantera
25 {
26 
27 // forward references
28 
29 class ReactionData;
30 class InterfaceKineticsData;
31 class ThermoPhase;
32 class SurfPhase;
33 class ImplicitSurfChem;
34 
35 
36 //! This class holds mechanism-specific data.
37 /*!
38  *
39  */
41 {
42 public:
44 
46 
47  InterfaceKineticsData& operator=(const InterfaceKineticsData& right);
48 
49  //! Virtual destructor
50  /*!
51  * todo - why is this virtual
52  */
53  virtual ~InterfaceKineticsData();
54 
55  doublereal m_logp0;
56  doublereal m_logc0;
57  vector_fp m_ropf;
58  vector_fp m_ropr;
59  vector_fp m_ropnet;
60 
61  bool m_ROP_ok;
62 
63  //! Current temperature of the data
64  doublereal m_temp;
65  //! Current log of the temperature
66  doublereal m_logtemp;
67  vector_fp m_rfn;
68  vector_fp m_rkcn;
69 };
70 
71 
72 
73 //! A kinetics manager for heterogeneous reaction mechanisms. The
74 //! reactions are assumed to occur at a 2D interface between two 3D phases.
75 /*!
76  *
77  * There are some important additions to the behavior of the kinetics class due to the
78  * presence of multiple phases and a heterogeneous interface. If a reactant phase
79  * doesn't exists, i.e., has a mole number of zero, a heterogeneous reaction can not
80  * proceed from reactants to products. Note it could perhaps proceed from products to
81  * reactants if all of the product phases exist.
82  *
83  * In order to make the determination of whether a phase exists or not actually involves
84  * the specification of additional information to the kinetics object., which heretofore
85  * has only had access to intrinsic field information about the phases (i.e., temperature
86  * pressure, and mole fraction).
87  *
88  * The extrinsic specification of whether a phase exists or not must be specified on top of the
89  * intrinsic calculation of the reaction rate. This routine carries a set of
90  * booleans indicating whether a phase in the heterogeneous mechanism exists or not.
91  *
92  * Additionally, the routine carries a set of booleans around indicating whether a product
93  * phase is stable or not. If a phase is not thermodynamically stable, it may be the case that
94  * a particular reaction in a heterogeneous mechanism will create a product species in the
95  * unstable phase. However, other reactions in the mechanism will destruct that species.
96  * This may cause oscillations in the formation of the unstable phase from time step to time
97  * step within a ODE solver, in practice. In order to avoid this situation, a set of
98  * booleans is tracked which sets the stability of a phase. If a phase is deemed to be unstable,
99  * then species in that phase will not be allowed to be birthed by the kinetics operator.
100  * Nonexistent phases are deemed to be unstable by default, but this can be changed.
101  *
102  * @ingroup chemkinetics
103  */
105 {
106 
107 public:
108 
109 
110  //! Constructor
111  /*!
112  * @param thermo The optional parameter may be used to initialize
113  * the object with one ThermoPhase object.
114  * HKM Note -> Since the interface kinetics
115  * object will probably require multiple thermophase
116  * objects, this is probably not a good idea
117  * to have this parameter.
118  */
120 
121 
122  /// Destructor.
123  virtual ~InterfaceKinetics();
124 
125  //! Copy Constructor for the %Kinetics object.
126  /*!
127  * Currently, this is not fully implemented. If called it will
128  * throw an exception.
129  */
130  InterfaceKinetics(const InterfaceKinetics& right);
131 
132  //! Assignment operator
133  /*!
134  * This is NOT a virtual function.
135  *
136  * @param right Reference to %Kinetics object to be copied into the
137  * current one.
138  */
140 
141 
142 
143  //! Duplication routine for objects which inherit from Kinetics
144  /*!
145  * This virtual routine can be used to duplicate %Kinetics objects
146  * inherited from %Kinetics even if the application only has
147  * a pointer to %Kinetics to work with.
148  *
149  * These routines are basically wrappers around the derived copy constructor.
150  *
151  * @param tpVector Vector of shallow pointers to ThermoPhase objects. this is the
152  * m_thermo vector within this object
153  */
154  virtual Kinetics* duplMyselfAsKinetics(const std::vector<thermo_t*> & tpVector) const;
155 
156  //! Return the ID of the kinetics object
157  //! @deprecated use type() instead
158  DEPRECATED(virtual int ID() const);
159 
160  //! Return the type of the kinetics object
161  virtual int type() const;
162 
163  //! Set the electric potential in the nth phase
164  /*!
165  * @param n phase Index in this kinetics object.
166  * @param V Electric potential (volts)
167  */
168  void setElectricPotential(int n, doublereal V);
169 
170 
171  ///
172  /// @name Reaction Rates Of Progress
173  ///
174  //@{
175 
176  //! Return the forward rates of progress for each reaction
177  /*!
178  * @param fwdROP vector of rates of progress.
179  * length = number of reactions, Units are kmol m-2 s-1.
180  */
181  virtual void getFwdRatesOfProgress(doublereal* fwdROP) {
182  updateROP();
183  std::copy(m_kdata->m_ropf.begin(), m_kdata->m_ropf.end(), fwdROP);
184  }
185 
186  //! Return the reverse rates of progress for each reaction
187  /*!
188  * @param revROP vector of rates of progress.
189  * length = number of reactions, Units are kmol m-2 s-1.
190  */
191  virtual void getRevRatesOfProgress(doublereal* revROP) {
192  updateROP();
193  std::copy(m_kdata->m_ropr.begin(), m_kdata->m_ropr.end(), revROP);
194  }
195 
196  //! Return the net rates of progress for each reaction
197  /*!
198  * @param netROP vector of rates of progress.
199  * length = number of reactions, Units are kmol m-2 s-1.
200  */
201  virtual void getNetRatesOfProgress(doublereal* netROP) {
202  updateROP();
203  std::copy(m_kdata->m_ropnet.begin(), m_kdata->m_ropnet.end(), netROP);
204  }
205 
206 
207  //! Get the equilibrium constants of all reactions, whether
208  //! the reaction is reversible or not.
209  /*!
210  * @param kc Returns the concentration equation constant for the reaction.
211  * Length is the number of reactions
212  */
213  virtual void getEquilibriumConstants(doublereal* kc);
214 
215  void getExchangeCurrentQuantities();
216 
217  //! Return the vector of values for the reaction gibbs free energy change.
218  /*!
219  * These values depend upon the concentration of the solution.
220  *
221  * units = J kmol-1
222  *
223  * @param deltaG Output vector of deltaG's for reactions
224  * Length: m_ii.
225  */
226  virtual void getDeltaGibbs(doublereal* deltaG);
227 
228  //! Return the vector of values for the reaction electrochemical free energy change.
229  /*!
230  * These values depend upon the concentration of the solution and
231  * the voltage of the phases
232  *
233  * units = J kmol-1
234  *
235  * @param deltaM Output vector of deltaM's for reactions
236  * Length: m_ii.
237  */
238  virtual void getDeltaElectrochemPotentials(doublereal* deltaM);
239 
240  /**
241  * Return the vector of values for the reactions change in
242  * enthalpy.
243  * These values depend upon the concentration
244  * of the solution.
245  *
246  * units = J kmol-1
247  */
248  virtual void getDeltaEnthalpy(doublereal* deltaH);
249 
250  //! Return the vector of values for the change in
251  //! entropy due to each reaction
252  /*!
253  * These values depend upon the concentration
254  * of the solution.
255  *
256  * units = J kmol-1 Kelvin-1
257  *
258  * @param deltaS vector of Enthalpy changes
259  * Length = m_ii, number of reactions
260  *
261  */
262  virtual void getDeltaEntropy(doublereal* deltaS);
263 
264 
265  //! Return the vector of values for the reaction
266  //! standard state gibbs free energy change.
267  /*!
268  * These values don't depend upon the concentration
269  * of the solution.
270  *
271  * @param deltaG vector of rxn SS free energy changes
272  * units = J kmol-1
273  */
274  virtual void getDeltaSSGibbs(doublereal* deltaG);
275 
276  //! Return the vector of values for the change in the
277  //! standard state enthalpies of reaction.
278  /*!
279  * These values don't depend upon the concentration
280  * of the solution.
281  *
282  * @param deltaH vector of rxn SS enthalpy changes
283  * units = J kmol-1
284  */
285  virtual void getDeltaSSEnthalpy(doublereal* deltaH);
286 
287  //! Return the vector of values for the change in the
288  //! standard state entropies for each reaction.
289  /*!
290  * These values don't depend upon the concentration
291  * of the solution.
292  *
293  * @param deltaS vector of rxn SS entropy changes
294  * units = J kmol-1 Kelvin-1
295  */
296  virtual void getDeltaSSEntropy(doublereal* deltaS);
297 
298 
299  //@}
300  /**
301  * @name Species Production Rates
302  */
303  //@{
304 
305 
306  //! Returns the Species creation rates [kmol/m^2/s].
307  /*!
308  * Return the species
309  * creation rates in array cdot, which must be
310  * dimensioned at least as large as the total number of
311  * species in all phases of the kinetics
312  * model
313  *
314  * @param cdot Vector containing creation rates.
315  * length = m_kk. units = kmol/m^2/s
316  */
317  virtual void getCreationRates(doublereal* cdot);
318 
319  //! Return the Species destruction rates [kmol/m^2/s].
320  /*!
321  * Return the species destruction rates in array ddot, which must be
322  * dimensioned at least as large as the total number of
323  * species in all phases of the kinetics model
324  *
325  * @param ddot Vector containing destruction rates.
326  * length = m_kk. units = kmol/m^2/s
327  */
328  virtual void getDestructionRates(doublereal* ddot);
329 
330  //! Return the species net production rates [kmol/m^2/s].
331  /*!
332  * Species net production rates [kmol/m^2/s]. Return the species
333  * net production rates (creation - destruction) in array
334  * wdot, which must be dimensioned at least as large as the
335  * total number of species in all phases of the kinetics
336  * model
337  *
338  * @param net Vector of species production rates.
339  * units kmol m-d s-1, where d is dimension.
340  */
341  virtual void getNetProductionRates(doublereal* net);
342 
343  //@}
344  /**
345  * @name Reaction Mechanism Informational Query Routines
346  */
347  //@{
348 
349  /**
350  * Stoichiometric coefficient of species k as a reactant in
351  * reaction i.
352  */
353  virtual doublereal reactantStoichCoeff(size_t k, size_t i) const {
354  return m_rrxn[k][i];
355  }
356 
357  /**
358  * Stoichiometric coefficient of species k as a product in
359  * reaction i.
360  */
361  virtual doublereal productStoichCoeff(size_t k, size_t i) const {
362  return m_prxn[k][i];
363  }
364 
365  /**
366  * Flag specifying the type of reaction. The legal values and
367  * their meaning are specific to the particular kinetics
368  * manager.
369  */
370  virtual int reactionType(size_t i) const {
371  return m_index[i].first;
372  }
373 
374  //! Get the vector of activity concentrations used in the kinetics object
375  /*!
376  * @param conc (output) Vector of activity concentrations. Length is
377  * equal to the number of species in the kinetics object
378  */
379  virtual void getActivityConcentrations(doublereal* const conc);
380 
381  //! Return the charge transfer rxn Beta parameter for the ith reaction
382  /*!
383  * Returns the beta parameter for a charge transfer reaction. This
384  * parameter is not important for non-charge transfer reactions.
385  * Note, the parameter defaults to zero. However, a value of 0.5
386  * should be supplied for every charge transfer reaction if
387  * no information is known, as a value of 0.5 pertains to a
388  * symmetric transition state. The value can vary between 0 to 1.
389  *
390  *
391  * @param irxn Reaction number in the kinetics mechanism
392  *
393  * @return
394  * Beta parameter. This defaults to zero, even for charge transfer
395  * reactions.
396  */
397  doublereal electrochem_beta(size_t irxn) const;
398 
399  /**
400  * True if reaction i has been declared to be reversible. If
401  * isReversible(i) is false, then the reverse rate of progress
402  * for reaction i is always zero.
403  */
404  virtual bool isReversible(size_t i) {
405  if (std::find(m_revindex.begin(), m_revindex.end(), i)
406  < m_revindex.end()) {
407  return true;
408  } else {
409  return false;
410  }
411  }
412 
413  /**
414  * Return a string representing the reaction.
415  */
416  virtual std::string reactionString(size_t i) const {
417  return m_rxneqn[i];
418  }
419 
420 
421  virtual void getFwdRateConstants(doublereal* kfwd);
422  virtual void getRevRateConstants(doublereal* krev,
423  bool doIrreversible = false);
424 
425 
426  virtual void getActivationEnergies(doublereal* E);
427 
428  //@}
429  /**
430  * @name Reaction Mechanism Construction
431  */
432  //@{
433 
434  //! Add a phase to the kinetics manager object.
435  /*!
436  * This must be done before the function init() is called or
437  * before any reactions are input.
438  *
439  * This function calls the Kinetics operator addPhase.
440  * It also sets the following functions
441  *
442  * m_phaseExists[]
443  *
444  * @param thermo Reference to the ThermoPhase to be added.
445  */
446  virtual void addPhase(thermo_t& thermo);
447 
448  //! Prepare the class for the addition of reactions.
449  /*!
450  * This function must be called after instantiation of the class, but before
451  * any reactions are actually added to the mechanism.
452  * This function calculates m_kk the number of species in all
453  * phases participating in the reaction mechanism. We don't know
454  * m_kk previously, before all phases have been added.
455  */
456  virtual void init();
457 
458  //! Add a single reaction to the mechanism.
459  /*!
460  * @param r Reference to a ReactionData object containing all of
461  * the info needed to describe the reaction.
462  */
463  virtual void addReaction(ReactionData& r);
464 
465 
466  //! Finish adding reactions and prepare for use.
467  /*!
468  * This function
469  * must be called after all reactions are entered into the mechanism
470  * and before the mechanism is used to calculate reaction rates.
471  */
472  virtual void finalize();
473 
474  virtual bool ready() const;
475 
476  //! Internal routine that updates the Rates of Progress of the reactions
477  /*!
478  * This is actually the guts of the functionality of the object
479  */
480  void updateROP();
481 
482 
483 
484  //! Update properties that depend on temperature
485  /*!
486  * This is called to update all of the properties that depend on temperature
487  *
488  * Current objects that this function updates
489  * m_kdata->m_logtemp
490  * m_kdata->m_rfn
491  * m_rates.
492  * updateKc();
493  */
494  void _update_rates_T();
495 
496  //! Update properties that depend on the electric potential
497  /*!
498  * This is called to update all of the properties that depend on potential
499  */
500  void _update_rates_phi();
501 
502  //! Update properties that depend on the species mole fractions and/or concentration
503  /*!
504  * This is called to update all of the properties that depend on concentration
505  */
506  void _update_rates_C();
507 
508  //! Advance the surface coverages in time
509  /*!
510  * This method carries out a time-accurate advancement of the
511  * surface coverages for a specified amount of time.
512  *
513  * \f[
514  * \dot {\theta}_k = \dot s_k (\sigma_k / s_0)
515  * \f]
516  *
517  *
518  * @param tstep Time value to advance the surface coverages
519  */
520  void advanceCoverages(doublereal tstep);
521 
522  //! Solve for the pseudo steady-state of the surface problem
523  /*!
524  * Solve for the steady state of the surface problem.
525  * This is the same thing as the advanceCoverages() function,
526  * but at infinite times.
527  *
528  * Note, a direct solve is carried out under the hood here,
529  * to reduce the computational time.
530  *
531  * @param ifuncOverride 4 values are possible
532  * 1 SFLUX_INITIALIZE
533  * 2 SFLUX_RESIDUAL
534  * 3 SFLUX_JACOBIAN
535  * 4 SFLUX_TRANSIENT
536  * The default is -1, which means that the program
537  * will decide.
538  * @param timeScaleOverride When a pseudo transient is
539  * selected this value can be used to override
540  * the default time scale for integration which
541  * is one.
542  * When SFLUX_TRANSIENT is used, this is equal to the
543  * time over which the equations are integrated.
544  * When SFLUX_INITIALIZE is used, this is equal to the
545  * time used in the initial transient algorithm,
546  * before the equation system is solved directly.
547  */
548  void solvePseudoSteadyStateProblem(int ifuncOverride = -1,
549  doublereal timeScaleOverride = 1.0);
550 
551  void setIOFlag(int ioFlag);
552 
553  void checkPartialEquil();
554 
555 
556  size_t reactionNumber() const {
557  return m_ii;
558  }
559 
560  void addElementaryReaction(ReactionData& r);
561  void addGlobalReaction(const ReactionData& r);
562  void installReagents(const ReactionData& r);
563 
564  void updateKc();
565 
566  //! Write values into m_index
567  /*!
568  * @param rxnNumber reaction number
569  * @param type reaction type
570  * @param loc location ??
571  */
572  void registerReaction(size_t rxnNumber, int type, size_t loc) {
573  m_index[rxnNumber] = std::pair<int, size_t>(type, loc);
574  }
575 
576  //! Apply corrections for interfacial charge transfer reactions
577  /*!
578  * For reactions that transfer charge across a potential difference,
579  * the activation energies are modified by the potential difference.
580  * (see, for example, ...). This method applies this correction.
581  *
582  * @param kf Vector of forward reaction rate constants on which to have
583  * the correction applied
584  */
585  void applyButlerVolmerCorrection(doublereal* const kf);
586 
587  //! When an electrode reaction rate is optionally specified in terms of its
588  //! exchange current density, extra vectors need to be precalculated
589  /*!
590  *
591  */
592  void applyExchangeCurrentDensityFormulation(doublereal* const kfwd);
593 
594  //! Set the existence of a phase in the reaction object
595  /*!
596  * Tell the kinetics object whether a phase in the object exists.
597  * This is actually an extrinsic specification that must be carried out on top of the
598  * intrinsic calculation of the reaction rate.
599  * The routine will also flip the IsStable boolean within the kinetics object as well.
600  *
601  * @param iphase Index of the phase. This is the order within the internal thermo vector object
602  * @param exists Boolean indicating whether the phase exists or not
603  */
604  void setPhaseExistence(const size_t iphase, const bool exists);
605 
606  //! Set the stability of a phase in the reaction object
607  /*!
608  * Tell the kinetics object whether a phase in the object is stable. Species in an unstable phase
609  * will not be allowed to have a positive rate of formation from this kinetics object.
610  * This is actually an extrinsic specification that must be carried out on top of the
611  * intrinsic calculation of the reaction rate.
612  *
613  * While conceptually not needed since kinetics is consistent with thermo when taken as a whole,
614  * in practice it has found to be very useful to turn off the creation of phases which shouldn't
615  * be forming. Typically this can reduce the oscillations in phase formation and destruction
616  * which are observed.
617  *
618  * @param iphase Index of the phase. This is the order within the internal thermo vector object
619  * @param isStable Flag indicating whether the phase is stable or not
620  */
621  void setPhaseStability(const int iphase, const int isStable);
622 
623  //! Gets the phase existence int for the ith phase
624  /*!
625  * @param iphase Phase Id
626  *
627  * @return Returns the int specifying whether the kinetics object thinks the phase exists
628  * or not. If it exists, then species in that phase can be a reactant in reactions.
629  */
630  int phaseExistence(const int iphase) const;
631 
632  //! Gets the phase stability int for the ith phase
633  /*!
634  * @param iphase Phase Id
635  *
636  * @return Returns the int specifying whether the kinetics object thinks the phase is stable
637  * with nonzero mole numbers.
638  * If it stable, then the kinetics object will allow for rates of production of
639  * of species in that phase that are positive.
640  */
641  int phaseStability(const int iphase) const;
642 
643 
644 protected:
645 
646  //! Temporary work vector of length m_kk
648 
649  //! List of reactions numbers which are reversible reactions
650  /*!
651  * This is a vector of reaction numbers. Each reaction
652  * in the list is reversible.
653  * Length = number of reversible reactions
654  */
655  std::vector<size_t> m_revindex;
656 
657  //! Templated class containing the vector of reactions for this interface
658  /*!
659  * The templated class is described in RateCoeffMgr.h
660  * The class SurfaceArrhenius is described in RxnRates.h
661  */
663 
664  bool m_redo_rates;
665 
666  /**
667  * Vector of information about reactions in the
668  * mechanism.
669  * The key is the reaction index (0 < i < m_ii).
670  * The first pair is the reactionType of the reaction.
671  * The second pair is ...
672  */
673  mutable std::map<size_t, std::pair<int, size_t> > m_index;
674 
675  //! Vector of irreversible reaction numbers
676  /*!
677  * vector containing the reaction numbers of irreversible
678  * reactions.
679  */
680  std::vector<size_t> m_irrev;
681 
682  //! Stoichiometric manager for the reaction mechanism
683  /*!
684  * This is the manager for the kinetics mechanism that
685  * handles turning reaction extents into species
686  * production rates and also handles turning thermo
687  * properties into reaction thermo properties.
688  */
690 
691  //! Number of irreversible reactions in the mechanism
692  size_t m_nirrev;
693 
694  //! Number of reversible reactions in the mechanism
695  size_t m_nrev;
696 
697 
698  //! m_rrxn is a vector of maps, containing the reactant
699  //! stoichiometric coefficient information
700  /*!
701  * m_rrxn has a length
702  * equal to the total number of species in the kinetics
703  * object. For each species, there exists a map, with the
704  * reaction number being the key, and the
705  * reactant stoichiometric coefficient for the species being the value.
706  * HKM -> mutable because search sometimes creates extra
707  * entries. To be fixed in future...
708  */
709  mutable std::vector<std::map<size_t, doublereal> > m_rrxn;
710 
711  //! m_prxn is a vector of maps, containing the reactant
712  //! stoichiometric coefficient information
713  /**
714  * m_prxn is a vector of maps. m_prxn has a length
715  * equal to the total number of species in the kinetics
716  * object. For each species, there exists a map, with the
717  * reaction number being the key, and the
718  * product stoichiometric coefficient for the species being the value.
719  */
720  mutable std::vector<std::map<size_t, doublereal> > m_prxn;
721 
722  //! String expression for each rxn
723  /*!
724  * Vector of strings of length m_ii, the number of
725  * reactions, containing the
726  * string expressions for each reaction
727  * (e.g., reactants <=> product1 + product2)
728  */
729  std::vector<std::string> m_rxneqn;
730 
731  /**
732  * Temporary data storage used in calculating the rates of
733  * of reactions.
734  */
736 
737  //! an array of generalized concentrations for each species
738  /*!
739  * An array of generalized concentrations
740  * \f$ C_k \f$ that are defined such that \f$ a_k = C_k /
741  * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration/
742  * These generalized concentrations are used
743  * by this kinetics manager class to compute the forward and
744  * reverse rates of elementary reactions. The "units" for the
745  * concentrations of each phase depend upon the implementation
746  * of kinetics within that phase.
747  * The order of the species within the vector is based on
748  * the order of listed ThermoPhase objects in the class, and the
749  * order of the species within each ThermoPhase class.
750  */
752 
753  //! Vector of standard state chemical potentials
754  /*!
755  * This vector contains a temporary vector of
756  * standard state chemical potentials
757  * for all of the species in the kinetics object
758  *
759  * Length = m_k
760  * units = J/kmol
761  */
763 
764  //! Vector of phase electric potentials
765  /*!
766  * Temporary vector containing the potential of each phase
767  * in the kinetics object
768  *
769  * length = number of phases
770  * units = Volts
771  */
773 
774  //! Vector of potential energies due to Voltages
775  /*!
776  * Length is the number of species in kinetics mech. It's
777  * used to store the potential energy due to the voltage.
778  */
780 
781  //! Vector temporary
782  /*!
783  * Length is number of reactions. It's used to store the
784  * voltage contribution to the activation energy.
785  */
787 
788  //! Vector of raw activation energies for the reactions
789  /*!
790  * units are in Kelvin
791  * Length is number of reactions.
792  */
794 
795  //! Pointer to the single surface phase
797 
798  //! Pointer to the Implicit surface chemistry object
799  /*!
800  * Note this object is owned by this InterfaceKinetics
801  * object. It may only be used to solve this single
802  * InterfaceKinetics objects's surface problem uncoupled
803  * from other surface phases.
804  */
806 
807  vector_fp m_beta;
808 
809  //! Vector of reaction indexes specifying the id of the current transfer reactions
810  //! in the mechanism
811  /*!
812  * Vector of reaction indices which involve current transfers. This provides
813  * an index into the m_beta array.
814  *
815  * irxn = m_ctrxn[i]
816  */
817  std::vector<size_t> m_ctrxn;
818 
819  //! Vector of booleans indicating whether the charge transfer reaction may be
820  //! described by an exchange current density expression
822 
823  vector_fp m_StandardConc;
824  vector_fp m_deltaG0;
825  vector_fp m_ProdStanConcReac;
826 
827 
828 
829  //! boolean indicating whether mechanism has been finalized
831 
832  //! Boolean flag indicating whether any reaction in the mechanism
833  //! has a coverage dependent forward reaction rate
834  /*!
835  * If this is true, then the coverage dependence is multiplied into
836  * the forward reaction rates constant
837  */
839 
840  //! Boolean flag indicating whether any reaction in the mechanism
841  //! has a beta electrochemical parameter.
842  /*!
843  * If this is true, the Butler-Volmer correction is applied
844  * to the forward reaction rate for those reactions.
845  *
846  * fac = exp ( - beta * (delta_phi))
847  */
849 
850  //! Boolean flag indicating whether any reaction in the mechanism
851  //! is described by an exchange current density expression
852  /*!
853  * If this is true, the standard state gibbs free energy of the reaction and
854  * the product of the reactant standard concentrations must be precalculated
855  * in order to calculate the rate constant.
856  */
858 
859  //! Int flag to indicate that some phases in the kinetics mechanism are
860  //! non-existent.
861  /*!
862  * We change the ROP vectors to make sure that non-existent phases are treated
863  * correctly in the kinetics operator. The value of this is equal to the number
864  * of phases which don't exist.
865  */
867 
868  //! Vector of booleans indicating whether phases exist or not
869  /*!
870  * Vector of booleans indicating whether a phase exists or not.
871  * We use this to set the ROP's so that unphysical things don't happen
872  *
873  * length = number of phases in the object
874  * By default all phases exist.
875  */
876  std::vector<bool> m_phaseExists;
877 
878  //! Vector of int indicating whether phases are stable or not
879  /*!
880  * Vector of booleans indicating whether a phase is stable or not
881  * under the current conditions.
882  * We use this to set the ROP's so that unphysical things don't happen
883  *
884  * length = number of phases in the object
885  * By default all phases are stable
886  */
887  std::vector<int> m_phaseIsStable;
888 
889  //! Vector of vector of booleans indicating whether a phase participates in a
890  //! reaction as a reactant
891  /*!
892  * m_rxnPhaseIsReactant[j][p] indicates whether a species in phase p
893  * participates in reaction j as a reactant.
894  */
895  std::vector<bool*> m_rxnPhaseIsReactant;
896 
897  //! Vector of vector of booleans indicating whether a phase participates in a
898  //! reaction as a product
899  /*!
900  * m_rxnPhaseIsReactant[j][p] indicates whether a species in phase p
901  * participates in reaction j as a product.
902  */
903  std::vector<bool*> m_rxnPhaseIsProduct;
904 
905 #ifdef KINETICS_WITH_INTERMEDIATE_ZEROED_PHASES
906  //! Vector of ints indicating whether zeroed phase is an intermediate for
907  //! the formation of another phase
908  /*!
909  * If a phase is zeroed out but it is an intermediate, then the phase
910  * can be formed whether it is stable or not, but the destruction rate of
911  * species in that phase can't exceed the formation rate for species in that
912  * phase.
913  *
914  * length = number of phases in the object
915  * By default all phases are not intermediates
916  */
917  std::vector<int> m_phaseIsIntermediate;
918  int m_numIntermediatePhases;
919 
920  //! Reaction rate reduction factor for intermediates
921  /*!
922  * Individual reaction rates are reduced to accommodate the requirements of intermediate
923  * zero phases.
924  *
925  * length = number of reactions in the object
926  * By default all phases are not intermediates
927  */
928  std::vector<doublereal> m_rxnRateFactorPhaseIntermediates;
929 
930  //! Work vector having length number of species
931  std::vector<doublereal> m_speciesTmpP;
932  std::vector<doublereal> m_speciesTmpD;
933 #endif
934 
935  int m_ioFlag;
936 private:
937 
938 };
939 }
940 
941 #endif