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
Cantera::IdealSolnGasVPSS::setToEquilState
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
Definition: IdealSolnGasVPSS.cpp:229
Cantera::IdealSolnGasVPSS::m_formGC
int m_formGC
form of the generalized concentrations
Definition: IdealSolnGasVPSS.h:194
Cantera::IdealSolnGasVPSS::standardConcentrationUnits
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
Definition: IdealSolnGasVPSS.cpp:125
Cantera::IdealSolnGasVPSS::m_idealGas
int m_idealGas
boolean indicating what ideal solution this is
Definition: IdealSolnGasVPSS.h:186
Cantera::IdealSolnGasVPSS::getActivityConcentrations
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: IdealSolnGasVPSS.cpp:134
Cantera::warn_deprecated
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
Cantera::IdealSolnGasVPSS::standardConcentration
virtual doublereal standardConcentration(size_t k=0) const
Returns the standard concentration , which is used to normalize the generalized concentration.
Definition: IdealSolnGasVPSS.cpp:160
Cantera::IdealSolnGasVPSS::getPartialMolarEnthalpies
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: IdealSolnGasVPSS.cpp:196
Cantera::IdealSolnGasVPSS::setParametersFromXML
virtual void setParametersFromXML(const XML_Node &thermoNode)
Set equation of state parameter values from XML entries.
Definition: IdealSolnGasVPSS.cpp:318
Cantera::IdealSolnGasVPSS::getPartialMolarVolumes
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
Definition: IdealSolnGasVPSS.cpp:224
Cantera::IdealSolnGasVPSS::isothermalCompressibility
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
Definition: IdealSolnGasVPSS.cpp:116
Cantera::IdealSolnGasVPSS::setSolnMode
void setSolnMode()
Set this phase to represent an ideal liquid or solid solution.
Definition: IdealSolnGasVPSS.h:75
Cantera::IdealSolnGasVPSS::phaseOfMatter
virtual std::string phaseOfMatter() const
String indicating the mechanical phase of the matter in this Phase.
Definition: IdealSolnGasVPSS.h:59
Cantera::vector_fp
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
Cantera::IdealSolnGasVPSS::setGasMode
void setGasMode()
Set this phase to represent an ideal gas.
Definition: IdealSolnGasVPSS.h:68
Cantera::IdealSolnGasVPSS::entropy_mole
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: IdealSolnGasVPSS.cpp:76
Cantera::IdealSolnGasVPSS::getPartialMolarIntEnergies
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
Definition: IdealSolnGasVPSS.cpp:212
Cantera::IdealSolnGasVPSS::calcDensity
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
Definition: IdealSolnGasVPSS.cpp:100
Cantera::IdealSolnGasVPSS::getChemPotentials
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: IdealSolnGasVPSS.cpp:187
Cantera::IdealSolnGasVPSS::getActivityCoefficients
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature,...
Definition: IdealSolnGasVPSS.cpp:178
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera::IdealSolnGasVPSS::initThermo
virtual void initThermo()
Definition: IdealSolnGasVPSS.cpp:266
Cantera::IdealSolnGasVPSS::enthalpy_mole
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: IdealSolnGasVPSS.cpp:70
Cantera::IdealSolnGasVPSS::type
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: IdealSolnGasVPSS.h:47
Cantera::IdealSolnGasVPSS::addSpecies
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: IdealSolnGasVPSS.cpp:257
VPStandardStateTP.h
Cantera::IdealSolnGasVPSS::getPartialMolarCp
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Definition: IdealSolnGasVPSS.cpp:218
Cantera::IdealSolnGasVPSS::setPressure
void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: IdealSolnGasVPSS.cpp:93
Cantera::IdealSolnGasVPSS::cp_mole
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: IdealSolnGasVPSS.cpp:82
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:29
Cantera::IdealSolnGasVPSS::getPartialMolarEntropies
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition: IdealSolnGasVPSS.cpp:202
Cantera::IdealSolnGasVPSS::setStandardConcentrationModel
void setStandardConcentrationModel(const std::string &model)
Set the standard concentration model.
Definition: IdealSolnGasVPSS.cpp:47
Cantera::IdealSolnGasVPSS::cv_mole
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: IdealSolnGasVPSS.cpp:88
Cantera::IdealSolnGasVPSS
Definition: IdealSolnGasVPSS.h:30
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:263
Cantera::IdealSolnGasVPSS::initThermoXML
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
Definition: IdealSolnGasVPSS.cpp:287
Cantera::IdealSolnGasVPSS::m_pp
vector_fp m_pp
Temporary storage - length = m_kk.
Definition: IdealSolnGasVPSS.h:197
Cantera::VPStandardStateTP
Definition: VPStandardStateTP.h:41