mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Water viscosity and moved viscosity specific values into the viscosity entry in JSON files
This commit is contained in:
@@ -348,12 +348,37 @@ protected:
|
||||
/// Parse the transport properties
|
||||
void parse_viscosity(rapidjson::Value &viscosity, CoolPropFluid & fluid)
|
||||
{
|
||||
// Load the BibTeX key
|
||||
fluid.transport.BibTeX_viscosity = cpjson::get_string(viscosity,"BibTeX");
|
||||
if (viscosity.HasMember("hardcoded")){
|
||||
std::string target = cpjson::get_string(viscosity,"hardcoded");
|
||||
if (!target.compare("Water")){
|
||||
fluid.transport.hardcoded = CoolProp::TransportPropertyData::VISCOSITY_HARDCODED_WATER;
|
||||
return;
|
||||
}
|
||||
else{
|
||||
throw ValueError();
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Lennard-Jones 12-6 potential variables, or approximate them from method of Chung
|
||||
if (!viscosity.HasMember("sigma_eta")|| !viscosity.HasMember("epsilon_over_k")){
|
||||
default_transport(fluid);
|
||||
}
|
||||
else{
|
||||
fluid.transport.sigma_eta = cpjson::get_double(viscosity, "sigma_eta");
|
||||
fluid.transport.epsilon_over_k = cpjson::get_double(viscosity, "epsilon_over_k");
|
||||
}
|
||||
|
||||
// Load dilute viscosity term
|
||||
if (viscosity.HasMember("dilute")){
|
||||
parse_dilute_viscosity(viscosity["dilute"], fluid);
|
||||
}
|
||||
// Load initial density term
|
||||
if (viscosity.HasMember("initial_density")){
|
||||
parse_initial_density_viscosity(viscosity["initial_density"], fluid);
|
||||
}
|
||||
// Load higher_order term
|
||||
if (viscosity.HasMember("higher_order")){
|
||||
parse_higher_order_viscosity(viscosity["higher_order"], fluid);
|
||||
}
|
||||
@@ -366,13 +391,6 @@ protected:
|
||||
/// Parse the transport properties
|
||||
void parse_transport(rapidjson::Value &transport, CoolPropFluid & fluid)
|
||||
{
|
||||
if (!transport.HasMember("sigma_eta")|| !transport.HasMember("epsilon_over_k")){
|
||||
default_transport(fluid);
|
||||
}
|
||||
else{
|
||||
fluid.transport.sigma_eta = cpjson::get_double(transport, "sigma_eta");
|
||||
fluid.transport.epsilon_over_k = cpjson::get_double(transport, "epsilon_over_k");
|
||||
}
|
||||
// Parse viscosity
|
||||
if (transport.HasMember("viscosity")){
|
||||
parse_viscosity(transport["viscosity"],fluid);
|
||||
|
||||
@@ -132,6 +132,16 @@ long double HelmholtzEOSMixtureBackend::calc_viscosity(void)
|
||||
{
|
||||
if (is_pure_or_pseudopure)
|
||||
{
|
||||
if (components[0]->transport.hardcoded != CoolProp::TransportPropertyData::VISCOSITY_NOT_HARDCODED)
|
||||
{
|
||||
switch(components[0]->transport.hardcoded)
|
||||
{
|
||||
case CoolProp::TransportPropertyData::VISCOSITY_HARDCODED_WATER:
|
||||
return TransportRoutines::viscosity_water_hardcoded(*this);
|
||||
default:
|
||||
throw ValueError(format("hardcoded viscosity type [%d] is invalid for fluid %s", components[0]->transport.hardcoded, name().c_str()));
|
||||
}
|
||||
}
|
||||
// Dilute part
|
||||
long double eta_dilute;
|
||||
switch(components[0]->transport.viscosity_dilute.type)
|
||||
|
||||
@@ -142,5 +142,115 @@ long double TransportRoutines::viscosity_initial_density_dependence_Rainwater_Fr
|
||||
}
|
||||
}
|
||||
|
||||
static void visc_Helper(double Tbar, double rhobar, double *mubar_0, double *mubar_1)
|
||||
{
|
||||
std::vector<std::vector<long double> > H(6,std::vector<long double>(7,0));
|
||||
double sum;
|
||||
int i,j;
|
||||
|
||||
// Dilute-gas component
|
||||
*mubar_0=100.0*sqrt(Tbar)/(1.67752+2.20462/Tbar+0.6366564/powInt(Tbar,2)-0.241605/powInt(Tbar,3));
|
||||
|
||||
//Fill in zeros in H
|
||||
for (i=0;i<=5;i++)
|
||||
{
|
||||
for (j=0;j<=6;j++)
|
||||
{
|
||||
H[i][j]=0;
|
||||
}
|
||||
}
|
||||
|
||||
//Set non-zero parameters of H
|
||||
H[0][0]=5.20094e-1;
|
||||
H[1][0]=8.50895e-2;
|
||||
H[2][0]=-1.08374;
|
||||
H[3][0]=-2.89555e-1;
|
||||
|
||||
H[0][1]=2.22531e-1;
|
||||
H[1][1]=9.99115e-1;
|
||||
H[2][1]=1.88797;
|
||||
H[3][1]=1.26613;
|
||||
H[5][1]=1.20573e-1;
|
||||
|
||||
H[0][2]=-2.81378e-1;
|
||||
H[1][2]=-9.06851e-1;
|
||||
H[2][2]=-7.72479e-1;
|
||||
H[3][2]=-4.89837e-1;
|
||||
H[4][2]=-2.57040e-1;
|
||||
|
||||
H[0][3]=1.61913e-1;
|
||||
H[1][3]=2.57399e-1;
|
||||
|
||||
H[0][4]=-3.25372e-2;
|
||||
H[3][4]=6.98452e-2;
|
||||
|
||||
H[4][5]=8.72102e-3;
|
||||
|
||||
H[3][6]=-4.35673e-3;
|
||||
H[5][6]=-5.93264e-4;
|
||||
|
||||
// Finite density component
|
||||
sum=0;
|
||||
for (i=0;i<=5;i++)
|
||||
{
|
||||
for (j=0;j<=6;j++)
|
||||
{
|
||||
sum+=powInt(1/Tbar-1,i)*(H[i][j]*powInt(rhobar-1,j));
|
||||
}
|
||||
}
|
||||
*mubar_1=exp(rhobar*sum);
|
||||
}
|
||||
long double TransportRoutines::viscosity_water_hardcoded(HelmholtzEOSMixtureBackend &HEOS)
|
||||
{
|
||||
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, pstar, Tstar, rhostar;
|
||||
double delta,tau,mubar_0,mubar_1,mubar_2,drhodp,drhodp_R,DeltaChibar,zeta,w,L,Y,psi_D,Tbar,rhobar;
|
||||
double drhobar_dpbar,drhobar_dpbar_R,R_Water;
|
||||
|
||||
pstar = 22.064e6;
|
||||
Tstar = 647.096;
|
||||
rhostar = 322;
|
||||
Tbar = HEOS.T()/Tstar;
|
||||
rhobar = HEOS.keyed_output(CoolProp::iDmass)/rhostar;
|
||||
R_Water = HEOS.gas_constant()/HEOS.molar_mass();
|
||||
|
||||
// Dilute and finite gas portions
|
||||
visc_Helper(Tbar, rhobar, &mubar_0, &mubar_1);
|
||||
|
||||
///************************ Critical Enhancement ************************
|
||||
delta=rhobar;
|
||||
// "Normal" calculation
|
||||
tau=1/Tbar;
|
||||
drhodp=1/(R_Water*HEOS.T()*(1+2*delta*HEOS.dalphar_dDelta()+delta*delta*HEOS.d2alphar_dDelta2()));
|
||||
drhobar_dpbar = pstar/rhostar*drhodp;
|
||||
// "Reducing" calculation
|
||||
tau=1/Tbar_R;
|
||||
drhodp_R=1/(R_Water*Tbar_R*Tstar*(1+2*delta*HEOS.dalphar_dDelta()+delta*delta*HEOS.d2alphar_dDelta2()));
|
||||
drhobar_dpbar_R = pstar/rhostar*drhodp_R;
|
||||
|
||||
DeltaChibar=rhobar*(drhobar_dpbar-drhobar_dpbar_R*Tbar_R/Tbar);
|
||||
if (DeltaChibar<0)
|
||||
DeltaChibar=0;
|
||||
zeta=zeta_0*pow(DeltaChibar/LAMBDA_0,nu/gamma);
|
||||
if (zeta<0.3817016416){
|
||||
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));
|
||||
}
|
||||
else
|
||||
{
|
||||
psi_D=acos(pow(1+powInt(qd*zeta,2),-1.0/2.0));
|
||||
w=sqrt(fabs((qc*zeta-1)/(qc*zeta+1)))*tan(psi_D/2.0);
|
||||
if (qc*zeta>1){
|
||||
L=log((1+w)/(1-w));
|
||||
}
|
||||
else{
|
||||
L=2*atan(fabs(w));
|
||||
}
|
||||
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);
|
||||
}
|
||||
mubar_2=exp(x_mu*Y);
|
||||
|
||||
return (mubar_0*mubar_1*mubar_2)/1e6;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}; /* namespace CoolProp */
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
*/
|
||||
static long double modified_Batschinski_Hildebrand_viscosity_term(HelmholtzEOSMixtureBackend &HEOS);
|
||||
|
||||
static long double TransportRoutines::viscosity_water_hardcoded(HelmholtzEOSMixtureBackend &HEOS);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -122,19 +122,19 @@ vel("R152A", "T", 242, "Dmass", 1025.5, "V", 347.3e-6, 1e-3),
|
||||
vel("R152A", "T", 242, "Dmass", 2.4868, "V", 8.174e-6, 1e-3),
|
||||
vel("R152A", "T", 384, "Dmass", 504.51, "V", 43.29e-6, 5e-3),
|
||||
vel("R152A", "T", 384, "Dmass", 239.35, "V", 21.01e-6, 10e-3),
|
||||
//
|
||||
//// Huber, JPCRD, 2008 and IAPWS
|
||||
//vel("Water", "T", 298.15, "Dmass", 998, "V", 889.735100e-6, 1e-3),
|
||||
//vel("Water", "T", 298.15, "Dmass", 1200, "V", 1437.649467e-6, 1e-3),
|
||||
//vel("Water", "T", 373.15, "Dmass", 1000, "V", 307.883622e-6, 1e-3),
|
||||
//vel("Water", "T", 433.15, "Dmass", 1, "V", 14.538324e-6, 1e-3),
|
||||
//vel("Water", "T", 433.15, "Dmass", 1000, "V", 217.685358e-6, 1e-3),
|
||||
//vel("Water", "T", 873.15, "Dmass", 1, "V", 32.619287e-6, 1e-3),
|
||||
//vel("Water", "T", 873.15, "Dmass", 100, "V", 35.802262e-6, 1e-3),
|
||||
//vel("Water", "T", 873.15, "Dmass", 600, "V", 77.430195e-6, 1e-3),
|
||||
//vel("Water", "T", 1173.15, "Dmass", 1, "V", 44.217245e-6, 1e-3),
|
||||
//vel("Water", "T", 1173.15, "Dmass", 100, "V", 47.640433e-6, 1e-3),
|
||||
//vel("Water", "T", 1173.15, "Dmass", 400, "V", 64.154608e-6, 1e-3),
|
||||
|
||||
// Huber, JPCRD, 2008 and IAPWS
|
||||
vel("Water", "T", 298.15, "Dmass", 998, "V", 889.735100e-6, 1e-3),
|
||||
vel("Water", "T", 298.15, "Dmass", 1200, "V", 1437.649467e-6, 1e-3),
|
||||
vel("Water", "T", 373.15, "Dmass", 1000, "V", 307.883622e-6, 1e-3),
|
||||
vel("Water", "T", 433.15, "Dmass", 1, "V", 14.538324e-6, 1e-3),
|
||||
vel("Water", "T", 433.15, "Dmass", 1000, "V", 217.685358e-6, 1e-3),
|
||||
vel("Water", "T", 873.15, "Dmass", 1, "V", 32.619287e-6, 1e-3),
|
||||
vel("Water", "T", 873.15, "Dmass", 100, "V", 35.802262e-6, 1e-3),
|
||||
vel("Water", "T", 873.15, "Dmass", 600, "V", 77.430195e-6, 1e-3),
|
||||
vel("Water", "T", 1173.15, "Dmass", 1, "V", 44.217245e-6, 1e-3),
|
||||
vel("Water", "T", 1173.15, "Dmass", 100, "V", 47.640433e-6, 1e-3),
|
||||
vel("Water", "T", 1173.15, "Dmass", 400, "V", 64.154608e-6, 1e-3),
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user