Cantera  2.1.2
StoichSubstance.h
Go to the documentation of this file.
1 /**
2  * @file StoichSubstance.h
3  * This file contains the class declarations for the StoichSubstance
4  * ThermoPhase class.
5  */
6 
7 // Copyright 2001 California Institute of Technology
8 
9 #ifndef CT_STOICHSUBSTANCE_H
10 #define CT_STOICHSUBSTANCE_H
11 
12 #include "mix_defs.h"
13 #include "ThermoPhase.h"
14 #include "SpeciesThermo.h"
15 
16 namespace Cantera
17 {
18 
19 /**
20  * @ingroup thermoprops
21  *
22  * Class StoichSubstance represents a stoichiometric (fixed composition)
23  * incompressible substance.
24  * \nosubgrouping
25  */
27 {
28 public:
29  //! Default empty constructor
31 
32  //! Copy Constructor
33  /*!
34  * Copy constructor for the object. Constructed
35  * object will be a clone of this object, but will
36  * also own all of its data.
37  * This is a wrapper around the assignment operator
38  *
39  * @param right Object to be copied.
40  */
41  StoichSubstance(const StoichSubstance& right);
42 
43  //! Assignment operator
44  /*!
45  * Assignment operator for the object. Constructed
46  * object will be a clone of this object, but will
47  * also own all of its data.
48  *
49  * @param right Object to be copied.
50  */
52 
53  //! Duplicator from the %ThermoPhase parent class
54  /*
55  * Given a pointer to a %ThermoPhase object, this function will
56  * duplicate the %ThermoPhase object and all underlying structures.
57  * This is basically a wrapper around the copy constructor.
58  *
59  * @return returns a pointer to a %ThermoPhase
60  */
62 
63  /**
64  * Equation of state flag. Returns the value cStoichSubstance,
65  * defined in mix_defs.h.
66  */
67  virtual int eosType() const {
68  return cStoichSubstance;
69  }
70 
71  //! @name Molar Thermodynamic Properties of the Solution
72  //! @{
73 
74  /**
75  * Molar enthalpy. Units: J/kmol. For an incompressible,
76  * stoichiometric substance, the internal energy is
77  * independent of pressure, and therefore the molar enthalpy
78  * is \f[ \hat h(T, P) = \hat u(T) + P \hat v \f], where the
79  * molar specific volume is constant.
80  */
81  virtual doublereal enthalpy_mole() const;
82 
83  /**
84  * Molar internal energy. J/kmol. For an incompressible,
85  * stoichiometric substance, the molar internal energy is
86  * independent of pressure. Since the thermodynamic properties
87  * are specified by giving the standard-state enthalpy, the
88  * term \f$ P_0 \hat v\f$ is subtracted from the specified molar
89  * enthalpy to compute the molar internal energy.
90  */
91  virtual doublereal intEnergy_mole() const;
92 
93  /**
94  * Molar entropy. Units: J/kmol/K. For an incompressible,
95  * stoichiometric substance, the molar entropy depends only on
96  * the temperature.
97  */
98  virtual doublereal entropy_mole() const;
99 
100  /**
101  * Molar gibbs Function. Units: J/kmol. This is determined
102  * from the molar enthalpy and entropy functions.
103  */
104  virtual doublereal gibbs_mole() const;
105 
106  /**
107  * Molar heat capacity at constant pressure. Units: J/kmol/K.
108  * For an incompressible substance, \f$ \hat c_p = \hat c_v\f$.
109  */
110  virtual doublereal cp_mole() const;
111 
112  /**
113  * Molar heat capacity at constant volume. Units: J/kmol/K.
114  * For an incompressible substance, \f$ \hat c_p = \hat c_v\f$.
115  */
116  virtual doublereal cv_mole() const;
117 
118  //! @}
119  //! @name Mechanical Equation of State
120  //! @{
121 
122  //! Report the Pressure. Units: Pa.
123  /*!
124  * For an incompressible substance, the density is independent
125  * of pressure. This method simply returns the stored
126  * pressure value.
127  */
128  virtual doublereal pressure() const;
129 
130  //! Set the pressure at constant temperature. Units: Pa.
131  /*!
132  * For an incompressible substance, the density is
133  * independent of pressure. Therefore, this method only
134  * stores the specified pressure value. It does not
135  * modify the density.
136  *
137  * @param p Pressure (units - Pa)
138  */
139  virtual void setPressure(doublereal p);
140 
141  //! @}
142  //! @name Chemical Potentials and Activities
143  //! @{
144 
145  /**
146  * This method returns the array of generalized
147  * concentrations. For a stoichiometric substance, there is
148  * only one species, and the generalized concentration is 1.0.
149  */
150  virtual void getActivityConcentrations(doublereal* c) const;
151 
152  /**
153  * The standard concentration. This is defined as the concentration
154  * by which the generalized concentration is normalized to produce
155  * the activity.
156  */
157  virtual doublereal standardConcentration(size_t k=0) const;
158 
159  /**
160  * Returns the natural logarithm of the standard
161  * concentration of the kth species
162  */
163  virtual doublereal logStandardConc(size_t k=0) const;
164 
165  /**
166  * Get the array of chemical potentials at unit activity
167  * \f$ \mu^0_k \f$.
168  *
169  * For a stoichiometric substance, there is no activity term in
170  * the chemical potential expression, and therefore the
171  * standard chemical potential and the chemical potential
172  * are both equal to the molar Gibbs function.
173  */
174  virtual void getStandardChemPotentials(doublereal* mu0) const;
175 
176  /**
177  * Returns the units of the standard and generalized
178  * concentrations. Note they have the same units, as their
179  * ratio is defined to be equal to the activity of the kth
180  * species in the solution, which is unitless.
181  *
182  * This routine is used in print out applications where the
183  * units are needed. Usually, MKS units are assumed throughout
184  * the program and in the XML input files.
185  *
186  * uA[0] = kmol units - default = 0
187  * uA[1] = m units - default = 0
188  * uA[2] = kg units - default = 0;
189  * uA[3] = Pa(pressure) units - default = 0;
190  * uA[4] = Temperature units - default = 0;
191  * uA[5] = time units - default = 0
192  * @deprecated
193  */
194  virtual void getUnitsStandardConc(double* uA, int k = 0,
195  int sizeUA = 6) const;
196 
197  //@}
198  /// @name Partial Molar Properties of the Solution
199  //@{
200 
201  /**
202  * Get the array of non-dimensional chemical potentials
203  * \f$ \mu_k / \hat R T \f$.
204  */
205  virtual void getChemPotentials_RT(doublereal* mu) const;
206 
207  /**
208  * For a stoichiometric substance, there is only one species.
209  * This method returns the molar gibbs function in the
210  * first element of array \c mu.
211  */
212  virtual void getChemPotentials(doublereal* mu) const;
213 
214  /**
215  * Get the species electrochemical potentials. Units: J/kmol.
216  * This method adds a term \f$ Fz_k \phi_k \f$ to the
217  * to each chemical potential.
218  */
219  void getElectrochemPotentials(doublereal* mu) const;
220 
221  /**
222  * Returns an array of partial molar enthalpies for the species
223  * in the mixture.
224  * Units (J/kmol)
225  */
226  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
227 
228  /**
229  * Returns an array of partial molar entropies of the species in the
230  * solution. Units: J/kmol/K.
231  */
232  virtual void getPartialMolarEntropies(doublereal* sbar) const;
233 
234  /**
235  * returns an array of partial molar volumes of the species
236  * in the solution. Units: m^3 kmol-1.
237  */
238  virtual void getPartialMolarVolumes(doublereal* vbar) const;
239 
240  //@}
241  /// @name Properties of the Standard State of the Species in the Solution
242  //@{
243  /**
244  * Get the nondimensional Enthalpy functions for the species
245  * at their standard states at the current
246  * <I>T</I> and <I>P</I> of the solution.
247  */
248  virtual void getEnthalpy_RT(doublereal* hrt) const;
249 
250  /**
251  * Get the array of nondimensional Enthalpy functions for the
252  * standard state species
253  * at the current <I>T</I> and <I>P</I> of the solution.
254  */
255  virtual void getEntropy_R(doublereal* sr) const;
256 
257  /**
258  * Get the nondimensional Gibbs functions for the species
259  * at their standard states of solution at the current T and P
260  * of the solution.
261  */
262  virtual void getGibbs_RT(doublereal* grt) const;
263 
264  //! Get the Gibbs functions for the standard
265  //! state of the species at the current <I>T</I> and <I>P</I> of the solution
266  /*!
267  * Units are Joules/kmol
268  * @param gpure Output vector of standard state gibbs free energies
269  * Length: m_kk.
270  */
271  virtual void getPureGibbs(doublereal* gpure) const;
272 
273  /**
274  * Get the nondimensional Heat Capacities at constant
275  * pressure for the standard state of the species
276  * at the current T and P.
277  */
278  virtual void getCp_R(doublereal* cpr) const;
279 
280  /**
281  * Get the standard volumes for the standard state of the species
282  * at the current T and P
283  */
284  virtual void getStandardVolumes(doublereal* vol) const;
285 
286  //@}
287  /// @name Thermodynamic Values for the Species Reference States
288  //@{
289 
290  /**
291  * Returns the vector of nondimensional
292  * enthalpies of the reference state at the current temperature
293  * of the solution and the reference pressure for the species.
294  *
295  * This function fills in its one entry in hrt[] by calling
296  * the underlying species thermo function for the
297  * dimensionless enthalpy.
298  */
299  virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
300 
301 #ifdef H298MODIFY_CAPABILITY
302 
303  virtual void modifyOneHf298SS(const size_t& k, const doublereal Hf298New) {
304  m_spthermo->modifyOneHf298(k, Hf298New);
305  m_tlast += 0.0001234;
306  }
307 #endif
308  /**
309  * Returns the vector of nondimensional
310  * enthalpies of the reference state at the current temperature
311  * of the solution and the reference pressure for the species.
312  *
313  * This function fills in its one entry in hrt[] by calling
314  * the underlying species thermo function for the
315  * dimensionless gibbs free energy, calculated from the
316  * dimensionless enthalpy and entropy.
317  */
318  virtual void getGibbs_RT_ref(doublereal* grt) const;
319 
320  /**
321  * Returns the vector of the
322  * gibbs function of the reference state at the current temperature
323  * of the solution and the reference pressure for the species.
324  * units = J/kmol
325  *
326  * This function fills in its one entry in g[] by calling
327  * the underlying species thermo functions for the
328  * gibbs free energy, calculated from enthalpy and the
329  * entropy, and the multiplying by RT.
330  */
331  virtual void getGibbs_ref(doublereal* g) const;
332 
333  /**
334  * Returns the vector of nondimensional
335  * entropies of the reference state at the current temperature
336  * of the solution and the reference pressure for the species.
337  *
338  * This function fills in its one entry in hrt[] by calling
339  * the underlying species thermo function for the
340  * dimensionless entropy.
341  */
342  virtual void getEntropy_R_ref(doublereal* er) const;
343 
344  //! Returns the vector of nondimensional
345  //! constant pressure heat capacities of the reference state
346  //! at the current temperature of the solution
347  //! and reference pressure for each species.
348  /*!
349  * @param cprt Output vector of nondimensional reference state
350  * heat capacities at constant pressure for the species.
351  * Length: m_kk
352  */
353  virtual void getCp_R_ref(doublereal* cprt) const;
354  //! @}
355 
356  virtual void initThermo();
357 
358  //! @deprecated Use setDensity()
359  virtual void setParameters(int n, double* const c);
360 
361  //! @deprecated Use density()
362  virtual void getParameters(int& n, double* const c) const;
363 
364  virtual void setParametersFromXML(const XML_Node& eosdata);
365 
366 protected:
367  doublereal m_press;
368  doublereal m_p0;
369 
370  mutable doublereal m_tlast;
371  mutable vector_fp m_h0_RT;
372  mutable vector_fp m_cp0_R;
373  mutable vector_fp m_s0_R;
374 
375 private:
376  void _updateThermo() const;
377 };
378 
379 }
380 
381 #endif
virtual doublereal enthalpy_mole() const
Molar enthalpy.
virtual doublereal gibbs_mole() const
Molar gibbs Function.
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and generalized concentrations.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New)
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) ...
Definition: ThermoPhase.h:227
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
ThermoPhase * duplMyselfAsThermoPhase() const
Duplicator from the ThermoPhase parent class.
virtual void getPartialMolarVolumes(doublereal *vbar) const
returns an array of partial molar volumes of the species in the solution.
virtual doublereal logStandardConc(size_t k=0) const
Returns the natural logarithm of the standard concentration of the kth species.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure.
virtual void setPressure(doublereal p)
Set the pressure at constant temperature. Units: Pa.
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of chemical potentials at unit activity .
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...
Class StoichSubstance represents a stoichiometric (fixed composition) incompressible substance...
virtual void setParameters(int n, double *const c)
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
StoichSubstance & operator=(const StoichSubstance &right)
Assignment operator.
virtual void getStandardVolumes(doublereal *vol) const
Get the standard volumes for the standard state of the species at the current T and P...
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
virtual doublereal pressure() const
Report the Pressure. Units: Pa.
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the gibbs function of the reference state at the current temperature of the sol...
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the standard state of the species at ...
virtual doublereal cv_mole() const
Molar heat capacity at constant volume.
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional chemical potentials .
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species at their standard states of solution at the cu...
virtual doublereal intEnergy_mole() const
Molar internal energy.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
StoichSubstance()
Default empty constructor.
virtual doublereal entropy_mole() const
Molar entropy.
virtual void getParameters(int &n, double *const c) const
virtual void getChemPotentials(doublereal *mu) const
For a stoichiometric substance, there is only one species.
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:165
virtual int eosType() const
Equation of state flag.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
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).
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
SpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1625
virtual doublereal standardConcentration(size_t k=0) const
The standard concentration.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.