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
R717.cpp
Go to the documentation of this file.
1 /*
2 Properties for R717 (ammonia).
3 by Ian Bell
4 
5 Thermo props from
6 "Eine neue Fundamentalgleichung fur Ammoniak (A new Equation of State for Ammonia)"
7 by R. Tillner-Roth and F. Harms-Watzenberg and H.D. Baehr, Deutscher Kaelte- und Klimatechnischer Verein Tagung 1993
8 
9 */
10 
11 #if defined(_MSC_VER)
12 #define _CRTDBG_MAP_ALLOC
13 #define _CRT_SECURE_NO_WARNINGS
14 #include <stdlib.h>
15 #include <crtdbg.h>
16 #else
17 #include <stdlib.h>
18 #endif
19 
20 #include <math.h>
21 #include "string.h"
22 #include "stdio.h"
23 #include "CoolProp.h"
24 #include "FluidClass.h"
25 #include "R717.h"
26 
27 /*
28 From REFPROP documentation:
29 The original paper has a typographical error that shows a positive coefficient
30 instead of negative. The correct value should be -0.3497111e-01.
31 */
32 
34 {
35 
36  static const double n[]={
37  0.0, //[0]
38  0.4554431e-1, //[1]
39  0.7238548e+0, //[2]
40  0.1229470e-1, //[3]
41  -0.1858814e+1, //[4]
42  0.2141882e-10, //[5]
43  -0.1430020e-1, //[6]
44  0.3441324e+0, //[7]
45  -0.2873571e+0, //[8]
46  0.2352589e-4, //[9]
47  -0.3497111e-1, //[10]
48  0.2397852e-1, //[11]
49  0.1831117e-2, //[12]
50  -0.4085375e-1, //[13]
51  0.2379275e+0, //[14]
52  -0.3548972e-1, //[15]
53  -0.1823729e+0, //[16]
54  0.2281556e-1, //[17]
55  -0.6663444e-2, //[18]
56  -0.8847486e-2, //[19]
57  0.2272635e-2, //[20]
58  -0.5588655e-3, //[21]
59  };
60 
61  static const double d[]={
62  0, //[0]
63  2, //[1]
64  1, //[2]
65  4, //[3]
66  1, //[4]
67  15, //[5]
68  3, //[6]
69  3, //[7]
70  1, //[8]
71  8, //[9]
72  2, //[10]
73  1, //[11]
74  8, //[12]
75  1, //[13]
76  2, //[14]
77  3, //[15]
78  2, //[16]
79  4, //[17]
80  3, //[18]
81  1, //[19]
82  2, //[20]
83  4 //[21]
84  };
85 
86  static const double t[]={
87  0.0, //[0]
88  -1.0/2.0, //[1]
89  1.0/2.0, //[2]
90  1.0, //[3]
91  3.0/2.0, //[4]
92  3.0, //[5]
93  0.0, //[6]
94  3.0, //[7]
95  4.0, //[8]
96  4.0, //[9]
97  5.0, //[10]
98  3.0, //[11]
99  5.0, //[12]
100  6.0, //[13]
101  8.0, //[14]
102  8.0, //[15]
103  10.0, //[16]
104  10.0, //[17]
105  5.0, //[18]
106  15.0/2.0, //[19]
107  15.0, //[20]
108  30.0 //[21]
109  };
110 
111  static const double c[]={
112  0.0, //[0]
113  0.0, //[1]
114  0.0, //[2]
115  0.0, //[3]
116  0.0, //[4]
117  0.0, //[5]
118  1.0, //[6]
119  1.0, //[7]
120  1.0, //[8]
121  1.0, //[9]
122  1.0, //[10]
123  2.0, //[11]
124  2.0, //[12]
125  2.0, //[13]
126  2.0, //[14]
127  2.0, //[15]
128  2.0, //[16]
129  2.0, //[17]
130  3.0, //[18]
131  3.0, //[19]
132  3.0, //[20]
133  3.0 //[21]
134  };
135 
136  static const double a0[]={
137  0.0, //[0]
138  -15.815020, //[1]
139  4.255726, //[2]
140  11.474340, //[3]
141  -1.296211, //[4]
142  0.5706757 //[5]
143  };
144  static const double t0[]={
145  0.0, //[0]
146  0.0, //[1]
147  0.0, //[2]
148  1.0/3.0, //[3]
149  -3.0/2.0, //[4]
150  -7.0/4.0 //[5]
151  };
152 
153  std::vector<double> a0_v(a0,a0+sizeof(a0)/sizeof(double));
154  std::vector<double> t0_v(t0,t0+sizeof(t0)/sizeof(double));
155 
156  phirlist.push_back(new phir_power(n,d,t,c,1,21,22));
157 
158  // phi0=log(delta)+a0[1]+a0[2]*tau-log(tau)+a0[3]*pow(tau,1.0/3.0)+a0[4]*pow(tau,-3.0/2.0)+a0[5]*pow(tau,-7.0/4.0);
159  phi0list.push_back(new phi0_lead(a0[1],a0[2]));
160  phi0list.push_back(new phi0_logtau(-1));
161  phi0list.push_back(new phi0_power(a0_v,t0_v,3,5));
162 
163  // Critical parameters
164  crit.rho = 225;
165  crit.p = PressureUnit(11333, UNIT_KPA);
166  crit.T = 405.40;
167  crit.v = 1.0/crit.rho;
168 
169  // Other fluid parameters
170  params.molemass = 17.03026;
171  params.Ttriple = 195.495;
172  params.ptriple = 6.09170982378;
173  params.accentricfactor = 0.25601;
174  params.R_u = 8.314471;
175 
176  // Limits of EOS
177  limits.Tmin = 195.495;
178  limits.Tmax = 700.0;
179  limits.pmax = 1000000.0;
180  limits.rhomax = 52.915*params.molemass;
181 
182  EOSReference.assign("\"Eine neue Fundamentalgleichung fur Ammoniak (A new Equation of State for Ammonia)\""
183  " R. Tillner-Roth and F. Harms-Watzenberg and H.D. Baehr, "
184  "Deutscher Kaelte- und Klimatechnischer Verein Tagung 1993");
185  TransportReference.assign("Viscosity: \"The Viscosity of Ammonia\", "
186  "A. Fenghour and W.A. Wakeham and V. Vesovic and J.T.R. Watson and J. Millat and E. Vogel"
187  "J. Phys. Chem. Ref. Data, Vol. 24, No. 5, 1995 \n\n"
188  "Conductivity: \"Thermal Conductivity of Ammonia in a Large"
189  "Temperature and Pressure Range Including the Critical Region\""
190  "by R. Tufeu, D.Y. Ivanov, Y. Garrabos, B. Le Neindre, "
191  "Bereicht der Bunsengesellschaft Phys. Chem. 88 (1984) 422-427\n\n"
192  "Does not include the critical enhancement. Comparison of EES (without enhancement) and Refprop (with enhancement) give "
193  "errors in saturated liquid and saturated vapor conductivities of \n\n"
194  "T < 325K, error < 0.1%\n"
195  "325K < T < 355 K, error <1%\n\n"
196  "Most practical conditions will be in the <325K range\n"
197  "Surface tension: Michael Kleiber and Ralph Joh, \"VDI Heat Atlas 2010 Chapter D3.1 Liquids and Gases\" ");
198 
199  name.assign("Ammonia");
200  aliases.push_back("NH3");
201  aliases.push_back("ammonia");
202  aliases.push_back("R717");
203  aliases.push_back(std::string("AMMONIA"));
204  REFPROPname.assign("AMMONIA");
205 
206  BibTeXKeys.EOS = "TillnerRoth-DKV-1993";
207  BibTeXKeys.VISCOSITY = "Fenghour-JPCRD-1995";
208  BibTeXKeys.CONDUCTIVITY = "Tufeu-BBPC-1984";
209  BibTeXKeys.SURFACE_TENSION = "Mulero-JPCRD-2012";
210 }
211 double R717Class::conductivity_Trho(double T, double rho)
212 {
213  /*
214  From "Thermal Conductivity of Ammonia in a Large
215  Temperature and Pressure Range Including the Critical Region"
216  by R. Tufeu, D.Y. Ivanov, Y. Garrabos, B. Le Neindre,
217  Bereicht der Bunsengesellschaft Phys. Chem. 88 (1984) 422-427
218  */
219 
220  /*
221  Does not include the critical enhancement. Comparison of EES (without enhancement) and Refprop (with enhancement) give
222  errors in saturated liquid and saturated vapor conductivities of
223 
224  T < 325K, error < 0.1%
225  325K < T < 355 K, error <1%
226 
227  Nearly all practical conditions will be in the <325K range
228  */
229 
230 
231  double lambda_0,lambda_tilde;
232 
233  double a= 0.3589e-1;
234  double b=-0.1750e-3;
235  double c= 0.4551e-6;
236  double d= 0.1685e-9;
237  double e=-0.4828e-12;
238  double lambda_1= 0.16207e-3;
239  double lambda_2= 0.12038e-5;
240  double lambda_3=-0.23139e-8;
241  double lambda_4= 0.32749e-11;
242 
243  // This variable appears to be unused in the code:
244  //double a_zeta_plus=0.7;
245 
246  double LAMBDA=1.2, nu=0.63, gamma =1.24, DELTA=0.50, rhoc_visc=235,t,zeta_0_plus=1.34e-10,a_zeta=1,GAMMA_0_plus=0.423e-8;
247  double pi=3.141592654,a_chi,k_B=1.3806504e-23,X_T,DELTA_lambda,dPdT,eta_B,DELTA_lambda_id,DELTA_lambda_i;
248 
249  lambda_0=a+b*T+c*T*T+d*T*T*T+e*T*T*T*T;
250  lambda_tilde=lambda_1*rho+lambda_2*rho*rho+lambda_3*rho*rho*rho+lambda_4*rho*rho*rho*rho;
251 
252  if (0)//(T>Tc)
253  {
254  t=fabs((T-reduce.T)/reduce.T);
255  a_chi=a_zeta/0.7;
256  eta_B=(2.60*1.6*t)*1e-5;
257  dPdT=(2.18-0.12/exp(17.8*t))*1e5; //[Pa-K]
258  X_T=0.61*rhoc_visc+16.5*log(t);
259  // Along the critical isochore (only a function of temperature) (Eq. 9)
260  DELTA_lambda_i=LAMBDA*(k_B*T*T)/(6*pi*eta_B*(zeta_0_plus*pow(t,-nu)*(1+a_zeta*pow(t,DELTA))))*dPdT*dPdT*GAMMA_0_plus*pow(t,-gamma)*(1+a_chi*pow(t,DELTA));
261  DELTA_lambda_id=DELTA_lambda_i*exp(-36*t*t);
262  if (rho<0.6*reduce.rho)
263  {
264  DELTA_lambda=DELTA_lambda_id*(X_T*X_T)/(X_T*X_T+powInt(0.6*rhoc_visc-0.96*rhoc_visc,2))*powInt(rho,2)/powInt(0.6*rhoc_visc,2);
265  }
266  else
267  {
268  DELTA_lambda=DELTA_lambda_id*(X_T*X_T)/(X_T*X_T+powInt(rho-0.96*rhoc_visc,2));
269  }
270  }
271  else
272  {
273  DELTA_lambda=0.0;
274  }
275 
276  return lambda_0+lambda_tilde+DELTA_lambda;
277 }
278 double R717Class::viscosity_Trho(double T, double rho)
279 {
280  /*
281  From "The Viscosity of Ammonia"
282  by A. Fenghour and W.A. Wakeham and V. Vesovic and J.T.R. Watson and J. Millat and E. Vogel
283  J. Phys. Chem. Ref. Data, Vol. 24, No. 5, 1995
284  */
285  double sum=0, e_k=386.0,sigma=0.2957,M=17.03026,sum2=0.0;
286  int i,j;
287  double T_star,G_eta_star,eta0,B_eta_star,B_eta,b_1,deltaeta_h;
288  double a[]={4.99318220,-0.61122364,0.0,0.18535124,-0.11160946};
289  double c[]={-0.17999496e1,0.46692621e2,-0.53460794e3,0.33604074e4,-0.13019164e5,
290  0.33414230e5,-0.58711743e5,0.71426686e5,-0.59834012e5,0.33652741e5,
291  -0.12027350e5,0.24348205e4,-0.20807957e3};
292  // indices are backwards from paper
293  double d[5][3]={{0,0.17366936e-2,0.0},
294  {0.0,-0.64250359e-2,0.0},
295  {2.19664285e-1,0.0,1.67668649e-4},
296  {0.0,0.0,-1.49710093e-4},
297  {-0.83651107e-1,0.0,0.77012274e-4}};
298 
299  // rho is units of mol/L, so convert the density from kg/m^3 to mol/L (poorly documented in paper)
300  rho=rho/M;
301 
302  sum=0;
303  T_star=T/e_k;
304  for (i=0;i<=4;i++)
305  {
306  sum+=a[i]*powInt(log(T_star),i);
307  }
308  G_eta_star=exp(sum);
309 
310  // From REFPROP fluid file: !=0.021357*SQRT(MW)*(unknown factor of 100) [Chapman-Enskog term]
311  // Seems like there is a typo in Fenghour - or am I missing something?
312  eta0=0.021357*sqrt(T*M)*100/(sigma*sigma*G_eta_star);
313 
314  sum=0;
315  for (i=0;i<=12;i++)
316  {
317  sum+=c[i]*powInt(sqrt(T_star),-i);
318  }
319  B_eta_star=sum;
320  B_eta=B_eta_star*(0.6022137*sigma*sigma*sigma);
321  b_1=B_eta*eta0;
322 
323  sum=0;
324  for (i=2;i<=4;i++)
325  {
326  sum2=0.0;
327  for (j=0;j<=4;j++)
328  {
329  // indices of d are backwards from paper
330  sum2+=d[j][i-2]/powInt(T_star,j);
331  }
332  sum+=sum2*powInt(rho,i);
333  }
334  deltaeta_h=sum;
335  return (eta0+b_1*rho+deltaeta_h)/1e6;
336 }
337 double R717Class::psat(double T)
338 {
339  // Maximum absolute error is 0.055212 % between 195.495001 K and 405.399990 K
340  const double t[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 20, 26};
341  const double N[]={0, 0.04909506379170004, -8.5985591284104057, 22.98850790970738, -222.28840209935356, 1491.9401420842644, -6641.0811040366289, 19697.275454679908, -38321.157974702161, 45841.962482923009, -27382.278742352592, 6743.9692067905371, -2077.8944819332091, 1272.2022925639299, -597.49829753755705};
342  double summer=0,theta;
343  int i;
344  theta=1-T/reduce.T;
345  for (i=1;i<=14;i++)
346  {
347  summer += N[i]*pow(theta,t[i]/2);
348  }
349  return reduce.p.Pa*exp(reduce.T/T*summer);
350 }
351 
352 double R717Class::rhosatL(double T)
353 {
354  // Maximum absolute error is 0.264196 % between 195.495001 K and 405.399990 K
355  const double t[] = {0, 0.16666666666666666, 0.3333333333333333, 0.5, 0.6666666666666666, 0.8333333333333334, 1.0, 1.1666666666666667, 1.3333333333333333, 1.5, 2.1666666666666665};
356  const double N[] = {0, 3.2591904910225704, -41.687339030964814, 246.43755287753763, -837.61113396671999, 2080.7279064276067, -3935.4817672564195, 5171.1096164456239, -4027.6487405218049, 1387.0671995039477, -43.611646611054738};
357  double summer=0,theta;
358  int i;
359  theta=1-T/reduce.T;
360  for (i=1; i<=10; i++)
361  {
362  summer += N[i]*pow(theta,t[i]);
363  }
364  return reduce.rho*(summer+1);
365 }
366 
367 double R717Class::rhosatV(double T)
368 {
369  // Maximum absolute error is 0.123990 % between 195.495001 K and 405.399990 K
370  const double t[] = {0, 0.3333333333333333, 0.5, 0.6666666666666666, 0.8333333333333334, 1.0, 1.1666666666666667, 1.3333333333333333, 1.5, 1.8333333333333333};
371  const double N[] = {0, -62.065663192057258, 869.56245921894947, -5338.5660401310852, 18273.366873938554, -38074.430040623774, 48944.180419243385, -36862.534086957254, 13256.30649363281, -1014.8176862674514};
372  double summer=0,theta;
373  int i;
374  theta=1-T/reduce.T;
375  for (i=1; i<=9; i++)
376  {
377  summer += N[i]*pow(theta,t[i]);
378  }
379  return reduce.rho*exp(reduce.T/T*summer);
380 }
382 {
383  return 0.1028*pow(1-T/reduce.T,1.211)-0.09453*pow(1-T/reduce.T,5.585);
384 }
std::vector< phi_BC * > phirlist
Definition: FluidClass.h:178
double rhosatL(double)
Definition: R717.cpp:352
struct FluidLimits limits
Definition: FluidClass.h:219
virtual double conductivity_Trho(double, double)
Definition: R717.cpp:211
std::string EOS
Definition: FluidClass.h:120
std::string VISCOSITY
Definition: FluidClass.h:122
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
R717Class()
Definition: R717.cpp:33
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 REFPROPname
The name of the fluid.
Definition: FluidClass.h:152
double surface_tension_T(double T)
Definition: R717.cpp:381
std::string SURFACE_TENSION
Definition: FluidClass.h:126
double psat(double)
Definition: R717.cpp:337
virtual double viscosity_Trho(double, double)
Definition: R717.cpp:278
double pmax
Definition: FluidClass.h:54
params
struct CriticalStruct crit
Definition: FluidClass.h:218
BibTeXKeysStruct BibTeXKeys
Definition: FluidClass.h:175
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 rhosatV(double)
Definition: R717.cpp:367
double Tmin
Definition: FluidClass.h:54
double rhomax
Definition: FluidClass.h:54
std::string CONDUCTIVITY
Definition: FluidClass.h:123