def CriticalIsotherm(Fluid): return textwrap.dedent( """ Along the critical isotherm where T=T\ :sub:`c` ================================================ .. plot:: Fluid = "{Fluid:s}" RPFluid = "{RPFluid:s}" #Critical isotherm from CoolProp.CoolProp import Props from numpy import linspace,array,abs import matplotlib.pyplot as plt Tc = Props(Fluid,'Tcrit') rhoc = Props(Fluid,'rhocrit') rhov = linspace(1e-12,2*rhoc) #All the CoolProp calculations p = array([Props('P','T',Tc,'D',D,Fluid) for D in rhov]) rho = array([Props('D','T',Tc,'D',D,Fluid) for D in rhov]) cp = array([Props('C','T',Tc,'D',D,Fluid) for D in rhov]) cv = array([Props('O','T',Tc,'D',D,Fluid) for D in rhov]) h0 = Props('H','T',0.95*Tc,'Q',1,Fluid) h = array([Props('H','T',Tc,'D',D,Fluid)-h0 for D in rhov]) s0 = Props('S','T',0.95*Tc,'Q',1,Fluid) s = array([Props('S','T',Tc,'D',D,Fluid)-s0 for D in rhov]) visc = array([Props('V','T',Tc,'D',D,Fluid) for D in rhov]) cond = array([Props('L','T',Tc,'D',D,Fluid) for D in rhov]) Rp = array([Props('P','T',Tc,'D',D,RPFluid) for D in rhov]) Rrho = array([Props('D','T',Tc,'D',D,RPFluid) for D in rhov]) Rcp = array([Props('C','T',Tc,'D',D,RPFluid) for D in rhov]) Rcv = array([Props('O','T',Tc,'D',D,RPFluid) for D in rhov]) Rh0 = Props('H','T',0.95*Tc,'Q',1,RPFluid) Rh = array([Props('H','T',Tc,'D',D,RPFluid)-Rh0 for D in rhov]) Rs0 = Props('S','T',0.95*Tc,'Q',1,RPFluid) Rs = array([Props('S','T',Tc,'D',D,RPFluid)-Rs0 for D in rhov]) Rvisc = array([Props('V','T',Tc,'D',D,RPFluid) for D in rhov]) Rcond = array([Props('L','T',Tc,'D',D,RPFluid) for D in rhov]) fig = plt.figure() ax = fig.add_axes((0.15,0.15,0.8,0.8)) ax.semilogy(rhov/rhoc,abs(p/Rp-1)*100,'o',label='Pressure') ax.semilogy(rhov/rhoc,abs(cp/Rcp-1)*100,'o',label='Specific heat (cp)') ax.semilogy(rhov/rhoc,abs(cv/Rcv-1)*100,'o',label='Specific heat (cv)') ax.semilogy(rhov/rhoc,abs(h/Rh-1)*100,'o',label='Enthalpy') ax.semilogy(rhov/rhoc,abs(s/Rs-1)*100,'o',label='Entropy') ax.semilogy(rhov/rhoc,abs(visc/Rvisc-1)*100,'^',label='Viscosity') ax.semilogy(rhov/rhoc,abs(cond/Rcond-1)*100,'s',label='Conductivity') ax.set_ylim(1e-16,100) ax.set_title('Critical isotherm Deviations from REFPROP 9.1') ax.set_xlabel(r'Reduced density $\\rho/\\rho_c$') ax.set_ylabel('Absolute deviation [%]') ax.legend(numpoints=1,loc='best') plt.show() """.format(Fluid=Fluid,RPFluid = 'REFPROP-'+CP.get_REFPROPname(Fluid)))
def CriticalIsotherm(Fluid): return textwrap.dedent(""" Along the critical isotherm where T=T\ :sub:`c` ================================================ .. plot:: Fluid = "{Fluid:s}" RPFluid = "{RPFluid:s}" #Critical isotherm from CoolProp.CoolProp import Props from numpy import linspace,array,abs import matplotlib.pyplot as plt Tc = Props(Fluid,'Tcrit') rhoc = Props(Fluid,'rhocrit') rhov = linspace(1e-12,2*rhoc) #All the CoolProp calculations p = array([Props('P','T',Tc,'D',D,Fluid) for D in rhov]) rho = array([Props('D','T',Tc,'D',D,Fluid) for D in rhov]) cp = array([Props('C','T',Tc,'D',D,Fluid) for D in rhov]) cv = array([Props('O','T',Tc,'D',D,Fluid) for D in rhov]) h0 = Props('H','T',0.95*Tc,'Q',1,Fluid) h = array([Props('H','T',Tc,'D',D,Fluid)-h0 for D in rhov]) s0 = Props('S','T',0.95*Tc,'Q',1,Fluid) s = array([Props('S','T',Tc,'D',D,Fluid)-s0 for D in rhov]) visc = array([Props('V','T',Tc,'D',D,Fluid) for D in rhov]) cond = array([Props('L','T',Tc,'D',D,Fluid) for D in rhov]) Rp = array([Props('P','T',Tc,'D',D,RPFluid) for D in rhov]) Rrho = array([Props('D','T',Tc,'D',D,RPFluid) for D in rhov]) Rcp = array([Props('C','T',Tc,'D',D,RPFluid) for D in rhov]) Rcv = array([Props('O','T',Tc,'D',D,RPFluid) for D in rhov]) Rh0 = Props('H','T',0.95*Tc,'Q',1,RPFluid) Rh = array([Props('H','T',Tc,'D',D,RPFluid)-Rh0 for D in rhov]) Rs0 = Props('S','T',0.95*Tc,'Q',1,RPFluid) Rs = array([Props('S','T',Tc,'D',D,RPFluid)-Rs0 for D in rhov]) Rvisc = array([Props('V','T',Tc,'D',D,RPFluid) for D in rhov]) Rcond = array([Props('L','T',Tc,'D',D,RPFluid) for D in rhov]) fig = plt.figure() ax = fig.add_axes((0.15,0.15,0.8,0.8)) ax.semilogy(rhov/rhoc,abs(p/Rp-1)*100,'o',label='Pressure') ax.semilogy(rhov/rhoc,abs(cp/Rcp-1)*100,'o',label='Specific heat (cp)') ax.semilogy(rhov/rhoc,abs(cv/Rcv-1)*100,'o',label='Specific heat (cv)') ax.semilogy(rhov/rhoc,abs(h/Rh-1)*100,'o',label='Enthalpy') ax.semilogy(rhov/rhoc,abs(s/Rs-1)*100,'o',label='Entropy') ax.semilogy(rhov/rhoc,abs(visc/Rvisc-1)*100,'^',label='Viscosity') ax.semilogy(rhov/rhoc,abs(cond/Rcond-1)*100,'s',label='Conductivity') ax.set_ylim(1e-16,100) ax.set_title('Critical isotherm Deviations from REFPROP 9.1') ax.set_xlabel(r'Reduced density $\\rho/\\rho_c$') ax.set_ylabel('Absolute deviation [%]') ax.legend(numpoints=1,loc='best') plt.show() """.format(Fluid=Fluid, RPFluid='REFPROP-' + CP.get_REFPROPname(Fluid)))
def get_name(name): """Seach for compatible fluid name.""" for k, v in fluid_list.items(): if name.lower() in v.possible_names: name = k fluid_name = CP.get_REFPROPname(name) if fluid_name == "": raise ValueError(f"Fluid {name} not available. See ccp.fluid_list. ") return fluid_name
def SatLiquidParity(Fluid): return textwrap.dedent( """ Saturated Liquid Deviations =========================== .. plot:: Fluid = "{Fluid:s}" RPFluid = "{RPFluid:s}" #Saturated Liquid from CoolProp.CoolProp import Props from numpy import linspace,array,abs import matplotlib.pyplot as plt Tt = Props(Fluid,'Tmin') Tc = Props(Fluid,'Tcrit') Tv = linspace(Tt+0.01,0.95*Tc,20) #All the CoolProp calculations p = array([Props('P','T',T,'Q',0,Fluid) for T in Tv]) rho = array([Props('D','T',T,'Q',0,Fluid) for T in Tv]) cp = array([Props('C','T',T,'Q',0,Fluid) for T in Tv]) cv = array([Props('O','T',T,'Q',0,Fluid) for T in Tv]) h0 = Props('H','T',(Tt+Tc)/2.0,'Q',0,Fluid) h = array([Props('H','T',T,'Q',0,Fluid)-h0 for T in Tv]) s0 = Props('S','T',(Tt+Tc)/2.0,'Q',0,Fluid) s = array([Props('S','T',T,'Q',0,Fluid)-s0 for T in Tv]) visc = array([Props('V','T',T,'Q',0,Fluid) for T in Tv]) cond = array([Props('L','T',T,'Q',0,Fluid) for T in Tv]) sigma = array([Props('I','T',T,'Q',0,Fluid) for T in Tv]) Rp = array([Props('P','T',T,'Q',0,RPFluid) for T in Tv]) Rrho = array([Props('D','T',T,'Q',0,RPFluid) for T in Tv]) Rcp = array([Props('C','T',T,'Q',0,RPFluid) for T in Tv]) Rcv = array([Props('O','T',T,'Q',0,RPFluid) for T in Tv]) Rh0 = Props('H','T',(Tt+Tc)/2.0,'Q',0,RPFluid) Rh = array([Props('H','T',T,'Q',0,RPFluid)-Rh0 for T in Tv]) Rs0 = Props('S','T',(Tt+Tc)/2.0,'Q',0,RPFluid) Rs = array([Props('S','T',T,'Q',0,RPFluid)-Rs0 for T in Tv]) Rvisc = array([Props('V','T',T,'Q',0,RPFluid) for T in Tv]) Rcond = array([Props('L','T',T,'Q',0,RPFluid) for T in Tv]) Rsigma = array([Props('I','T',T,'Q',0,RPFluid) for T in Tv]) fig = plt.figure() ax = fig.add_axes((0.15,0.15,0.8,0.8)) ax.semilogy(Tv/Tc,abs(p/Rp-1)*100,'o',label='Pressure') ax.semilogy(Tv/Tc,abs(rho/Rrho-1)*100,'o',label='Density') ax.semilogy(Tv/Tc,abs(cp/Rcp-1)*100,'o',label='Specific heat (cp)') ax.semilogy(Tv/Tc,abs(cv/Rcv-1)*100,'o',label='Specific heat (cv)') ax.semilogy(Tv/Tc,abs(h/Rh-1)*100,'o',label='Enthalpy') ax.semilogy(Tv/Tc,abs(s/Rs-1)*100,'o',label='Entropy') ax.semilogy(Tv/Tc,abs(visc/Rvisc-1)*100,'^',label='Viscosity') ax.semilogy(Tv/Tc,abs(cond/Rcond-1)*100,'s',label='Conductivity') ax.semilogy(Tv/Tc,abs(sigma/Rsigma-1)*100,'p',label='Surface tension') ax.set_ylim(1e-16,100) ax.set_title('Saturated Liquid Deviations from REFPROP 9.1') ax.set_xlabel('Reduced temperature T/Tc') ax.set_ylabel('Absolute deviation [%]') ax.legend(numpoints=1,loc='best') plt.show() """.format(Fluid=Fluid,RPFluid = 'REFPROP-'+CP.get_REFPROPname(Fluid)))
# -*- coding: utf-8 -*- """ Created on Fri May 31 09:21:27 2013 @author: Belli """ import CoolProp.CoolProp as CP import CoolProp for fluid in CoolProp.__fluids__: try: lines = open('C:\\Program Files (x86)\\REFPROP\\fluids\\' + CP.get_REFPROPname(fluid) + '.fld','r').readlines() for line in lines: if line.find('CAS number') > -1: CAS_number = line.split('!')[0].strip() break if not CP.get_CAS_code(fluid) == CAS_number: print fluid, CP.get_CAS_code(fluid), CAS_number else: print 'CAS_number is ok for',fluid except IOError: pass#print "didn't find",fluid
# -*- coding: utf-8 -*- """ Created on Fri May 31 09:21:27 2013 @author: Belli """ import CoolProp.CoolProp as CP import CoolProp for fluid in CoolProp.__fluids__: try: lines = open('C:\\Program Files (x86)\\REFPROP\\fluids\\' + CP.get_REFPROPname(fluid) + '.fld','r').readlines() for line in lines: if line.find('CAS number') > -1: CAS_number = line.split('!')[0].strip() break if not CP.get_CAS_code(fluid) == CAS_number: print fluid, CP.get_CAS_code(fluid), CAS_number else: print 'CAS_number is ok for',fluid except IOError: pass#print "didn't find",fluid
# -*- coding: utf-8 -*- """ Created on Fri May 31 09:21:27 2013 @author: Belli """ import CoolProp.CoolProp as CP import CoolProp for fluid in CoolProp.__fluids__: try: lines = open( 'C:\\Program Files (x86)\\REFPROP\\fluids\\' + CP.get_REFPROPname(fluid) + '.fld', 'r').readlines() for line in lines: if line.find('CAS number') > -1: CAS_number = line.split('!')[0].strip() break if not CP.get_CAS_code(fluid) == CAS_number: print fluid, CP.get_CAS_code(fluid), CAS_number else: print 'CAS_number is ok for', fluid except IOError: pass #print "didn't find",fluid
def SatLiquidParity(Fluid): return textwrap.dedent(""" Saturated Liquid Deviations =========================== .. plot:: Fluid = "{Fluid:s}" RPFluid = "{RPFluid:s}" #Saturated Liquid from CoolProp.CoolProp import Props from numpy import linspace,array,abs import matplotlib.pyplot as plt Tt = Props(Fluid,'Tmin') Tc = Props(Fluid,'Tcrit') Tv = linspace(Tt+0.01,0.95*Tc,20) #All the CoolProp calculations p = array([Props('P','T',T,'Q',0,Fluid) for T in Tv]) rho = array([Props('D','T',T,'Q',0,Fluid) for T in Tv]) cp = array([Props('C','T',T,'Q',0,Fluid) for T in Tv]) cv = array([Props('O','T',T,'Q',0,Fluid) for T in Tv]) h0 = Props('H','T',(Tt+Tc)/2.0,'Q',0,Fluid) h = array([Props('H','T',T,'Q',0,Fluid)-h0 for T in Tv]) s0 = Props('S','T',(Tt+Tc)/2.0,'Q',0,Fluid) s = array([Props('S','T',T,'Q',0,Fluid)-s0 for T in Tv]) visc = array([Props('V','T',T,'Q',0,Fluid) for T in Tv]) cond = array([Props('L','T',T,'Q',0,Fluid) for T in Tv]) sigma = array([Props('I','T',T,'Q',0,Fluid) for T in Tv]) Rp = array([Props('P','T',T,'Q',0,RPFluid) for T in Tv]) Rrho = array([Props('D','T',T,'Q',0,RPFluid) for T in Tv]) Rcp = array([Props('C','T',T,'Q',0,RPFluid) for T in Tv]) Rcv = array([Props('O','T',T,'Q',0,RPFluid) for T in Tv]) Rh0 = Props('H','T',(Tt+Tc)/2.0,'Q',0,RPFluid) Rh = array([Props('H','T',T,'Q',0,RPFluid)-Rh0 for T in Tv]) Rs0 = Props('S','T',(Tt+Tc)/2.0,'Q',0,RPFluid) Rs = array([Props('S','T',T,'Q',0,RPFluid)-Rs0 for T in Tv]) Rvisc = array([Props('V','T',T,'Q',0,RPFluid) for T in Tv]) Rcond = array([Props('L','T',T,'Q',0,RPFluid) for T in Tv]) Rsigma = array([Props('I','T',T,'Q',0,RPFluid) for T in Tv]) fig = plt.figure() ax = fig.add_axes((0.15,0.15,0.8,0.8)) ax.semilogy(Tv/Tc,abs(p/Rp-1)*100,'o',label='Pressure') ax.semilogy(Tv/Tc,abs(rho/Rrho-1)*100,'o',label='Density') ax.semilogy(Tv/Tc,abs(cp/Rcp-1)*100,'o',label='Specific heat (cp)') ax.semilogy(Tv/Tc,abs(cv/Rcv-1)*100,'o',label='Specific heat (cv)') ax.semilogy(Tv/Tc,abs(h/Rh-1)*100,'o',label='Enthalpy') ax.semilogy(Tv/Tc,abs(s/Rs-1)*100,'o',label='Entropy') ax.semilogy(Tv/Tc,abs(visc/Rvisc-1)*100,'^',label='Viscosity') ax.semilogy(Tv/Tc,abs(cond/Rcond-1)*100,'s',label='Conductivity') ax.semilogy(Tv/Tc,abs(sigma/Rsigma-1)*100,'p',label='Surface tension') ax.set_ylim(1e-16,100) ax.set_title('Saturated Liquid Deviations from REFPROP 9.1') ax.set_xlabel('Reduced temperature T/Tc') ax.set_ylabel('Absolute deviation [%]') ax.legend(numpoints=1,loc='best') plt.show() """.format(Fluid=Fluid, RPFluid='REFPROP-' + CP.get_REFPROPname(Fluid)))