Cantera  2.4.0
WaterPropsIAPWSphi.h
Go to the documentation of this file.
1 /**
2  * @file WaterPropsIAPWSphi.h
3  * Header for Lowest level of the classes which support a real water model
4  * (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and class
5  * \link Cantera::WaterPropsIAPWSphi WaterPropsIAPWSphi\endlink).
6  *
7  * This class calculates dimensionless quantities.
8  */
9 
10 // This file is part of Cantera. See License.txt in the top-level directory or
11 // at http://www.cantera.org/license.txt for license and copyright information.
12 
13 #ifndef WATERPROPSIAPWSPHI_H
14 #define WATERPROPSIAPWSPHI_H
15 
16 #include "cantera/base/config.h"
17 
18 namespace Cantera
19 {
20 
21 //! Low level class for the real description of water.
22 /*!
23  * The reference is W. Wagner, A. Pruss, "The IAPWS Formulation 1995 for the
24  * Thermodynamic Properties of Ordinary Water Substance for General and
25  * Scientific Use," J. Phys. Chem. Ref. Dat, 31, 387, 2002.
26  *
27  * Units Note: This class works with reduced units exclusively.
28  */
30 {
31 public:
32  //! Base constructor
34 
35  //! Calculate the Phi function, which is the base function
36  /*!
37  * The phi function is basically the Helmholtz free energy Eqn. (6.4) All
38  * internal polynomials are recalculated.
39  *
40  * @param tau Dimensionless temperature = T_c/T
41  * @param delta Dimensionless density = delta = rho / Rho_c
42  */
43  doublereal phi(doublereal tau, doublereal delta);
44 
45  //! Calculate derivative of phi wrt delta
46  /*!
47  * @param tau Dimensionless temperature = T_c/T
48  * @param delta Dimensionless density = delta = rho / Rho_c
49  */
50  doublereal phi_d(doublereal tau, doublereal delta);
51 
52  //! 2nd derivative of phi wrt delta
53  /*!
54  * @param tau Dimensionless temperature = T_c/T
55  * @param delta Dimensionless density = delta = rho / Rho_c
56  */
57  doublereal phi_dd(doublereal tau, doublereal delta);
58 
59  //! First derivative of phi wrt tau
60  /*!
61  * @param tau Dimensionless temperature = T_c/T
62  * @param delta Dimensionless density = delta = rho / Rho_c
63  */
64  doublereal phi_t(doublereal tau, doublereal delta);
65 
66  //! Second derivative of phi wrt tau
67  /*!
68  * @param tau Dimensionless temperature = T_c/T
69  * @param delta Dimensionless density = delta = rho / Rho_c
70  */
71  doublereal phi_tt(doublereal tau, doublereal delta);
72 
73  //! Calculate the dimensionless pressure at tau and delta;
74  /*!
75  * pM/(rhoRT) = delta * phi_d() = 1.0 + delta phiR_d()
76  *
77  * @param tau Dimensionless temperature = T_c/T
78  * @param delta Dimensionless density = delta = rho / Rho_c
79  *
80  * note: this is done so much, we have a separate routine.
81  */
82  doublereal pressureM_rhoRT(doublereal tau, doublereal delta);
83 
84  //! Dimensionless derivative of p wrt rho at constant T
85  /*!
86  * dp/drho * 1/RT = (2. delta phi_d() + delta**2 phi_dd())
87  * (1.0 + 2. delta phiR_d() + delta**2 phiR_dd())
88  *
89  * @param tau Dimensionless temperature = T_c/T
90  * @param delta Dimensionless density = delta = rho / Rho_c
91  */
92  doublereal dimdpdrho(doublereal tau, doublereal delta);
93 
94  //! Dimensionless derivative of p wrt T at constant rho
95  /*!
96  * dp/dT * M/(Rho R) = (1.0 + delta phiR_d()
97  * - tau delta (phiR_dt())
98  *
99  * @param tau Dimensionless temperature = T_c/T
100  * @param delta Dimensionless density = delta = rho / Rho_c
101  */
102  doublereal dimdpdT(doublereal tau, doublereal delta);
103 
104  /**
105  * This function computes the reduced density, given the reduced pressure
106  * and the reduced temperature, tau. It takes an initial guess, deltaGuess.
107  * DeltaGuess is important as this is a multivalued function below the
108  * critical point.
109  *
110  * @param p_red Value of the dimensionless pressure
111  * @param tau Dimensionless temperature = T_c/T
112  * @param deltaGuess Initial guess for the dimensionless density
113  *
114  * @returns the dimensionless density.
115  */
116  doublereal dfind(doublereal p_red, doublereal tau, doublereal deltaGuess);
117 
118  //! Calculate the dimensionless Gibbs free energy
119  doublereal gibbs_RT() const;
120 
121  //! Calculate the dimensionless enthalpy, h/RT
122  doublereal enthalpy_RT() const;
123 
124  //! Calculate the dimensionless entropy, s/R
125  doublereal entropy_R() const;
126 
127  //! Calculate the dimensionless internal energy, u/RT
128  doublereal intEnergy_RT() const;
129 
130  //! Calculate the dimensionless constant volume heat capacity, Cv/R
131  doublereal cv_R() const;
132 
133  //! Calculate the dimensionless constant pressure heat capacity, Cv/R
134  doublereal cp_R() const;
135 
136  //! Calculates internal polynomials in tau and delta.
137  /*!
138  * This routine is used to store the internal state of tau and delta
139  * for later use by the other routines in the class.
140  *
141  * @param tau Dimensionless temperature = T_c/T
142  * @param delta Dimensionless density = delta = rho / Rho_c
143  */
144  void tdpolycalc(doublereal tau, doublereal delta);
145 
146  /*!
147  * Calculate Equation 6.6 for phiR, the residual part of the
148  * dimensionless Helmholtz free energy.
149  */
150  doublereal phiR() const;
151 
152 protected:
153  //! Calculate Equation 6.5 for phi0, the ideal gas part of the
154  //! dimensionless Helmholtz free energy.
155  doublereal phi0() const;
156  //! Calculate d_phiR_d(delta), the first derivative of phiR wrt delta
157  doublereal phiR_d() const;
158  //! Calculate d_phi0_d(delta), the first derivative of phi0 wrt delta
159  doublereal phi0_d() const;
160  //! Calculate d2_phiR_dd(delta), the second derivative of phiR wrt delta
161  doublereal phiR_dd() const;
162  //! Calculate d2_phi0_dd(delta), the second derivative of phi0 wrt delta
163  doublereal phi0_dd() const;
164  //! Calculate d_phi0/d(tau)
165  doublereal phi0_t() const;
166  //! Calculate Equation 6.6 for dphiRdtau, the derivative residual part of
167  //! the dimensionless Helmholtz free energy wrt temperature
168  doublereal phiR_t() const;
169  //! Calculate Equation 6.6 for dphiRdtau, the second derivative residual
170  //! part of the dimensionless Helmholtz free energy wrt temperature
171  doublereal phiR_tt() const;
172  //! Calculate d2_phi0/dtau2
173  doublereal phi0_tt() const;
174  //! Calculate the mixed derivative d2_phiR/(dtau ddelta)
175  doublereal phiR_dt() const;
176  //! Calculate the mixed derivative d2_phi0/(dtau ddelta)
177  doublereal phi0_dt() const;
178 
179  //! Value of internally calculated polynomials of powers of TAU
180  doublereal TAUp[52];
181 
182  //! Value of internally calculated polynomials of powers of delta
183  doublereal DELTAp[16];
184 
185  //! Last tau that was used to calculate polynomials
186  doublereal TAUsave;
187 
188  //! sqrt of TAU
189  doublereal TAUsqrt;
190 
191  //! Last delta that was used to calculate polynomials
192  doublereal DELTAsave;
193 };
194 
195 } // namespace Cantera
196 #endif
doublereal phiR_d() const
Calculate d_phiR_d(delta), the first derivative of phiR wrt delta.
doublereal phi_dd(doublereal tau, doublereal delta)
2nd derivative of phi wrt delta
doublereal phiR_t() const
Calculate Equation 6.6 for dphiRdtau, the derivative residual part of the dimensionless Helmholtz fre...
doublereal dfind(doublereal p_red, doublereal tau, doublereal deltaGuess)
This function computes the reduced density, given the reduced pressure and the reduced temperature...
doublereal TAUsave
Last tau that was used to calculate polynomials.
doublereal phi0_dt() const
Calculate the mixed derivative d2_phi0/(dtau ddelta)
doublereal DELTAp[16]
Value of internally calculated polynomials of powers of delta.
doublereal gibbs_RT() const
Calculate the dimensionless Gibbs free energy.
doublereal DELTAsave
Last delta that was used to calculate polynomials.
doublereal pressureM_rhoRT(doublereal tau, doublereal delta)
Calculate the dimensionless pressure at tau and delta;.
doublereal cp_R() const
Calculate the dimensionless constant pressure heat capacity, Cv/R.
doublereal phi0_tt() const
Calculate d2_phi0/dtau2.
doublereal phi0_t() const
Calculate d_phi0/d(tau)
doublereal dimdpdrho(doublereal tau, doublereal delta)
Dimensionless derivative of p wrt rho at constant T.
doublereal phi_tt(doublereal tau, doublereal delta)
Second derivative of phi wrt tau.
doublereal phi0_d() const
Calculate d_phi0_d(delta), the first derivative of phi0 wrt delta.
doublereal dimdpdT(doublereal tau, doublereal delta)
Dimensionless derivative of p wrt T at constant rho.
doublereal cv_R() const
Calculate the dimensionless constant volume heat capacity, Cv/R.
doublereal phiR_dd() const
Calculate d2_phiR_dd(delta), the second derivative of phiR wrt delta.
WaterPropsIAPWSphi()
Base constructor.
void tdpolycalc(doublereal tau, doublereal delta)
Calculates internal polynomials in tau and delta.
doublereal phi_t(doublereal tau, doublereal delta)
First derivative of phi wrt tau.
doublereal phi0_dd() const
Calculate d2_phi0_dd(delta), the second derivative of phi0 wrt delta.
Low level class for the real description of water.
doublereal phiR_tt() const
Calculate Equation 6.6 for dphiRdtau, the second derivative residual part of the dimensionless Helmho...
doublereal TAUsqrt
sqrt of TAU
doublereal intEnergy_RT() const
Calculate the dimensionless internal energy, u/RT.
doublereal phi0() const
Calculate Equation 6.5 for phi0, the ideal gas part of the dimensionless Helmholtz free energy...
doublereal phi_d(doublereal tau, doublereal delta)
Calculate derivative of phi wrt delta.
doublereal phi(doublereal tau, doublereal delta)
Calculate the Phi function, which is the base function.
doublereal phiR_dt() const
Calculate the mixed derivative d2_phiR/(dtau ddelta)
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
doublereal entropy_R() const
Calculate the dimensionless entropy, s/R.
doublereal TAUp[52]
Value of internally calculated polynomials of powers of TAU.
doublereal enthalpy_RT() const
Calculate the dimensionless enthalpy, h/RT.