def get_fluid_strings(mix=False): if mix: fluids_in = ["Propane[0.5]&Ethane[0.5]", "ISOBUTAN[0.8]&PROPANE[0.2]", "R32[0.697615]&R125[0.302385]"] else: fluids_in = ["Water", "R134a", "Air"] fluids = [] for fld in fluids_in: for bac in ["HEOS", "REFPROP"]: if bac=="REFPROP" and not mix: fluids.append(bac+"::"+get_fluid_param_string(fld,"REFPROP_name")) else: fluids.append(bac+"::"+fld) return fluids
def get_fluid_strings(mix=False): if mix: fluids_in = [ "Propane[0.5]&Ethane[0.5]", "ISOBUTAN[0.8]&PROPANE[0.2]", "R32[0.697615]&R125[0.302385]" ] else: fluids_in = ["Water", "R134a", "Air"] fluids = [] for fld in fluids_in: for bac in ["HEOS", "REFPROP"]: if bac == "REFPROP" and not mix: fluids.append(bac + "::" + get_fluid_param_string(fld, "REFPROP_name")) else: fluids.append(bac + "::" + fld) return fluids
epsilon = 0 beta = 0 gamma = 0 else: i, d, t, n, eta, epsilon, beta, gamma = vals D.append(int(d)) T.append(float(t)) N.append(float(n)) ETA.append(float(eta)) EPSILON.append(float(epsilon)) BETA.append(float(beta)) GAMMA.append(float(gamma)) name1, name2 = names.split('/') CAS1 = get_fluid_param_string(name1, 'CAS') CAS2 = get_fluid_param_string(name2, 'CAS') print template.format(Name1=name1, Name2=name2, CAS1=CAS1, CAS2=CAS2, d=str(D), t=str(T), n=str(N), eta=str(ETA), epsilon=str(EPSILON), beta=str(BETA), gamma=str(GAMMA))
from scipy.optimize import fsolve #see example page 33 func = lambda x: [x[0]**2-2*x[1]-2, x[0]+x[1]**2-1] x =fsolve(func, [0,0]) print('fsolve x =',x) print('fsolve f(x) = ', func(x)) print(' ') print(1e-5) print(1E-5) print(' ') print ('Molar = ', PropsSI('M','R410A')) #,'T',298.15,'P',101325 print ('surface tension = ', PropsSI('I','P',250000,'Q',0,'R407C')) #[N/m] print ('surface tension = ', PropsSI('I','P',250000,'Q',0.5,'R407C')) #[N/m] print ('surface tension = ', PropsSI('I','P',250000,'Q',1,'R407C')) #[N/m] print('fluid string:',get_fluid_param_string('water','pure')) #print('new surface tension method:',saturation_ancillary('R407C','I',1,'T', 250)) print ('T_HR = ', HAPropsSI('T','P',101325.0,'H',37972.967209365510,'R',1)-273.15,'degree C') print ('P_sat = ', PropsSI('Q','P', 445100,'H',244044.447331,'R404A'),'Pa') print ('P_sat = ', PropsSI('P','T', 323.15,'Q',0,'R407C'),'Pa') AS = CoolProp.AbstractState("TTSE&HEOS", "R410A") #print (AS.get_mass_fractions()) #AS.set_mass_fractions([0.2]) rhosatV = 36.4720363389 Tdew = 278.688177082 AS.update(CP.DmassT_INPUTS,rhosatV,Tdew) #AS.update(CP.PQ_INPUTS,250000,0) print('density=',AS.saturated_liquid_keyed_output(CP.iHmass)) print (AS.hmass()) print ('h_props = ', PropsSI('H','P', 120000,'T',300,'INCOMP::MEG-20%'),'J/kg')
'iC4H10': 'IsoButane', 'nC5H12': 'n-Pentane', 'iC5H12': 'Isopentane', 'nC6H14': 'n-Hexane', 'nC7H16': 'n-Heptane', 'nC8H18': 'n-Octane', 'nC9H20': 'n-Nonane', 'nC10H22': 'n-Decane', } F_factors = {} lines = open('KunzWagner2012_TableA6.txt','r').readlines() for line in lines: names,F = line.strip().split(' ') name1,name2 = names.split('/') CAS1 = get_fluid_param_string(name1,'CAS') CAS2 = get_fluid_param_string(name2,'CAS') F_factors[(CAS1,CAS2)] = F F_factors[(CAS2,CAS1)] = F lines = open('KunzWagner2012_TableA8.txt','r').readlines() template = """{{"Name1" : "{Name1:s}", "Name2" : "{Name2:s}", "CAS1" : "{CAS1:s}", "CAS2" : "{CAS2:s}", "betaV" : {betaV:s}, "gammaV" : {gammaV:s}, "betaT" : {betaT:s}, "gammaT" : {gammaT:s}, "F" : {F:s}