14 #define _CRTDBG_MAP_ALLOC
15 #define _CRT_SECURE_NO_WARNINGS
32 static const double n[]={0,
53 -0.13251180074668e-11,
91 static const int d[]={0,
148 static const double t[]={0.00,
205 static const int c[]={0,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
329 static const double n0[]={0,
339 static const double gamma0[]={0,
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));
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);
387 params.molemass = 18.015268;
389 params.ptriple = 0.611699223742;
390 params.R_u = 8.314371357587;
391 params.accentricfactor = 0.3442920843;
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");
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");
407 name.assign(
"Water");
409 aliases.push_back(std::string(
"WATER"));
419 static void visc_Helper(
double Tbar,
double rhobar,
double *mubar_0,
double *mubar_1)
425 *mubar_0=100.0*sqrt(Tbar)/(1.67752+2.20462/Tbar+0.6366564/
powInt(Tbar,2)-0.241605/
powInt(Tbar,3));
474 *mubar_1=exp(rhobar*sum);
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}};
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;
492 rhobar = rho/rhostar;
493 R_Water = 8314.47215/
params.molemass;
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));
508 lambdabar_1=exp(rhobar*sum);
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,
517 double drhobar_dpbar=pstar/rhostar*drhodp;
519 double drhobar_dpbar_Trbar=pstar/rhostar*drhodp_Trbar;
524 double DELTAchibar_T=rhobar*(drhobar_dpbar-drhobar_dpbar_Trbar*Tr_bar/Tbar);
528 xi=xi_0*pow(DELTAchibar_T/Lambda_0,nu/gamma);
532 double kappa = cp/cv;
536 Z=2/(pi*y)*(((1-1/kappa)*atan(y)+y/kappa)-(1-exp(-1/(1/y+y*y/3/rhobar/rhobar))));
538 lambdabar_2=GAMMA*rhobar*cpbar*Tbar/mubar*Z;
539 return (lambdabar_0*lambdabar_1+lambdabar_2)*lambdastar;
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;
552 visc_Helper(Tbar,rhobar,&mubar_0,&mubar_1);
565 DeltaChibar=rhobar*(drhobar_dpbar-drhobar_dpbar_R*Tbar_R/Tbar);
568 zeta=zeta_0*pow(DeltaChibar/LAMBDA_0,nu/gamma);
569 if (zeta<0.3817016416)
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));
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);
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);
589 return (mubar_0*mubar_1*mubar_2)/1e6;
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};
599 summer=summer+ai[i]*pow(1-T/
reduce.
T,ti[i]);
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};
611 summer=summer+ai[i]*pow(1.0-T/
reduce.
T,ti[i]);
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};
623 summer=summer+ai[i]*pow(1.0-T/
reduce.
T,ti[i]);
631 return -0.1306*pow(1-T/
reduce.
T,2.471)+0.2151*pow(1-T/
reduce.
T,1.233);
std::vector< phi_BC * > phirlist
double R()
Returns the mass-specific gas constant for the fluid in the desired units.
struct FluidLimits limits
double surface_tension_T(double T)
std::string name
A container to hold the cache for residual Helmholtz derivatives.
std::string TransportReference
A std::string that contains a reference for thermo properties for the fluid.
std::vector< std::string > aliases
The REFPROP-compliant name if REFPROP-"name" is not a compatible fluid name. If not included...
struct CriticalStruct reduce
A pointer to the point that is used to reduce the T and rho for EOS.
std::string EOSReference
The critical qd parameter for the Olchowy-Sengers cross-over term.
std::string ECS_LENNARD_JONES
std::string SURFACE_TENSION
double specific_heat_v_Trho(double T, double rho)
virtual double d2phir_dDelta2(double tau, double delta)
virtual double conductivity_Trho(double, double)
struct CriticalStruct crit
BibTeXKeysStruct BibTeXKeys
virtual double viscosity_Trho(double, double)
std::vector< phi_BC * > phi0list
A vector of instances of the phi_BC classes for the residual Helmholtz energy contribution.
double specific_heat_p_Trho(double T, double rho)
This is the abstract base class upon which each residual Helmholtz energy class is built...
virtual double dphir_dDelta(double tau, double delta)