Cantera  2.5.1
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 https://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  *
27  * @deprecated "Gas" mode to be removed after Cantera 2.5. Use IdealGasPhase for
28  * ideal gas phases instead.
29  */
31 {
32 public:
33  /*!
34  * @name Constructors and Duplicators for IdealSolnGasVPSS
35  */
36  //! @{
37 
39 
40  /// Create an object from an input file
41  IdealSolnGasVPSS(const std::string& infile, std::string id="");
42 
43  //@}
44  //! @name Utilities (IdealSolnGasVPSS)
45  //@{
46 
47  virtual std::string type() const {
48  return "IdealSolnGas";
49  }
50 
51  //! String indicating the mechanical phase of the matter in this Phase.
52  /*!
53  * Options for the string are:
54  * * `gas`
55  * * `undefined`
56  *
57  * If `m_idealGas` is true, returns `gas`. Otherwise, returns `undefined`.
58  */
59  virtual std::string phaseOfMatter() const {
60  if (m_idealGas) {
61  return "gas";
62  } else {
63  return "undefined";
64  }
65  }
66 
67  //! Set this phase to represent an ideal gas
68  void setGasMode() {
69  warn_deprecated("IdealSolnGasVPSS::setGasMode",
70  "To be removed after Cantera 2.5. Use class IdealGasPhase instead.");
71  m_idealGas = true;
72  }
73 
74  //! Set this phase to represent an ideal liquid or solid solution
75  void setSolnMode() { m_idealGas = false; }
76 
77  //! Set the standard concentration model
78  /*
79  * Does not apply to the ideal gas case. Must be one of 'unity',
80  * 'molar_volume', or 'solvent_volume'.
81  */
82  void setStandardConcentrationModel(const std::string& model);
83 
84  //! @}
85  //! @name Molar Thermodynamic Properties
86  //! @{
87 
88  virtual doublereal enthalpy_mole() const;
89  virtual doublereal entropy_mole() const;
90  virtual doublereal cp_mole() const;
91  virtual doublereal cv_mole() const;
92 
93  //! @}
94  //! @name Mechanical Properties
95  //! @{
96 
97  void setPressure(doublereal p);
98 
99  virtual doublereal isothermalCompressibility() const;
100 
101 protected:
102  /**
103  * Calculate the density of the mixture using the partial molar volumes and
104  * mole fractions as input. The formula for this is
105  *
106  * \f[
107  * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
108  * \f]
109  *
110  * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
111  * weights, and \f$V_k\f$ are the pure species molar volumes.
112  *
113  * Note, the basis behind this formula is that in an ideal solution the
114  * partial molar volumes are equal to the species standard state molar
115  * volumes. The species molar volumes may be functions of temperature and
116  * pressure.
117  */
118  virtual void calcDensity();
119  //! @}
120 
121 public:
122  virtual Units standardConcentrationUnits() const;
123  virtual void getActivityConcentrations(doublereal* c) const;
124 
125  //! Returns the standard concentration \f$ C^0_k \f$, which is used to
126  //! normalize the generalized concentration.
127  /*!
128  * This is defined as the concentration by which the generalized
129  * concentration is normalized to produce the activity. In many cases, this
130  * quantity will be the same for all species in a phase. Since the activity
131  * for an ideal gas mixture is simply the mole fraction, for an ideal gas
132  * \f$ C^0_k = P/\hat R T \f$.
133  *
134  * @param k Optional parameter indicating the species. The default
135  * is to assume this refers to species 0.
136  * @return
137  * Returns the standard Concentration in units of m3 kmol-1.
138  */
139  virtual doublereal standardConcentration(size_t k=0) const;
140 
141  //! Get the array of non-dimensional activity coefficients at the current
142  //! solution temperature, pressure, and solution concentration.
143  /*!
144  * For ideal gases, the activity coefficients are all equal to one.
145  *
146  * @param ac Output vector of activity coefficients. Length: m_kk.
147  */
148  virtual void getActivityCoefficients(doublereal* ac) const;
149 
150 
151  /// @name Partial Molar Properties of the Solution
152  //@{
153 
154  virtual void getChemPotentials(doublereal* mu) const;
155  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
156  virtual void getPartialMolarEntropies(doublereal* sbar) const;
157  virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
158  virtual void getPartialMolarCp(doublereal* cpbar) const;
159  virtual void getPartialMolarVolumes(doublereal* vbar) const;
160  //@}
161 
162 public:
163  //! @name Initialization Methods - For Internal use
164  /*!
165  * The following methods are used in the process of constructing the phase
166  * and setting its parameters from a specification in an input file. They
167  * are not normally used in application programs. To see how they are used,
168  * see importPhase().
169  */
170  //@{
171 
172  virtual bool addSpecies(shared_ptr<Species> spec);
173  virtual void setParametersFromXML(const XML_Node& thermoNode);
174  virtual void initThermo();
175  virtual void setToEquilState(const doublereal* lambda_RT);
176  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
177 
178  //@}
179 
180 protected:
181  //! boolean indicating what ideal solution this is
182  /*!
183  * - 1 = ideal gas
184  * - 0 = ideal soln
185  */
187 
188  //! form of the generalized concentrations
189  /*!
190  * - 0 unity (default)
191  * - 1 1/V_k
192  * - 2 1/V_0
193  */
194  int m_formGC;
195 
196  //! Temporary storage - length = m_kk.
198 };
199 }
200 
201 #endif
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
An ideal solution or an ideal gas approximation of a phase.
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature,...
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
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.
void setGasMode()
Set this phase to represent an ideal gas.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
vector_fp m_pp
Temporary storage - length = m_kk.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
virtual std::string phaseOfMatter() const
String indicating the mechanical phase of the matter in this Phase.
void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
void setSolnMode()
Set this phase to represent an ideal liquid or solid solution.
int m_formGC
form of the generalized concentrations
virtual std::string type() const
String indicating the thermodynamic model implemented.
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
void setStandardConcentrationModel(const std::string &model)
Set the standard concentration model.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
virtual void setParametersFromXML(const XML_Node &thermoNode)
Set equation of state parameter values from XML entries.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
int m_idealGas
boolean indicating what ideal solution this is
virtual doublereal standardConcentration(size_t k=0) const
Returns the standard concentration , which is used to normalize the generalized concentration.
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
This is a filter class for ThermoPhase that implements some preparatory steps for efficiently handlin...
virtual bool addSpecies(shared_ptr< Species > spec)
Add a Species to this Phase.
Definition: Phase.cpp:833
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