Cantera  2.1.2
IdealSolidSolnPhase.h
Go to the documentation of this file.
1 /**
2  * @file IdealSolidSolnPhase.h Header file for an ideal solid solution model
3  * with incompressible thermodynamics (see \ref thermoprops and
4  * \link Cantera::IdealSolidSolnPhase IdealSolidSolnPhase\endlink).
5  *
6  * This class inherits from the Cantera class ThermoPhase and implements an
7  * ideal solid solution model with incompressible thermodynamics.
8  */
9 /*
10  * Copyright 2006 Sandia Corporation. Under the terms of Contract
11  * DE-AC04-94AL85000, with Sandia Corporation, the U.S. Government
12  * retains certain rights in this software.
13  */
14 
15 #ifndef CT_IDEALSOLIDSOLNPHASE_H
16 #define CT_IDEALSOLIDSOLNPHASE_H
17 
18 #include "mix_defs.h"
19 #include "ThermoPhase.h"
20 #include "ThermoFactory.h"
21 #include "SpeciesThermo.h"
22 
23 namespace Cantera
24 {
25 
26 /*!
27  * @name CONSTANTS - Models for the Standard State of IdealSolidSolnPhase's
28  */
29 //@{
30 const int cIdealSolidSolnPhase0 = 5010;
31 const int cIdealSolidSolnPhase1 = 5011;
32 const int cIdealSolidSolnPhase2 = 5012;
33 //@}
34 
35 /**
36  * Class IdealSolidSolnPhase represents a condensed phase ideal
37  * solution compound. The phase and the pure species phases which
38  * comprise the standard states of the species are assumed to have
39  * zero volume expansivity and zero isothermal compressibility.
40  * Each species does, however, have constant but distinct partial
41  * molar volumes equal to their pure species molar volumes.
42  * The class derives from class ThermoPhase,
43  * and overloads the virtual methods defined there with ones that
44  * use expressions appropriate for ideal solution mixtures.
45  *
46  * The generalized concentrations can have three different forms
47  * depending on the value of the member attribute #m_formGC, which
48  * is supplied in the constructor and in the XML file.
49  * The value and form of the generalized concentration will affect
50  * reaction rate constants involving species in this phase.
51  *
52  * @ingroup thermoprops
53  */
55 {
56 public:
57  /**
58  * Constructor for IdealSolidSolnPhase.
59  * The generalized concentrations can have three different forms
60  * depending on the value of the member attribute #m_formGC, which
61  * is supplied in the constructor or read from the xml data file.
62  *
63  * @param formCG This parameter initializes the #m_formGC variable.
64  */
65  IdealSolidSolnPhase(int formCG=0);
66 
67  //! Construct and initialize an IdealSolidSolnPhase ThermoPhase object
68  //! directly from an ASCII input file
69  /*!
70  * This constructor will also fully initialize the object.
71  * The generalized concentrations can have three different forms
72  * depending on the value of the member attribute #m_formGC, which
73  * is supplied in the constructor or read from the xml data file.
74  *
75  * @param infile File name for the XML datafile containing information
76  * for this phase
77  * @param id The name of this phase. This is used to look up
78  * the phase in the XML datafile.
79  * @param formCG This parameter initializes the #m_formGC variable.
80  */
81  IdealSolidSolnPhase(const std::string& infile, const std::string& id="", int formCG=0);
82 
83  //! Construct and initialize an IdealSolidSolnPhase ThermoPhase object
84  //! directly from an XML database
85  /*!
86  * The generalized concentrations can have three different forms
87  * depending on the value of the member attribute #m_formGC, which
88  * is supplied in the constructor and/or read from the data file.
89  *
90  * @param root XML tree containing a description of the phase.
91  * The tree must be positioned at the XML element
92  * named phase with id, "id", on input to this routine.
93  * @param id The name of this phase. This is used to look up
94  * the phase in the XML datafile.
95  * @param formCG This parameter initializes the #m_formGC variable.
96  */
97  IdealSolidSolnPhase(XML_Node& root, const std::string& id="", int formCG=0);
98 
99  //! Copy Constructor
101 
102  //! Assignment operator
104 
105  /*!
106  * Base Class Duplication Function
107  *
108  * Given a pointer to ThermoPhase, this function can duplicate the object.
109  */
110  virtual ThermoPhase* duplMyselfAsThermoPhase() const;
111 
112  /**
113  * Equation of state flag. Returns a value depending upon the value of
114  * #m_formGC, which is defined at instantiation.
115  */
116  virtual int eosType() const;
117 
118  //! @name Molar Thermodynamic Properties of the Solution
119  //! @{
120 
121  /**
122  * Molar enthalpy of the solution. Units: J/kmol.
123  * For an ideal, constant partial molar volume solution mixture with
124  * pure species phases which exhibit zero volume expansivity and
125  * zero isothermal compressibility:
126  * \f[
127  * \hat h(T,P) = \sum_k X_k \hat h^0_k(T) + (P - P_{ref}) (\sum_k X_k \hat V^0_k)
128  * \f]
129  * The reference-state pure-species enthalpies at the reference pressure Pref
130  * \f$ \hat h^0_k(T) \f$, are computed by the species thermodynamic
131  * property manager. They are polynomial functions of temperature.
132  * @see SpeciesThermo
133  */
134  virtual doublereal enthalpy_mole() const;
135 
136  /**
137  * Molar internal energy of the solution. Units: J/kmol.
138  * For an ideal, constant partial molar volume solution mixture with
139  * pure species phases which exhibit zero volume expansivity and
140  * zero isothermal compressibility:
141  * \f[
142  * \hat u(T,X) = \hat h(T,P,X) - p \hat V
143  * = \sum_k X_k \hat h^0_k(T) - P_{ref} (\sum_k{X_k \hat V^0_k})
144  * \f]
145  * and is a function only of temperature.
146  * The reference-state pure-species enthalpies
147  * \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic
148  * property manager.
149  * @see SpeciesThermo
150  */
151  virtual doublereal intEnergy_mole() const;
152 
153  /**
154  * Molar entropy of the solution. Units: J/kmol/K.
155  * For an ideal, constant partial molar volume solution mixture with
156  * pure species phases which exhibit zero volume expansivity:
157  * \f[
158  * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k)
159  * \f]
160  * The reference-state pure-species entropies
161  * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the species thermodynamic
162  * property manager. The pure species entropies are independent of
163  * pressure since the volume expansivities are equal to zero.
164  * @see SpeciesThermo
165  */
166  virtual doublereal entropy_mole() const;
167 
168  /**
169  * Molar gibbs free energy of the solution. Units: J/kmol.
170  * For an ideal, constant partial molar volume solution mixture with
171  * pure species phases which exhibit zero volume expansivity:
172  * \f[
173  * \hat g(T, P) = \sum_k X_k \hat g^0_k(T,P) + \hat R T \sum_k X_k log(X_k)
174  * \f]
175  * The reference-state pure-species gibbs free energies
176  * \f$ \hat g^0_k(T) \f$ are computed by the species thermodynamic
177  * property manager, while the standard state gibbs free energies
178  * \f$ \hat g^0_k(T,P) \f$ are computed by the member function, gibbs_RT().
179  * @see SpeciesThermo
180  */
181  virtual doublereal gibbs_mole() const;
182 
183  /**
184  * Molar heat capacity at constant pressure of the solution.
185  * Units: J/kmol/K.
186  * For an ideal, constant partial molar volume solution mixture with
187  * pure species phases which exhibit zero volume expansivity:
188  * \f[
189  * \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) .
190  * \f]
191  * The heat capacity is independent of pressure.
192  * The reference-state pure-species heat capacities
193  * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic
194  * property manager.
195  * @see SpeciesThermo
196  */
197  virtual doublereal cp_mole() const;
198 
199  /**
200  * Molar heat capacity at constant volume of the solution.
201  * Units: J/kmol/K.
202  * For an ideal, constant partial molar volume solution mixture with
203  * pure species phases which exhibit zero volume expansivity:
204  * \f[ \hat c_v(T,P) = \hat c_p(T,P) \f]
205  * The two heat capacities are equal.
206  */
207  virtual doublereal cv_mole() const {
208  return cp_mole();
209  }
210 
211  //@}
212  /** @name Mechanical Equation of State Properties
213  *
214  * In this equation of state implementation, the density is a
215  * function only of the mole fractions. Therefore, it can't be
216  * an independent variable. Instead, the pressure is used as the
217  * independent variable. Functions which try to set the thermodynamic
218  * state by calling setDensity() may cause an exception to be
219  * thrown.
220  */
221  //@{
222 
223  /**
224  * Pressure. Units: Pa.
225  * For this incompressible system, we return the internally stored
226  * independent value of the pressure.
227  */
228  virtual doublereal pressure() const {
229  return m_Pcurrent;
230  }
231 
232  /**
233  * Set the pressure at constant temperature. Units: Pa.
234  * This method sets a constant within the object.
235  * The mass density is not a function of pressure.
236  *
237  * @param p Input Pressure (Pa)
238  */
239  virtual void setPressure(doublereal p);
240 
241  /**
242  * Calculate the density of the mixture using the partial
243  * molar volumes and mole fractions as input
244  *
245  * The formula for this is
246  *
247  * \f[
248  * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
249  * \f]
250  *
251  * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
252  * the molecular weights, and \f$V_k\f$ are the pure species
253  * molar volumes.
254  *
255  * Note, the basis behind this formula is that in an ideal
256  * solution the partial molar volumes are equal to the pure
257  * species molar volumes. We have additionally specified
258  * in this class that the pure species molar volumes are
259  * independent of temperature and pressure.
260  */
261  void calcDensity();
262 
263  /**
264  * Overwritten setDensity() function is necessary because the
265  * density is not an independent variable.
266  *
267  * This function will now throw an error condition
268  *
269  * @internal May have to adjust the strategy here to make
270  * the eos for these materials slightly compressible, in order
271  * to create a condition where the density is a function of
272  * the pressure.
273  *
274  * @param rho Input density
275  */
276  virtual void setDensity(const doublereal rho);
277 
278  /**
279  * Overwritten setMolarDensity() function is necessary because the
280  * density is not an independent variable.
281  *
282  * This function will now throw an error condition.
283  *
284  * @param rho Input Density
285  */
286  virtual void setMolarDensity(const doublereal rho);
287 
288  //! Set the mole fractions
289  /*!
290  * @param x Input vector of mole fractions.
291  * Length: m_kk.
292  */
293  virtual void setMoleFractions(const doublereal* const x);
294 
295  //! Set the mole fractions, but don't normalize them to one.
296  /*!
297  * @param x Input vector of mole fractions.
298  * Length: m_kk.
299  */
300  virtual void setMoleFractions_NoNorm(const doublereal* const x);
301 
302  //! Set the mass fractions, and normalize them to one.
303  /*!
304  * @param y Input vector of mass fractions.
305  * Length: m_kk.
306  */
307  virtual void setMassFractions(const doublereal* const y);
308 
309  //! Set the mass fractions, but don't normalize them to one
310  /*!
311  * @param y Input vector of mass fractions.
312  * Length: m_kk.
313  */
314  virtual void setMassFractions_NoNorm(const doublereal* const y);
315 
316  //! Set the concentration,
317  /*!
318  * @param c Input vector of concentrations.
319  * Length: m_kk.
320  */
321  virtual void setConcentrations(const doublereal* const c);
322 
323  //@}
324 
325  /**
326  * @name Chemical Potentials and Activities
327  *
328  * The activity \f$a_k\f$ of a species in solution is
329  * related to the chemical potential by
330  * \f[
331  * \mu_k(T,P,X_k) = \mu_k^0(T,P)
332  * + \hat R T \log a_k.
333  * \f]
334  * The quantity \f$\mu_k^0(T,P)\f$ is
335  * the standard state chemical potential at unit activity.
336  * It may depend on the pressure and the temperature. However,
337  * it may not depend on the mole fractions of the species
338  * in the solid solution.
339  *
340  * The activities are related to the generalized
341  * concentrations, \f$\tilde C_k\f$, and standard
342  * concentrations, \f$C^0_k\f$, by the following formula:
343  *
344  * \f[
345  * a_k = \frac{\tilde C_k}{C^0_k}
346  * \f]
347  * The generalized concentrations are used in the kinetics classes
348  * to describe the rates of progress of reactions involving the
349  * species. Their formulation depends upon the specification
350  * of the rate constants for reaction, especially the units used
351  * in specifying the rate constants. The bridge between the
352  * thermodynamic equilibrium expressions that use a_k and the
353  * kinetics expressions which use the generalized concentrations
354  * is provided by the multiplicative factor of the
355  * standard concentrations.
356  * @{
357  */
358 
359  /**
360  * This method returns the array of generalized
361  * concentrations. The generalized concentrations are used
362  * in the evaluation of the rates of progress for reactions
363  * involving species in this phase. The generalized
364  * concentration divided by the standard concentration is also
365  * equal to the activity of species.
366  *
367  * For this implementation the activity is defined to be the
368  * mole fraction of the species. The generalized concentration
369  * is defined to be equal to the mole fraction divided by
370  * the partial molar volume. The generalized concentrations
371  * for species in this phase therefore have units of
372  * kmol m<SUP>-3</SUP>. Rate constants must reflect this fact.
373  *
374  * On a general note, the following must be true.
375  * For an ideal solution, the generalized concentration must consist
376  * of the mole fraction multiplied by a constant. The constant may be
377  * fairly arbitrarily chosen, with differences adsorbed into the
378  * reaction rate expression. 1/V_N, 1/V_k, or 1 are equally good,
379  * as long as the standard concentration is adjusted accordingly.
380  * However, it must be a constant (and not the concentration, btw,
381  * which is a function of the mole fractions) in order for the
382  * ideal solution properties to hold at the same time having the
383  * standard concentration to be independent of the mole fractions.
384  *
385  * In this implementation the form of the generalized concentrations
386  * depend upon the member attribute, #m_formGC.
387  *
388  * HKM Note: We have absorbed the pressure dependence of the pure species
389  * state into the thermodynamics functions. Therefore the
390  * standard state on which the activities are based depend
391  * on both temperature and pressure. If we hadn't, it would have
392  * appeared in this function in a very awkward exp[] format.
393  *
394  * @param c Pointer to array of doubles of length m_kk, which on exit
395  * will contain the generalized concentrations.
396  */
397  virtual void getActivityConcentrations(doublereal* c) const;
398 
399  /**
400  * The standard concentration \f$ C^0_k \f$ used to normalize the
401  * generalized concentration. In many cases, this quantity will be the
402  * same for all species in a phase. However, for this case, we will return
403  * a distinct concentration for each species. This is the inverse of the
404  * species molar volume. Units for the standard concentration are kmol
405  * m<SUP>-3</SUP>.
406  *
407  * @param k Species number: this is a require parameter,
408  * a change from the ThermoPhase base class, where it was
409  * an optional parameter.
410  */
411  virtual doublereal standardConcentration(size_t k) const;
412 
413  /**
414  * The reference (ie standard) concentration \f$ C^0_k \f$ used to normalize
415  * the generalized concentration. In many cases, this quantity
416  * will be the same for all species in a phase.
417  * However, for this case, we will return a distinct concentration
418  * for each species. (clone of the standard concentration ->
419  * suggest changing the name). This is the inverse of the species molar
420  * volume.
421  *
422  * @param k Species index.
423  */
424  virtual doublereal referenceConcentration(int k) const;
425 
426  /**
427  * Returns the log of the standard concentration of the kth species
428  *
429  * @param k Species number: this is a require parameter,
430  * a change from the ThermoPhase base class, where it was
431  * an optional parameter.
432  */
433  virtual doublereal logStandardConc(size_t k) const;
434 
435  /**
436  * Returns the units of the standard and general concentrations
437  * Note they have the same units, as their divisor is
438  * defined to be equal to the activity of the kth species
439  * in the solution, which is unitless.
440  *
441  * This routine is used in print out applications where the
442  * units are needed. Usually, MKS units are assumed throughout
443  * the program and in the XML input files.
444  *
445  * @param uA Output vector containing the units:
446  *
447  * uA[0] = kmol units - default = 1
448  * uA[1] = m units - default = -nDim(), the number of spatial
449  * dimensions in the Phase class.
450  * uA[2] = kg units - default = 0;
451  * uA[3] = Pa(pressure) units - default = 0;
452  * uA[4] = Temperature units - default = 0;
453  * uA[5] = time units - default = 0
454  *
455  * @param k species index. Defaults to 0.
456  * @param sizeUA output int containing the size of the vector.
457  * Currently, this is equal to 6.
458  *
459  * For EOS types other than cIdealSolidSolnPhase0, the default
460  * kmol/m3 holds for standard concentration units. For
461  * cIdealSolidSolnPhase0 type, the standard concentration is
462  * unitless.
463  * @deprecated
464  */
465  virtual void getUnitsStandardConc(double* uA, int k = 0,
466  int sizeUA = 6) const;
467 
468  //! Get the array of species activity coefficients
469  /*!
470  * @param ac output vector of activity coefficients. Length: m_kk
471  */
472  virtual void getActivityCoefficients(doublereal* ac) const;
473 
474  /**
475  * Get the species chemical potentials. Units: J/kmol.
476  *
477  * This function returns a vector of chemical potentials of the
478  * species in solution.
479  * \f[
480  * \mu_k = \mu^{ref}_k(T) + V_k * (p - p_o) + R T ln(X_k)
481  * \f]
482  * or another way to phrase this is
483  * \f[
484  * \mu_k = \mu^o_k(T,p) + R T ln(X_k)
485  * \f]
486  * where \f$ \mu^o_k(T,p) = \mu^{ref}_k(T) + V_k * (p - p_o)\f$
487  *
488  * @param mu Output vector of chemical potentials.
489  */
490  virtual void getChemPotentials(doublereal* mu) const;
491 
492  /**
493  * Get the array of non-dimensional species solution
494  * chemical potentials at the current T and P
495  * \f$\mu_k / \hat R T \f$.
496  * \f[
497  * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k + RT ln(X_k)
498  * \f]
499  * where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
500  * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
501  * species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
502  *
503  * @param mu Output vector of dimensionless chemical potentials. Length = m_kk.
504  */
505  virtual void getChemPotentials_RT(doublereal* mu) const;
506 
507  //@}
508  /// @name Partial Molar Properties of the Solution
509  //@{
510 
511  //! Returns an array of partial molar enthalpies for the species in the mixture.
512  /*!
513  * Units (J/kmol)
514  * For this phase, the partial molar enthalpies are equal to the
515  * pure species enthalpies
516  * \f[
517  * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
518  * \f]
519  * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
520  * at the reference pressure,\f$ P_{ref} \f$,
521  * are computed by the species thermodynamic
522  * property manager. They are polynomial functions of temperature.
523  * @see SpeciesThermo
524  *
525  * @param hbar Output vector containing partial molar enthalpies.
526  * Length: m_kk.
527  */
528  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
529 
530  /**
531  * Returns an array of partial molar entropies of the species in the
532  * solution. Units: J/kmol/K.
533  * For this phase, the partial molar entropies are equal to the
534  * pure species entropies plus the ideal solution contribution.
535  * \f[
536  * \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k)
537  * \f]
538  * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$,
539  * at the reference pressure, \f$ P_{ref} \f$, are computed by the
540  * species thermodynamic
541  * property manager. They are polynomial functions of temperature.
542  * @see SpeciesThermo
543  *
544  * @param sbar Output vector containing partial molar entropies.
545  * Length: m_kk.
546  */
547  virtual void getPartialMolarEntropies(doublereal* sbar) const;
548 
549  /**
550  * Returns an array of partial molar Heat Capacities at constant
551  * pressure of the species in the
552  * solution. Units: J/kmol/K.
553  * For this phase, the partial molar heat capacities are equal
554  * to the standard state heat capacities.
555  *
556  * @param cpbar Output vector of partial heat capacities. Length: m_kk.
557  */
558  virtual void getPartialMolarCp(doublereal* cpbar) const;
559 
560  /**
561  * returns an array of partial molar volumes of the species
562  * in the solution. Units: m^3 kmol-1.
563  *
564  * For this solution, thepartial molar volumes are equal to the
565  * constant species molar volumes.
566  *
567  * @param vbar Output vector of partial molar volumes. Length: m_kk.
568  */
569  virtual void getPartialMolarVolumes(doublereal* vbar) const;
570 
571  //@}
572  /// @name Properties of the Standard State of the Species in the Solution
573  //@{
574 
575  /**
576  * Get the standard state chemical potentials of the species.
577  * This is the array of chemical potentials at unit activity
578  * \f$ \mu^0_k(T,P) \f$.
579  * We define these here as the chemical potentials of the pure
580  * species at the temperature and pressure of the solution.
581  * This function is used in the evaluation of the
582  * equilibrium constant Kc. Therefore, Kc will also depend
583  * on T and P. This is the norm for liquid and solid systems.
584  *
585  * units = J / kmol
586  *
587  * @param mu0 Output vector of standard state chemical potentials.
588  * Length: m_kk.
589  */
590  virtual void getStandardChemPotentials(doublereal* mu0) const {
591  getPureGibbs(mu0);
592  }
593 
594  //! Get the array of nondimensional Enthalpy functions for the standard state species
595  //! at the current <I>T</I> and <I>P</I> of the solution.
596  /*!
597  * We assume an incompressible constant partial molar
598  * volume here:
599  * \f[
600  * h^0_k(T,P) = h^{ref}_k(T) + (P - P_{ref}) * V_k
601  * \f]
602  * where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
603  * \f$ h^{ref}_k(T)\f$ is the enthalpy of the pure
604  * species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
605  *
606  * @param hrt Vector of length m_kk, which on return hrt[k]
607  * will contain the nondimensional
608  * standard state enthalpy of species k.
609  */
610  void getEnthalpy_RT(doublereal* hrt) const;
611 
612  //! Get the nondimensional Entropies for the species
613  //! standard states at the current T and P of the solution.
614  /*!
615  * Note, this is equal to the reference state entropies
616  * due to the zero volume expansivity:
617  * i.e., (dS/dP)_T = (dV/dT)_P = 0.0
618  *
619  * @param sr Vector of length m_kk, which on return sr[k]
620  * will contain the nondimensional
621  * standard state entropy for species k.
622  */
623  void getEntropy_R(doublereal* sr) const;
624 
625  /**
626  * Get the nondimensional gibbs function for the species
627  * standard states at the current T and P of the solution.
628  *
629  * \f[
630  * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
631  * \f]
632  * where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
633  * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
634  * species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
635  *
636  * @param grt Vector of length m_kk, which on return sr[k]
637  * will contain the nondimensional
638  * standard state gibbs function for species k.
639  */
640  virtual void getGibbs_RT(doublereal* grt) const;
641 
642  /**
643  * Get the Gibbs functions for the pure species
644  * at the current <I>T</I> and <I>P</I> of the solution.
645  * We assume an incompressible constant partial molar
646  * volume here:
647  * \f[
648  * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
649  * \f]
650  * where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
651  * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
652  * species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
653  *
654  * @param gpure Output vector of Gibbs functions for species
655  * Length: m_kk.
656  */
657  virtual void getPureGibbs(doublereal* gpure) const;
658 
659  //! Returns the vector of nondimensional
660  //! internal Energies of the standard state at the current
661  //! temperature and pressure of the solution for each species.
662  /*!
663  * @param urt Output vector of standard state nondimensional internal energies.
664  * Length: m_kk.
665  */
666  virtual void getIntEnergy_RT(doublereal* urt) const;
667 
668  /**
669  * Get the nondimensional heat capacity at constant pressure function for
670  * the species standard states at the current T and P of the solution.
671  * \f[
672  * Cp^0_k(T,P) = Cp^{ref}_k(T)
673  * \f]
674  * where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
675  * \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity
676  * of species <I>k</I> at the reference pressure, \f$p_{ref}\f$.
677  *
678  * @param cpr Vector of length m_kk, which on return cpr[k]
679  * will contain the nondimensional
680  * constant pressure heat capacity for species k.
681  */
682  void getCp_R(doublereal* cpr) const;
683 
684  /**
685  * Get the molar volumes of each species in their standard
686  * states at the current <I>T</I> and <I>P</I> of the solution.
687  * units = m^3 / kmol
688  *
689  * @param vol Output vector of standard state volumes.
690  * Length: m_kk.
691  */
692  virtual void getStandardVolumes(doublereal* vol) const;
693 
694  //@}
695  /// @name Thermodynamic Values for the Species Reference States
696  //@{
697 
698  /**
699  * Returns the vector of nondimensional
700  * enthalpies of the reference state at the current temperature
701  * of the solution and the reference pressure for the species.
702  *
703  * @param hrt Output vector containing reference nondimensional enthalpies.
704  * Length: m_kk.
705  */
706  virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
707 
708  /**
709  * Returns the vector of nondimensional
710  * enthalpies of the reference state at the current temperature
711  * of the solution and the reference pressure for the species.
712  *
713  * @param grt Output vector containing reference nondimensional Gibbs free energies.
714  * Length: m_kk.
715  */
716  virtual void getGibbs_RT_ref(doublereal* grt) const;
717 
718  /**
719  * Returns the vector of the
720  * gibbs function of the reference state at the current temperature
721  * of the solution and the reference pressure for the species.
722  * units = J/kmol
723  *
724  * @param g Output vector containing reference Gibbs free energies.
725  * Length: m_kk.
726  */
727  virtual void getGibbs_ref(doublereal* g) const;
728 
729  /**
730  * Returns the vector of nondimensional
731  * entropies of the reference state at the current temperature
732  * of the solution and the reference pressure for the species.
733  *
734  * @param er Output vector containing reference nondimensional entropies.
735  * Length: m_kk.
736  */
737  virtual void getEntropy_R_ref(doublereal* er) const;
738 
739  /**
740  * Returns the vector of nondimensional
741  * internal Energies of the reference state at the current temperature
742  * of the solution and the reference pressure for each species.
743  *
744  * @param urt Output vector containing reference nondimensional internal energies.
745  * Length: m_kk.
746  */
747  virtual void getIntEnergy_RT_ref(doublereal* urt) const;
748 
749  /**
750  * Returns the vector of nondimensional
751  * constant pressure heat capacities of the reference state
752  * at the current temperature of the solution
753  * and reference pressure for the species.
754  *
755  * @param cprt Output vector containing reference nondimensional heat capacities.
756  * Length: m_kk.
757  */
758  virtual void getCp_R_ref(doublereal* cprt) const;
759 
760  /**
761  * Returns a reference to the vector of nondimensional
762  * enthalpies of the reference state at the current temperature.
763  * Real reason for its existence is that it also checks
764  * to see if a recalculation of the reference thermodynamics
765  * functions needs to be done.
766  */
767  const vector_fp& enthalpy_RT_ref() const;
768 
769  /**
770  * Returns a reference to the vector of nondimensional
771  * enthalpies of the reference state at the current temperature.
772  * Real reason for its existence is that it also checks
773  * to see if a recalculation of the reference thermodynamics
774  * functions needs to be done.
775  */
776  const vector_fp& gibbs_RT_ref() const {
777  _updateThermo();
778  return m_g0_RT;
779  }
780 
781  /**
782  * Returns a reference to the vector of nondimensional
783  * enthalpies of the reference state at the current temperature.
784  * Real reason for its existence is that it also checks
785  * to see if a recalculation of the reference thermodynamics
786  * functions needs to be done.
787  */
788  const vector_fp& entropy_R_ref() const;
789 
790  /**
791  * Returns a reference to the vector of nondimensional
792  * enthalpies of the reference state at the current temperature.
793  * Real reason for its existence is that it also checks
794  * to see if a recalculation of the reference thermodynamics
795  * functions needs to be done.
796  */
797  const vector_fp& cp_R_ref() const {
798  _updateThermo();
799  return m_cp0_R;
800  }
801 
802  virtual void setPotentialEnergy(int k, doublereal pe) {
803  m_pe[k] = pe;
804  _updateThermo();
805  }
806 
807  virtual doublereal potentialEnergy(int k) const {
808  return m_pe[k];
809  }
810 
811  //@}
812  /// @name Utility Functions
813  //@{
814 
815  /**
816  * Initialization of an IdealSolidSolnPhase phase:
817  * Note this function is pretty much useless because it doesn't
818  * get the xml tree passed to it. Suggest a change.
819  */
820  virtual void initThermo();
821 
822  /**
823  * @internal Import and initialize a ThermoPhase object using an XML
824  * tree. Here we read extra information about the XML description of a
825  * phase. Regular information about elements and species and their
826  * reference state thermodynamic information have already been read at
827  * this point. For example, we do not need to call this function for
828  * ideal gas equations of state. This function is called from
829  * importPhase() after the elements and the species are initialized
830  * with default ideal solution level data.
831  *
832  * @param phaseNode This object must be the phase node of a complete XML
833  * tree description of the phase, including all of the
834  * species data. In other words while "phase" must point to
835  * an XML phase object, it must have sibling nodes
836  * "speciesData" that describe the species in the phase.
837  * @param id ID of the phase. If nonnull, a check is done to see if
838  * phaseNode is pointing to the phase with the correct id.
839  */
840  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
841 
842  /**
843  * Set mixture to an equilibrium state consistent with specified
844  * element potentials and the temperature.
845  *
846  * @param lambda_RT vector of non-dimensional element potentials
847  * \f$ \lambda_m/RT \f$.
848  */
849  virtual void setToEquilState(const doublereal* lambda_RT);
850 
851  /**
852  * Report the molar volume of species k
853  *
854  * units - \f$ m^3 kmol^-1 \f$
855  *
856  * @param k species index
857  */
858  double speciesMolarVolume(int k) const;
859 
860  /**
861  * Fill in a return vector containing the species molar volumes.
862  *
863  * units - \f$ m^3 kmol^-1 \f$
864  *
865  * @param smv output vector containing species molar volumes.
866  * Length: m_kk.
867  */
868  void getSpeciesMolarVolumes(doublereal* smv) const;
869 
870  //@}
871 
872 protected:
873  /**
874  * Format for the generalized concentrations.
875  *
876  * <TABLE>
877  * <TR><TD> m_formGC </TD><TD> GeneralizedConc </TD><TD> StandardConc </TD></TR>
878  * <TR><TD> 0 (default) </TD><TD> X_k </TD><TD> 1.0 </TD></TR>
879  * <TR><TD> 1 </TD><TD> X_k / V_k </TD><TD> 1.0 / V_k </TD></TR>
880  * <TR><TD> 2 </TD><TD> X_k / V_N </TD><TD> 1.0 / V_N </TD></TR>
881  * </TABLE>
882  *
883  * The value and form of the generalized concentration will affect
884  * reaction rate constants involving species in this phase.
885  */
886  int m_formGC;
887 
888  /**
889  * Value of the reference pressure for all species in this phase.
890  * The T dependent polynomials are evaluated at the reference
891  * pressure. Note, because this is a single value, all species
892  * are required to have the same reference pressure.
893  */
894  doublereal m_Pref;
895 
896  /**
897  * m_Pcurrent = The current pressure
898  * Since the density isn't a function of pressure, but only of the
899  * mole fractions, we need to independently specify the pressure.
900  * The density variable which is inherited as part of the State class,
901  * m_dens, is always kept current whenever T, P, or X[] change.
902  */
903  doublereal m_Pcurrent;
904 
905  //! Vector of molar volumes for each species in the solution
906  /**
907  * Species molar volumes \f$ m^3 kmol^-1 \f$
908  */
910 
911  /**
912  * Value of the temperature at which the thermodynamics functions
913  * for the reference state of the species were last evaluated.
914  */
915  mutable doublereal m_tlast;
916 
917  //! Vector containing the species reference enthalpies at T = m_tlast
919 
920  /**
921  * Vector containing the species reference constant pressure
922  * heat capacities at T = m_tlast
923  */
925 
926  //! Vector containing the species reference Gibbs functions at T = m_tlast
928 
929  //! Vector containing the species reference entropies at T = m_tlast
930  mutable vector_fp m_s0_R;
931 
932  /**
933  * Vector containing the species reference exp(-G/RT) functions
934  * at T = m_tlast
935  */
937 
938  //! Vector of potential energies for the species.
939  mutable vector_fp m_pe;
940 
941  //! Temporary array used in equilibrium calculations
942  mutable vector_fp m_pp;
943 
944 private:
945  /// @name Utility Functions
946  //@{
947  /**
948  * This function gets called for every call to functions in this
949  * class. It checks to see whether the temperature has changed and
950  * thus the reference thermodynamics functions for all of the species
951  * must be recalculated.
952  * If the temperature has changed, the species thermo manager is called
953  * to recalculate G, Cp, H, and S at the current temperature.
954  */
955  void _updateThermo() const;
956 
957  //! This internal function adjusts the lengths of arrays
958  void initLengths();
959 
960  //@}
961 };
962 }
963 
964 #endif
void _updateThermo() const
This function gets called for every call to functions in this class.
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P ...
vector_fp m_pp
Temporary array used in equilibrium calculations.
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
void getEntropy_R(doublereal *sr) const
Get the nondimensional Entropies for the species standard states at the current T and P of the soluti...
double speciesMolarVolume(int k) const
Report the molar volume of species k.
virtual void setMoleFractions_NoNorm(const doublereal *const x)
Set the mole fractions, but don't normalize them to one.
virtual doublereal referenceConcentration(int k) const
The reference (ie standard) concentration used to normalize the generalized concentration.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the standard state at the current temperatu...
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
const vector_fp & cp_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions, and normalize them to one.
virtual doublereal intEnergy_mole() const
Molar internal energy of the solution.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
virtual void initThermo()
Initialization of an IdealSolidSolnPhase phase: Note this function is pretty much useless because it ...
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
int m_formGC
Format for the generalized concentrations.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
virtual int eosType() const
Equation of state flag.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of each species in their standard states at the current T and P of the solution...
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
doublereal m_Pref
Value of the reference pressure for all species in this phase.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
doublereal m_tlast
Value of the temperature at which the thermodynamics functions for the reference state of the species...
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
void getEnthalpy_RT(doublereal *hrt) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
virtual void setToEquilState(const doublereal *lambda_RT)
Set mixture to an equilibrium state consistent with specified element potentials and the temperature...
virtual doublereal logStandardConc(size_t k) const
Returns the log of the standard concentration of the kth species.
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
virtual void setMolarDensity(const doublereal rho)
Overwritten setMolarDensity() function is necessary because the density is not an independent variabl...
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual void setConcentrations(const doublereal *const c)
Set the concentration,.
virtual doublereal entropy_mole() const
Molar entropy of the solution.
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the gibbs function of the reference state at the current temperature of the sol...
Class IdealSolidSolnPhase represents a condensed phase ideal solution compound.
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:165
void initLengths()
This internal function adjusts the lengths of arrays.
virtual void setDensity(const doublereal rho)
Overwritten setDensity() function is necessary because the density is not an independent variable...
virtual doublereal pressure() const
Pressure.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional gibbs function for the species standard states at the current T and P of the s...
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
vector_fp m_pe
Vector of potential energies for the species.
IdealSolidSolnPhase & operator=(const IdealSolidSolnPhase &)
Assignment operator.
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
virtual doublereal cv_mole() const
Molar heat capacity at constant volume of the solution.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and general concentrations Note they have the same units...
virtual void setMassFractions_NoNorm(const doublereal *const y)
Set the mass fractions, but don't normalize them to one.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the standard state chemical potentials of the species.
virtual doublereal gibbs_mole() const
Molar gibbs free energy of the solution.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.