Cantera  2.3.0
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 http://www.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  * @ingroup thermoprops
28  */
30 {
31 public:
32  //! Constructor.
34 
36  ConstDensityThermo& operator=(const ConstDensityThermo& right);
37  virtual ThermoPhase* duplMyselfAsThermoPhase() const;
38 
39  virtual int eosType() const;
40  virtual std::string type() const {
41  return "ConstDensity";
42  }
43 
44  virtual doublereal enthalpy_mole() const;
45  virtual doublereal entropy_mole() const;
46  virtual doublereal cp_mole() const;
47  virtual doublereal cv_mole() const;
48 
49  //! Return the thermodynamic pressure (Pa).
50  virtual doublereal pressure() const;
51 
52  //! Set the internally stored pressure (Pa) at constant temperature and
53  //! composition
54  /*!
55  * @param p input Pressure (Pa)
56  */
57  virtual void setPressure(doublereal p);
58 
59  virtual void getActivityConcentrations(doublereal* c) const;
60  virtual void getActivityCoefficients(doublereal* ac) const;
61 
62  virtual void getChemPotentials(doublereal* mu) const;
63  virtual void getStandardChemPotentials(doublereal* mu0) const;
64 
65  //! Returns the standard Concentration in units of m3 kmol-1.
66  //! @copydoc ThermoPhase::standardConcentration
67  virtual doublereal standardConcentration(size_t k=0) const;
68 
69  virtual void getPureGibbs(doublereal* gpure) const {
70  const vector_fp& gibbsrt = gibbs_RT();
71  scale(gibbsrt.begin(), gibbsrt.end(), gpure, RT());
72  }
73 
74  void getEnthalpy_RT(doublereal* hrt) const {
75  const vector_fp& _h = enthalpy_RT();
76  std::copy(_h.begin(), _h.end(), hrt);
77  }
78 
79  void getEntropy_R(doublereal* sr) const {
80  const vector_fp& _s = entropy_R();
81  std::copy(_s.begin(), _s.end(), sr);
82  }
83 
84  virtual void getGibbs_RT(doublereal* grt) const {
85  const vector_fp& gibbsrt = gibbs_RT();
86  std::copy(gibbsrt.begin(), gibbsrt.end(), grt);
87  }
88 
89  void getCp_R(doublereal* cpr) const {
90  const vector_fp& _cpr = cp_R();
91  std::copy(_cpr.begin(), _cpr.end(), cpr);
92  }
93 
94  //! Returns a reference to the vector of nondimensional enthalpies of the
95  //! reference state at the current temperature of the solution and the
96  //! reference pressure for the species.
97  const vector_fp& enthalpy_RT() const {
98  _updateThermo();
99  return m_h0_RT;
100  }
101 
102  //! Returns a reference to the vector of nondimensional Gibbs Free Energies
103  //! of the reference state at the current temperature of the solution and
104  //! the reference pressure for the species.
105  const vector_fp& gibbs_RT() const {
106  _updateThermo();
107  return m_g0_RT;
108  }
109 
110  //! Returns a reference to the vector of nondimensional entropies of the
111  //! reference state at the current temperature of the solution and the
112  //! reference pressure for each species.
113  const vector_fp& entropy_R() const {
114  _updateThermo();
115  return m_s0_R;
116  }
117 
118  //! Returns a reference to the vector of nondimensional constant pressure
119  //! heat capacities of the reference state at the current temperature of the
120  //! solution and reference pressure for each species.
121  const vector_fp& cp_R() const {
122  _updateThermo();
123  return m_cp0_R;
124  }
125 
126  virtual bool addSpecies(shared_ptr<Species> spec);
127 
128  virtual void setParameters(int n, doublereal* const c) {
129  setDensity(c[0]);
130  }
131 
132  virtual void getParameters(int& n, doublereal* const c) const {
133  double d = density();
134  c[0] = d;
135  n = 1;
136  }
137 
138  virtual void setParametersFromXML(const XML_Node& eosdata);
139 
140 protected:
141  //! Temporary storage for dimensionless reference state enthalpies
143 
144  //! Temporary storage for dimensionless reference state heat capacities
146 
147  //! Temporary storage for dimensionless reference state Gibbs energies
149 
150  //! Temporary storage for dimensionless reference state entropies
151  mutable vector_fp m_s0_R;
152 
153  //! Current pressure (Pa)
154  doublereal m_press;
155 
156 private:
157  //! Function to update the reference state thermo functions
158  void _updateThermo() const;
159 };
160 }
161 
162 #endif
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...
vector_fp m_s0_R
Temporary storage for dimensionless reference state entropies.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
vector_fp m_h0_RT
Temporary storage for dimensionless reference state enthalpies.
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:607
doublereal m_press
Current pressure (Pa)
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:809
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
const vector_fp & enthalpy_RT() const
Returns a reference to the vector of nondimensional enthalpies of the reference state at the current ...
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
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 doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
const vector_fp & entropy_R() const
Returns a reference to the vector of nondimensional entropies of the reference state at the current t...
void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Overloads the virtual methods of class ThermoPhase to implement the incompressible equation of state...
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual int eosType() const
Equation of state type flag.
virtual bool addSpecies(shared_ptr< Species > spec)
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
const vector_fp & cp_R() const
Returns a reference to the vector of nondimensional constant pressure heat capacities of the referenc...
void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
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 getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition: utilities.h:130
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
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 doublereal standardConcentration(size_t k=0) const
Returns the standard Concentration in units of m3 kmol-1.
vector_fp m_g0_RT
Temporary storage for dimensionless reference state Gibbs energies.
void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Namespace for the Cantera kernel.
Definition: application.cpp:29
vector_fp m_cp0_R
Temporary storage for dimensionless reference state heat capacities.
const vector_fp & gibbs_RT() const
Returns a reference to the vector of nondimensional Gibbs Free Energies of the reference state at the...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
void _updateThermo() const
Function to update the reference state thermo functions.
virtual std::string type() const
String indicating the thermodynamic model implemented.
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase.
Definition: Phase.h:622