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