2 #if defined(__powerpc__)
4 #define RAPIDJSON_NO_INT64DEFINE
17 #define DBL_EPSILON std::numeric_limits<double>::epsilon()
31 if (Fluid.find(
"REFPROP-")==0){
75 throw ValueError(
format(
"Bad Fluid name [%s] - not a CoolProp fluid",Fluid.c_str()));
134 return ((iI1 == I1 || iI1 == I2) && (iI2 == I1 || iI2 == I2) && iI1!=iI2);
136 void sort_pair(
long *iInput1,
double *Value1,
long *iInput2,
double *Value2,
long I1,
long I2)
138 if (!(*iInput1 == I1) || !(*iInput2 == I2)){
139 std::swap(*iInput1,*iInput2);
140 std::swap(*Value1,*Value2);
149 if (fabs(Q-1) < mach_eps){
152 else if (fabs(Q) < mach_eps){
166 if (fabs(Q-1) < mach_eps){
169 else if (fabs(Q) < mach_eps){
227 std::cout <<
format(
"%s:%d: CoolPropStateClassSI::update %d,%g,%d,%g,%s",__FILE__,__LINE__,iInput1,Value1,iInput2,Value2,
pFluid->
get_name().c_str()).c_str() << std::endl;
241 bool using_EOS =
true;
272 update_Tp(iInput1,Value1,iInput2,Value2);
275 update_ph(iInput1,Value1,iInput2,Value2, T0, rho0);
278 update_ps(iInput1,Value1,iInput2,Value2);
284 update_hs(iInput1,Value1,iInput2,Value2);
287 update_Ts(iInput1,Value1,iInput2,Value2);
291 throw ValueError(
format(
"Sorry your inputs didn't work; valid pairs are P,Q T,Q T,D T,P P,H P,S T,S"));
305 std::cout <<
format(
"%s:%d: StateClassSI updated; T = %15.13g rho = %15.13g \n", __FILE__, __LINE__,
_T,
_rho).c_str();
341 sort_pair(&iInput1,&Value1,&iInput2,&Value2,iInput2,
iQ);
345 sort_pair(&iInput1,&Value1,&iInput2,&Value2,iInput1,
iQ);
383 throw ValueError(
format(
"Pseudo-pure fluids cannot use temperature-quality as inputs if Q is not 1 or 0"));
409 catch (std::exception &){
433 if (Value1 < 0 ){
throw ValueError(
format(
"Your temperature [%f K] is less than zero",Value1));}
434 if (Value2 < 0 ){
throw ValueError(
format(
"Your density [%f kg/m^3] is less than zero",Value2));}
497 if (
_p < 0 ){
throw ValueError(
format(
"Your pressure [%f Pa] is less than zero",Value1));}
559 std::cout <<
format(
"%s:%d: CoolPropStateClassSI::update_Tp(%d, %g, %d, %g)\n",__FILE__,__LINE__,iInput1,Value1,iInput2,Value2).c_str();
562 if (Value1 < 0 ){
throw ValueError(
format(
"Your temperature [%g K] is less than zero",Value1));}
563 if (Value2 < 0 ){
throw ValueError(
format(
"Your pressure [%g Pa] is less than zero",Value2));}
581 if (
get_debug_level() > 5) { std::cout <<
format(
"%s:%d: CoolPropStateClass::update_Tp::_TwoPhase : %d\n",__FILE__,__LINE__,_TwoPhase).c_str(); }
603 if (Value1 < 0 ){
throw ValueError(
format(
"Your pressure [%g Pa] is less than zero",Value1));}
611 std::cout <<
format(
"%s:%d: CoolPropStateClassSI::update_ph(p=%g,h=%g,T0=%g,rho0=%g)\n",__FILE__,__LINE__,
_p,
_h, T0, rho0) ;
642 if (Value1 < 0 ){
throw ValueError(
format(
"Your pressure [%g Pa] is less than zero",Value1));}
654 std::cout <<
format(
"pFluid->temperature_ps(_p, _s, &_T, &_rho, &rhosatL, &rhosatV, &TsatL, &TsatV)\n").c_str();
655 std::cout <<
format(
"pFluid->temperature_ps(%g, %g, %g, %g, %g, %g, %g, %g)\n",
_p,
_s,
_T,
_rho,
rhosatL,
rhosatV,
TsatL,
TsatV).c_str();
699 if ( _p < pFluid->crit.p.Pa && _rho < rhosatL && _rho >
rhosatV)
724 if (Value1 < 0 ){
throw ValueError(
format(
"Your temperature [%g K] is less than zero",Value1));}
736 std::cout <<
format(
"pFluid->density_Ts(_T, _s, &_rho, &_p, &rhosatL, &rhosatV, &psatL, &psatV)\n").c_str();
737 std::cout <<
format(
"pFluid->density_Ts(%g, %g, %g, %g, %g, %g, %g, %g)\n",
_T,
_s,
_rho,
_p,
rhosatL,
rhosatV,
psatL,
psatV).c_str();
741 if ( _T < pFluid->crit.T && _rho < rhosatL && _rho >
rhosatV)
856 _Q = (h-hsatL)/(hsatV-hsatL);
916 _h =
_Q*hsatV + (1-
_Q)*hsatL;
959 _Q = (s-ssatL)/(ssatV-ssatL);
962 _h =
_Q*hsatV + (1-
_Q)*hsatL;
1015 printf(
"Sorry your inputs[%d,%d] don't work for now with TTSE\n",(
int)iInput1,(
int)iInput2);
1016 throw ValueError(
format(
"Sorry your inputs don't work for now with TTSE"));
1026 _T = Value1;
_p = Value2;
1043 double x1=0,x2=0,x3=0,y1=0,y2=0,eps=1e-8,change=999,f=999;
1046 while ((iter<=3 || fabs(f)>eps) && iter<100)
1048 if (iter==1){x1 = 300;
_T=x1;}
1049 if (iter==2){x2 = 300+0.1;
_T=x2;}
1050 if (iter>2) {
_T=x2;}
1057 x3=x2-y2/(y2-y1)*(x2-x1);
1058 change=fabs(y2/(y2-y1)*(x2-x1));
1059 y1=y2; x1=x2; x2=x3;
1070 printf(
"Sorry your inputs[%d,%d] don't work for now with incompressible\n",(
int)iInput1,(
int)iInput2);
1071 throw ValueError(
format(
"Sorry your inputs don't work for now with incompressible"));
1122 output =
iGas;
break;
1146 output =
_rho;
break;
1148 output =
p();
break;
1150 output =
cp();
break;
1154 output =
cv();
break;
1158 output =
h()-
_T*
s();
break;
1168 output =
h();
break;
1170 output =
s();
break;
1172 output =
h()-
p()/
_rho;
break;
1175 output =
phase();
break;
1206 output =
Z();
break;
1210 output =
dZdTau();
break;
1212 output =
B();
break;
1214 output =
dBdT();
break;
1216 output =
C();
break;
1218 output =
dCdT();
break;
1291 throw ValueError(
format(
"Invalid Output index to CPState function keyed_output: %d ",iOutput));
1294 std::cout <<
format(
"%s:%d: CoolPropStateClassSI::keyed_output(%d) -> %g\n",__FILE__,__LINE__, iOutput,output) ;
1414 if (
get_debug_level()>9){ std::cout <<
format(
"%s:%d: StateClassSI::h: h %g\n", __FILE__,__LINE__,val).c_str(); }
1563 return (drhodp_h*dsdh_p-drhodh_p*dsdp_h);
1573 return (drhodh_p*dsdp_h-drhodp_h*dsdh_p)/(dTdh_p*drhodp_h-dTdp_h*drhodh_p);
1595 double dvdTL = -drhodTL/
rhoL()/
rhoL();
1596 double dvdTV = -drhodTV/
rhoV()/
rhoV();
1597 double dxdT_v = (
_Q*dvdTV + (1-
_Q)*dvdTL)/(1/
rhoL()-1/
rhoV());
1599 return Tsat*dsdTL + Tsat*dxdT_v*(
sV()-
sL()) +
_Q*Tsat*(dsdTV - dsdTL);
1617 double dxdT_v = (
_Q*dvdTV + (1-
_Q)*dvdTL)/(1/
rhoL()-1/
rhoV());
1619 return Tsat*dsdTL + Tsat*dxdT_v*(
sV()-
sL()) +
_Q*Tsat*(dsdTV - dsdTL);
1639 double dxdp_s = (-
_Q*(dsdpV-dsdpL) - dsdpL)/(
sV()-
sL());
1640 double dddp_s = -pow(
_rho,2)*(dvdpL + dxdp_s*(1/
rhoV() - 1/
rhoL()) +
_Q*(dvdpV-dvdpL));
1641 return pow(1.0/dddp_s,0.5);
1653 return 1/sqrt((drhodp__h-drhodh__p*dsdp__h/dsdh__p));
1662 double dxdp_s = (-
_Q*(dsdpV-dsdpL) - dsdpL)/(
sV()-
sL());
1663 double dddp_s = -pow(
_rho,2)*(dvdpL + dxdp_s*(1/
rhoV() - 1/
rhoL()) +
_Q*(dvdpV-dvdpL));
1664 return pow(1.0/dddp_s,0.5);
1668 return sqrt(-c2*this->
_T*this->
cp()/c1);
1702 return 1.0/rho*(drhodp__h-drhodh__p*dTdp__h/dTdh__p);
1733 return -1.0/(
rho)*drhodh__p/dTdh__p;
1754 double drho =
Props(
"D",
'P',
p(),
'T',
T()+deltaT,
pIncompLiquid->
getName())-
Props(
"D",
'P',
p(),
'T',
T()-deltaT,
pIncompLiquid->
getName());
1755 double dh =
Props(
"H",
'P',
p(),
'T',
T()+deltaT,
pIncompLiquid->
getName())-
Props(
"H",
'P',
p(),
'T',
T()-deltaT,
pIncompLiquid->
getName());
1760 double drho =
Props(
"D",
'P',
p(),
'T',
T()+deltaT,
brine_string)-
Props(
"D",
'P',
p(),
'T',
T()-deltaT,
brine_string);
1761 double dh =
Props(
"H",
'P',
p(),
'T',
T()+deltaT,
brine_string)-
Props(
"H",
'P',
p(),
'T',
T()-deltaT,
brine_string);
1796 double hL = this->
hL();
1797 double hV = this->
hV();
1798 double hend = xend*hV+(1-xend)*hL;
1826 double hL = this->
hL();
1827 double hV = this->
hV();
1828 double hend = xend*hV+(1-xend)*hL;
1858 double h_l = this->
hL();
1859 double h_v = this->
hV();
1860 double rho_l = this->
rhoL();
1861 double rho_v = this->
rhoV();
1863 double h_end = xend * h_v + (1-xend)*h_l;
1864 double rho_end = (rho_l * rho_v)/(xend * rho_l + (1-xend)*rho_v);
1877 double dxdp = ((xend - 1 )* dhldp - xend* dhvdp)/(h_v - h_l);
1878 double drhodh_end = pow(rho_end,2)/(rho_l*rho_v) * (rho_v - rho_l)/(h_v - h_l);
1879 double dvdh_end = (1/rho_v - 1/rho_l)/(h_v - h_l);
1880 double dvdp_end = (-1/pow(rho_l,2) * drholdp + dxdp * (1/rho_v - 1/rho_l) + xend * (-1/pow(rho_v,2) * drhovdp + 1/pow(rho_l,2) * drholdp));
1881 double drhodp_end = -pow(rho_end,2) * dvdp_end;
1882 double dvdhdp_end = 1/(h_v - h_l) * (-1/pow(rho_v,2)*drhovdp + 1/pow(rho_l,2) * drholdp) - (1/rho_v - 1/rho_l) / pow((h_v - h_l),2) * (dhvdp - dhldp);
1883 double drhodhdp_end = -2 * rho_end * dvdh_end * drhodp_end -pow(rho_end,2)*dvdhdp_end;
1886 double drhoxdp = pow(rho_end,2)*(xend / pow(rho_v,2) * drhovdp + (1-xend)/pow(rho_l,2) * drholdp);
1889 double delta = x * (h_v - h_l);
1890 double delta_end = h_end - h_l;
1891 double ddeltaxdp = xend * (dhvdp - dhldp);
1892 double ddeltadp = -dhldp;
1895 double a = 1/pow(delta_end,3) * (2*rho_l - 2*rho_end + delta_end * (drhodh_l + drhodh_end));
1896 double b = 3/pow(delta_end,2) * (-rho_l + rho_end) - 1/delta_end * (drhodh_end + 2 * drhodh_l);
1897 double c = drhodh_l;
1901 double dadp = -6/pow(delta_end,4) * ddeltaxdp * (rho_l - rho_end) + 2/pow(delta_end,3) * (drholdp - drhoxdp) + 1/pow(delta_end,2) * (drhodhdp_l + drhodhdp_end) -2/pow(delta_end,3) * (drhodh_l + drhodh_end)*ddeltaxdp;
1902 double dbdp = -6/pow(delta_end,3) * ddeltaxdp * (-rho_l + rho_end) + 3/pow(delta_end,2) * (-drholdp + drhoxdp) + 1/pow(delta_end,2) * ddeltaxdp * (drhodh_end + 2 * drhodh_l) - 1/delta_end * (drhodhdp_end + 2 * drhodhdp_l);
1903 double dcdp = drhodhdp_l;
1904 double dddp = drholdp;
1907 rho_spline = a * pow(delta,3) + b * pow(delta,2) + c * delta + d;
1908 dsplinedp = (3*a * pow(delta,2) +2* b * delta + c)* ddeltadp + pow(delta,3) * dadp + pow(delta,2) * dbdp + delta * dcdp + dddp;
1909 dsplinedh = 3 * a * pow(delta,2) + 2*b * delta + c;
1944 #ifndef DISABLE_CATCH
1947 TEST_CASE(
"Check of density smoothing derivatives",
"[normal]")
1950 double rho_spline, dsplinedh, dsplinedp;
1964 CPS.
rho_smoothed(0.3,rho_spline, dsplinedh, dsplinedp);
1968 double drho_dh__constp_num = (CPS2.
rho()-CPS.
rho())/dh;
1974 CHECK(fabs(dsplinedh/drho_dh__constp-1) < 1e-4);
1975 CHECK(fabs(drho_dh__constp_num/drho_dh__constp-1) < 1e-4);
1978 THEN(
"Smoothed Density")
1980 for (
double x = 0;
x <=0.31;
x+= 0.3)
1985 CPS.
rho_smoothed(0.3, rho_spline, dsplinedh, dsplinedp);
1986 double rho_EOS = CPS.
rho();
1991 CHECK(fabs(rho_spline/rho_EOS-1) < 1e-6);
1999 THEN(
"drho_dh|p at x = xend")
2005 CPS.
rho_smoothed(0.3, rho_spline, dsplinedh, dsplinedp);
2012 CHECK(fabs(dsplinedh/drho_dh__constp-1) < 1e-2);
2015 THEN(
"Smoothed Density")
2017 for (
double x = 0;
x <=0.31;
x+= 0.3)
2022 CPS.
rho_smoothed(0.3, rho_spline, dsplinedh, dsplinedp);
2023 double rho_EOS = CPS.
rho();
2029 CHECK(fabs(rho_spline/rho_EOS-1) < 1e-2);
2040 throw ValueError(
"function invalid for incompressibles");
2055 double dxdp_h = (dhdpL+
_Q*(dhdpV-dhdpL))/(hL-
hV);
2056 double dvdp_h = dvdpL+dxdp_h*(1/rhoV-1/
rhoL)+
_Q*(dvdpV-dvdpL);
2075 double dxdp_h = (dhdpL+
_Q*(dhdpV-dhdpL))/(
hL()-
hV());
2112 return -dpdT_rho/dpdrho_T;
2135 double cv = this->
cv();
2143 double LAMBDA1 = d2pdv2_constT;
2144 double LAMBDA2 = -3*
_T/cv*dpdT_constv*d2pdvdT;
2145 double LAMBDA3 = +pow(
_T/cv*dpdT_constv,2)*(3*d2pdT2_constv+1/
_T*dpdT_constv*(1-
_T/cv*dcv_dT_constv));
2146 return LAMBDA1 + LAMBDA2 + LAMBDA3;
2163 double cp = this->
cp();
2164 double drhodT = -dpdT/dpdrho;
2348 return ddT_drhodT_p_constrho+ddrho_drhodT_p_constT*
drhodT_constp();
2369 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2382 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2388 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2394 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2401 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2413 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2425 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2433 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2442 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2448 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2454 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2462 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2471 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2485 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2499 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2507 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2515 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2520 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2526 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2531 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2538 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2544 if (!
TwoPhase){
throw ValueError(
format(
"Saturation derivative cannot be called now. Call update() with a two-phase set of inputs"));}
2766 return valueL+Q*(valueV-valueL);
2824 std::cout <<
format(
"%s:%d: CoolPropStateClass::update(%d,%g,%d,%g)\n",__FILE__,__LINE__,iInput1,Value1,iInput2,Value2).c_str();
2835 #ifndef DISABLE_CATCH
2837 TEST_CASE((
char*)
"Check REFPROP and coolprop state classes match",
"")
2842 SECTION((
char*)
"check T,rho -> p")
2844 double T = 313, rho = 1;
2845 CPWater.update(
iT,T,
iD,rho);
2849 SECTION((
char*)
"check T,p -> rho")
2851 double T = 313, p = 101325;
2852 CPWater.update(
iT,T,
iP,p);
2858 REQUIRE(fabs(RPrho - CPrho) < 1e-4);
2862 double T = 313, p = 101325;
2863 CPWater.update(
iT,T,
iP,p);
2869 REQUIRE(fabs(RPcp - CPcp) < 1e-4);
2873 double T = 313, p = 101325;
2874 CPWater.update(
iT,T,
iP,p);
2880 REQUIRE(fabs(RPcv - CPcv) < 1e-4);
2882 SECTION((
char*)
"check viscosity")
2884 double T = 313, p = 101325;
2885 CPWater.update(
iT,T,
iP,p);
2891 REQUIRE(fabs(RPvisc - CPvisc) < 1e-4);
2893 SECTION((
char*)
"check conductivity")
2895 double T = 313, p = 101325;
2896 CPWater.update(
iT,T,
iP,p);
2902 REQUIRE(fabs(RPcond - CPcond) < 1e-4);
2904 SECTION((
char*)
"check surface tension")
2906 double T = 313, p = 101325;
2907 CPWater.update(
iT,T,
iP,p);
2913 REQUIRE(fabs(RPsigma - CPsigma) < 1e-4);
double dhdp_constrho(void)
TEST_CASE("Check of density smoothing derivatives","[normal]")
double d2pdv2_consts(void)
double conductivity(void)
double drhodp_along_sat_vapor(void)
void update_Ts(long iInput1, double Value1, long iInput2, double Value2)
double interp_recip(double Q, double valueL, double valueV)
Fluid * get_fluid(long iFluid)
virtual double d3phir_dDelta_dTau2(double tau, double delta)
CoolPropStateClassSI RPWater("REFPROP-Water")
double R()
Returns the mass-specific gas constant for the fluid in the desired units.
virtual double d2phi0_dTau2(double tau, double delta)
std::string brine_string
Temporary until solutions are fixed.
double dphi0_dDelta(double tau, double delta)
bool match_pair(long iI1, long iI2, long I1, long I2)
double evaluate(long iParam, double p, double logp, double h)
double keyed_output(long iInput)
Return an output based on the integer key for the term.
virtual double d2phir_dDelta_dTau(double tau, double delta)
void disable_TTSE_LUT_writing(void)
Disable the writing of TTSE tables to file.
virtual void temperature_ph(double p, double h, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout, double T0=-1, double rho0=-1)
long get_Fluid_index(std::string FluidName)
double isothermal_compressibility(void)
double dphir_dTau(double tau, double delta)
bool build_TTSE_LUT(bool force=false)
Build of the TTSE LUT.
virtual void temperature_ps(double p, double s, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout)
struct FluidLimits limits
virtual double d3phir_dDelta3(double tau, double delta)
virtual double density_Tp(double T, double p)
virtual void temperature_hs(double h, double s, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout)
double dhdp_along_sat_vapor(void)
double Tsat(double Q)
Saturation temperature.
double dsdrho_constT(void)
void enable_TTSE_LUT_writing(void)
Enable the writing of TTSE tables to file.
void update_twophase(long iInput1, double Value1, long iInput2, double Value2)
void set_TTSESinglePhase_LUT_size(int Np, int Nh)
Over-ride the default size of the single-phase LUT.
double Tsat_anc(double p, double Q)
bool isenabled_TTSE_LUT_writing(void)
Check if the writing of TTSE tables to file is enabled.
double d2phir_dDelta_dTau(double tau, double delta)
void update_ps(long iInput1, double Value1, long iInput2, double Value2)
double dsdT_along_sat_vapor(void)
virtual double d3phi0_dTau3(double tau, double delta)
double psatV_anc(double T)
double d2sdrho2_constT(void)
void no_SatLSatV(void)
Stop it from adding the SatL and SatV class pointers.
CachedElement d2phir_dDelta2
double specific_heat_p_ideal_Trho(double T)
double d2rhodp2_along_sat_liquid(void)
virtual double d3phir_dTau3(double tau, double delta)
double drhodp_consth(void)
void update_hs(long iInput1, double Value1, long iInput2, double Value2)
double d3phir_dDelta3(double tau, double delta)
double phir(double tau, double delta)
virtual double phi0(double tau, double delta)
EXPORT_CODE int CONVENTION get_debug_level()
double Props(std::string Output, std::string Name1, double Prop1, std::string Name2, double Prop2, std::string Ref)
void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax)
Over-ride the default range of the single-phase LUT.
double d2hdp2_along_sat_vapor(void)
double d3phi0_dTau3(double tau, double delta)
void enable_TTSE_LUT(void)
Enable the TTSE.
double d3phir_dDelta_dTau2(double tau, double delta)
double d2rhodh2_constp(void)
double ddp_dTdp_along_sat(void)
Partial derivative w.r.t. pressure of dTdp along saturation curve.
void disable_EXTTP(void)
Disable the TTSE.
void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax)
Get the current range of the single-phase LUT.
double dhdT_along_sat_vapor(void)
virtual double d3phi0_dDelta3(double tau, double delta)
std::string getName() const
double surface_tension(void)
IncompressibleLiquid * pIncompLiquid
A pointer to the class for an incompressible liquid.
void update(long iInput1, double Value1, long iInput2, double Value2, double T0=-1, double rho0=-1)
double d2hdp2_along_sat_liquid(void)
long phase_prho_indices(double p, double rho, double &T, double &TL, double &TV, double &rhoL, double &rhoV)
double dhdrho_constp(void)
double psatL_anc(double T)
double d2phi0_dDelta2(double tau, double delta)
virtual double dphi0_dTau(double tau, double delta)
double drhodp_constT(void)
double d2rhodp2_along_sat_vapor(void)
EXPORT_CODE int CONVENTION get_standard_unit_system(void)
struct CriticalStruct reduce
A pointer to the point that is used to reduce the T and rho for EOS.
double ddT_dTdp_along_sat(void)
Partial derivative w.r.t. temperature of dTdp along saturation curve.
bool isenabled_TTSE_LUT(void)
Check if TTSE is enabled.
long phase_Trho_indices(double T, double rho, double &pL, double &pV, double &rhoL, double &rhoV)
Return the phase using the phase flags from phase enum in CoolProp.h.
double drhodh_constp_smoothed(double xend)
A smoothed version of the derivative using a spline curve in the region of x=0 to x=xend...
CachedElement d2phir_dDelta_dTau
double d3phi0_dDelta2_dTau(double tau, double delta)
void set_TTSESinglePhase_LUT_size(int Np, int Nh)
Over-ride the default size of the single-phase LUT.
std::string get_name()
Returns a std::string with the name of the fluid.
double dsdrho_constp(void)
virtual double surface_tension_T(double T)
virtual double rhosatV(double T)
double dphi0_dTau(double tau, double delta)
CachedElement d3phir_dDelta2_dTau
double d2hdp2_constT(void)
Fluid * pFluid
A pointer to a CoolProp fluid.
double evaluate_first_derivative(long iOF, long iWRT, long iCONSTANT, double p, double logp, double h)
TTSETwoPhaseTableClass TTSESatV
Fluid is the abstract base class that is employed by all the other fluids.
double d2sdT2_constp(void)
double B_over_D_TTSE(double _p, double _h)
Get the ratio directly which is just a bit faster.
virtual double rho(double T_K, double p)
Density as a function of temperature and pressure.
void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax)
Over-ride the default range of the single-phase LUT.
void sort_pair(long *iInput1, double *Value1, long *iInput2, double *Value2, long I1, long I2)
double d2phir_dDelta2(double tau, double delta)
CachedElement d2phi0_dTau2
virtual double dphir_dTau(double tau, double delta)
void disable_EXTTP(void)
Disable the extended two-phase calculations.
virtual double dphi0_dDelta(double tau, double delta)
EnvironmentalFactorsStruct environment
CachedElement d2phi0_dDelta_dTau
long phase_Tp_indices(double T, double p, double &pL, double &pV, double &rhoL, double &rhoV)
Return the phase using the phase flags from phase enum in CoolProp.h.
void enable_TTSE_LUT(void)
bool isenabled_TTSE_LUT_writing(void)
Check if the writing of TTSE tables to file is enabled.
double dhdrho_constT(void)
void set_TTSESat_LUT_size(int Nsat)
Over-ride the default size of both of the saturation LUT.
double dpdrho_constT(void)
double d2sdp2_constT(void)
TTSESinglePhaseTableClass TTSESinglePhase
std::vector< double > x(ncmax, 0)
void update_TTSE_LUT(long iInput1, double Value1, long iInput2, double Value2)
double dhdp_along_sat_liquid(void)
CachedElement d3phir_dDelta_dTau2
bool isenabled_EXTTP(void)
Check if TTSE is enabled.
double drhodT_constp(void)
struct OtherParameters params
void update_incompressible(long iInput1, double Value1, long iInput2, double Value2)
double evaluate(double x)
IncompressibleSolution * get_solution(long index)
bool add_value_constraint(double x, double y)
double d2hdT2_constrho(void)
void update_ph(long iInput1, double Value1, long iInput2, double Value2, double T0=-1, double rho0=-1)
double d2hdT2_constp(void)
CriticalSplineStruct_T CriticalSpline_T
LiquidsContainer LiquidsList
double dsdp_along_sat_vapor(void)
CachedElement dphi0_dDelta
void set_TTSESat_LUT_size(int N)
Over-ride the default size of both of the saturation LUT.
double d2rhodT2_constp(void)
double dphir_dDelta(double tau, double delta)
double B_TTSE(double _p, double _h)
Evaluate the B term from TTSE method.
bool add_REFPROP_fluid(std::string FluidName)
Add a REFPROP fluid to the fluid listing in CoolProp.
CachedElement d3phi0_dTau3
bool IsIncompressibleLiquid(std::string name)
virtual double s(double T_K, double p)
Entropy as a function of temperature and pressure.
double fundamental_derivative_of_gas_dynamics(void)
double dhdT_along_sat_liquid(void)
void disable_TTSE_LUT_writing(void)
Disable the writing of TTSE tables to file.
double d2Tdp2_along_sat(void)
Second derivative of temperature w.r.t. pressure along saturation curve.
double evaluate(long iParam, double p)
virtual double d2phir_dDelta2(double tau, double delta)
void update_prho(long iInput1, double Value1, long iInput2, double Value2)
double drhodT_along_sat_liquid(void)
struct CriticalStruct crit
double evaluate_T(double T)
bool IsIncompressibleSolution(std::string name)
double d2phir_dTau2(double tau, double delta)
double d2pdrho2_constT(void)
double d2sdT2_constrho(void)
double d3phi0_dDelta_dTau2(double tau, double delta)
virtual double c(double T_K, double p)
Heat capacities as a function of temperature and pressure.
double drhodh_constp(void)
virtual double h(double T_K, double p)
Enthalpy as a function of temperature and pressure.
virtual double phir(double tau, double delta)
REQUIRE(fabs(CPWater.p()-RPWater.p())< 1e-4)
double d2sdp2_along_sat_vapor(void)
bool enabled_TTSE_LUT
Parameters for the Tabular Taylor Series Expansion (TTSE) Method.
double temperature_prho(double p, double rho, double T0)
double dsdT_along_sat_liquid(void)
void rho_smoothed(double xend, double &rho_spline, double &dsplinedh, double &dsplinedp)
Density corresponding to the smoothed derivatives in the region of x=0 to x=xend. ...
double drhodT_along_sat_vapor(void)
CachedElement dphir_dDelta
void enable_TTSE_LUT_writing(void)
Enable the writing of TTSE tables to file.
CachedElement d3phir_dDelta3
virtual double d2phi0_dDelta2(double tau, double delta)
double phi0(double tau, double delta)
double isobaric_expansion_coefficient(void)
CachedElement d3phi0_dDelta3
void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax)
Get the current range of the single-phase LUT.
double d2sdp2_along_sat_liquid(void)
void update(long iInput1, double Value1, long iInput2, double Value2)
IncompressibleLiquid * get_liquid(long index)
CoolPropStateClassSI * SatV
double dsdT_constrho(void)
double dhdT_constrho(void)
void enable_EXTTP(void)
Enable the extended two-phase calculations.
virtual double viscosity_Trho(double T, double rho)
void check_saturated_quality(double Q)
bool within_TTSE_range(long iInput1, double Value1, long iInput2, double Value2)
Check whether within the TTSE range.
virtual double d2phi0_dDelta_dTau(double tau, double delta)
bool isenabled_TTSE_LUT(void)
Check if TTSE is enabled.
double convert_from_unit_system_to_SI(long iInput, double value, int old_system)
double dsdp_along_sat_liquid(void)
bool pure()
Returns true if the fluid is pure, false if pseudo-pure or a mixture.
virtual double d2phir_dTau2(double tau, double delta)
double d3phir_dTau3(double tau, double delta)
#define SECTION(name, description)
double temperature_prho_PengRobinson(double p, double rho)
double d3phi0_dDelta3(double tau, double delta)
TTSETwoPhaseTableClass TTSESatL
virtual double dphir_dDelta(double tau, double delta)
double dpdrho_consth(void)
virtual double rhosatL(double T)
virtual void saturation_p(double p, bool UseLUT, double &TsatLout, double &TsatVout, double &rhoLout, double &rhoVout)
void add_saturation_states(void)
void update_Tp(long iInput1, double Value1, long iInput2, double Value2)
IncompressibleSolution * pIncompSolution
A pointer to the class for an incompressible solution.
bool add_derivative_constraint(double x, double dydx)
void disable_TTSE_LUT(void)
Disable the TTSE.
virtual double d3phir_dDelta2_dTau(double tau, double delta)
bool isenabled_EXTTP(void)
Check if extended two-phase calculations are enabled.
double evaluate_sat_derivative(long iParam, double p)
virtual double conductivity_Trho(double T, double rho)
void update_Trho(long iInput1, double Value1, long iInput2, double Value2)
virtual double cond(double T_K, double p)
Thermal conductivity as a function of temperature and pressure.
void disable_TTSE_LUT(void)
Disable the TTSE.
CoolPropStateClassSI * SatL
virtual void density_Ts(double T, double s, double &rhoout, double &pout, double &rhoLout, double &rhoVout, double &psatLout, double &psatVout)
CachedElement d2phi0_dDelta2
virtual void saturation_T(double T, bool UseLUT, double &psatLout, double &psatVout, double &rhoLout, double &rhoVout)
double d2phi0_dTau2(double tau, double delta)
double d2pdT2_constrho(void)
double d2phi0_dDelta_dTau(double tau, double delta)
double d2hdrho2_constT(void)
double interp_linear(double Q, double valueL, double valueV)
Extended two-phase calculations need different interpolation functions.
SolutionsContainer SolutionsList
double drhodp_consth_smoothed(double xend)
A smoothed version of the derivative using a spline curve in the region of x=0 to x=xend...
double d2rhodp2_constT(void)
double dTdp_along_sat(void)
Derivative of temperature w.r.t. pressure along saturation curve.
CachedElement d2phir_dTau2
double Tend
The last temperature for which the conventional methods can be used.
double evaluate_one_other_input(long iInput1, double Param1, long iOther, double Other)
Evaluate the TTSE using P,S or P,T.
double d3phir_dDelta2_dTau(double tau, double delta)
double evaluate_Trho(long iOutput, double T, double rho, double logrho)
double dpdT_constrho(void)
double drhodp_along_sat_liquid(void)
virtual double visc(double T_K, double p)
Viscosity as a function of temperature and pressure.
CachedElement d3phir_dTau3