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