5 using namespace Cantera;
16 R = 2.59820853437877e2,
17 Gamma = 5.46895508389297e-6,
23 static const double Aoxy[] = {
24 -4.26396872798684e-1, 3.48334938784107e1, -5.77516910418738e2,
25 2.40961751553325e4, -1.23332307855543e6, 3.73585286319658e-4,
26 -1.70178244046465e-1 ,-3.33226903068473e-4, 8.61334799901291e3,
27 -6.80394661057309e-7, 7.09583347162704e-4, -5.73905688255053e-2,
28 -1.92123080811409e-7, 3.11764722329504e-8, -8.09463854745591e-6,
29 -2.22562296356501e-11, 9.18401045361994e-15, 5.75758417511114e-12,
30 -2.10752269644774e-15, 3.62884761272184e3, -1.23317754317110e6,
31 -5.03800414800672e-2, 3.30686173177055e2, -5.26259633964252e-8 ,
32 5.53075442383100e-6, -2.71042853363688e-13, -1.65732450675251e-9 ,
33 -5.82711196409204e-20, 4.42953322148281e-17 ,-2.95529679136244e-25,
34 -1.92361786708846e-23, 9.43758410350413e-23
37 static const double Foxy[] = {
38 -5.581932039e2, -1.0966262185e2, -8.3456211630e-2,
39 2.6603644330e-3, 1.6875023830e-5, -2.1262477120e-7,
40 9.5741096780e-10, -1.6617640450e-12, 2.7545605710e1
43 static const double Doxy[] =
44 { 4.3615175e2, 7.5897189e2, -4.2576866e2, 2.3487106e3, -3.0474660e3, 1.4850169e3 };
46 static const double Goxy[] = {
47 -1.29442711174062e6, 5.98231747005341e4, -8.97850772730944e2,
48 6.55236176900400e2, -1.13131252131570e-2,
49 3.4981070244228e-6, 4.21065222886885e-9, 2.67997030050139e2
52 double oxygen::C(
int i,
double rt,
double rt2)
56 return Aoxy[0] * T + Aoxy[1] * sqrt(T) + Aoxy[2] + (Aoxy[3] + Aoxy[4] * rt) * rt;
58 return Aoxy[5] * T + Aoxy[6] + rt * (Aoxy[7] + Aoxy[8] * rt);
60 return Aoxy[9] * T + Aoxy[10] + Aoxy[11] * rt;
64 return rt*(Aoxy[13] + Aoxy[14]*rt);
68 return rt*(Aoxy[16] + Aoxy[17]*rt);
72 return rt2*(Aoxy[19] + Aoxy[20]*rt);
74 return rt2*(Aoxy[21] + Aoxy[22]*rt2);
76 return rt2*(Aoxy[23] + Aoxy[24]*rt);
78 return rt2*(Aoxy[25] + Aoxy[26]*rt2);
80 return rt2*(Aoxy[27] + Aoxy[28]*rt);
82 return rt2*(Aoxy[29] + Aoxy[30]*rt + Aoxy[31]*rt2);
88 double oxygen::Cprime(
int i,
double rt,
double rt2,
double rt3)
92 return Aoxy[0] + 0.5*Aoxy[1]/sqrt(T) - (Aoxy[3] + 2.0*Aoxy[4]*rt)*rt2;
94 return Aoxy[5] - rt2*(Aoxy[7] + 2.0*Aoxy[8]*rt);
96 return Aoxy[9] - Aoxy[11]*rt2;
100 return -rt2*(Aoxy[13] + 2.0*Aoxy[14]*rt);
102 return -Aoxy[15]*rt2;
104 return -rt2*(Aoxy[16] + 2.0*Aoxy[17]*rt);
106 return -2.0*Aoxy[18]*rt3;
108 return -rt3*(2.0*Aoxy[19] + 3.0*Aoxy[20]*rt);
110 return -rt3*(2.0*Aoxy[21] + 4.0*Aoxy[22]*rt2);
112 return -rt3*(2.0*Aoxy[23] + 3.0*Aoxy[24]*rt);
114 return -rt3*(2.0*Aoxy[25] + 4.0*Aoxy[26]*rt2);
116 return -rt3*(2.0*Aoxy[27] + 3.0*Aoxy[28]*rt);
118 return -rt3*(2.0*Aoxy[29] + 3.0*Aoxy[30]*rt + 4.0*Aoxy[31]*rt2);
124 double oxygen::W(
int n,
double egrho)
126 return (n == 0 ? (1.0 - egrho)/(2.0*Gamma) :
127 (n*W(n-1, egrho) - 0.5*pow(Rho,2*n)*egrho)/Gamma);
130 double oxygen::H(
int i,
double egrho)
132 return (i < 8 ? pow(Rho,i+2) : pow(Rho,2*i-13)*egrho);
135 double oxygen::I(
int i,
double egrho)
137 return (i < 8 ? pow(Rho,i+1)/
double(i+1) : W(i-8, egrho));
145 double egrho = exp(-Gamma*Rho*Rho);
148 for (
int i=0; i<14; i++) {
149 sum += (C(i,rt,rt2) - T*Cprime(i,rt,rt2,rt3))*I(i,egrho);
152 sum += (((0.25*Goxy[6]*T + Goxy[5]/3.0)*T + 0.5*Goxy[4])*T + Goxy[3])*T + Goxy[2]*log(T)
153 - (Goxy[1] + 0.5*Goxy[0]*rt)*rt + Goxy[7]*beta/(exp(beta*rt) - 1.0) + u0;
155 return sum + m_energy_offset;
163 double egrho = exp(-Gamma*Rho*Rho);
166 sum = s0 - R*log(Rho);
167 for (
int i=0; i<14; i++) {
168 sum -= Cprime(i,rt,rt2,rt3)*I(i,egrho);
171 sum += (((Goxy[6]/3.0)*T + 0.5*Goxy[5])*T + Goxy[4])*T + Goxy[3]*log(T)
172 -((Goxy[0]*rt/3.0 + 0.5*Goxy[1])*rt + Goxy[2])*rt
173 + Goxy[7]*(beta*rt + beta*rt/(exp(beta*rt) - 1.0)
174 - log(exp(beta*rt) - 1.0));
175 return sum + m_entropy_offset;
182 double egrho = exp(-Gamma*Rho*Rho);
185 for (
int i=0; i<14; i++) {
186 P += C(i,rt,rt2)*H(i,egrho);
191 double oxygen::Psat()
195 if ((T < Tmn) || (T > Tc)) {
196 throw TPX_Error(
"oxygen::Psat",
197 "Temperature out of range. T = " +
fp2str(T));
199 for (i=0, lnp=0; i<=7; i++) {
201 lnp+=Foxy[i]*pow(Tc-T, alpha);
203 lnp+=Foxy[i]*pow(T,i-1);
210 double oxygen::ldens()
212 double xx=1-T/Tc, sum=0;
213 if ((T < Tmn) || (T > Tc)) {
214 throw TPX_Error(
"oxygen::ldens",
215 "Temperature out of range. T = " +
fp2str(T));
217 for (
int i=0; i<=5; i++) {
218 sum+=Doxy[i]*pow(xx,
double(i)/3.0);
223 double oxygen::Tcrit()
227 double oxygen::Pcrit()
231 double oxygen::Vcrit()
235 double oxygen::Tmin()
239 double oxygen::Tmax()
243 double oxygen::MolWt()
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
Contains declarations for string manipulation functions within Cantera.