Cantera  2.3.0
lk.cpp
Go to the documentation of this file.
1 //! @file lk.cpp Lee-Kesler equation of state
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at http://www.cantera.org/license.txt for license and copyright information.
5 
6 #include "lk.h"
7 #include <math.h>
8 
9 namespace tpx
10 {
11 
12 static double b[2][4] = {{0.1181193, 0.265728, 0.154790, 0.030323},
13  {0.2026579, 0.331511, 0.027655, 0.203488}
14 };
15 static double c[2][4] = {{0.0236744, 0.0186984, 0.0, 0.042724},
16  {0.0313385, 0.0503618, 0.016901, 0.041577}
17 };
18 static double d[2][2] = {{1.55488e-5, 6.23689e-5},{4.8736e-5, 0.740336e-5}};
19 static double beta[2] = {0.65392, 1.226};
20 static double gamma[2] = {0.060167, 0.03754};
21 
22 //--------------------------- member functions ------------------
23 
24 double leekesler::W(int n, double egrho, double Gamma)
25 {
26  return (n == 0 ? (1.0 - egrho)/(2.0*Gamma) :
27  (n*W(n-1, egrho, Gamma) - 0.5*pow(Rho,2*n)*egrho)/Gamma);
28 }
29 
30 double leekesler::up()
31 {
32  return -(8314.3/Mw)*T*(1.0 + T*I()/Tcr); // + h_0(T)
33 }
34 
35 double leekesler::hdep()
36 {
37  double tr = T/Tcr;
38  return tr*tr*I() + (1.0 - z())*tr;
39 }
40 
41 double leekesler::sdep()
42 {
43  double tr = T/Tcr;
44  return tr*I() + J() - log(z());
45 }
46 
47 double leekesler::sp()
48 {
49  const double Pref = 101325.0;
50  double rgas = 8314.3/Mw;
51  return rgas*(log(Pref/(Rho*rgas*T)) - (T/Tcr)*I() - J());
52 }
53 
54 double leekesler::I() // \int_0^\rho_r (1/\rho_r)(dZ/dT_r) d\rho_r
55 {
56  double Bp, Cp, Dp;
57  double rtr = Tcr/T;
58  double rtr2 = rtr*rtr;
59  double rvr = 8314.3*Tcr*Rho/(Pcr*Mw); // 1/v_r^\prime
60  double rvr2 = rvr*rvr;
61  double egrho;
62 
63  egrho = exp(-gamma[Isr]*rvr2);
64  Bp = rtr2*b[Isr][1] + 2.0*rtr*rtr2*b[Isr][2] + 3.0*rtr2*rtr2*b[Isr][3];
65  Cp = rtr2*c[Isr][1] - 3.0*c[Isr][2]*rtr2*rtr2;
66  Dp = -d[Isr][1]*rtr2;
67  double r = Bp*rvr + 0.5*rvr2*Cp + 0.2*pow(rvr,5)*Dp
68  - 3.0*c[Isr][3]*rtr2*rtr2*(beta[Isr]*W(0,egrho,gamma[Isr])
69  + gamma[Isr]*W(1,egrho,gamma[Isr]));
70  return r;
71 }
72 
73 double leekesler::J() // \int_0^\rho_r (1/\rho_r)(Z - 1) d\rho_r
74 {
75  double BB, CC, DD;
76  double rtr = Tcr/T;
77  double rtr2 = rtr*rtr;
78  double rvr = 8314.3*Tcr*Rho/(Pcr*Mw); // 1/v_r^\prime
79  double rvr2 = rvr*rvr;
80  double egrho;
81 
82  egrho = exp(-gamma[Isr]*rvr2);
83  BB = b[Isr][0] - rtr*(b[Isr][1]
84  + rtr*(b[Isr][2] + rtr*b[Isr][3]));
85  CC = c[Isr][0] - rtr*(c[Isr][1] - c[Isr][2]*rtr*rtr);
86  DD = d[Isr][0] + d[Isr][1]*rtr;
87  double r = BB*rvr + 0.5*rvr2*CC + 0.2*pow(rvr,5)*DD
88  + c[Isr][3]*rtr2*rtr*(beta[Isr]*W(0,egrho,gamma[Isr])
89  + gamma[Isr]*W(1,egrho,gamma[Isr]));
90  return r;
91 }
92 
93 double leekesler::z()
94 {
95  double zz, rvr2, BB, CC, DD, EE;
96  double rtr = Tcr/T; // 1/T_r
97  double rvr = Rho*8314.3*Tcr/(Pcr*Mw);
98  rvr2 = rvr*rvr;
99  BB = b[Isr][0] - rtr*(b[Isr][1]
100  + rtr*(b[Isr][2] + rtr*b[Isr][3]));
101  CC = c[Isr][0] - rtr*(c[Isr][1] - c[Isr][2]*rtr*rtr);
102  DD = d[Isr][0] + d[Isr][1]*rtr;
103  EE = exp(-gamma[Isr]*rvr2);
104 
105  zz = 1.0 + BB*rvr + CC*rvr2 + DD*pow(rvr,5)
106  + c[Isr][3]*pow(rtr,3)*rvr2*
107  (beta[Isr] + gamma[Isr]*rvr2)*EE;
108  return zz;
109 }
110 
111 double leekesler::Pp()
112 {
113  return 8314.3*z()*Rho*T/Mw;
114 }
115 
117 {
118  double tr = 1.0 - Tcr/T;
119  double lpr;
120 
121  if (Isr == 0) {
122  lpr = 5.395743797*tr + 0.05524287*tr*tr + 0.06853005*tr*tr*tr;
123  } else {
124  lpr = 7.259961465*tr - 0.549206092*tr*tr + 0.177581752*tr*tr*tr;
125  }
126  return Pcr*exp(lpr);
127 }
128 
129 double leekesler::ldens()
130 {
131  double x = 1.0 - T/Tcr;
132 
133  // for simple fluid
134  double rho_r;
135  if (Isr == 0) {
136  rho_r = 5.2307 + 15.16*x - 21.9778*x*x + 18.767*x*x*x;
137  } else {
138  rho_r = 6.166930606 + 17.42866964*x - 18.62589833*x*x
139  + 11.73957224*x*x*x;
140  rho_r *= 1.0;
141  }
142  return Pcr*rho_r*Mw/(8314.3*Tcr);
143 }
144 
146 {
147  return Tcr;
148 }
150 {
151  return Pcr;
152 }
154 {
155  return 0.2901*8314.3*Tcr/(Pcr*Mw);
156 }
158 {
159  return -100.0;
160 }
162 {
163  return 10000.0;
164 }
166 {
167  return Mw;
168 }
169 }
double x()
Vapor mass fraction.
Definition: Sub.cpp:217
double Vcrit()
Critical specific volume [m^3/kg].
Definition: lk.cpp:153
double Pcrit()
Critical pressure [Pa].
Definition: lk.cpp:149
double up()
Internal energy of a single-phase state.
Definition: lk.cpp:30
double MolWt()
Molecular weight [kg/kmol].
Definition: lk.cpp:165
double Tcrit()
Critical temperature [K].
Definition: lk.cpp:145
double Psat()
Saturation pressure, Pa.
Definition: lk.cpp:116
double Tmax()
Maximum temperature for which the equation of state is valid.
Definition: lk.cpp:161
double sp()
Entropy of a single-phase state.
Definition: lk.cpp:47
double Tmin()
Minimum temperature for which the equation of state is valid.
Definition: lk.cpp:157
Lee-Kesler equation of state.