Implements the method of Vogel 1998 (Propane) for the linear part """ N_A=6.02214129e23 molemass = Props(fluid,'molemass') Tstar = T/e_k b= [-19.572881,219.73999,-1015.3226,2471.01251,-3375.1717,2491.6597,-787.26086,14.085455,-0.34664158] s = sum([b[i]*pow(Tstar,-0.25*i) for i in range(7)]) B_eta_star = s+b[7]*pow(Tstar,-2.5)+b[8]*pow(Tstar,-5.5) #//[no units] B_eta = N_A*pow(sigma/1e9,3)*B_eta_star #[m3/mol] return viscosity_dilute(fluid,T,e_k,sigma)*B_eta*rho/molemass*1000 from PDSim.misc.datatypes import Collector RHO = Collector() TT = Collector() DELTA = Collector() TAU = Collector() VV = Collector() VV0 = Collector() VV1 = Collector() VVH = Collector() fluid = 'REFPROP-R32' Tc = Props(fluid,'Tcrit') rhoc = Props(fluid,'rhocrit') for T in np.linspace(290,Props(fluid,'Tcrit')-0.1,100): rhoV = Props('D','T',T,'Q',1,fluid) rhoL = Props('D','T',T,'Q',0,fluid) rhomax = Props('D','T',Props(fluid,'Tmin'),'Q',0,fluid) for rho in list(np.linspace(rhoL,rhomax,100)):#+list(np.linspace(rhoV,0.0001,100)): #for rho in list(np.linspace(rhoV,0.0001,100)):
Tstar = T / e_k b = [ -19.572881, 219.73999, -1015.3226, 2471.01251, -3375.1717, 2491.6597, -787.26086, 14.085455, -0.34664158 ] s = sum([b[i] * pow(Tstar, -0.25 * i) for i in range(7)]) B_eta_star = s + b[7] * pow(Tstar, -2.5) + b[8] * pow(Tstar, -5.5) #//[no units] B_eta = N_A * pow(sigma / 1e9, 3) * B_eta_star #[m3/mol] return viscosity_dilute(fluid, T, e_k, sigma) * B_eta * rho / molemass * 1000 from PDSim.misc.datatypes import Collector RHO = Collector() TT = Collector() DELTA = Collector() TAU = Collector() VV = Collector() VV0 = Collector() VV1 = Collector() VVH = Collector() fluid = 'REFPROP-R32' Tc = Props(fluid, 'Tcrit') rhoc = Props(fluid, 'rhocrit') for T in np.linspace(290, Props(fluid, 'Tcrit') - 0.1, 100): rhoV = Props('D', 'T', T, 'Q', 1, fluid) rhoL = Props('D', 'T', T, 'Q', 0, fluid) rhomax = Props('D', 'T', Props(fluid, 'Tmin'), 'Q', 0, fluid)
molemass_REF = CP.Props(fluid_REF, 'molemass') rhocrit_REF = CP.Props(fluid_REF, 'rhocrit') Zcrit_REF = CP.DerivTerms('Z', Tcrit_REF, rhocrit_REF, fluid_REF) fluid = 'DimethylEther' molemass = CP.Props(fluid, 'molemass') Ttriple = CP.Props(fluid, 'Ttriple') Tcrit = CP.Props(fluid, 'Tcrit') omega = CP.Props(fluid, "accentric") rhocrit = CP.Props(fluid, 'rhocrit') pcrit = CP.Props(fluid, 'pcrit') Zcrit = CP.DerivTerms('Z', Tcrit, rhocrit, fluid) N = 12 RHO, TTT, RHO0, TTT0 = Collector(), Collector(), Collector(), Collector() rhomax = CP.Props('D', 'T', Ttriple, 'Q', 0, fluid) #Build a database of "experimental" data for T in np.linspace(Ttriple, Tcrit + 50, 80): for rho in np.linspace(1e-10, rhomax, 80): T0, rho0 = CP.conformal_Trho(fluid, fluid_REF, T, rho) p = CP.Props('P', 'T', T, 'D', rho, fluid) ar = CP.DerivTerms("phir", T, rho, fluid) ar_REF = CP.DerivTerms("phir", T0, rho0, fluid_REF) Z = CP.DerivTerms("Z", T, rho, fluid) Z_REF = CP.DerivTerms("Z", T0, rho0, fluid_REF) #goodstate = ((T > Tcrit and p > pcrit) or (T<Tcrit and rho > CP.rhosatL_anc(fluid,T) ))
from CoolProp import CoolProp as CP from PDSim.misc.datatypes import Collector import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt fluid = 'R245fa' Ttriple = CP.Props(fluid, 'Ttriple') Tcrit = CP.Props(fluid, 'Tcrit') RHO, TTT, RHO0, TTT0, ERR = Collector(), Collector(), Collector(), Collector( ), Collector() rhomax = CP.Props('D', 'T', Ttriple, 'Q', 0, 'R245fa') # Build a database of "experimental" data for T in np.linspace(Ttriple, Tcrit + 50, 80): for rho in np.linspace(1e-10, rhomax, 80): if (T > Tcrit or rho > CP.rhosatL_anc(fluid, T) or rho < CP.rhosatV_anc(fluid, T)): h = CP.Props('H', 'T', T, 'D', rho, 'R245fa') p = CP.Props('P', 'T', T, 'D', rho, 'R245fa') RHO << rho TTT << T ERR << h TTT0 << p fig = plt.figure() ax1 = fig.add_subplot(121, projection='3d') ax1.scatter(np.array(RHO.vec), np.array(TTT.vec), ERR.vec) ax2 = fig.add_subplot(122, projection='3d')
fluid = 'DimethylEther' Rfluid = 'REFPROP-DME' e_k = 329.72 sigma = 0.5529 molemass = CP.Props(fluid, 'molemass') Ttriple = CP.Props(fluid, 'Ttriple') Tcrit = CP.Props(fluid, 'Tcrit') rhocrit = CP.Props(fluid, 'rhocrit') n = 6 m = 3 NP = 1 Nb = 0 N = (n - 1) * (m + 1) + 3 + Nb mu, mu_dilute, RHO, TTT = Collector(), Collector(), Collector(), Collector() rhomax = CP.Props('D', 'T', Ttriple, 'Q', 0, fluid) # Build a database of "experimental" data for T in np.linspace(Ttriple, Tcrit + 30, 400): for rho in np.linspace(1e-10, rhomax, 400): muval = CP.Props('V', 'T', T, 'D', rho, Rfluid) mudilute = CP.viscosity_dilute(fluid, T, rho, e_k, sigma) # Want positive value, and single-phase if (muval > 0 and T > Tcrit or rho > CP.rhosatL_anc(fluid, T) or rho < CP.rhosatV_anc(fluid, T)): mu << muval mu_dilute << mudilute TTT << T RHO << rho