Cantera  2.5.1
ConstDensityThermo.h
Go to the documentation of this file.
1 /**
2  * @file ConstDensityThermo.h
3  * Header for a Thermo manager for incompressible ThermoPhases
4  * (see \ref thermoprops and \link Cantera::ConstDensityThermo ConstDensityThermo\endlink).
5  */
6 
7 // This file is part of Cantera. See License.txt in the top-level directory or
8 // at https://cantera.org/license.txt for license and copyright information.
9 
10 #ifndef CT_CONSTRHOTHERMO_H
11 #define CT_CONSTRHOTHERMO_H
12 
13 #include "ThermoPhase.h"
14 #include "cantera/base/utilities.h"
15 
16 namespace Cantera
17 {
18 
19 //! Overloads the virtual methods of class ThermoPhase to implement the
20 //! incompressible equation of state.
21 /**
22  * ## Specification of Solution Thermodynamic Properties
23  *
24  * The density is assumed to be constant, no matter what the concentration of
25  * the solution.
26  *
27  * @deprecated To be removed after Cantera 2.5.0. Replaceable with LatticePhase
28  * or IdealSolidSolnPhase
29  *
30  * @ingroup thermoprops
31  */
33 {
34 public:
35  //! Constructor.
37  warn_deprecated("class ConstDensityThermo", "To be removed after Cantera "
38  "2.5.0. Consider replacing with LatticePhase or IdealSolidSolnPhase\n");
39  }
40 
41  virtual std::string type() const {
42  return "ConstDensity";
43  }
44 
45  virtual bool isCompressible() const {
46  return false;
47  }
48 
49  virtual doublereal enthalpy_mole() const;
50  virtual doublereal entropy_mole() const;
51  virtual doublereal cp_mole() const;
52  virtual doublereal cv_mole() const;
53 
54  //! Return the thermodynamic pressure (Pa).
55  virtual doublereal pressure() const;
56 
57  //! Set the internally stored pressure (Pa) at constant temperature and
58  //! composition
59  /*!
60  * @param p input Pressure (Pa)
61  */
62  virtual void setPressure(doublereal p);
63 
64  virtual void getActivityConcentrations(doublereal* c) const;
65  virtual void getActivityCoefficients(doublereal* ac) const;
66 
67  virtual void getChemPotentials(doublereal* mu) const;
68  virtual void getStandardChemPotentials(doublereal* mu0) const;
69 
70  //! Returns the standard Concentration in units of m3 kmol-1.
71  //! @copydoc ThermoPhase::standardConcentration
72  virtual doublereal standardConcentration(size_t k=0) const;
73 
74  virtual void getPureGibbs(doublereal* gpure) const {
75  const vector_fp& gibbsrt = gibbs_RT();
76  scale(gibbsrt.begin(), gibbsrt.end(), gpure, RT());
77  }
78 
79  void getEnthalpy_RT(doublereal* hrt) const {
80  const vector_fp& _h = enthalpy_RT();
81  std::copy(_h.begin(), _h.end(), hrt);
82  }
83 
84  void getEntropy_R(doublereal* sr) const {
85  const vector_fp& _s = entropy_R();
86  std::copy(_s.begin(), _s.end(), sr);
87  }
88 
89  virtual void getGibbs_RT(doublereal* grt) const {
90  const vector_fp& gibbsrt = gibbs_RT();
91  std::copy(gibbsrt.begin(), gibbsrt.end(), grt);
92  }
93 
94  void getCp_R(doublereal* cpr) const {
95  const vector_fp& _cpr = cp_R();
96  std::copy(_cpr.begin(), _cpr.end(), cpr);
97  }
98 
99  //! Returns a reference to the vector of nondimensional enthalpies of the
100  //! reference state at the current temperature of the solution and the
101  //! reference pressure for the species.
102  const vector_fp& enthalpy_RT() const {
103  _updateThermo();
104  return m_h0_RT;
105  }
106 
107  //! Returns a reference to the vector of nondimensional Gibbs Free Energies
108  //! of the reference state at the current temperature of the solution and
109  //! the reference pressure for the species.
110  const vector_fp& gibbs_RT() const {
111  _updateThermo();
112  return m_g0_RT;
113  }
114 
115  //! Returns a reference to the vector of nondimensional entropies of the
116  //! reference state at the current temperature of the solution and the
117  //! reference pressure for each species.
118  const vector_fp& entropy_R() const {
119  _updateThermo();
120  return m_s0_R;
121  }
122 
123  //! Returns a reference to the vector of nondimensional constant pressure
124  //! heat capacities of the reference state at the current temperature of the
125  //! solution and reference pressure for each species.
126  const vector_fp& cp_R() const {
127  _updateThermo();
128  return m_cp0_R;
129  }
130 
131  virtual bool addSpecies(shared_ptr<Species> spec);
132 
133  virtual void setParameters(int n, doublereal* const c) {
134  assignDensity(c[0]);
135  }
136 
137  virtual void getParameters(int& n, doublereal* const c) const {
138  double d = density();
139  c[0] = d;
140  n = 1;
141  }
142 
143  virtual void initThermo();
144  virtual void setParametersFromXML(const XML_Node& eosdata);
145 
146 protected:
147  //! Temporary storage for dimensionless reference state enthalpies
149 
150  //! Temporary storage for dimensionless reference state heat capacities
152 
153  //! Temporary storage for dimensionless reference state Gibbs energies
155 
156  //! Temporary storage for dimensionless reference state entropies
157  mutable vector_fp m_s0_R;
158 
159  //! Current pressure (Pa)
160  doublereal m_press;
161 
162 private:
163  //! Function to update the reference state thermo functions
164  void _updateThermo() const;
165 };
166 }
167 
168 #endif
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Overloads the virtual methods of class ThermoPhase to implement the incompressible equation of state.
const vector_fp & cp_R() const
Returns a reference to the vector of nondimensional constant pressure heat capacities of the referenc...
vector_fp m_g0_RT
Temporary storage for dimensionless reference state Gibbs energies.
doublereal m_press
Current pressure (Pa)
vector_fp m_cp0_R
Temporary storage for dimensionless reference state heat capacities.
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
vector_fp m_h0_RT
Temporary storage for dimensionless reference state enthalpies.
const vector_fp & enthalpy_RT() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
vector_fp m_s0_R
Temporary storage for dimensionless reference state entropies.
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.
void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual bool isCompressible() const
Return whether phase represents a compressible substance.
void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual 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.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution.
virtual std::string type() const
String indicating the thermodynamic model implemented.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
const vector_fp & gibbs_RT() const
Returns a reference to the vector of nondimensional Gibbs Free Energies of the reference state at the...
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
void _updateThermo() const
Function to update the reference state thermo functions.
const vector_fp & entropy_R() const
Returns a reference to the vector of nondimensional entropies of the reference state at the current t...
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
virtual doublereal standardConcentration(size_t k=0) const
Returns the standard Concentration in units of m3 kmol-1.
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:727
virtual double density() const
Density (kg/m^3).
Definition: Phase.h:685
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:776
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
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition: utilities.h:135
Various templated functions that carry out common vector operations (see Templated Utility Functions)...