Cantera  2.0
WaterProps.h
Go to the documentation of this file.
1 /**
2  * @file WaterProps.h
3  * Header for a class used to house several approximation
4  * routines for properties of water.
5  * (see \ref thermoprops
6  * and class \link Cantera::WaterProps WaterProps\endlink).
7  */
8 /*
9  * Copyright (2006) Sandia Corporation. Under the terms of
10  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
11  * U.S. Government retains certain rights in this software.
12  */
13 #ifndef CT_WATERPROPS_H
14 #define CT_WATERPROPS_H
15 
16 
17 #include "cantera/base/ct_defs.h"
18 namespace Cantera
19 {
20 class WaterPropsIAPWS;
21 class PDSS_Water;
22 
23 /**
24  * @defgroup relatedProps Electric Properties of Phases
25  *
26  *
27  * <H3>
28  * Treatment of the %Phase Potential and the electrochemical potential of a species
29  * </H3>
30  *
31  *
32  * The electrochemical potential of species <I>k</I> in a phase <I>p</I>, \f$ \zeta_k \f$,
33  * is related to the chemical potential via
34  * the following equation,
35  *
36  * \f[
37  * \zeta_{k}(T,P) = \mu_{k}(T,P) + z_k \phi_p
38  * \f]
39  *
40  * where \f$ \nu_k \f$ is the charge of species <I>k</I>, and \f$ \phi_p \f$ is
41  * the electric potential of phase <I>p</I>.
42  *
43  * The potential \f$ \phi_p \f$ is tracked and internally stored within
44  * the base %ThermoPhase object. It constitutes a specification of the
45  * internal state of the phase; it's the third state variable, the first
46  * two being temperature and density (or, pressure, for incompressible
47  * equations of state). It may be set with the function,
48  * ThermoPhase::setElectricPotential(),
49  * and may be queried with the function ThermoPhase::electricPotential().
50  *
51  * Note, the overall electrochemical potential of a phase may not be
52  * changed by the potential because many phases enforce charge
53  * neutrality:
54  *
55  * \f[
56  * 0 = \sum_k z_k X_k
57  * \f]
58  *
59  * Whether charge neutrality is necessary for a phase is also specified
60  * within the ThermoPhase object, by the function call
61  * ThermoPhase::chargeNeutralityNecessary(). Note, that it is not
62  * necessary for the IdealGas phase, currently. However, it is
63  * necessary for liquid phases such as Cantera::DebyeHuckel and
64  * Cantera::HMWSoln for the proper specification of the chemical potentials.
65  *
66  *
67  * This equation, when applied to the \f$ \zeta_k \f$ equation described
68  * above, results in a zero net change in the effective Gibbs free
69  * energy of the phase. However, specific charged species in the phase
70  * may increase or decrease their electrochemical potentials, which will
71  * have an effect on interfacial reactions involving charged species,
72  * when there is a potential drop between phases. This effect is used
73  * within the Cantera::InterfaceKinetics and Cantera::EdgeKinetics kinetics
74  * objects classes.
75  *
76  *
77  * <H3>
78  * Electrothermochemical Properties of Phases of Matter.
79  * </H3>
80  *
81  * The following classes are used to compute the electrical and electrothermochemical properties of
82  * phases of matter. The main property currently is the dielectric
83  * constant, which is an important parameter for electrolyte solutions.
84  * The class WaterProps calculate the dielectric constant of water as a function of
85  * temperature and pressure.
86  *
87  * WaterProps also calculate the constant A_debye used in the Debye Huckel
88  * and Pitzer activity coefficient calculations.
89  *
90  *
91  * @ingroup phases
92  */
93 //@{
94 
95 
96 //! The WaterProps class is used to
97 //! house several approximation routines for properties of water.
98 /*!
99  * The class is also a wrapper around the WaterPropsIAPWS class
100  * which provides the calculations for the equation of
101  * state properties for water.
102  *
103  * In particular, this class house routine for the calculation
104  * of the dielectric constant of water
105  *
106  * Most if not all of the member functions are static.
107  */
109 {
110 
111 public:
112 
113  //! Default constructor
114  WaterProps();
115 
116  //! Constructor with pointer to Water PDSS object
117  /*!
118  * @param wptr Pointer to WaterPropsIAPWS object
119  */
121 
122  //! Constructor with pointer to Water PDSS object
123  /*!
124  * @param wptr Pointer to water standard state object
125  */
126  WaterProps(PDSS_Water* wptr);
127 
128  //! Copy Constructor
129  /*!
130  * @param b Object to be copied
131  */
132  WaterProps(const WaterProps& b);
133 
134  //! destructor
135  virtual ~WaterProps();
136 
137  //! Assignment operator
138  /*!
139  * @param b Object to be copied
140  */
141  WaterProps& operator=(const WaterProps& b);
142 
143 
144  //! Simple calculation of water density at atmospheric pressure.
145  //! Valid up to boiling point.
146  /*!
147  * static function.
148  * This formulation has no dependence on the pressure and shouldn't
149  * be used where accuracy is needed.
150  *
151  * @param T temperature in kelvin
152  * @param P Pressure in pascal
153  * @param ifunc changes what's returned
154  *
155  * @return value returned depends on ifunc value:
156  * ifunc = 0 Returns the density in kg/m^3
157  * ifunc = 1 returns the derivative of the density wrt T.
158  * ifunc = 2 returns the 2nd derivative of the density wrt T
159  * ifunc = 3 returns the derivative of the density wrt P.
160  *
161  * Verification:
162  * Agrees with the CRC values (6-10) for up to 4 sig digits.
163  *
164  * units = returns density in kg m-3.
165  */
166  static doublereal density_T(doublereal T, doublereal P, int ifunc);
167 
168 
169  //! Bradley-Pitzer equation for the dielectric constant
170  //! of water as a function of temperature and pressure.
171  /*!
172  * Returns the dimensionless relative dielectric constant
173  * and its derivatives.
174  *
175  *
176  * Range of validity: 0 to 350C, 0 to 1 kbar pressure
177  *
178  * @param T temperature (kelvin)
179  * @param P_pascal pressure in pascal
180  * @param ifunc changes what's returned from the function
181  * - ifunc = 0 return value
182  * - ifunc = 1 return temperature derivative
183  * - ifunc = 2 return temperature second derivative
184  * - ifunc = 3 return pressure first derivative
185  * .
186  *
187  * @return Depends on the value of ifunc:
188  * - ifunc = 0 return value
189  * - ifunc = 1 return temperature derivative
190  * - ifunc = 2 return temperature second derivative
191  * - ifunc = 3 return pressure first derivative
192  * .
193  *
194  * Validation:
195  * Numerical experiments indicate that this function agrees with
196  * the Archer and Wang data in the CRC p. 6-10 to all 4 significant
197  * digits shown (0 to 100C).
198  *
199  * value at 25C and 1 atm, relEps = 78.38
200  *
201  */
202  doublereal relEpsilon(doublereal T, doublereal P_pascal, int ifunc = 0);
203 
204 
205  //! ADebye calculates the value of A_Debye as a function
206  //! of temperature and pressure according to relations
207  //! that take into account the temperature and pressure
208  //! dependence of the water density and dielectric constant.
209  /*!
210  * The A_Debye expression appears on the top of the
211  * ln actCoeff term in the general Debye-Huckel expression
212  * It depends on temperature and pressure. And, therefore,
213  * most be recalculated whenever T or P changes.
214  * The units returned by this expression are sqrt(kg/gmol).
215  *
216  *
217  * \f[
218  * A_{Debye} = \frac{1}{8 \pi} \sqrt{\frac{2 N_{Avog} \rho_w}{1000}}
219  * {\left(\frac{e^2}{\epsilon k_{boltz} T}\right)}^{\frac{3}{2}}
220  * \f]
221  *
222  *
223  * Nominal value at 25C and 1atm = 1.172576 sqrt(kg/gmol).
224  *
225  * Based on:
226  * epsilon/epsilon_0 = 78.54 (water at 25C)
227  * T = 298.15 K
228  * B_Debye = 3.28640E9 sqrt(kg/gmol)/m
229  *
230  * @param T Temperature (kelvin)
231  * @param P pressure (pascal)
232  * @param ifunc Changes what's returned from the routine:
233  * - ifunc = 0 return value
234  * - ifunc = 1 return temperature derivative
235  * - ifunc = 2 return temperature second derivative
236  * - ifunc = 3 return pressure first derivative
237  * .
238  *
239  * @return Returns a single doublereal whose meaning depends on ifunc:
240  * - ifunc = 0 return value
241  * - ifunc = 1 return temperature derivative
242  * - ifunc = 2 return temperature second derivative
243  * - ifunc = 3 return pressure first derivative
244  * .
245  *
246  * Verification:
247  *
248  * With the epsRelWater value from the Bradley-Pitzer relation,
249  * and the water density from the density_IAPWS() function,
250  * The A_Debye computed with this function agrees with
251  * the Pitzer table p. 99 to 4 significant digits at 25C.
252  * and 20C. (Aphi = ADebye/3)
253  */
254  doublereal ADebye(doublereal T, doublereal P, int ifunc);
255 
256 
257  //! Returns the saturation pressure given the temperature
258  /*!
259  * @param T temperature (kelvin)
260  * @return returns the saturation pressure (pascal)
261  */
262  doublereal satPressure(doublereal T);
263 
264 
265  //! Returns the density of water
266  /*!
267  * This function sets the internal temperature and pressure
268  * of the underlying object at the same time.
269  *
270  * @param T Temperature (kelvin)
271  * @param P pressure (pascal)
272  */
273  doublereal density_IAPWS(doublereal T, doublereal P);
274 
275  //! Returns the density of water
276  /*!
277  * This function uses the internal state of the
278  * underlying water object
279  */
280  doublereal density_IAPWS() const;
281 
282 
283  //! returns the coefficient of thermal expansion
284  /*!
285  * @param T Temperature (kelvin)
286  * @param P pressure (pascal)
287  */
288  doublereal coeffThermalExp_IAPWS(doublereal T, doublereal P);
289 
290  //! Returns the isothermal compressibility of water
291  /*!
292  * @param T temperature in kelvin
293  * @param P pressure in pascal
294  */
295  doublereal isothermalCompressibility_IAPWS(doublereal T, doublereal P);
296 
297  //! Returns the viscosity of water at the current conditions
298  //! (kg/m/s)
299  /*!
300  * This function calculates the value of the viscosity of pure
301  * water at the current T and P.
302  *
303  * The formulas used are from the paper
304  * J. V. Sengers, J. T. R. Watson, "Improved International
305  * Formulations for the Viscosity and Thermal Conductivity of
306  * Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
307  *
308  * The formulation is accurate for all temperatures and pressures,
309  * for steam and for water, even near the critical point.
310  * Pressures above 500 MPa and temperature above 900 C are suspect.
311  */
312  doublereal viscosityWater() const;
313 
314  //! Returns the thermal conductivity of water at the current conditions
315  //! (W/m/K)
316  /*!
317  * This function calculates the value of the thermal conductivity of
318  * water at the current T and P.
319  *
320  * The formulas used are from the paper
321  * J. V. Sengers, J. T. R. Watson, "Improved International
322  * Formulations for the Viscosity and Thermal Conductivity of
323  * Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
324  *
325  * The formulation is accurate for all temperatures and pressures,
326  * for steam and for water, even near the critical point.
327  * Pressures above 500 MPa and temperature above 900 C are suspect.
328  */
329  doublereal thermalConductivityWater() const;
330 
331 
332 
333 
334 
335 protected:
336 
337  //! Pointer to the WaterPropsIAPWS object
338  /*!
339  * this pointer points to the water object.
340  */
342 
343  //! true if we own the WaterPropsIAPWS object
344  bool m_own_sub;
345 };
346 
347 //@}
348 }
349 
350 
351 #endif