Cantera  2.5.1
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 // This file is part of Cantera. See License.txt in the top-level directory or
11 // at https://cantera.org/license.txt for license and copyright information.
12 
13 #ifndef CT_IDEALSOLIDSOLNPHASE_H
14 #define CT_IDEALSOLIDSOLNPHASE_H
15 
16 #include "ThermoPhase.h"
17 
18 namespace Cantera
19 {
20 
21 /**
22  * Class IdealSolidSolnPhase represents a condensed phase ideal solution
23  * compound. The phase and the pure species phases which comprise the standard
24  * states of the species are assumed to have zero volume expansivity and zero
25  * isothermal compressibility. Each species does, however, have constant but
26  * distinct partial molar volumes equal to their pure species molar volumes. The
27  * class derives from class ThermoPhase, and overloads the virtual methods
28  * defined there with ones that use expressions appropriate for ideal solution
29  * mixtures.
30  *
31  * The generalized concentrations can have three different forms depending on
32  * the value of the member attribute #m_formGC, which is supplied in the
33  * constructor and in the input file. The value and form of the generalized
34  * concentration will affect reaction rate constants involving species in this
35  * phase.
36  *
37  * @ingroup thermoprops
38  */
40 {
41 public:
42  /**
43  * Constructor for IdealSolidSolnPhase.
44  * The generalized concentrations can have three different forms
45  * depending on the value of the member attribute #m_formGC, which
46  * is supplied in the constructor or read from the input file.
47  *
48  * @param formCG This parameter initializes the #m_formGC variable.
49  */
50  IdealSolidSolnPhase(int formCG=0);
51 
52  //! Construct and initialize an IdealSolidSolnPhase ThermoPhase object
53  //! directly from an ASCII input file
54  /*!
55  * This constructor will also fully initialize the object.
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 input file.
59  *
60  * @param infile File name for the input file containing information
61  * for this phase
62  * @param id The name of this phase. This is used to look up
63  * the phase in the input file.
64  * @param formCG This parameter initializes the #m_formGC variable.
65  */
66  IdealSolidSolnPhase(const std::string& infile, const std::string& id="", int formCG=0);
67 
68  //! Construct and initialize an IdealSolidSolnPhase ThermoPhase object
69  //! directly from an XML database
70  /*!
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 and/or read from the data file.
74  *
75  * @param root XML tree containing a description of the phase.
76  * The tree must be positioned at the XML element
77  * named phase with id, "id", on input to this routine.
78  * @param id The name of this phase. This is used to look up
79  * the phase in the XML datafile.
80  * @param formCG This parameter initializes the #m_formGC variable.
81  *
82  * @deprecated The XML input format is deprecated and will be removed in
83  * Cantera 3.0.
84  */
85  IdealSolidSolnPhase(XML_Node& root, const std::string& id="", int formCG=0);
86 
87  virtual std::string type() const {
88  return "IdealSolidSoln";
89  }
90 
91  virtual bool isCompressible() const {
92  return false;
93  }
94 
95  //! @name Molar Thermodynamic Properties of the Solution
96  //! @{
97 
98  /**
99  * Molar enthalpy of the solution. Units: J/kmol. For an ideal, constant
100  * partial molar volume solution mixture with pure species phases which
101  * exhibit zero volume expansivity and zero isothermal compressibility:
102  * \f[
103  * \hat h(T,P) = \sum_k X_k \hat h^0_k(T) + (P - P_{ref}) (\sum_k X_k \hat V^0_k)
104  * \f]
105  * The reference-state pure-species enthalpies at the reference pressure Pref
106  * \f$ \hat h^0_k(T) \f$, are computed by the species thermodynamic
107  * property manager. They are polynomial functions of temperature.
108  * @see MultiSpeciesThermo
109  */
110  virtual doublereal enthalpy_mole() const;
111 
112  /**
113  * Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant
114  * partial molar volume solution mixture with pure species phases which
115  * exhibit zero volume expansivity:
116  * \f[
117  * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k)
118  * \f]
119  * The reference-state pure-species entropies
120  * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the species thermodynamic
121  * property manager. The pure species entropies are independent of
122  * pressure since the volume expansivities are equal to zero.
123  * @see MultiSpeciesThermo
124  */
125  virtual doublereal entropy_mole() const;
126 
127  /**
128  * Molar Gibbs free energy of the solution. Units: J/kmol. For an ideal,
129  * constant partial molar volume solution mixture with pure species phases
130  * which exhibit zero volume expansivity:
131  * \f[
132  * \hat g(T, P) = \sum_k X_k \hat g^0_k(T,P) + \hat R T \sum_k X_k log(X_k)
133  * \f]
134  * The reference-state pure-species Gibbs free energies
135  * \f$ \hat g^0_k(T) \f$ are computed by the species thermodynamic
136  * property manager, while the standard state Gibbs free energies
137  * \f$ \hat g^0_k(T,P) \f$ are computed by the member function, gibbs_RT().
138  * @see MultiSpeciesThermo
139  */
140  virtual doublereal gibbs_mole() const;
141 
142  /**
143  * Molar heat capacity at constant pressure of the solution.
144  * Units: J/kmol/K.
145  * For an ideal, constant partial molar volume solution mixture with
146  * pure species phases which exhibit zero volume expansivity:
147  * \f[
148  * \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) .
149  * \f]
150  * The heat capacity is independent of pressure. The reference-state pure-
151  * species heat capacities \f$ \hat c^0_{p,k}(T) \f$ are computed by the
152  * species thermodynamic property manager.
153  * @see MultiSpeciesThermo
154  */
155  virtual doublereal cp_mole() const;
156 
157  /**
158  * Molar heat capacity at constant volume of the solution. Units: J/kmol/K.
159  * For an ideal, constant partial molar volume solution mixture with pure
160  * species phases which exhibit zero volume expansivity:
161  * \f[ \hat c_v(T,P) = \hat c_p(T,P) \f]
162  * The two heat capacities are equal.
163  */
164  virtual doublereal cv_mole() const {
165  return cp_mole();
166  }
167 
168  //@}
169  /** @name Mechanical Equation of State Properties
170  *
171  * In this equation of state implementation, the density is a function only
172  * of the mole fractions. Therefore, it can't be an independent variable.
173  * Instead, the pressure is used as the independent variable. Functions
174  * which try to set the thermodynamic state by calling setDensity() will
175  * cause an exception to be thrown.
176  */
177  //@{
178 
179  /**
180  * Pressure. Units: Pa. For this incompressible system, we return the
181  * internally stored independent value of the pressure.
182  */
183  virtual doublereal pressure() const {
184  return m_Pcurrent;
185  }
186 
187  /**
188  * Set the pressure at constant temperature. Units: Pa. This method sets a
189  * constant within the object. The mass density is not a function of
190  * pressure.
191  *
192  * @param p Input Pressure (Pa)
193  */
194  virtual void setPressure(doublereal p);
195 
196  /**
197  * Calculate the density of the mixture using the partial molar volumes and
198  * mole fractions as input
199  *
200  * The formula for this is
201  *
202  * \f[
203  * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
204  * \f]
205  *
206  * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
207  * weights, and \f$V_k\f$ are the pure species molar volumes.
208  *
209  * Note, the basis behind this formula is that in an ideal solution the
210  * partial molar volumes are equal to the pure species molar volumes. We
211  * have additionally specified in this class that the pure species molar
212  * volumes are independent of temperature and pressure.
213  */
214  void calcDensity();
215 
216  /**
217  * Overridden setDensity() function is necessary because the density is not
218  * an independent variable.
219  *
220  * This function will now throw an error condition
221  *
222  * @internal May have to adjust the strategy here to make the eos for these
223  * materials slightly compressible, in order to create a condition where
224  * the density is a function of the pressure.
225  *
226  * @param rho Input density
227  * @deprecated Functionality merged with base function after Cantera 2.5.
228  * (superseded by isCompressible check in Phase::setDensity)
229  */
230  virtual void setDensity(const doublereal rho);
231 
232  /**
233  * Overridden setMolarDensity() function is necessary because the density
234  * is not an independent variable.
235  *
236  * This function will now throw an error condition.
237  *
238  * @param rho Input Density
239  * @deprecated Functionality merged with base function after Cantera 2.5.
240  * (superseded by isCompressible check in Phase::setDensity)
241  */
242  virtual void setMolarDensity(const doublereal rho);
243 
244  //@}
245 
246  /**
247  * @name Chemical Potentials and Activities
248  *
249  * The activity \f$a_k\f$ of a species in solution is related to the
250  * chemical potential by
251  * \f[
252  * \mu_k(T,P,X_k) = \mu_k^0(T,P)
253  * + \hat R T \log a_k.
254  * \f]
255  * The quantity \f$\mu_k^0(T,P)\f$ is the standard state chemical potential
256  * at unit activity. It may depend on the pressure and the temperature.
257  * However, it may not depend on the mole fractions of the species in the
258  * solid solution.
259  *
260  * The activities are related to the generalized concentrations, \f$\tilde
261  * C_k\f$, and standard concentrations, \f$C^0_k\f$, by the following
262  * formula:
263  *
264  * \f[
265  * a_k = \frac{\tilde C_k}{C^0_k}
266  * \f]
267  * The generalized concentrations are used in the kinetics classes to
268  * describe the rates of progress of reactions involving the species. Their
269  * formulation depends upon the specification of the rate constants for
270  * reaction, especially the units used in specifying the rate constants. The
271  * bridge between the thermodynamic equilibrium expressions that use a_k and
272  * the kinetics expressions which use the generalized concentrations is
273  * provided by the multiplicative factor of the standard concentrations.
274  * @{
275  */
276 
277  virtual Units standardConcentrationUnits() const;
278 
279  /**
280  * This method returns the array of generalized concentrations. The
281  * generalized concentrations are used in the evaluation of the rates of
282  * progress for reactions involving species in this phase. The generalized
283  * concentration divided by the standard concentration is also equal to the
284  * activity of species.
285  *
286  * For this implementation the activity is defined to be the mole fraction
287  * of the species. The generalized concentration is defined to be equal to
288  * the mole fraction divided by the partial molar volume. The generalized
289  * concentrations for species in this phase therefore have units of
290  * kmol/m^3. Rate constants must reflect this fact.
291  *
292  * On a general note, the following must be true. For an ideal solution, the
293  * generalized concentration must consist of the mole fraction multiplied by
294  * a constant. The constant may be fairly arbitrarily chosen, with
295  * differences adsorbed into the reaction rate expression. 1/V_N, 1/V_k, or
296  * 1 are equally good, as long as the standard concentration is adjusted
297  * accordingly. However, it must be a constant (and not the concentration,
298  * btw, which is a function of the mole fractions) in order for the ideal
299  * solution properties to hold at the same time having the standard
300  * concentration to be independent of the mole fractions.
301  *
302  * In this implementation the form of the generalized concentrations
303  * depend upon the member attribute, #m_formGC.
304  *
305  * HKM Note: We have absorbed the pressure dependence of the pure species
306  * state into the thermodynamics functions. Therefore the standard
307  * state on which the activities are based depend on both temperature
308  * and pressure. If we hadn't, it would have appeared in this
309  * function in a very awkward exp[] format.
310  *
311  * @param c Pointer to array of doubles of length m_kk, which on exit
312  * will contain the generalized concentrations.
313  */
314  virtual void getActivityConcentrations(doublereal* c) const;
315 
316  /**
317  * The standard concentration \f$ C^0_k \f$ used to normalize the
318  * generalized concentration. In many cases, this quantity will be the
319  * same for all species in a phase. However, for this case, we will return
320  * a distinct concentration for each species. This is the inverse of the
321  * species molar volume. Units for the standard concentration are kmol/m^3.
322  *
323  * @param k Species number: this is a require parameter, a change from the
324  * ThermoPhase base class, where it was an optional parameter.
325  */
326  virtual doublereal standardConcentration(size_t k) const;
327 
328  //! Get the array of species activity coefficients
329  /*!
330  * @param ac output vector of activity coefficients. Length: m_kk
331  */
332  virtual void getActivityCoefficients(doublereal* ac) const;
333 
334  /**
335  * Get the species chemical potentials. Units: J/kmol.
336  *
337  * This function returns a vector of chemical potentials of the
338  * species in solution.
339  * \f[
340  * \mu_k = \mu^{ref}_k(T) + V_k * (p - p_o) + R T ln(X_k)
341  * \f]
342  * or another way to phrase this is
343  * \f[
344  * \mu_k = \mu^o_k(T,p) + R T ln(X_k)
345  * \f]
346  * where \f$ \mu^o_k(T,p) = \mu^{ref}_k(T) + V_k * (p - p_o)\f$
347  *
348  * @param mu Output vector of chemical potentials.
349  */
350  virtual void getChemPotentials(doublereal* mu) const;
351 
352  /**
353  * Get the array of non-dimensional species solution
354  * chemical potentials at the current T and P
355  * \f$\mu_k / \hat R T \f$.
356  * \f[
357  * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k + RT ln(X_k)
358  * \f]
359  * where \f$V_k\f$ is the molar volume of pure species *k*.
360  * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
361  * species *k* at the reference pressure, \f$P_{ref}\f$.
362  *
363  * @param mu Output vector of dimensionless chemical potentials.
364  * Length = m_kk.
365  */
366  virtual void getChemPotentials_RT(doublereal* mu) const;
367 
368  //@}
369  /// @name Partial Molar Properties of the Solution
370  //@{
371 
372  //! Returns an array of partial molar enthalpies for the species in the
373  //! mixture.
374  /*!
375  * Units (J/kmol). For this phase, the partial molar enthalpies are equal to
376  * the pure species enthalpies
377  * \f[
378  * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
379  * \f]
380  * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
381  * at the reference pressure,\f$ P_{ref} \f$, are computed by the species
382  * thermodynamic property manager. They are polynomial functions of
383  * temperature.
384  * @see MultiSpeciesThermo
385  *
386  * @param hbar Output vector containing partial molar enthalpies.
387  * Length: m_kk.
388  */
389  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
390 
391  /**
392  * Returns an array of partial molar entropies of the species in the
393  * solution. Units: J/kmol/K. For this phase, the partial molar entropies
394  * are equal to the pure species entropies plus the ideal solution
395  * contribution.
396  * \f[
397  * \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k)
398  * \f]
399  * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, at
400  * the reference pressure, \f$ P_{ref} \f$, are computed by the species
401  * thermodynamic property manager. They are polynomial functions of
402  * temperature.
403  * @see MultiSpeciesThermo
404  *
405  * @param sbar Output vector containing partial molar entropies.
406  * Length: m_kk.
407  */
408  virtual void getPartialMolarEntropies(doublereal* sbar) const;
409 
410  /**
411  * Returns an array of partial molar Heat Capacities at constant pressure of
412  * the species in the solution. Units: J/kmol/K. For this phase, the partial
413  * molar heat capacities are equal to the standard state heat capacities.
414  *
415  * @param cpbar Output vector of partial heat capacities. Length: m_kk.
416  */
417  virtual void getPartialMolarCp(doublereal* cpbar) const;
418 
419  /**
420  * returns an array of partial molar volumes of the species
421  * in the solution. Units: m^3 kmol-1.
422  *
423  * For this solution, the partial molar volumes are equal to the
424  * constant species molar volumes.
425  *
426  * @param vbar Output vector of partial molar volumes. Length: m_kk.
427  */
428  virtual void getPartialMolarVolumes(doublereal* vbar) const;
429 
430  //@}
431  /// @name Properties of the Standard State of the Species in the Solution
432  //@{
433 
434  /**
435  * Get the standard state chemical potentials of the species. This is the
436  * array of chemical potentials at unit activity \f$ \mu^0_k(T,P) \f$. We
437  * define these here as the chemical potentials of the pure species at the
438  * temperature and pressure of the solution. This function is used in the
439  * evaluation of the equilibrium constant Kc. Therefore, Kc will also depend
440  * on T and P. This is the norm for liquid and solid systems.
441  *
442  * units = J / kmol
443  *
444  * @param mu0 Output vector of standard state chemical potentials.
445  * Length: m_kk.
446  */
447  virtual void getStandardChemPotentials(doublereal* mu0) const {
448  getPureGibbs(mu0);
449  }
450 
451  //! Get the array of nondimensional Enthalpy functions for the standard
452  //! state species at the current *T* and *P* of the solution.
453  /*!
454  * We assume an incompressible constant partial molar volume here:
455  * \f[
456  * h^0_k(T,P) = h^{ref}_k(T) + (P - P_{ref}) * V_k
457  * \f]
458  * where \f$V_k\f$ is the molar volume of pure species *k*.
459  * \f$ h^{ref}_k(T)\f$ is the enthalpy of the pure species *k* at the
460  * reference pressure, \f$P_{ref}\f$.
461  *
462  * @param hrt Vector of length m_kk, which on return hrt[k] will contain the
463  * nondimensional standard state enthalpy of species k.
464  */
465  virtual void getEnthalpy_RT(doublereal* hrt) const;
466 
467  //! Get the nondimensional Entropies for the species standard states at the
468  //! current T and P of the solution.
469  /*!
470  * Note, this is equal to the reference state entropies due to the zero
471  * volume expansivity: i.e., (dS/dP)_T = (dV/dT)_P = 0.0
472  *
473  * @param sr Vector of length m_kk, which on return sr[k] will contain the
474  * nondimensional standard state entropy for species k.
475  */
476  virtual void getEntropy_R(doublereal* sr) const;
477 
478  /**
479  * Get the nondimensional Gibbs function for the species standard states at
480  * the current T and P of the solution.
481  *
482  * \f[
483  * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
484  * \f]
485  * where \f$V_k\f$ is the molar volume of pure species *k*.
486  * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure species *k*
487  * at the reference pressure, \f$P_{ref}\f$.
488  *
489  * @param grt Vector of length m_kk, which on return sr[k] will contain the
490  * nondimensional standard state Gibbs function for species k.
491  */
492  virtual void getGibbs_RT(doublereal* grt) const;
493 
494  /**
495  * Get the Gibbs functions for the pure species at the current *T* and *P*
496  * of the solution. We assume an incompressible constant partial molar
497  * volume here:
498  * \f[
499  * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
500  * \f]
501  * where \f$V_k\f$ is the molar volume of pure species *k*.
502  * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure species *k* at
503  * the reference pressure, \f$P_{ref}\f$.
504  *
505  * @param gpure Output vector of Gibbs functions for species. Length: m_kk.
506  */
507  virtual void getPureGibbs(doublereal* gpure) const;
508 
509  virtual void getIntEnergy_RT(doublereal* urt) const;
510 
511  /**
512  * Get the nondimensional heat capacity at constant pressure function for
513  * the species standard states at the current T and P of the solution.
514  * \f[
515  * Cp^0_k(T,P) = Cp^{ref}_k(T)
516  * \f]
517  * where \f$V_k\f$ is the molar volume of pure species *k*.
518  * \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity of species
519  * *k* at the reference pressure, \f$p_{ref}\f$.
520  *
521  * @param cpr Vector of length m_kk, which on return cpr[k] will contain the
522  * nondimensional constant pressure heat capacity for species k.
523  */
524  virtual void getCp_R(doublereal* cpr) const;
525 
526  virtual void getStandardVolumes(doublereal* vol) const;
527 
528  //@}
529  /// @name Thermodynamic Values for the Species Reference States
530  //@{
531 
532  virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
533  virtual void getGibbs_RT_ref(doublereal* grt) const;
534  virtual void getGibbs_ref(doublereal* g) const;
535  virtual void getEntropy_R_ref(doublereal* er) const;
536  virtual void getIntEnergy_RT_ref(doublereal* urt) const;
537  virtual void getCp_R_ref(doublereal* cprt) const;
538 
539  /**
540  * Returns a reference to the vector of nondimensional enthalpies of the
541  * reference state at the current temperature. Real reason for its existence
542  * is that it also checks to see if a recalculation of the reference
543  * thermodynamics functions needs to be done.
544  */
545  const vector_fp& enthalpy_RT_ref() const;
546 
547  /**
548  * Returns a reference to the vector of nondimensional enthalpies of the
549  * reference state at the current temperature. Real reason for its existence
550  * is that it also checks to see if a recalculation of the reference
551  * thermodynamics functions needs to be done.
552  */
553  const vector_fp& gibbs_RT_ref() const {
554  _updateThermo();
555  return m_g0_RT;
556  }
557 
558  /**
559  * Returns a reference to the vector of nondimensional enthalpies of the
560  * reference state at the current temperature. Real reason for its existence
561  * is that it also checks to see if a recalculation of the reference
562  * thermodynamics functions needs to be done.
563  */
564  const vector_fp& entropy_R_ref() const;
565 
566  /**
567  * Returns a reference to the vector of nondimensional enthalpies of the
568  * reference state at the current temperature. Real reason for its existence
569  * is that it also checks to see if a recalculation of the reference
570  * thermodynamics functions needs to be done.
571  */
572  const vector_fp& cp_R_ref() const {
573  _updateThermo();
574  return m_cp0_R;
575  }
576 
577  //! @deprecated To be removed after Cantera 2.5
578  virtual void setPotentialEnergy(int k, doublereal pe) {
579  warn_deprecated("IdealSolidSolnPhase::setPotentialEnergy",
580  "To be removed after Cantera 2.5");
581  m_pe[k] = pe;
582  _updateThermo();
583  }
584 
585  //! @deprecated To be removed after Cantera 2.5
586  virtual doublereal potentialEnergy(int k) const {
587  warn_deprecated("IdealSolidSolnPhase::potentialEnergy",
588  "To be removed after Cantera 2.5");
589  return m_pe[k];
590  }
591 
592  //@}
593  /// @name Utility Functions
594  //@{
595 
596  virtual bool addSpecies(shared_ptr<Species> spec);
597  virtual void initThermo();
598  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
599  virtual void setToEquilState(const doublereal* mu_RT);
600 
601  //! Set the form for the standard and generalized concentrations
602  /*!
603  * Must be one of 'unity', 'species-molar-volume', or
604  * 'solvent-molar-volume'. The default is 'unity'.
605  *
606  * | m_formGC | GeneralizedConc | StandardConc |
607  * | -------------------- | --------------- | ------------ |
608  * | unity | X_k | 1.0 |
609  * | species-molar-volume | X_k / V_k | 1.0 / V_k |
610  * | solvent-molar-volume | X_k / V_N | 1.0 / V_N |
611  *
612  * The value and form of the generalized concentration will affect
613  * reaction rate constants involving species in this phase.
614  */
615  void setStandardConcentrationModel(const std::string& model);
616 
617  /**
618  * Report the molar volume of species k
619  *
620  * units - \f$ m^3 kmol^-1 \f$
621  *
622  * @param k species index
623  */
624  double speciesMolarVolume(int k) const;
625 
626  /**
627  * Fill in a return vector containing the species molar volumes.
628  *
629  * units - \f$ m^3 kmol^-1 \f$
630  *
631  * @param smv output vector containing species molar volumes.
632  * Length: m_kk.
633  */
634  void getSpeciesMolarVolumes(doublereal* smv) const;
635 
636  //@}
637 
638 protected:
639  virtual void compositionChanged();
640 
641  /**
642  * The standard concentrations can have one of three different forms:
643  * 0 = 'unity', 1 = 'molar_volume', 2 = 'solvent_volume'. See
644  * setStandardConcentrationModel().
645  */
646  int m_formGC;
647 
648  /**
649  * Value of the reference pressure for all species in this phase. The T
650  * dependent polynomials are evaluated at the reference pressure. Note,
651  * because this is a single value, all species are required to have the same
652  * reference pressure.
653  */
654  doublereal m_Pref;
655 
656  /**
657  * m_Pcurrent = The current pressure
658  * Since the density isn't a function of pressure, but only of the
659  * mole fractions, we need to independently specify the pressure.
660  * The density variable which is inherited as part of the State class,
661  * m_dens, is always kept current whenever T, P, or X[] change.
662  */
663  doublereal m_Pcurrent;
664 
665  //! Vector of molar volumes for each species in the solution
666  /**
667  * Species molar volumes \f$ m^3 kmol^-1 \f$
668  */
670 
671  //! Vector containing the species reference enthalpies at T = m_tlast
673 
674  //! Vector containing the species reference constant pressure heat
675  //! capacities at T = m_tlast
677 
678  //! Vector containing the species reference Gibbs functions at T = m_tlast
680 
681  //! Vector containing the species reference entropies at T = m_tlast
682  mutable vector_fp m_s0_R;
683 
684  //! Vector containing the species reference exp(-G/RT) functions at
685  //! T = m_tlast
687 
688  //! Vector of potential energies for the species.
689  //! @deprecated To be removed after Cantera 2.5
690  mutable vector_fp m_pe;
691 
692  //! Temporary array used in equilibrium calculations
693  mutable vector_fp m_pp;
694 
695 private:
696  /// @name Utility Functions
697  //@{
698  /**
699  * This function gets called for every call to functions in this class. It
700  * checks to see whether the temperature has changed and thus the reference
701  * thermodynamics functions for all of the species must be recalculated. If
702  * the temperature has changed, the species thermo manager is called to
703  * recalculate G, Cp, H, and S at the current temperature.
704  */
705  virtual void _updateThermo() const;
706 
707  //@}
708 };
709 }
710 
711 #endif
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Class IdealSolidSolnPhase represents a condensed phase ideal solution compound.
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast.
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast.
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of species activity coefficients.
vector_fp m_expg0_RT
Vector containing the species reference exp(-G/RT) functions at T = m_tlast.
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...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure of the solution.
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.
double speciesMolarVolume(int k) const
Report the molar volume of species k.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual doublereal enthalpy_mole() const
Molar enthalpy of the solution.
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
vector_fp m_pp
Temporary array used in equilibrium calculations.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
const vector_fp & gibbs_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional heat capacity at constant pressure function for the species standard states at...
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the standard state chemical potentials of the species.
virtual void getPartialMolarCp(doublereal *cpbar) const
Returns an array of partial molar Heat Capacities at constant pressure of the species in the solution...
void getSpeciesMolarVolumes(doublereal *smv) const
Fill in a return vector containing the species molar volumes.
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual bool isCompressible() const
Return whether phase represents a compressible substance.
virtual void getEntropy_R(doublereal *sr) const
Get the nondimensional Entropies for the species standard states at the current T and P of the soluti...
virtual doublereal cv_mole() const
Molar heat capacity at constant volume of the solution.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature.
virtual void setPotentialEnergy(int k, doublereal pe)
virtual void setDensity(const doublereal rho)
Overridden setDensity() function is necessary because the density is not an independent variable.
vector_fp m_speciesMolarVolume
Vector of molar volumes for each species in the solution.
virtual doublereal entropy_mole() const
Molar entropy of the solution.
const vector_fp & entropy_R_ref() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual doublereal standardConcentration(size_t k) const
The standard concentration used to normalize the generalized concentration.
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
int m_formGC
The standard concentrations can have one of three different forms: 0 = 'unity', 1 = 'molar_volume',...
IdealSolidSolnPhase(int formCG=0)
Constructor for IdealSolidSolnPhase.
virtual std::string type() const
String indicating the thermodynamic model implemented.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual doublereal gibbs_mole() const
Molar Gibbs free energy of the solution.
doublereal m_Pcurrent
m_Pcurrent = The current pressure Since the density isn't a function of pressure, but only of the mol...
virtual doublereal pressure() const
Pressure.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
vector_fp m_pe
Vector of potential energies for the species.
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
virtual void compositionChanged()
Apply changes to the state which are needed after the composition changes.
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species solution chemical potentials at the current T and P .
void setStandardConcentrationModel(const std::string &model)
Set the form for the standard and generalized concentrations.
virtual void _updateThermo() const
This function gets called for every call to functions in this class.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials.
virtual void setMolarDensity(const doublereal rho)
Overridden setMolarDensity() function is necessary because the density is not an independent variable...
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 getGibbs_ref(doublereal *g) const
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
virtual doublereal potentialEnergy(int k) const
doublereal m_Pref
Value of the reference pressure for all species in this phase.
virtual 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 getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the pure species at the current T and P of the solution.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:104
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
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:180
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264