13static const double M = 28.01348,
19 R = 2.96790515164171e2,
20 Gamma = 7.13602531283233e-6,
26static const double Ann[] = {
27 1.75889959256970e-1, 1.38197604384933e1, -3.14918412133921e2,
28 4.40300150239380e3, -5.45358971644916e5, 4.84413320182919e-4,
29 -5.18964416491365e-2, 6.57265859197103e-4 ,8.51299771713314e4 ,
30 1.33459405162578e-8, 3.83381319826746e-4, -8.35421151028455e-2,
32 -2.38296116270360e-7, -1.48321912935764e-4, 5.62605853190540e-10,
33 -2.98201050924595e-13, 9.85319087685241e-11, -1.92002176056468e-14,
34 -7.82250103373122e4, -5.51801778744598e5, -5.72781957607352e-1,
35 3.25760529488327e2, -1.34659309828737e-6, -1.92036423064911e-5,
36 -3.94564337674524e-12,-2.44388245328965e-9, -1.50970602460077e-18,
37 1.25854885346038e-16,-8.34271144923969e-24, -1.17299202018417e-22,
41static const double Fnn[]= {
42 8.3944094440e3, -1.8785191705e3, -7.2822291650,
43 1.0228509660e-2, 5.5560638250e-4,
44 -5.9445446620e-6, 2.7154339320e-8,
45 -4.8795359040e-11, 5.0953608240e2
48static const double Dnn[] = {
49 3.1402991e2, 4.4111015e2, 9.4622994e2 ,
50 -2.9067111e3, 4.4785979e3, -2.2746914e3
53static const double Gnn[] = {
54 -2.18203473713518e5, 1.01573580096247e4, -1.65504721657240e2,
55 7.43175999190430e2, -5.14605623546025e-3,
56 5.18347156760489e-6, -1.05922170493616e-9, 2.98389393363817e2
63 return Ann[0] * T + Ann[1] * sqrt(T)
64 + Ann[2] + (Ann[3] + Ann[4] * rt) * rt;
66 return Ann[5] * T + Ann[6] + rt * (Ann[7] + Ann[8] * rt);
68 return Ann[9] * T + Ann[10] + Ann[11] * rt;
72 return rt*(Ann[13] + Ann[14]*rt);
76 return rt*(Ann[16] + Ann[17]*rt);
80 return rt2*(Ann[19] + Ann[20]*rt);
82 return rt2*(Ann[21] + Ann[22]*rt2);
84 return rt2*(Ann[23] + Ann[24]*rt);
86 return rt2*(Ann[25] + Ann[26]*rt2);
88 return rt2*(Ann[27] + Ann[28]*rt);
90 return rt2*(Ann[29] + Ann[30]*rt + Ann[31]*rt2);
96double nitrogen::Cprime(
int i,
double rt,
double rt2,
double rt3)
100 return Ann[0] + 0.5*Ann[1]/sqrt(T) - (Ann[3] + 2.0*Ann[4]*rt)*rt2;
102 return Ann[5] - rt2*(Ann[7] + 2.0*Ann[8]*rt);
104 return Ann[9] - Ann[11]*rt2;
108 return -rt2*(Ann[13] + 2.0*Ann[14]*rt);
112 return -rt2*(Ann[16] + 2.0*Ann[17]*rt);
114 return -2.0*Ann[18]*rt3;
116 return -rt3*(2.0*Ann[19] + 3.0*Ann[20]*rt);
118 return -rt3*(2.0*Ann[21] + 4.0*Ann[22]*rt2);
120 return -rt3*(2.0*Ann[23] + 3.0*Ann[24]*rt);
122 return -rt3*(2.0*Ann[25] + 4.0*Ann[26]*rt2);
124 return -rt3*(2.0*Ann[27] + 3.0*Ann[28]*rt);
126 return -rt3*(2.0*Ann[29] + 3.0*Ann[30]*rt + 4.0*Ann[31]*rt2);
132double nitrogen::W(
int n,
double egrho)
134 return (n == 0 ? (1.0 - egrho)/(2.0*Gamma) :
135 (n*W(n-1, egrho) - 0.5*pow(Rho,2*n)*egrho)/Gamma);
138double nitrogen::H(
int i,
double egrho)
140 return (i < 8 ? pow(Rho,i+2) : pow(Rho,2*i-13)*egrho);
143double nitrogen::I(
int i,
double egrho)
145 return (i < 8 ? pow(Rho,i+1)/
double(i+1) : W(i-8, egrho));
153 double egrho = exp(-Gamma*Rho*Rho);
156 for (
int i=0; i<14; i++) {
157 sum += (
C(i,rt,rt2) - T*Cprime(i,rt,rt2,rt3))*I(i,egrho);
159 sum += (((0.25*Gnn[6]*T + Gnn[5]/3.0)*T
160 + 0.5*Gnn[4])*T + Gnn[3])*T + Gnn[2]*log(T)
161 - (Gnn[1] + 0.5*Gnn[0]*rt)*rt
162 + Gnn[7]*beta/(exp(beta*rt) - 1.0) + u0
172 double egrho = exp(-Gamma*Rho*Rho);
175 sum = s0 + m_entropy_offset - R*log(Rho);
176 for (
int i=0; i<14; i++) {
177 sum -= Cprime(i,rt,rt2,rt3)*I(i,egrho);
179 sum += (((Gnn[6]/3.0)*T + 0.5*Gnn[5])*T + Gnn[4])*T + Gnn[3]*log(T)
180 -((Gnn[0]*rt/3.0 + 0.5*Gnn[1])*rt + Gnn[2])*rt
181 + Gnn[7]*(beta*rt + beta*rt/(exp(beta*rt) - 1.0)
182 - log(exp(beta*rt) - 1.0));
190 double egrho = exp(-Gamma*Rho*Rho);
193 for (
int i=0; i<14; i++) {
194 P +=
C(i,rt,rt2)*H(i,egrho);
203 if ((T < Tmn) || (T > Tc)) {
205 "Temperature out of range. T = {}", T);
207 for (i=0, lnp=0; i<=7; i++) {
209 lnp+=Fnn[i]*pow(Tc-T, alpha);
211 lnp+=Fnn[i]*pow(T,i-1);
220 double xx=1-T/Tc, sum=0;
221 if ((T < Tmn) || (T > Tc)) {
223 "Temperature out of range. T = {}", T);
225 for (
int i=0; i<=5; i++) {
226 sum+=Dnn[i]*pow(xx,
double(i)/3.0);
Base class for exceptions thrown by Cantera classes.
double Vcrit()
Critical specific volume [m^3/kg].
double Tmax()
Maximum temperature for which the equation of state is valid.
double Tmin()
Minimum temperature for which the equation of state is valid.
double MolWt()
Molecular weight [kg/kmol].
double C(int i, double rt, double rt2)
Equation P4 from Reynolds TPSI.
double sp()
Entropy of a single-phase state.
double Tcrit()
Critical temperature [K].
double Pcrit()
Critical pressure [Pa].
double Psat()
Saturation pressure. Equation S4 from Reynolds TPSI.
double ldens()
Liquid density. Equation D2 from Reynolds TPSI.
double up()
Internal energy of a single-phase state.
Namespace for the Cantera kernel.
Contains declarations for string manipulation functions within Cantera.