24 Gamma = 1.008854772e-3,
32 static const double Ahydro[] = {
33 1.150470519352900e1, 1.055427998826072e3, -1.270685949968568e4,
34 7.287844527295619e4, -7.448780703363973e5, 2.328994151810363e-1,
35 -1.635308393739296e1, 3.730678064960389e3, 6.299667723184813e5,
36 1.210920358305697e-3, 1.753651095884817, -1.367022988058101e2,
37 -6.869936641299885e-3, 3.644494201750974e-2, -2.559784772600182,
38 -4.038855202905836e-4, 1.485396303520942e-6, 4.243613981060742e-4,
39 -2.307910113586888e-6, -6.082192173879582e5, -1.961080967486886e6,
40 -5.786932854076408e2, 2.799129504191752e4, -2.381566558300913e-1,
41 8.918796032452872e-1, -6.985739539036644e-5, -7.339554179182899e-3,
42 -5.597033440289980e-9, 8.842130160884514e-8, -2.655507264539047e-12,
43 -4.544474518140164e-12, 9.818775257001922e-11
45 static const double Dhydro[]= {
46 4.8645813003e1, -3.4779278180e1, 4.0776538192e2,
47 -1.1719787304e3, 1.6213924400e3, -1.1531096683e3, 3.3825492039e2
49 static const double Fhydro[]=
50 { 3.05300134164, 2.80810925813, -6.55461216567e-1, 1.59514439374 };
51 static const double Ghydro[]= {
52 6.1934792e3, 2.9490437e2, -1.5401979e3, -4.9176101e3,
53 6.8957165e4, -2.2282185e5, 3.7990059e5, -3.7094216e5, 2.1326792e5,
54 -7.1519411e4, 1.2971743e4, -9.8533014e2, 1.0434776e4,
55 -3.9144179e2, 5.8277696e2, 6.5409163e2, -1.8728847e2
58 double hydrogen::C(
int i,
double rt,
double rt2)
62 return Ahydro[0] * T + Ahydro[1] * sqrt(T) + Ahydro[2] + (Ahydro[3] + Ahydro[4] * rt) * rt;
64 return Ahydro[5] * T + Ahydro[6] + rt * (Ahydro[7] + Ahydro[8] * rt);
66 return Ahydro[9] * T + Ahydro[10] + Ahydro[11] * rt;
70 return rt*(Ahydro[13] + Ahydro[14]*rt);
74 return rt*(Ahydro[16] + Ahydro[17]*rt);
76 return Ahydro[18]*rt2;
78 return rt2*(Ahydro[19] + Ahydro[20]*rt);
80 return rt2*(Ahydro[21] + Ahydro[22]*rt2);
82 return rt2*(Ahydro[23] + Ahydro[24]*rt);
84 return rt2*(Ahydro[25] + Ahydro[26]*rt2);
86 return rt2*(Ahydro[27] + Ahydro[28]*rt);
88 return rt2*(Ahydro[29] + Ahydro[30]*rt + Ahydro[31]*rt2);
94 double hydrogen::Cprime(
int i,
double rt,
double rt2,
double rt3)
98 return Ahydro[0] + 0.5*Ahydro[1]/sqrt(T) - (Ahydro[3] + 2.0*Ahydro[4]*rt)*rt2;
100 return Ahydro[5] - rt2*(Ahydro[7] + 2.0*Ahydro[8]*rt);
102 return Ahydro[9] - Ahydro[11]*rt2;
106 return -rt2*(Ahydro[13] + 2.0*Ahydro[14]*rt);
108 return -Ahydro[15]*rt2;
110 return -rt2*(Ahydro[16] + 2.0*Ahydro[17]*rt);
112 return -2.0*Ahydro[18]*rt3;
114 return -rt3*(2.0*Ahydro[19] + 3.0*Ahydro[20]*rt);
116 return -rt3*(2.0*Ahydro[21] + 4.0*Ahydro[22]*rt2);
118 return -rt3*(2.0*Ahydro[23] + 3.0*Ahydro[24]*rt);
120 return -rt3*(2.0*Ahydro[25] + 4.0*Ahydro[26]*rt2);
122 return -rt3*(2.0*Ahydro[27] + 3.0*Ahydro[28]*rt);
124 return -rt3*(2.0*Ahydro[29] + 3.0*Ahydro[30]*rt + 4.0*Ahydro[31]*rt2);
130 double hydrogen::W(
int n,
double egrho)
132 return (n == 0 ? (1.0 - egrho)/(2.0*Gamma) :
133 (n*W(n-1, egrho) - 0.5*pow(Rho,2*n)*egrho)/Gamma);
136 double hydrogen::H(
int i,
double egrho)
138 return (i < 8 ? pow(Rho,i+2) : pow(Rho,2*i-13)*egrho);
141 double hydrogen::I(
int i,
double egrho)
143 return (i < 8 ? pow(Rho,i+1)/
double(i+1) : W(i-8, egrho));
146 double hydrogen::icv(
int i,
double x,
double xlg)
148 return (i == 0 ? x - 1 : x*pow(xlg,i) - i*icv(i-1,x,xlg));
151 double hydrogen::up()
156 double egrho = exp(-Gamma*Rho*Rho);
158 for (
int i=0; i<14; i++) {
159 sum += (C(i, rt, rt2) - T*Cprime(i, rt, rt2, rt3))*I(i, egrho);
163 sum += Ghydro[0] * (std::min(T, T1) - To);
165 double x = std::min(T, T2) / T1;
166 for (
int i = 0; i < 12; i++) {
167 sum += Ghydro[i] * T1 * icv(i, x, log(x));
172 for (
int i = 0; i < 5; i++) {
173 sum += Ghydro[i+12] * T2 * icv(i, x, log(x));
176 return sum + m_energy_offset;
179 double hydrogen::sp()
184 double egrho = exp(-Gamma*Rho*Rho);
185 double sum = s0 - R*log(Rho);
186 for (
int i=0; i<14; i++) {
187 sum -= Cprime(i, rt, rt2, rt3)*I(i, egrho);
191 sum += Ghydro[0] * log(std::min(T, T1)/ To);
193 double xlg = log(std::min(T, T2)/T1);
194 for (
int i = 0; i < 12; i++) {
195 sum += Ghydro[i] / (i + 1) * pow(xlg, i+1);
199 double xlg = log(T/T2);
200 for (
int i = 0; i < 5; i++) {
201 sum += Ghydro[i+12] / (i + 1) * pow(xlg, i+1);
204 return sum + m_entropy_offset;
207 double hydrogen::Pp()
211 double egrho = exp(-Gamma*Rho*Rho);
214 for (
int i=0; i<14; i++) {
215 P += C(i, rt, rt2)*H(i, egrho);
220 double hydrogen::ldens()
222 if ((T < Tmn) || (T > Tc)) {
224 "Temperature out of range. T = {}", T);
229 for (i=1, sum=0; i<=6; i++) {
230 sum+=Dhydro[i]*pow(x, 1+
double(i-1)/3.0);
232 return sum+Roc+Dhydro[0]*pow(x,alpha1);
235 double hydrogen::Psat()
237 double x = (1.0 - Tt/T)/(1.0 - Tt/Tc);
239 if ((T < Tmn) || (T > Tc)) {
241 "Temperature out of range. T = {}", T);
243 result = Fhydro[0]*x + Fhydro[1]*x*x + Fhydro[2]*x*x*x +
244 Fhydro[3]*x*pow(1-x, alpha);
245 return exp(result)*Pt;
248 double hydrogen::Tcrit()
252 double hydrogen::Pcrit()
256 double hydrogen::Vcrit()
260 double hydrogen::Tmin()
264 double hydrogen::Tmax()
268 double hydrogen::MolWt()
Base class for exceptions thrown by Cantera classes.
Contains declarations for string manipulation functions within Cantera.
Namespace for the Cantera kernel.