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
Water.cpp
Go to the documentation of this file.
1 /*
2 
3 Properties of Water (R718)
4 by Ian Bell
5 
6 Themo properties from
7 "The IAPWS Formulation 1995 for the Thermodynamic Properties
8 of Ordinary Water Substance for General and Scientific Use",
9 W. Wagner and A. Pruss, J. Phys. Chem. Ref. Data, v. 31, 2000
10 
11 */
12 
13 #if defined(_MSC_VER)
14 #define _CRTDBG_MAP_ALLOC
15 #define _CRT_SECURE_NO_WARNINGS
16 #include <stdlib.h>
17 #include <crtdbg.h>
18 #else
19 #include <stdlib.h>
20 #endif
21 
22 #include "math.h"
23 #include "stdio.h"
24 #include <string.h>
25 #include "CoolProp.h"
26 #include <vector>
27 #include "FluidClass.h"
28 #include "Water.h"
29 
31 {
32  static const double n[]={0,
33  0.125335479355233e-1, //[1]
34  0.78957634722828e1, //[2]
35  -0.87803203303561e1, //[3]
36  0.31802509345418, //[4]
37  -0.26145533859358, //[5]
38  -0.78199751687981e-2, //[6]
39  0.88089493102134e-2, //[7]
40  -0.66856572307965, //[8]
41  0.20433810950965, //[9]
42  -0.66212605039687e-4, //[10]
43  -0.19232721156002, //[11]
44  -0.25709043003438, //[12]
45  0.16074868486251, //[13]
46  -0.40092828925807e-1, //[14]
47  0.39343422603254e-6, //[15]
48  -0.75941377088144e-5, //[16]
49  0.56250979351888e-3, //[17]
50  -0.15608652257135e-4, //[18]
51  0.11537996422951e-8, //[19]
52  0.36582165144204e-6, //[20]
53  -0.13251180074668e-11, //[21]
54  -0.62639586912454e-9, //[22]
55  -0.10793600908932, //[23]
56  0.17611491008752e-1, //[24]
57  0.22132295167546, //[25]
58  -0.40247669763528, //[26]
59  0.58083399985759, //[27]
60  0.49969146990806e-2, //[28]
61  -0.31358700712549e-1, //[29]
62  -0.74315929710341, //[30]
63  0.47807329915480, //[31]
64  0.20527940895948e-1, //[32]
65  -0.13636435110343, //[33]
66  0.14180634400617e-1, //[34]
67  0.83326504880713e-2, //[35]
68  -0.29052336009585e-1, //[36]
69  0.38615085574206e-1, //[37]
70  -0.20393486513704e-1, //[38]
71  -0.16554050063734e-2, //[39]
72  0.19955571979541e-2, //[40]
73  0.15870308324157e-3, //[41]
74  -0.16388568342530e-4, //[42]
75  0.43613615723811e-1, //[43]
76  0.34994005463765e-1, //[44]
77  -0.76788197844621e-1, //[45]
78  0.22446277332006e-1, //[46]
79  -0.62689710414685e-4, //[47]
80  -0.55711118565645e-9, //[48]
81  -0.19905718354408, //[49]
82  0.31777497330738, //[50]
83  -0.11841182425981, //[51]
84  -0.31306260323435e2, //[52]
85  0.31546140237781e2, //[53]
86  -0.25213154341695e4, //[54]
87  -0.14874640856724, //[55]
88  0.31806110878444, //[56]
89  };
90 
91  static const int d[]={0,
92  1, //[1]
93  1, //[2]
94  1, //[3]
95  2, //[4]
96  2, //[5]
97  3, //[6]
98  4, //[7]
99  1, //[8]
100  1, //[9]
101  1, //[10]
102  2, //[11]
103  2, //[12]
104  3, //[13]
105  4, //[14]
106  4, //[15]
107  5, //[16]
108  7, //[17]
109  9, //[18]
110  10, //[19]
111  11, //[20]
112  13, //[21]
113  15, //[22]
114  1, //[23]
115  2, //[24]
116  2, //[25]
117  2, //[26]
118  3, //[27]
119  4, //[28]
120  4, //[29]
121  4, //[30]
122  5, //[31]
123  6, //[32]
124  6, //[33]
125  7, //[34]
126  9, //[35]
127  9, //[36]
128  9, //[37]
129  9, //[38]
130  9, //[39]
131  10, //[40]
132  10, //[41]
133  12, //[42]
134  3, //[43]
135  4, //[44]
136  4, //[45]
137  5, //[46]
138  14, //[47]
139  3, //[48]
140  6, //[49]
141  6, //[50]
142  6, //[51]
143  3, //[52]
144  3, //[53]
145  3, //[54]
146  };
147 
148  static const double t[]={0.00,
149  -0.5, //[1]
150  0.875, //[2]
151  1, //[3]
152  0.5, //[4]
153  0.75, //[5]
154  0.375, //[6]
155  1, //[7]
156  4, //[8]
157  6, //[9]
158  12, //[10]
159  1, //[11]
160  5, //[12]
161  4, //[13]
162  2, //[14]
163  13, //[15]
164  9, //[16]
165  3, //[17]
166  4, //[18]
167  11, //[19]
168  4, //[20]
169  13, //[21]
170  1, //[22]
171  7, //[23]
172  1, //[24]
173  9, //[25]
174  10, //[26]
175  10, //[27]
176  3, //[28]
177  7, //[29]
178  10, //[30]
179  10, //[31]
180  6, //[32]
181  10, //[33]
182  10, //[34]
183  1, //[35]
184  2, //[36]
185  3, //[37]
186  4, //[38]
187  8, //[39]
188  6, //[40]
189  9, //[41]
190  8, //[42]
191  16, //[43]
192  22, //[44]
193  23, //[45]
194  23, //[46]
195  10, //[47]
196  50, //[48]
197  44, //[49]
198  46, //[50]
199  50, //[51]
200  0, //[52]
201  1, //[53]
202  4, //[54]
203  };
204 
205  static const int c[]={0,
206  0, //[1]
207  0, //[2]
208  0, //[3]
209  0, //[4]
210  0, //[5]
211  0, //[6]
212  0, //[7]
213  1, //[8]
214  1, //[9]
215  1, //[10]
216  1, //[11]
217  1, //[12]
218  1, //[13]
219  1, //[14]
220  1, //[15]
221  1, //[16]
222  1, //[17]
223  1, //[18]
224  1, //[19]
225  1, //[20]
226  1, //[21]
227  1, //[22]
228  2, //[23]
229  2, //[24]
230  2, //[25]
231  2, //[26]
232  2, //[27]
233  2, //[28]
234  2, //[29]
235  2, //[30]
236  2, //[31]
237  2, //[32]
238  2, //[33]
239  2, //[34]
240  2, //[35]
241  2, //[36]
242  2, //[37]
243  2, //[38]
244  2, //[39]
245  2, //[40]
246  2, //[41]
247  2, //[42]
248  3, //[43]
249  3, //[44]
250  3, //[45]
251  3, //[46]
252  4, //[47]
253  6, //[48]
254  6, //[49]
255  6, //[50]
256  6, //[51]
257  0, //[52]
258  0, //[53]
259  0, //[54]
260  };
261 
262  static const double alpha[]={
263  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 51
264  20, //[52]
265  20, //[53]
266  20, //[54]
267  };
268 
269  static const double beta[]={
270  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 51
271  150, //[52]
272  150, //[53]
273  250, //[54]
274  0.3, //[55]
275  0.3, //[56]
276  };
277 
278  static const double GAMMA[]={
279  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 51
280  1.21, //[52]
281  1.21, //[53]
282  1.25, //[54]
283  };
284 
285  static const double epsilon[]={
286  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 51
287  1, //[52]
288  1, //[53]
289  1, //[54]
290  };
291 
292  static const double a[]={
293  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 54
294  3.5, //[55]
295  3.5, //[56]
296  };
297 
298  static const double b[]={
299  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 54
300  0.85, //[55]
301  0.95, //[56]
302  };
303 
304  static const double A[]={
305  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 54
306  0.32, //[55]
307  0.32, //[56]
308  };
309 
310  static const double B[]={
311  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 54
312  0.2, //[55]
313  0.2, //[56]
314  };
315 
316  static const double C[]={
317  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 54
318  28., //[55]
319  32., //[56]
320  };
321 
322  static const double D[]={
323  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //0 to 54
324  700.0, //[55]
325  800.0, //[56]
326  };
327 
328  // Constant for ideal gas part
329  static const double n0[]={0,
330  -8.3204464837497, //[1] //From Herrmann 2099 ASHRAE RP-1485
331  6.6832105275932, //[2] //From Herrmann 2099 ASHRAE RP-1485
332  3.00632, //[3]
333  0.012436, //[4]
334  0.97315, //[5]
335  1.27950, //[6]
336  0.96956, //[7]
337  0.24873, //[8]
338  };
339  static const double gamma0[]={0,
340  0,0,0, // 1 to 3
341  1.28728967, //[4]
342  3.53734222, //[5]
343  7.74073708, //[6]
344  9.24437796, //[7]
345  27.5075105 //[8]
346  };
347  std::vector<double> n_v(n,n+sizeof(n)/sizeof(double));
348  std::vector<double> d_v(d,d+sizeof(d)/sizeof(int));
349  std::vector<double> t_v(t,t+sizeof(t)/sizeof(double));
350  std::vector<double> l_v(c,c+sizeof(c)/sizeof(int));
351  std::vector<double> alpha_v(alpha,alpha+sizeof(alpha)/sizeof(double));
352  std::vector<double> beta_v(beta,beta+sizeof(beta)/sizeof(double));
353  std::vector<double> gamma_v(GAMMA,GAMMA+sizeof(GAMMA)/sizeof(double));
354  std::vector<double> epsilon_v(epsilon,epsilon+sizeof(epsilon)/sizeof(double));
355  std::vector<double> a_v(a,a+sizeof(a)/sizeof(double));
356  std::vector<double> b_v(b,b+sizeof(b)/sizeof(double));
357  std::vector<double> A_v(A,A+sizeof(A)/sizeof(double));
358  std::vector<double> B_v(B,B+sizeof(B)/sizeof(double));
359  std::vector<double> C_v(C,C+sizeof(C)/sizeof(double));
360  std::vector<double> D_v(D,D+sizeof(D)/sizeof(double));
361  std::vector<double> n0_v(n0,n0+sizeof(n0)/sizeof(double));
362  std::vector<double> gamma0_v(gamma0,gamma0+sizeof(gamma0)/sizeof(double));
363 
364  phi_BC * phir_ = new phir_power(n_v,d_v,t_v,l_v,1,51);
365  phi_BC * phirg_ = new phir_gaussian(n_v,d_v,t_v,alpha_v,epsilon_v,beta_v,gamma_v,52,54);
366  phi_BC * phirc_ = new phir_critical(n_v,d_v,t_v,a_v,b_v,beta_v,A_v,B_v,C_v,D_v,55,56);
367 
368  phirlist.push_back(phir_);
369  phirlist.push_back(phirg_);
370  phirlist.push_back(phirc_);
371 
372  phi_BC * phi0_lead_ = new phi0_lead(n0[1],n0[2]);
373  phi_BC * phi0_logtau_ = new phi0_logtau(n0[3]);
374  phi_BC * phi0_PE_ = new phi0_Planck_Einstein(n0_v,gamma0_v,4,8);
375 
376  phi0list.push_back(phi0_lead_);
377  phi0list.push_back(phi0_logtau_);
378  phi0list.push_back(phi0_PE_);
379 
380  // Critical parameters
381  crit.rho = 322;
382  crit.p = PressureUnit(22064, UNIT_KPA);
383  crit.T = 647.096;
384  crit.v = 1.0/crit.rho;
385 
386  // Other fluid parameters
387  params.molemass = 18.015268;
388  params.Ttriple = 273.16;
389  params.ptriple = 0.611699223742;
390  params.R_u = 8.314371357587;
391  params.accentricfactor = 0.3442920843;
392 
393  // Fluid limits
394  limits.Tmin = params.Ttriple;
395  limits.Tmax = 2000;
396  limits.pmax = 1000000.0;
397  limits.rhomax = 73.96 * params.molemass;
398 
399  EOSReference.assign("\"The IAPWS Formulation 1995 for the Thermodynamic Properties"
400  "of Ordinary Water Substance for General and Scientific Use\","
401  "W. Wagner and A. Pruss, J. Phys. Chem. Ref. Data, v. 31, 2002");
402 
403  TransportReference.assign("Thermal Conductivity: Release on the IAPWS Formulation 2011 for the Thermal Conductivity of Ordinary Water Substance\n\n"
404  "Viscosity: Release on the IAPWS Formulation 2008 for the Viscosity of Ordinary Water Substance\n\n"
405  "Surface Tension: International Representation of the Surface Tension of Ordinary Water Substance 1994\n");
406 
407  name.assign("Water");
408  aliases.push_back("water");
409  aliases.push_back(std::string("WATER"));
410  aliases.push_back("H2O");
411  aliases.push_back("h2o");
412 
413  BibTeXKeys.EOS = "Wagner-JPCRD-2002";
414  BibTeXKeys.VISCOSITY = "Huber-JPCRD-2009";
415  BibTeXKeys.CONDUCTIVITY = "Huber-JPCRD-2012";
416  BibTeXKeys.SURFACE_TENSION = "Mulero-JPCRD-2012";
417  BibTeXKeys.ECS_LENNARD_JONES = "Poling-BOOK-2001";
418 }
419 static void visc_Helper(double Tbar, double rhobar, double *mubar_0, double *mubar_1)
420 {
421  double H[6][7],sum;
422  int i,j;
423 
424  // Dilute-gas component
425  *mubar_0=100.0*sqrt(Tbar)/(1.67752+2.20462/Tbar+0.6366564/powInt(Tbar,2)-0.241605/powInt(Tbar,3));
426 
427  //Fill in zeros in H
428  for (i=0;i<=5;i++)
429  {
430  for (j=0;j<=6;j++)
431  {
432  H[i][j]=0;
433  }
434  }
435 
436  //Set non-zero parameters of H
437  H[0][0]=5.20094e-1;
438  H[1][0]=8.50895e-2;
439  H[2][0]=-1.08374;
440  H[3][0]=-2.89555e-1;
441 
442  H[0][1]=2.22531e-1;
443  H[1][1]=9.99115e-1;
444  H[2][1]=1.88797;
445  H[3][1]=1.26613;
446  H[5][1]=1.20573e-1;
447 
448  H[0][2]=-2.81378e-1;
449  H[1][2]=-9.06851e-1;
450  H[2][2]=-7.72479e-1;
451  H[3][2]=-4.89837e-1;
452  H[4][2]=-2.57040e-1;
453 
454  H[0][3]=1.61913e-1;
455  H[1][3]=2.57399e-1;
456 
457  H[0][4]=-3.25372e-2;
458  H[3][4]=6.98452e-2;
459 
460  H[4][5]=8.72102e-3;
461 
462  H[3][6]=-4.35673e-3;
463  H[5][6]=-5.93264e-4;
464 
465  // Finite density component
466  sum=0;
467  for (i=0;i<=5;i++)
468  {
469  for (j=0;j<=6;j++)
470  {
471  sum+=powInt(1/Tbar-1,i)*(H[i][j]*powInt(rhobar-1,j));
472  }
473  }
474  *mubar_1=exp(rhobar*sum);
475 }
476 double WaterClass::conductivity_Trho(double T, double rho)
477 {
478  // Many thanks to http://twt.mpei.ac.ru/mcs/worksheets/iapws/wspsTCRT.xmcd
479 
480  double L[5][6] = {{1.60397357,-0.646013523,0.111443906,0.102997357,-0.0504123634,0.00609859258},
481  {2.33771842,-2.78843778,1.53616167,-0.463045512,0.0832827019,-0.00719201245},
482  {2.19650529,-4.54580785,3.55777244,-1.40944978,0.275418278,-0.0205938816},
483  {-1.21051378,1.60812989,-0.621178141,0.0716373224,0,0},
484  {-2.7203370,4.57586331,-3.18369245,1.1168348,-0.19268305,0.012913842}};
485 
486  double lambdabar_0,lambdabar_1,lambdabar_2,rhobar,Tbar,sum,R_Water;
487  double Tstar=647.096,rhostar=322,pstar=22064000,lambdastar=1e-3,mustar=1e-6;
488  double tau,xi;
489  int i,j;
490 
491  Tbar = T/Tstar;
492  rhobar = rho/rhostar;
493  R_Water = 8314.47215/params.molemass;
494 
495  // Dilute gas contribution
496  lambdabar_0=sqrt(Tbar)/(2.443221e-3+1.323095e-2/Tbar+6.770357e-3/pow(Tbar,2)-3.454586e-3/pow(Tbar,3)+4.096266e-4/pow(Tbar,4));
497 
498  sum=0;
499  for (i=0;i<=4;i++)
500  {
501  for (j=0;j<=5;j++)
502  {
503  //printf("L[%d][%d]: %0.12fg\n",i,j,L[i][j]);
504  sum+=L[i][j]*powInt(1.0/Tbar-1.0,i)*powInt(rhobar-1,j);
505  }
506  }
507  // Finite density contribution
508  lambdabar_1=exp(rhobar*sum);
509 
510  double nu=0.630,GAMMA =177.8514,gamma=1.239,xi_0=0.13,Lambda_0=0.06,Tr_bar=1.5,qd_bar=1/0.4,pi=3.141592654,
511  R=461.51805;//J/kg/K
512  rhobar=rho/rhostar;
513  Tbar=T/Tstar;
514  tau=1/Tbar;
515 
516  double drhodp=1/(R*T*(1+2*rhobar*dphir_dDelta(1/Tbar,rhobar)+rhobar*rhobar*d2phir_dDelta2(1/Tbar,rhobar)));
517  double drhobar_dpbar=pstar/rhostar*drhodp;
518  double drhodp_Trbar=1/(R*Tr_bar*Tstar*(1+2*rhobar*dphir_dDelta(1/Tr_bar,rhobar)+rhobar*rhobar*d2phir_dDelta2(1/Tr_bar,rhobar)));
519  double drhobar_dpbar_Trbar=pstar/rhostar*drhodp_Trbar;
520  double cp=specific_heat_p_Trho(T,rho); // [J/kg/K]
521  double cv=specific_heat_v_Trho(T,rho); // [J/kg/K]
522  double cpbar=cp/R; //[-]
523  double mubar = viscosity_Trho(T,rho)/mustar;
524  double DELTAchibar_T=rhobar*(drhobar_dpbar-drhobar_dpbar_Trbar*Tr_bar/Tbar);
525  if (DELTAchibar_T<0)
526  xi=0;
527  else
528  xi=xi_0*pow(DELTAchibar_T/Lambda_0,nu/gamma);
529  double y=qd_bar*xi;
530 
531  double Z;
532  double kappa = cp/cv;
533  if (y<1.2e-7)
534  Z=0;
535  else
536  Z=2/(pi*y)*(((1-1/kappa)*atan(y)+y/kappa)-(1-exp(-1/(1/y+y*y/3/rhobar/rhobar))));
537 
538  lambdabar_2=GAMMA*rhobar*cpbar*Tbar/mubar*Z;
539  return (lambdabar_0*lambdabar_1+lambdabar_2)*lambdastar;
540 }
541 double WaterClass::viscosity_Trho(double T, double rho)
542 {
543  double x_mu=0.068,qc=1/1.9,qd=1/1.1,nu=0.630,gamma=1.239,zeta_0=0.13,LAMBDA_0=0.06,Tbar_R=1.5;
544  double delta,tau,mubar_0,mubar_1,mubar_2,drhodp,drhodp_R,DeltaChibar,zeta,w,L,Y,psi_D,Tbar,rhobar;
545  double drhobar_dpbar,drhobar_dpbar_R,R_Water;
546 
547  Tbar=T/reduce.T;
548  rhobar=rho/reduce.rho;
549  R_Water=R();
550 
551  // Dilute and finite gas portions
552  visc_Helper(Tbar,rhobar,&mubar_0,&mubar_1);
553 
555  delta=rhobar;
556  // "Normal" calculation
557  tau=1/Tbar;
558  drhodp=1/(R_Water*T*(1+2*delta*dphir_dDelta(tau,delta)+delta*delta*d2phir_dDelta2(tau,delta)));
559  drhobar_dpbar=reduce.p.Pa/reduce.rho*drhodp;
560  // "Reducing" calculation
561  tau=1/Tbar_R;
562  drhodp_R=1/(R_Water*Tbar_R*reduce.T*(1+2*delta*dphir_dDelta(tau,delta)+delta*delta*d2phir_dDelta2(tau,delta)));
563  drhobar_dpbar_R=reduce.p.Pa/reduce.rho*drhodp_R;
564 
565  DeltaChibar=rhobar*(drhobar_dpbar-drhobar_dpbar_R*Tbar_R/Tbar);
566  if (DeltaChibar<0)
567  DeltaChibar=0;
568  zeta=zeta_0*pow(DeltaChibar/LAMBDA_0,nu/gamma);
569  if (zeta<0.3817016416)
570  {
571  Y=1.0/5.0*qc*zeta*powInt(qd*zeta,5)*(1-qc*zeta+powInt(qc*zeta,2)-765.0/504.0*powInt(qd*zeta,2));
572  }
573  else
574  {
575  psi_D=acos(pow(1+powInt(qd*zeta,2),-1.0/2.0));
576  w=sqrt(fabs((qc*zeta-1)/(qc*zeta+1)))*tan(psi_D/2.0);
577  if (qc*zeta>1)
578  {
579  L=log((1+w)/(1-w));
580  }
581  else
582  {
583  L=2*atan(fabs(w));
584  }
585  Y=1.0/12.0*sin(3*psi_D)-1/(4*qc*zeta)*sin(2*psi_D)+1.0/powInt(qc*zeta,2)*(1-5.0/4.0*powInt(qc*zeta,2))*sin(psi_D)-1.0/powInt(qc*zeta,3)*((1-3.0/2.0*powInt(qc*zeta,2))*psi_D-pow(fabs(powInt(qc*zeta,2)-1),3.0/2.0)*L);
586  }
587  mubar_2=exp(x_mu*Y);
588 
589  return (mubar_0*mubar_1*mubar_2)/1e6;
590 }
591 double WaterClass::psat(double T)
592 {
593  const double ti[]={0,1.0,1.5,3.0,3.5,4.0,7.5};
594  const double ai[]={0,-7.85951783,1.84408259,-11.7866497,22.6807411,-15.9618719,1.80122502};
595  double summer=0;
596  int i;
597  for (i=1;i<=6;i++)
598  {
599  summer=summer+ai[i]*pow(1-T/reduce.T,ti[i]);
600  }
601  return reduce.p.Pa*exp(reduce.T/T*summer);
602 }
603 double WaterClass::rhosatL(double T)
604 {
605  const double ti[]={0,1.0/3.0,2.0/3.0,5.0/3.0,16.0/3.0,43.0/3.0,110.0/3.0};
606  const double ai[]={0,1.99274064,1.09965342,-0.510839303,-1.75493479,-45.5170352,-1.75493479,-45.5170352,-6.74694450e5};
607  double summer=1;
608  int i;
609  for (i=1;i<=6;i++)
610  {
611  summer=summer+ai[i]*pow(1.0-T/reduce.T,ti[i]);
612  }
613  return reduce.rho*summer;
614 }
615 double WaterClass::rhosatV(double T)
616 {
617  const double ti[]={0,2.0/6.0,4.0/6.0,8./6.0,18.0/6.0,37.0/6.0,71.0/6.0};
618  const double ai[]={0,-2.03150240,-2.68302940,-5.38626492,-17.2991605,-44.7586581,-63.9201063};
619  double summer=0;
620  int i;
621  for (i=1;i<=6;i++)
622  {
623  summer=summer+ai[i]*pow(1.0-T/reduce.T,ti[i]);
624  }
625  return reduce.rho*exp(summer);
626 }
627 
629 {
630  // From Mulero, 2012
631  return -0.1306*pow(1-T/reduce.T,2.471)+0.2151*pow(1-T/reduce.T,1.233);
632 }
633 
634 //double WaterClass::IsothermCompress_Water(double T, double p)
635 //{
636 // // Isothermal compressibility with units of 1/Pa
637 // double rho,delta,tau,dpdrho,R_Water;
638 // rho=Props('D','T',T,'P',p,"Water");
639 // delta=rho/rhoc;
640 // tau=Tc/T;
641 // R_Water=8.31447215/M_Water;
642 // dpdrho=R_Water*T*(1.0+2.0*delta*dphir_dDelta(tau,delta)+powInt(delta,2)*d2phir_dDelta2(tau,delta));
643 // return 1/(rho*dpdrho*1000.0);
644 //}
645 //
646 //double WaterClass::B_Water(double tau)
647 //{
648 // // given by B*rhoc=lim(delta --> 0) [dphir_ddelta(tau)]
649 // return 1.0/rhoc*dphir_dDelta(tau,1e-12);
650 //}
651 //
652 //double WaterClass::dBdT_Water(double tau)
653 //{
654 // // given by B*rhoc^2=lim(delta --> 0) [dphir2_ddelta2(tau)]
655 // return -1.0/rhoc*tau*tau/Tc*d2phir_dDelta_dTau(tau,1e-12);
656 //}
657 //
658 //double WaterClass::C_Water(double tau)
659 //{
660 // // given by B*rhoc^2=lim(delta --> 0) [dphir2_ddelta2(tau)]
661 // return 1.0/(rhoc*rhoc)*d2phir_dDelta2(tau,1e-12);
662 //}
663 //
664 //double WaterClass::dCdT_Water(double tau)
665 //{
666 // // given by B*rhoc^2=lim(delta --> 0) [dphir2_ddelta2(tau)]
667 // return -1.0/(rhoc*rhoc)*tau*tau/Tc*d3phir_dDelta2_dTau(tau,1e-12);
668 //}
669 
670 /*
671 double dphir3_dDelta2_dTau_Water(double tau, double delta)
672 {
673  // Derivation from Hermann 2009 (ASHRAE Report RP-1485)
674  int i;
675  double di, ci;
676  double dphir3_dDelta2_dTau=0,theta,DELTA,PSI,dPSI_dDelta,dDELTA_dDelta,dDELTAbi_dDelta,psi,dPSI2_dDelta2,dDELTAbi2_dDelta2,dDELTA2_dDelta2;
677  double dPSI2_dDelta_dTau, dDELTAbi2_dDelta_dTau, dPSI_dTau, dDELTAbi_dTau;
678  double Line1,Line2,Line3,dDELTA2_dDelta_dTau,dDELTA3_dDelta2_dTau,dDELTAbim1_dTau,dDELTAbim2_dTau;
679  double dDELTA_dTau,dDELTAbi3_dDelta2_dTau;
680  for (i=1;i<=7;i++)
681  {
682  di=(double)d[i];
683  dphir3_dDelta2_dTau+=n[i]*di*t[i]*(di-1)*powInt(delta,d[i]-2)*pow(tau,t[i]-1.0);
684  }
685  for (i=8;i<=51;i++)
686  {
687  di=(double)d[i];
688  ci=(double)c[i];
689  dphir3_dDelta2_dTau+=n[i]*t[i]*exp(-powInt(delta,c[i]))*powInt(delta,d[i]-2)*pow(tau,t[i]-1.0)*(((di-ci*powInt(delta,c[i])))*(di-1-c[i]*powInt(delta,c[i]))-c[i]*c[i]*powInt(delta,c[i]));
690  }
691  for (i=52;i<=54;i++)
692  {
693  di=(double)d[i];
694  psi=exp(-alpha[i]*powInt(delta-epsilon[i],2)-beta[i]*powInt(tau-GAMMA[i],2));
695  dphir3_dDelta2_dTau+=n[i]*pow(tau,t[i])*psi*powInt(delta,d[i])*(t[i]/tau-2.0*beta[i]*(tau-GAMMA[i]))*(-2.0*alpha[i]*(delta-epsilon[i])+4*alpha[i]*alpha[i]*pow(delta,d[i])*powInt(delta-epsilon[i],2)-4*d[i]*alpha[i]*pow(delta,d[i]-1)*(delta-epsilon[i])+d[i]*(d[i]-1)*powInt(delta,d[i]-2));
696  }
697  for (i=55;i<=56;i++)
698  {
699  theta=(1.0-tau)+A[i]*pow(powInt(delta-1.0,2),1.0/(2.0*beta[i]));
700  DELTA=powInt(theta,2)+B[i]*pow(powInt(delta-1.0,2),a[i]);
701  PSI=exp(-C[i]*powInt(delta-1.0,2)-D[i]*powInt(tau-1.0,2));
702 
703  dPSI_dDelta=-2.0*C[i]*(delta-1.0)*PSI;
704  dDELTA_dDelta=(delta-1.0)*(A[i]*theta*2.0/beta[i]*pow(powInt(delta-1.0,2),1.0/(2.0*beta[i])-1.0)+2.0*B[i]*a[i]*pow(powInt(delta-1.0,2),a[i]-1.0));
705  dDELTAbi_dDelta=b[i]*pow(DELTA,b[i]-1.0)*dDELTA_dDelta;
706 
707  dPSI2_dDelta2=(2.0*C[i]*powInt(delta-1.0,2)-1.0)*2.0*C[i]*PSI;
708  dDELTA2_dDelta2=1.0/(delta-1.0)*dDELTA_dDelta+powInt(delta-1.0,2)*(4.0*B[i]*a[i]*(a[i]-1.0)*pow(powInt(delta-1.0,2),a[i]-2.0)+2.0*powInt(A[i]/beta[i],2)*powInt(pow(powInt(delta-1.0,2),1.0/(2.0*beta[i])-1.0),2)+A[i]*theta*4.0/beta[i]*(1.0/(2.0*beta[i])-1.0)*pow(powInt(delta-1.0,2),1.0/(2.0*beta[i])-2.0));
709  dDELTAbi2_dDelta2=b[i]*(pow(DELTA,b[i]-1.0)*dDELTA2_dDelta2+(b[i]-1.0)*pow(DELTA,b[i]-2.0)*powInt(dDELTA_dDelta,2));
710 
711  dPSI_dTau=-2.0*D[i]*(tau-1.0)*PSI;
712  dDELTAbi_dTau=-2.0*theta*b[i]*pow(DELTA,b[i]-1.0);
713 
714  dPSI2_dDelta_dTau=4.0*C[i]*D[i]*(delta-1.0)*(tau-1.0)*PSI;
715  dDELTAbi2_dDelta_dTau=-A[i]*b[i]*2.0/beta[i]*pow(DELTA,b[i]-1.0)*(delta-1.0)*pow(powInt(delta-1.0,2),1.0/(2.0*beta[i])-1.0)-2.0*theta*b[i]*(b[i]-1.0)*pow(DELTA,b[i]-2.0)*dDELTA_dDelta;
716 
717  //Following Terms added for this derivative
718  dDELTA_dTau=-2*((1-tau)+A[i]*pow(powInt(delta-1,2),1/(2*beta[i])-1)+2*B[i]*a[i]*pow(powInt(delta-1,2),a[i]-1));
719  dDELTA2_dDelta_dTau=-(delta-1)*A[i]*(2/beta[i])*pow(powInt(delta-1,2),1/(2*beta[i])-1);
720  dDELTA3_dDelta2_dTau=1/(delta-1)*dDELTA2_dDelta_dTau-powInt(delta-1,2)*A[i]*(4/beta[i])*(1/(2*beta[i])-1)*pow(powInt(delta-1,2),1/(2*beta[i])-2);
721 
722  dDELTAbim1_dTau=(b[i]-1)*pow(DELTA,b[i]-2)*dDELTA_dTau;
723  dDELTAbim2_dTau=(b[i]-2)*pow(DELTA,b[i]-3)*dDELTA_dTau;
724  Line1=dDELTAbim1_dTau*dDELTA2_dDelta2+pow(DELTA,b[i]-1)*dDELTA3_dDelta2_dTau;
725  Line2=(b[i]-1)*(dDELTAbim2_dTau*powInt(dDELTA_dDelta,2)+pow(DELTA,b[i]-2)*2*dDELTA2_dDelta_dTau*dDELTA_dDelta);
726  dDELTAbi3_dDelta2_dTau=b[i]*(Line1+Line2);
727 
728  Line1=pow(DELTA,b[i])*(2*delta*dPSI2_dDelta_dTau+delta*dDELTA3_dDelta2_dTau)+dDELTAbi_dTau*(2*dPSI_dDelta+delta*dPSI2_dDelta2);
729  Line2=2*dDELTAbi2_dDelta_dTau*(PSI+delta*dPSI_dDelta)+2*dDELTAbi_dDelta*(dPSI_dTau+delta*dPSI2_dDelta_dTau);
730  Line3=dDELTAbi3_dDelta2_dTau*delta*PSI+dDELTAbi2_dDelta2*delta*dPSI_dTau;
731  dphir3_dDelta2_dTau+=n[i]*(Line1+Line2+Line3);
732  }
733  return dphir3_dDelta2_dTau;
734 }
735 */
double psat(double)
Definition: Water.cpp:591
double rhosatL(double)
Definition: Water.cpp:603
std::vector< phi_BC * > phirlist
Definition: FluidClass.h:178
double R()
Returns the mass-specific gas constant for the fluid in the desired units.
struct FluidLimits limits
Definition: FluidClass.h:219
std::string EOS
Definition: FluidClass.h:120
std::string VISCOSITY
Definition: FluidClass.h:122
double surface_tension_T(double T)
Definition: Water.cpp:628
PressureUnit p
Definition: FluidClass.h:50
double rhosatV(double)
Definition: Water.cpp:615
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 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
std::string EOSReference
The critical qd parameter for the Olchowy-Sengers cross-over term.
Definition: FluidClass.h:157
std::string ECS_LENNARD_JONES
Definition: FluidClass.h:124
WaterClass()
Definition: Water.cpp:30
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
virtual double conductivity_Trho(double, double)
Definition: Water.cpp:476
struct CriticalStruct crit
Definition: FluidClass.h:218
BibTeXKeysStruct BibTeXKeys
Definition: FluidClass.h:175
virtual double viscosity_Trho(double, double)
Definition: Water.cpp:541
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
This is the abstract base class upon which each residual Helmholtz energy class is built...
Definition: Helmholtz.h:24
virtual double dphir_dDelta(double tau, double delta)
Definition: FluidClass.cpp:257
double Tmin
Definition: FluidClass.h:54
double rhomax
Definition: FluidClass.h:54
std::string CONDUCTIVITY
Definition: FluidClass.h:123