Refprop CPP
Refprop CPP
Refprop CPP
//
//
//
//
//
//
// Some constants...
const
const
const
const
const
const
const
long
long
long
long
long
long
long
refpropcharlength=255;
filepathlength=255;
lengthofreference=3;
errormessagelength=255;
ncmax=20;
// Note: ncmax is the max number of components
numparams=72;
maxcoefs=50;
x[0]=.7812;
x[1]=.0092;
x[2]=.2096;
//Air composition
%10.4f,%10.4f,%10.4f,%10.4f,%10.4f\n",wm,acf,dip,ttp,t
printf("TC,PC,DC,RGAS
%10.4f,%10.4f,%10.4f,%10.4f,%10.4f\n",tc,pc,dc,rgas);
//...Calculate molecular weight of a mixture
//
wm=WMOLdll(x)
//...Get saturation properties given t,x; for i=1: x is liquid phase
//.....
for i=2: x is vapor phase
double t=100.0;
double p,dl,dv;
SATTdll(t,x,i,p,dl,dv,xliq,xvap,ierr,herr,errormessagelength);
printf("P,Dl,Dv,xl[0],xv[0]
%10.4f,%10.4f,%10.4f,%10.4f,%10.4f\n",p,dl,dv,xliq[0],xva
p[0]);
i=2;
SATTdll(t,x,i,p,dl,dv,xliq,xvap,ierr,herr,errormessagelength);
printf("P,Dl,Dv,xl[0],xv[0]
p[0]);
%10.4f,%10.4f,%10.4f,%10.4f,%10.4f\n",p,dl,dv,xliq[0],xva
%10.4f,%10.4f,%10.4f,%10.4f,%10.4f\n",t,dl,dv,xliq[0],xva
printf("dP/dD,d2P/dD2,dP/dT
%10.4f,%10.4f,%10.4f\n",dpdrho,d2pdd2,dpdt);
long kr=1;
THFLSHdll (t,h,x,
kr,pp,dd,dl,dv,xliq,xvap,q,e,s,cv,cp,w,ierr,herr,errormessagelength);
printf("T, D, P from THFLSH
%10.4f,%10.4f,%10.4f\n",t,dd,pp/1000.0);
//...Other general property calculation routines are given in FLSH_SUB.FOR
//...and FLASH2.FOR
//...Calculate melting pressure
t=100.0;
MELTTdll (t,x,p,ierr,herr,errormessagelength);
printf("Melting pressure(MPa) %10.4f,%10.4f\n",p/1000.0,t);
//...Calculate melting temperature
MELTPdll (p,x,tt,ierr,herr,errormessagelength);
printf("Melting temperature(K)%10.4f,%10.4f\n",tt,p/1000.0);
//...Calculate sublimation pressure
t=200.0;
SUBLTdll (t,x,p,ierr,herr,errormessagelength);
printf("Sublimation pr.(kPa) %10.4f,%10.4f\n",p,t);
//...Calculate sublimation temperature
SUBLPdll (p,x,tt,ierr,herr,errormessagelength);
printf("Sublimation temp.(K) %10.4f,%10.4f\n",tt,p);
//...Get limits of the equations and check if t,d,p is a valid point
//...Equation of state
//
call LIMITK ('EOS',1,t,d,p,tmin,tmax,Dmax,pmax,ierr,herr)
//...Viscosity equation
//
call LIMITK ('ETA',1,t,d,p,tmin,tmax,Dmax,pmax,ierr,herr)
//...Thermal conductivity equation
//
call LIMITK ('TCX',1,t,d,p,tmin,tmax,Dmax,pmax,ierr,herr)
//...Other routines are given in UTILITY.FOR
return 0;
}
//---------------------------------------------------------------------------