CoolProp  4.2.5
An open-source fluid property and humid air property database
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Air.cpp
Go to the documentation of this file.
1 /* Properties of Air
2 by Ian Bell
3 */
4 
5 #if defined(_MSC_VER)
6 #define _CRTDBG_MAP_ALLOC
7 #define _CRT_SECURE_NO_WARNINGS
8 #include <stdlib.h>
9 #include <crtdbg.h>
10 #else
11 #include <stdlib.h>
12 #endif
13 
14 #include "math.h"
15 #include "stdio.h"
16 #include <string.h>
17 #include "CoolProp.h"
18 #include "FluidClass.h"
19 #include "Air.h"
20 
22 {
23  static const double N[]={0,
24  0.118160747229,//[1]
25  0.713116392079,//[2]
26  -0.161824192067e1,//[3]
27  0.714140178971e-1,//[4]
28  -0.865421396646e-1,//[5]
29  0.134211176704,//[6]
30  0.112626704218e-1,//[7]
31  -0.420533228842e-1,//[8]
32  0.349008431982e-1,//[9]
33  0.164957183186e-3,//[10]
34  -0.101365037912,//[11]
35  -0.173813690970,//[12]
36  -0.472103183731e-1,//[13]
37  -0.122523554253e-1,//[14]
38  -0.146629609713,//[15]
39  -0.316055879821e-1,//[16]
40  0.233594806142e-3,//[17]
41  0.148287891978e-1,//[18]
42  -0.938782884667e-2//[19]
43  };
44 
45  static const double d[]={0,
46  1,//[1]
47  1,//[2]
48  1,//[3]
49  2,//[4]
50  3,//[5]
51  3,//[6]
52  4,//[7]
53  4,//[8]
54  4,//[9]
55  6,//[10]
56  1,//[11]
57  3,//[12]
58  5,//[13]
59  6,//[14]
60  1,//[15]
61  3,//[16]
62  11,//[17]
63  1,//[18]
64  3//[19]
65  };
66 
67  static const double t[]={0.00,
68  0,//[1]
69  0.33,//[2]
70  1.01,//[3]
71  0,//[4]
72  0,//[5]
73  0.15,//[6]
74  0,//[7]
75  0.2,//[8]
76  0.35,//[9]
77  1.35,//[10]
78  1.6,//[11]
79  0.8,//[12]
80  0.95,//[13]
81  1.25,//[14]
82  3.6,//[15]
83  6,//[16]
84  3.25,//[17]
85  3.5,//[18]
86  15//[19]
87  };
88 
89  static const double l[]={
90  0,0,0,0,0,0,0,0,0,0,0, // indices [0-10]
91  1,//[11]
92  1,//[12]
93  1,//[13]
94  1,//[14]
95  2,//[15]
96  2,//[16]
97  2,//[17]
98  3,//[18]
99  3,//[19]
100  };
101 
102  //Constants for ideal gas expression
103  static const double N0[]={0.0,
104  0.605719400e-7,//[1]
105  -0.210274769e-4,//[2]
106  -0.158860716e-3,//[3]
107  -13.841928076,//[4]
108  17.275266575,//[5]
109  -0.195363420e-3,//[6]
110  2.490888032,//[7]
111  0.791309509,//[8]
112  0.212236768,//[9]
113  -0.197938904,//[10]
114  25.36365,//[11]
115  16.90741,//[12]
116  87.31279//[13]
117  };
118 
119  phirlist.push_back(new phir_power(N,d,t,l,1,19,20));
120 
121  /*
122  phi0=log(delta);
123  for (k=1;k<=5;k++)
124  {
125  phi0=phi0+N0[k]*powInt(tau,k-4);
126  }
127  phi0+=N0[6]*pow(tau,1.5)+N0[7]*log(tau);
128  for (k=8;k<=9;k++)
129  {
130  phi0+=N0[k]*log(1.0-exp(-N0[k+3]*tau));
131  }
132  phi0+=N0[10]*log(2.0/3.0+exp(N0[13]*tau));
133  */
134  std::vector<double> N0_v(N0,N0+sizeof(N0)/sizeof(double));
135  std::vector<double> theta0_v(N0,N0+sizeof(N0)/sizeof(double));
136  // Set some constants
137  theta0_v[1]=1-4;
138  theta0_v[2]=2-4;
139  theta0_v[3]=3-4;
140  theta0_v[4]=4-4;
141  theta0_v[5]=5-4;
142  theta0_v[6]=1.5;
143  theta0_v[8]=N0_v[11];
144  theta0_v[9]=N0_v[12];
145  theta0_v[10]=N0_v[13];
146 
147  phi0list.push_back(new phi0_lead(0.0,0.0));
148  phi0list.push_back(new phi0_power(N0_v,theta0_v,1,5));
149  phi0list.push_back(new phi0_power(N0_v[6],1.5));
150  phi0list.push_back(new phi0_logtau(N0_v[7]));
151  phi0list.push_back(new phi0_Planck_Einstein(N0_v,theta0_v,8,9));
152  phi0list.push_back(new phi0_Planck_Einstein2(N0_v[10],theta0_v[10],2.0/3.0));
153 
154  // Critical parameters (max condensing temperature)
155  crit.rho = 11.8308*28.96546;
156  crit.p = PressureUnit(3786.0,UNIT_KPA);
157  crit.T = 132.5306;
158  crit.v = 1.0/crit.rho;
159 
160  maxcondT.rho = 10.4477*28.96546;
161  maxcondT.p = PressureUnit(3785.02,UNIT_KPA);
162  maxcondT.T = 132.6312;
163  maxcondT.v = 1.0/maxcondT.rho;
164 
165  // Other fluid parameters
166  params.molemass = 28.96546;
167  params.Ttriple = 59.75;
168  params.ptriple = 2.44582352329;
169  params.accentricfactor = 0.0816749632704;
170  params.R_u = 8.31451;
171  isPure = false;
172  preduce = &maxcondT;
173 
174  // Limits of EOS
175  limits.Tmin = 60;
176  limits.Tmax = 2000.0;
177  limits.pmax = 2000000.0;
178  limits.rhomax = 14.21*params.molemass;
179 
180  EOSReference.assign("Lemmon, E.W., Jacobsen, R.T, Penoncello, S.G., and Friend, D.G.,"
181  "\"Thermodynamic Properties of Air and Mixtures of Nitrogen, Argon, and"
182  " Oxygen from 60 to 2000 K at Pressures to 2000 MPa,"
183  " J. Phys. Chem. Ref. Data, 29(3):331-385, 2000.");
184  TransportReference.assign("E.W. Lemmon and R. T. Jacobsen, \"Viscosity and Thermal Conductivity Equations for "
185  "Nitrogen, Oxygen, Argon, and Air\", "
186  "International Journal of Thermophysics, Vol. 25, No. 1, January 2004");
187 
188  name.assign("Air");
189  aliases.push_back("air");
190  aliases.push_back(std::string("AIR"));
191 
192  BibTeXKeys.EOS = "Lemmon-JPCRD-2000";
193  BibTeXKeys.VISCOSITY = "Lemmon-IJT-2004";
194  BibTeXKeys.CONDUCTIVITY = "Lemmon-IJT-2004";
195  BibTeXKeys.SURFACE_TENSION = "Mulero-JPCRD-2012";
196 }
197 
198 double AirClass::rhosatL(double T)
199 {
200  const double ti[]={0,0.65,0.85,0.95,1.1};
201  const double Ni[]={0,44.3413,-240.073,285.139,-88.3366,-0.892181};
202  double summer=0; int k;
203  for (k=1;k<=4;k++)
204  {
205  summer=summer+Ni[k]*pow(1.0-T/reduce.T,ti[k]);
206  }
207  return reduce.rho*(1+summer+Ni[5]*log(T/reduce.T));
208 }
209 
210 double AirClass::rhosatV(double T)
211 {
212  const double ti[]={0,0.41,1.0,2.8,6.5};
213  const double Ni[]={0,-2.0466,-4.7520,-13.259,-47.652};
214  double summer=0; int k;
215  for (k=1;k<=4;k++)
216  {
217  summer=summer+Ni[k]*pow(1.0-T/reduce.T,ti[k]);
218  }
219  return reduce.rho*exp(summer);
220 }
221 
222 double AirClass::psatL(double T)
223 {
224  const double Ni[]={0,0.2260724,-7.080499,5.700283,-12.44017,17.81926,-10.81364};
225  double summer=0; int k;
226  for (k=1;k<=6;k++)
227  {
228  summer=summer+Ni[k]*pow(1-T/reduce.T,((double)k)/2.0);
229  }
230  double p = reduce.p.Pa*exp(reduce.T/T*summer);
231  return p;
232 }
233 
234 double AirClass::psatV(double T)
235 {
236  const double Ni[]={0,-0.1567266,-5.539635,0,0,0.7567212,0,0,-3.514322};
237  double summer=0; int k;
238  for (k=1;k<=8;k++)
239  {
240  summer=summer+Ni[k]*pow(1-T/reduce.T,((double)k)/2.0);
241  }
242  double p = reduce.p.Pa*exp(reduce.T/T*summer);
243  return p;
244 }
245 
246 double AirClass::viscosity_Trho(double T, double rho)
247 {
248  /*
249  E.W. Lemmon and R.T Jacobsen, Viscosity and Thermal Conductivity Equations for Nitrogen, Oxygen, Argon and Air
250  International Journal of Thermophysics, Vol. 25, No. 1, January 2004, p.28
251  */
252 
253  double e_k=103.3, //[K]
254  sigma=0.360; //[nm]
255  double eta0,etar,OMEGA,delta,tau,Tstar;
256  double b[]={0.431,-0.4623,0.08406,0.005341,-0.00331};
257 
258  // Ideal-gas part
259  Tstar = T/(e_k);
260  OMEGA=exp(b[0]*powInt(log(Tstar),0)
261  +b[1]*powInt(log(Tstar),1)
262  +b[2]*powInt(log(Tstar),2)
263  +b[3]*powInt(log(Tstar),3)
264  +b[4]*powInt(log(Tstar),4));
265 
266  eta0=0.0266958*sqrt(28.9586*T)/(sigma*sigma*OMEGA);
267 
268  // Residual part
269  double N[]={0,10.72,1.122,0.002019,-8.876,-0.02916};
270  double t[]={0,0.2,0.05,2.4,0.6,3.6};
271  double d[]={0,1,4,9,1,8};
272  double l[]={0,0,0,0,1,1};
273  double g[]={0,0,0,0,1,1};
274  delta = rho/(10.4477*28.9586);
275  tau = 132.6312/T;
276  etar=N[1]*pow(tau,t[1])*pow(delta,d[1])*exp(-g[1]*pow(delta,l[1]))
277  +N[2]*pow(tau,t[2])*pow(delta,d[2])*exp(-g[2]*pow(delta,l[2]))
278  +N[3]*pow(tau,t[3])*pow(delta,d[3])*exp(-g[3]*pow(delta,l[3]))
279  +N[4]*pow(tau,t[4])*pow(delta,d[4])*exp(-g[4]*pow(delta,l[4]))
280  +N[5]*pow(tau,t[5])*pow(delta,d[5])*exp(-g[5]*pow(delta,l[5]));
281 
282  return (eta0+etar)/1e6; // uPa-s to Pa-s
283 }
284 
285 double AirClass::X_tilde(double T,double tau,double delta)
286 {
287  // X_tilde is dimensionless
288  // Equation 11 slightly rewritten
289  double drho_dp,R_Air;
290  R_Air = params.R_u/params.molemass;
291  drho_dp=1.0/(R_Air*T*(1+2*delta*dphir_dDelta(tau,delta)+delta*delta*d2phir_dDelta2(tau,delta)));
292  return crit.p.Pa*delta/crit.rho*drho_dp;
293 }
294 
295 double AirClass::conductivity_Trho(double T, double rho)
296 {
297  /*
298  E.W. Lemmon and R.T Jacobsen, Viscosity and Thermal Conductivity Equations for Nitrogen, Oxygen, Argon and Air
299  International Journal of Thermophysics, Vol. 25, No. 1, January 2004, p.28
300  */
301  double e_k=103.3, //[K]
302  sigma=0.360, //[nm]
303  Tref=265.262, //[K]
304  zeta0=0.11, //[nm]
305  LAMBDA=0.055,
306  q_D=0.31; //[nm]
307  double eta0,OMEGA,delta,tau,Tstar,lambda0,lambdar,num,
308  cp,cv,OMEGA_tilde,OMEGA_tilde0,zeta,nu,gamma,R0,lambdac,k,
309  pi=3.141592654,mu;
310  double b[]={0.431,-0.4623,0.08406,0.005341,-0.00331};
311 
312  double N[]={0,1.308,1.405,-1.036,8.743,14.76,-16.62,3.793,-6.142,-0.3778};
313  double t[]={0,0,-1.1,-0.3,0.1,0.0,0.5,2.7,0.3,1.3};
314  double d[]={0,0,0,0,1,2,3,7,7,11};
315  double l[]={0,0,0,0,0,0,2,2,2,2};
316  double g[]={0,0,0,0,0,0,1,1,1,1};
317 
318  delta=rho/(10.4477*28.9586);
319  tau=132.6312/T;
320  Tstar=T/(e_k);
321 
322  OMEGA=exp(b[0]*powInt(log(Tstar),0)
323  +b[1]*powInt(log(Tstar),1)
324  +b[2]*powInt(log(Tstar),2)
325  +b[3]*powInt(log(Tstar),3)
326  +b[4]*powInt(log(Tstar),4));
327 
328  eta0=0.0266958*sqrt(28.9586*T)/(sigma*sigma*OMEGA);
329  lambda0=N[1]*eta0+N[2]*pow(tau,t[2])+N[3]*pow(tau,t[3]);
330 
331  lambdar=N[4]*pow(tau,t[4])*pow(delta,d[4])*exp(-g[4]*pow(delta,l[4]))
332  +N[5]*pow(tau,t[5])*pow(delta,d[5])*exp(-g[5]*pow(delta,l[5]))
333  +N[6]*pow(tau,t[6])*pow(delta,d[6])*exp(-g[6]*pow(delta,l[6]))
334  +N[7]*pow(tau,t[7])*pow(delta,d[7])*exp(-g[7]*pow(delta,l[7]))
335  +N[8]*pow(tau,t[8])*pow(delta,d[8])*exp(-g[8]*pow(delta,l[8]))
336  +N[9]*pow(tau,t[9])*pow(delta,d[9])*exp(-g[9]*pow(delta,l[9]));
337 
338  R0=1.01;
339  nu=0.63;
340  gamma=1.2415;
341  k=1.380658e-23; //[J/K]
342 
343  num=X_tilde(T,crit.T/T,delta)-X_tilde(Tref,crit.T/Tref,delta)*Tref/T;
344 
345  // no critical enhancement if numerator of Eq. 10 is negative
346  if (num<0)
347  return (lambda0+lambdar)/1e3;
348 
349  cp = specific_heat_p_Trho(T,rho); //[J/kg/K]
350  cv = specific_heat_v_Trho(T,rho); //[J/kg/K]
351  mu = viscosity_Trho(T,rho)*1e6; //[uPa-s]
352 
353  zeta=zeta0*pow(num/LAMBDA,nu/gamma); //[nm]
354  OMEGA_tilde=2.0/pi*((cp-cv)/cp*atan(zeta/q_D)+cv/cp*(zeta/q_D));
355  OMEGA_tilde0=2.0/pi*(1.-exp(-1./(q_D/zeta+1.0/3.0*(zeta/q_D)*(zeta/q_D)/delta/delta)));
356  lambdac=rho*cp*k*R0*T/(6*pi*zeta*mu)*(OMEGA_tilde-OMEGA_tilde0)*1e18; // 1e18 is conversion to mW/m-K (not described in paper)
357 
358  return (lambda0+lambdar+lambdac)/1e3;
359 }
360 
361 //
362 //double phi0_Air(double tau, double delta)
363 //{
364 // double phi0=0;
365 // int k;
366 //
367 // phi0=log(delta);
368 // for (k=1;k<=5;k++)
369 // {
370 // phi0=phi0+N0[k]*powInt(tau,k-4);
371 // }
372 // phi0+=N0[6]*pow(tau,1.5)+N0[7]*log(tau);
373 // for (k=8;k<=9;k++)
374 // {
375 // phi0+=N0[k]*log(1.0-exp(-N0[k+3]*tau));
376 // }
377 // phi0+=N0[10]*log(2.0/3.0+exp(N0[13]*tau));
378 // return phi0;
379 //}
380 //
381 //double dphi0_dDelta_Air(double tau, double delta)
382 //{
383 // return 1/delta;
384 //}
385 //
386 //double dphi02_dDelta2_Air(double tau, double delta)
387 //{
388 // return -1.0/powInt(delta,2);
389 //}
390 //
391 //double dphi0_dTau_Air(double tau, double delta)
392 //{
393 // double dphi0_dTau=0; int k;
394 // for (k=1;k<=5;k++)
395 // {
396 // dphi0_dTau+=N0[k]*(k-4)*powInt(tau,k-5);
397 // }
398 // dphi0_dTau+=1.5*N0[6]*sqrt(tau)+N0[7]/tau;
399 // dphi0_dTau+=N0[8]*N0[11]/(exp(N0[11]*tau)-1)+N0[9]*N0[12]/(exp(N0[12]*tau)-1);
400 // dphi0_dTau+=N0[10]*N0[13]/(2.0/3.0*exp(-N0[13]*tau)+1);
401 //
402 // return dphi0_dTau;
403 //}
404 //
405 //double dphi02_dTau2_Air(double tau, double delta)
406 //{
407 // double dphi02_dTau2=0;
408 // int k;
409 //
410 // for (k=1;k<=5;k++)
411 // {
412 // dphi02_dTau2+=N0[k]*(k-4)*(k-5)*powInt(tau,k-6);
413 // }
414 // dphi02_dTau2+=0.75*N0[6]*pow(tau,-0.5)-N0[7]/(tau*tau);
415 // dphi02_dTau2+=-N0[8]*N0[11]*N0[11]*exp(N0[11]*tau)/powInt(exp(N0[11]*tau)-1,2);
416 // dphi02_dTau2+=-N0[9]*N0[12]*N0[12]*exp(N0[12]*tau)/powInt(exp(N0[12]*tau)-1,2);
417 // dphi02_dTau2+=-(2.0/3.0)*N0[10]*N0[13]*N0[13]*exp(-N0[13]*tau)/powInt((2.0/3.0)*exp(-N0[13]*tau)+1,2);
418 // return dphi02_dTau2;
419 //}
double psatV(double)
Definition: Air.cpp:234
std::vector< phi_BC * > phirlist
Definition: FluidClass.h:178
struct FluidLimits limits
Definition: FluidClass.h:219
std::string EOS
Definition: FluidClass.h:120
std::string VISCOSITY
Definition: FluidClass.h:122
double rhosatV(double)
Definition: Air.cpp:210
PressureUnit p
Definition: FluidClass.h:50
std::string name
A container to hold the cache for residual Helmholtz derivatives.
Definition: FluidClass.h:151
std::string TransportReference
A std::string that contains a reference for thermo properties for the fluid.
Definition: FluidClass.h:158
double Pa
Definition: Units.h:22
std::vector< std::string > aliases
The REFPROP-compliant name if REFPROP-"name" is not a compatible fluid name. If not included...
Definition: FluidClass.h:153
double psatL(double)
Definition: Air.cpp:222
double powInt(double x, int y)
struct CriticalStruct reduce
A pointer to the point that is used to reduce the T and rho for EOS.
Definition: FluidClass.h:222
double Tmax
Definition: FluidClass.h:54
struct CriticalStruct * preduce
Definition: FluidClass.h:221
std::string EOSReference
The critical qd parameter for the Olchowy-Sengers cross-over term.
Definition: FluidClass.h:157
virtual double conductivity_Trho(double, double)
Definition: Air.cpp:295
double X_tilde(double T, double tau, double delta)
Definition: Air.cpp:285
bool isPure
A std::string that contains a reference for the transport properties of the fluid.
Definition: FluidClass.h:159
std::string SURFACE_TENSION
Definition: FluidClass.h:126
double specific_heat_v_Trho(double T, double rho)
Definition: FluidClass.cpp:480
double pmax
Definition: FluidClass.h:54
params
virtual double d2phir_dDelta2(double tau, double delta)
Definition: FluidClass.cpp:276
double rhosatL(double)
Definition: Air.cpp:198
struct CriticalStruct crit
Definition: FluidClass.h:218
virtual double viscosity_Trho(double, double)
Definition: Air.cpp:246
BibTeXKeysStruct BibTeXKeys
Definition: FluidClass.h:175
AirClass()
Definition: Air.cpp:21
std::vector< phi_BC * > phi0list
A vector of instances of the phi_BC classes for the residual Helmholtz energy contribution.
Definition: FluidClass.h:179
double specific_heat_p_Trho(double T, double rho)
Definition: FluidClass.cpp:487
virtual double dphir_dDelta(double tau, double delta)
Definition: FluidClass.cpp:257
struct CriticalStruct maxcondT
Definition: Air.h:16
double Tmin
Definition: FluidClass.h:54
double rhomax
Definition: FluidClass.h:54
std::string CONDUCTIVITY
Definition: FluidClass.h:123