Cantera  2.4.0
IdealSolnGasVPSS.h
Go to the documentation of this file.
1 /**
2  * @file IdealSolnGasVPSS.h
3  * Definition file for a derived class of ThermoPhase that assumes either
4  * an ideal gas or ideal solution approximation and handles
5  * variable pressure standard state methods for calculating
6  * thermodynamic properties (see \ref thermoprops and
7  * class \link Cantera::IdealSolnGasVPSS IdealSolnGasVPSS\endlink).
8  */
9 
10 // This file is part of Cantera. See License.txt in the top-level directory or
11 // at http://www.cantera.org/license.txt for license and copyright information.
12 
13 #ifndef CT_IDEALSOLNGASVPSS_H
14 #define CT_IDEALSOLNGASVPSS_H
15 
16 #include "VPStandardStateTP.h"
17 
18 namespace Cantera
19 {
20 
21 /**
22  * @ingroup thermoprops
23  *
24  * An ideal solution or an ideal gas approximation of a phase. Uses variable
25  * pressure standard state methods for calculating thermodynamic properties.
26  */
28 {
29 public:
30  /*!
31  * @name Constructors and Duplicators for IdealSolnGasVPSS
32  */
33  //! @{
34 
36 
37  /// Create an object from an XML input file
38  IdealSolnGasVPSS(const std::string& infile, std::string id="");
39 
40  //@}
41  //! @name Utilities (IdealSolnGasVPSS)
42  //@{
43 
44  virtual std::string type() const {
45  return "IdealSolnGas";
46  }
47 
48  //! Set this phase to represent an ideal gas
49  void setGasMode() { m_idealGas = true; }
50 
51  //! Set this phase to represent an ideal liquid or solid solution
52  void setSolnMode() { m_idealGas = false; }
53 
54  //! Set the standard concentration model
55  /*
56  * Does not apply to the ideal gas case. Must be one of 'unity',
57  * 'molar_volume', or 'solvent_volume'.
58  */
59  void setStandardConcentrationModel(const std::string& model);
60 
61  //! @}
62  //! @name Molar Thermodynamic Properties
63  //! @{
64 
65  virtual doublereal enthalpy_mole() const;
66  virtual doublereal entropy_mole() const;
67  virtual doublereal cp_mole() const;
68  virtual doublereal cv_mole() const;
69 
70  //! @}
71  //! @name Mechanical Properties
72  //! @{
73 
74  void setPressure(doublereal p);
75 
76  virtual doublereal isothermalCompressibility() const;
77 
78 protected:
79  /**
80  * Calculate the density of the mixture using the partial molar volumes and
81  * mole fractions as input. The formula for this is
82  *
83  * \f[
84  * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
85  * \f]
86  *
87  * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
88  * weights, and \f$V_k\f$ are the pure species molar volumes.
89  *
90  * Note, the basis behind this formula is that in an ideal solution the
91  * partial molar volumes are equal to the species standard state molar
92  * volumes. The species molar volumes may be functions of temperature and
93  * pressure.
94  */
95  virtual void calcDensity();
96  //! @}
97 
98 public:
99  virtual void getActivityConcentrations(doublereal* c) const;
100 
101  //! Returns the standard concentration \f$ C^0_k \f$, which is used to
102  //! normalize the generalized concentration.
103  /*!
104  * This is defined as the concentration by which the generalized
105  * concentration is normalized to produce the activity. In many cases, this
106  * quantity will be the same for all species in a phase. Since the activity
107  * for an ideal gas mixture is simply the mole fraction, for an ideal gas
108  * \f$ C^0_k = P/\hat R T \f$.
109  *
110  * @param k Optional parameter indicating the species. The default
111  * is to assume this refers to species 0.
112  * @return
113  * Returns the standard Concentration in units of m3 kmol-1.
114  */
115  virtual doublereal standardConcentration(size_t k=0) const;
116 
117  //! Get the array of non-dimensional activity coefficients at the current
118  //! solution temperature, pressure, and solution concentration.
119  /*!
120  * For ideal gases, the activity coefficients are all equal to one.
121  *
122  * @param ac Output vector of activity coefficients. Length: m_kk.
123  */
124  virtual void getActivityCoefficients(doublereal* ac) const;
125 
126 
127  /// @name Partial Molar Properties of the Solution
128  //@{
129 
130  virtual void getChemPotentials(doublereal* mu) const;
131  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
132  virtual void getPartialMolarEntropies(doublereal* sbar) const;
133  virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
134  virtual void getPartialMolarCp(doublereal* cpbar) const;
135  virtual void getPartialMolarVolumes(doublereal* vbar) const;
136  //@}
137 
138 public:
139  //! @name Initialization Methods - For Internal use
140  /*!
141  * The following methods are used in the process of constructing the phase
142  * and setting its parameters from a specification in an input file. They
143  * are not normally used in application programs. To see how they are used,
144  * see importPhase().
145  */
146  //@{
147 
148  virtual bool addSpecies(shared_ptr<Species> spec);
149  virtual void setParametersFromXML(const XML_Node& thermoNode);
150  virtual void initThermo();
151  virtual void setToEquilState(const doublereal* lambda_RT);
152  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
153 
154  //@}
155 
156 protected:
157  //! boolean indicating what ideal solution this is
158  /*!
159  * - 1 = ideal gas
160  * - 0 = ideal soln
161  */
163 
164  //! form of the generalized concentrations
165  /*!
166  * - 0 unity (default)
167  * - 1 1/V_k
168  * - 2 1/V_0
169  */
170  int m_formGC;
171 
172  //! Temporary storage - length = m_kk.
174 };
175 }
176 
177 #endif
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual bool addSpecies(shared_ptr< Species > spec)
vector_fp m_pp
Temporary storage - length = m_kk.
void setStandardConcentrationModel(const std::string &model)
Set the standard concentration model.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input...
virtual doublereal standardConcentration(size_t k=0) const
Returns the standard concentration , which is used to normalize the generalized concentration.
int m_formGC
form of the generalized concentrations
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
void setSolnMode()
Set this phase to represent an ideal liquid or solid solution.
virtual std::string type() const
String indicating the thermodynamic model implemented.
int m_idealGas
boolean indicating what ideal solution this is
void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
virtual void setParametersFromXML(const XML_Node &thermoNode)
Set equation of state parameter values from XML entries.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature, pressure, and solution concentration.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
void setGasMode()
Set this phase to represent an ideal gas.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
An ideal solution or an ideal gas approximation of a phase.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.