import json import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import numpy as np import gSAFTmm as gSAFT plt.style.use('classic') plt.rcParams["font.family"] = "Times New Roman" #NSW DATABANK NaCl_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Sodium,Chlorine>") LiI_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Lithium,Iodine>") LiBr_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Lithium,Bromide>") LiCl_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Lithium,Chlorine>") KCl_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Potassium,Chlorine>") RbBr_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Rubidium,Bromide>") HI_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Hydronium,Iodine>") HBr_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Hydronium,Bromide>") KOH_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX_DIV.xml<water,Potassium,Hydroxyl>")
type_activity_coefficient = "asymmetric" # either symmetric or asymmetric ################################################################################# z_ref = [] if type_activity_coefficient == "symmetric": z_ref = [0.001, 1, 1] else: z_ref = [55.51, 0, 0] ################################################################################# compounds_toString = ','.join(compounds) system_string = "GC_Mie_Databank_TL_MW_050620.xml<" + compounds_toString + ">" S = gSAFTmm.System(system_string) file_name_temp = "activityCoeff_" + type_activity_coefficient + str( T) + ',' + str(P) + '_' + compounds_toString + ".csv" f_csv = open( './predicted_properties/liquid_activity_coefficient_fromgSAFT/' + file_name_temp, "w") ################################################################################# m_range = [] m_temp = m_low while m_temp <= m_up: m_range.append(m_temp) m_temp += m_step
a = 'new_' b = salts_name[i] c = '_ED_calculated.json' e = '_ED.json' d = a + b + c f = a + b + e cat = salts_compounds[i * 2] an = salts_compounds[i * 2 + 1] wat = 'GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,' #_NSW end = '>' gc = wat + cat + ',' + an + end NSW = gSAFT.System(gc) # print(NSW) # with open(d) as json_data: # data = json.load(json_data) # tlist = list(zip(*data['BubblePressure'])) # tlist_oc = list(zip(*data['OsmoticCoefficient'])) # tlist_ld = list(zip(*data['SinglePhaseDensity'])) # T = tlist[0] # VP_calculated = tlist[2] # oc_calculated = tlist_oc[3] # m_oc = tlist_oc[2] # x_calculated = tlist_ld[2]
def saft_system(compounds_arr): compounds_toString = ','.join(compounds_arr) system_string = "GC_Mie_Databank_TL_MW_050620.xml<" + compounds_toString + ">" return gSAFTmm.System(system_string)
import json import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import numpy as np import gSAFTmm as gSAFT plt.style.use('classic') plt.rcParams["font.family"] = "Times New Roman" #NSW DATABANK NaCl_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Sodium,Chlorine>") LiI_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Lithium,Iodine>") LiBr_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Lithium,Bromide>") LiCl_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Lithium,Chlorine>") KCl_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Potassium,Chlorine>") RbBr_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Rubidium,Bromide>") HI_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Hydronium,Iodine>") HBr_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Hydronium,Bromide>") KOH_NSW = gSAFT.System( "GC_Mie_Databank_TL_18022020_NSW_17MX.xml<water,Potassium,Hydroxyl>") NaI_NSW = gSAFT.System(
def get_dir(filename, compound): return "./data/" + compound + "/" + filename Pvap_file = func.get_file(get_dir(Pvap_filename, compound_name)) Vsatliq_file = func.get_file(get_dir(Vsatliq_filename, compound_name)) Vsatvap_file = func.get_file(get_dir(Vsatvap_filename, compound_name)) NMRcompound_file = func.get_file(get_dir(NMRcompound_filename, compound_name)) NMRreference_file = func.get_file( get_dir(NMRreference_filename, reference_name)) ## gSAFT system Sys = gSAFTmm.System("GC_Mie_Databank_TL_MW_091120.xml<" + compound_name + ">") ## deviations (average values) com_arr = func.get_NMR_arr(NMRcompound_file) ref_arr = func.get_NMR_arr(NMRreference_file) abs_dev = func.get_avg_abs_dev(com_arr, ref_arr) rel_dev = func.get_avg_rel_dev(com_arr, ref_arr) print(abs_dev, rel_dev) ## properties and AAD calculation Pvap_data = func.get_prop_arr(Pvap_file, "Pvap") Vsatliq_data = func.get_prop_arr(Vsatliq_file, "Vsatliq")