def delta_G(entries): temperature = float(entries['Temperature_1'].get()) temperature2 = float(entries['Temperature_2'].get()) pressure = float(entries['Pressure_1'].get()) pressure2 = float(entries['Pressure_2'].get()) name = entries['Name(UpperCase)'].get() mw = float(entries['Molecular Weight'].get()) tc = float(entries['Critical Temperature'].get()) pc = float(entries['Critical Pressure'].get()) af = float(entries['Acentric Factor'].get()) do = float(entries['Dissociation Energy'].get()) if entries['Is linear (True/False)'].get() == 'True': is_linear = True else: is_linear = False gas_or_liquid = entries['Phase_1 (gas/liquid)'].get() gas_or_liquid2 = entries['Phase_2 (gas/liquid)'].get() gas_chosen = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid) gas_chosen2 = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid2) PT = Properties(temperature, pressure) PT2 = Properties(temperature2, pressure2) # Departure Function thermodynamic_ideal1 = ThermoIdeal(gas_chosen, PT) thermodynamic_ideal2 = ThermoIdeal(gas_chosen2, PT2) prEos1 = solDepart(gas_chosen, PT) prEos2 = solDepart(gas_chosen2, PT2) deltaG = round(thermodynamic_ideal2.Gig() + prEos2.deltaG() - thermodynamic_ideal1.Gig() - prEos1.deltaG(), 5) entries['Delta_G'].delete(0, tk.END) entries['Delta_G'].insert(0, deltaG)
def ideal_thermodynamic_properties(entries): temperature = float(entries['Temperature_1'].get()) temperature2 = float(entries['Temperature_2'].get()) pressure = float(entries['Pressure_1'].get()) pressure2 = float(entries['Pressure_2'].get()) name = entries['Name(UpperCase)'].get() mw = float(entries['Molecular Weight'].get()) tc = float(entries['Critical Temperature'].get()) pc = float(entries['Critical Pressure'].get()) af = float(entries['Acentric Factor'].get()) do = float(entries['Dissociation Energy'].get()) if entries['Is linear (True/False)'].get() == 'True': is_linear = True else: is_linear = False gas_or_liquid = entries['Phase_1 (gas/liquid)'].get() gas_or_liquid2 = entries['Phase_2 (gas/liquid)'].get() gas_chosen = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid) gas_chosen2 = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid2) PT = Properties(temperature, pressure) PT2 = Properties(temperature2, pressure2) # Departure Function thermodynamic_ideal = ThermoIdeal(gas_chosen, PT) thermodynamic_ideal2 = ThermoIdeal(gas_chosen2, PT2) aig = thermodynamic_ideal.Aig() uig = thermodynamic_ideal.Uig() cv = thermodynamic_ideal.Cv() sig = thermodynamic_ideal.Sig() hig = thermodynamic_ideal.Hig() gig = thermodynamic_ideal.Gig() aig2 = thermodynamic_ideal2.Aig() uig2 = thermodynamic_ideal2.Uig() cv2 = thermodynamic_ideal2.Cv() sig2 = thermodynamic_ideal2.Sig() hig2 = thermodynamic_ideal2.Hig() gig2 = thermodynamic_ideal2.Gig() entries['A_ideal gas'].delete(0, tk.END) entries['A_ideal gas'].insert(0, aig) entries['U_ideal gas'].delete(0, tk.END) entries['U_ideal gas'].insert(0, uig) entries['Cv'].delete(0, tk.END) entries['Cv'].insert(0, cv) entries['S_ideal gas'].delete(0, tk.END) entries['S_ideal gas'].insert(0, sig) entries['H_ideal gas'].delete(0, tk.END) entries['H_ideal gas'].insert(0, hig) entries['G_ideal gas'].delete(0, tk.END) entries['G_ideal gas'].insert(0, gig) entries['A_ideal gas_2'].delete(0, tk.END) entries['A_ideal gas_2'].insert(0, aig2) entries['U_ideal gas_2'].delete(0, tk.END) entries['U_ideal gas_2'].insert(0, uig2) entries['Cv_2'].delete(0, tk.END) entries['Cv_2'].insert(0, cv2) entries['S_ideal gas_2'].delete(0, tk.END) entries['S_ideal gas_2'].insert(0, sig2) entries['H_ideal gas_2'].delete(0, tk.END) entries['H_ideal gas_2'].insert(0, hig2) entries['G_ideal gas_2'].delete(0, tk.END) entries['G_ideal gas_2'].insert(0, gig2)