5 using namespace Cantera;
17 R = 2.59820853437877e2,
18 Gamma = 5.46895508389297e-6,
24 static const double Aoxy[] = {
25 -4.26396872798684e-1, 3.48334938784107e1, -5.77516910418738e2,
26 2.40961751553325e4, -1.23332307855543e6, 3.73585286319658e-4,
27 -1.70178244046465e-1 ,-3.33226903068473e-4, 8.61334799901291e3,
28 -6.80394661057309e-7, 7.09583347162704e-4, -5.73905688255053e-2,
29 -1.92123080811409e-7, 3.11764722329504e-8, -8.09463854745591e-6,
30 -2.22562296356501e-11, 9.18401045361994e-15, 5.75758417511114e-12,
31 -2.10752269644774e-15, 3.62884761272184e3, -1.23317754317110e6,
32 -5.03800414800672e-2, 3.30686173177055e2, -5.26259633964252e-8 ,
33 5.53075442383100e-6, -2.71042853363688e-13, -1.65732450675251e-9 ,
34 -5.82711196409204e-20, 4.42953322148281e-17 ,-2.95529679136244e-25,
35 -1.92361786708846e-23, 9.43758410350413e-23
38 static const double Foxy[] = {
39 -5.581932039e2, -1.0966262185e2, -8.3456211630e-2,
40 2.6603644330e-3, 1.6875023830e-5, -2.1262477120e-7,
41 9.5741096780e-10, -1.6617640450e-12, 2.7545605710e1
44 static const double Doxy[] =
45 { 4.3615175e2, 7.5897189e2, -4.2576866e2, 2.3487106e3, -3.0474660e3, 1.4850169e3 };
47 static const double Goxy[] = {
48 -1.29442711174062e6, 5.98231747005341e4, -8.97850772730944e2,
49 6.55236176900400e2, -1.13131252131570e-2,
50 3.4981070244228e-6, 4.21065222886885e-9, 2.67997030050139e2
53 double oxygen::C(
int i,
double rt,
double rt2)
57 return Aoxy[0] * T + Aoxy[1] * sqrt(T) + Aoxy[2] + (Aoxy[3] + Aoxy[4] * rt) * rt;
59 return Aoxy[5] * T + Aoxy[6] + rt * (Aoxy[7] + Aoxy[8] * rt);
61 return Aoxy[9] * T + Aoxy[10] + Aoxy[11] * rt;
65 return rt*(Aoxy[13] + Aoxy[14]*rt);
69 return rt*(Aoxy[16] + Aoxy[17]*rt);
73 return rt2*(Aoxy[19] + Aoxy[20]*rt);
75 return rt2*(Aoxy[21] + Aoxy[22]*rt2);
77 return rt2*(Aoxy[23] + Aoxy[24]*rt);
79 return rt2*(Aoxy[25] + Aoxy[26]*rt2);
81 return rt2*(Aoxy[27] + Aoxy[28]*rt);
83 return rt2*(Aoxy[29] + Aoxy[30]*rt + Aoxy[31]*rt2);
89 double oxygen::Cprime(
int i,
double rt,
double rt2,
double rt3)
93 return Aoxy[0] + 0.5*Aoxy[1]/sqrt(T) - (Aoxy[3] + 2.0*Aoxy[4]*rt)*rt2;
95 return Aoxy[5] - rt2*(Aoxy[7] + 2.0*Aoxy[8]*rt);
97 return Aoxy[9] - Aoxy[11]*rt2;
101 return -rt2*(Aoxy[13] + 2.0*Aoxy[14]*rt);
103 return -Aoxy[15]*rt2;
105 return -rt2*(Aoxy[16] + 2.0*Aoxy[17]*rt);
107 return -2.0*Aoxy[18]*rt3;
109 return -rt3*(2.0*Aoxy[19] + 3.0*Aoxy[20]*rt);
111 return -rt3*(2.0*Aoxy[21] + 4.0*Aoxy[22]*rt2);
113 return -rt3*(2.0*Aoxy[23] + 3.0*Aoxy[24]*rt);
115 return -rt3*(2.0*Aoxy[25] + 4.0*Aoxy[26]*rt2);
117 return -rt3*(2.0*Aoxy[27] + 3.0*Aoxy[28]*rt);
119 return -rt3*(2.0*Aoxy[29] + 3.0*Aoxy[30]*rt + 4.0*Aoxy[31]*rt2);
125 double oxygen::W(
int n,
double egrho)
127 return (n == 0 ? (1.0 - egrho)/(2.0*Gamma) :
128 (n*W(n-1, egrho) - 0.5*pow(Rho,2*n)*egrho)/Gamma);
131 double oxygen::H(
int i,
double egrho)
133 return (i < 8 ? pow(Rho,i+2) : pow(Rho,2*i-13)*egrho);
136 double oxygen::I(
int i,
double egrho)
138 return (i < 8 ? pow(Rho,i+1)/
double(i+1) : W(i-8, egrho));
146 double egrho = exp(-Gamma*Rho*Rho);
149 for (
int i=0; i<14; i++) {
150 sum += (C(i,rt,rt2) - T*Cprime(i,rt,rt2,rt3))*I(i,egrho);
153 sum += (((0.25*Goxy[6]*T + Goxy[5]/3.0)*T + 0.5*Goxy[4])*T + Goxy[3])*T + Goxy[2]*log(T)
154 - (Goxy[1] + 0.5*Goxy[0]*rt)*rt + Goxy[7]*beta/(exp(beta*rt) - 1.0) + u0;
156 return sum + m_energy_offset;
164 double egrho = exp(-Gamma*Rho*Rho);
167 sum = s0 - R*log(Rho);
168 for (
int i=0; i<14; i++) {
169 sum -= Cprime(i,rt,rt2,rt3)*I(i,egrho);
172 sum += (((Goxy[6]/3.0)*T + 0.5*Goxy[5])*T + Goxy[4])*T + Goxy[3]*log(T)
173 -((Goxy[0]*rt/3.0 + 0.5*Goxy[1])*rt + Goxy[2])*rt
174 + Goxy[7]*(beta*rt + beta*rt/(exp(beta*rt) - 1.0)
175 - log(exp(beta*rt) - 1.0));
176 return sum + m_entropy_offset;
184 double egrho = exp(-Gamma*Rho*Rho);
187 for (
int i=0; i<14; i++) {
188 P += C(i,rt,rt2)*H(i,egrho);
193 double oxygen::Psat()
197 if ((T < Tmn) || (T > Tc)) {
198 throw TPX_Error(
"oxygen::Psat",
199 "Temperature out of range. T = " +
fp2str(T));
201 for (i=0, lnp=0; i<=7; i++) {
203 lnp+=Foxy[i]*pow(Tc-T, alpha);
205 lnp+=Foxy[i]*pow(T,i-1);
212 double oxygen::ldens()
214 double xx=1-T/Tc, sum=0;
215 if ((T < Tmn) || (T > Tc)) {
216 throw TPX_Error(
"oxygen::ldens",
217 "Temperature out of range. T = " +
fp2str(T));
219 for (
int i=0; i<=5; i++) {
220 sum+=Doxy[i]*pow(xx,
double(i)/3.0);
225 double oxygen::Tcrit()
229 double oxygen::Pcrit()
233 double oxygen::Vcrit()
237 double oxygen::Tmin()
241 double oxygen::Tmax()
247 return (
char*) m_name.c_str();
249 char* oxygen::formula()
251 return (
char*) m_formula.c_str();
253 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.