def test_p5(self): #TODO: Add main code and test results """ Phase equilibrium at fixed pressure """ self.data.P = 1046007.02038 pure.pure_sim(self.data) numpy.testing.assert_allclose(1, 1, rtol=1e-02)
def test_p4(self): """ Phase equilibrium at fixed temperature """ self.data.T = 243.01 s, p = pure.pure_sim(self.data) p4 = [s['P_sat'], s['V_v'], s['V_l']] numpy.testing.assert_allclose(self.p4_ans, p4, rtol=1e-02)
def test_p3(self): """ Adachi-Lu model optimisation """ self.data.model = ['Adachi-Lu'] self.data.c[0]['model'] = ['Adachi-Lu'] self.data.c[0]['m (Adachi-Lu)'][0] = '' s, p = pure.pure_sim(self.data) numpy.testing.assert_allclose([self.p3_ans], [p['m'][0]], rtol=1e-02)
def test_p3(self): """ Adachi-Lu model optimisation """ self.data.model = ['Adachi-Lu'] self.data.c[0]['model'] = ['Adachi-Lu'] self.data.c[0]['m (Adachi-Lu)'][0] = '' s, p = pure.pure_sim(self.data) numpy.testing.assert_allclose([self.p3_ans],[p['m'][0]], rtol=1e-02)
def test_p2(self): """ Soave model optimisation """ self.data.model = ['Soave'] self.data.c[0]['model'] = ['Soave'] self.data.c[0]['m (Soave)'][0] = '' s, p = pure.pure_sim(self.data) numpy.testing.assert_allclose([self.p2_ans], [p['m'][0]], rtol=1e-03)
def test_p2(self): """ Soave model optimisation """ self.data.model = ['Soave'] self.data.c[0]['model'] = ['Soave'] self.data.c[0]['m (Soave)'][0] = '' s, p = pure.pure_sim(self.data) numpy.testing.assert_allclose([self.p2_ans],[p['m'][0]], rtol=1e-03)
def test_p1(self): """ Critical parameters """ self.data.c[0]['a_c (Pa m6 mol-2)'][0] = '' self.data.c[0]['b_c (m3 mol-1)'][0] = '' s, p = pure.pure_sim(self.data) # Redefine for other tests self.data.c[0]['a_c (Pa m6 mol-2)'] =[0.533365967206] self.data.c[0]['b_c (m3 mol-1)'] = [6.36225762119e-05] numpy.testing.assert_allclose([self.p1_ans1, self.p1_ans2], [p['a_c'], p['b_c']], rtol=1e-03)
def test_p1(self): """ Critical parameters """ self.data.c[0]['a_c (Pa m6 mol-2)'][0] = '' self.data.c[0]['b_c (m3 mol-1)'][0] = '' s, p = pure.pure_sim(self.data) # Redefine for other tests self.data.c[0]['a_c (Pa m6 mol-2)'] = [0.533365967206] self.data.c[0]['b_c (m3 mol-1)'] = [6.36225762119e-05] numpy.testing.assert_allclose([self.p1_ans1, self.p1_ans2], [p['a_c'], p['b_c']], rtol=1e-03)
self.plot_gibbs = False self.plot_pure = False # Saves self.optimise = False self.save = False self.save_pure = False self.force_pure_update = False if __name__ == '__main__': args = Args() data = data_handling.ImportData() data.run_options(args) # Load all pure dictionaries data.c[i] data.load_pure_data() s, p = pure.pure_sim(data, i=0) s['b'] = p['b_c'] # (b is not temperature dependant) ## START HERE: # V_root V_l_old = [] V_v_old = [] V_l_new = [] V_v_new = [] errorVold = [] errorLold = [] errorVnew = []
nargs=1, type=bool, default=False, help=' force a new optimisation for the m' 'parameter for the selected Model, to be ' 'used if new vapour data is added') args = parser.parse_args() data.run_options(args) if len(data.comps) == 1: # pure component simulation. # Load pure data data.load_pure_data() # Using data.comps # Find all specified outputs s, p = pure.pure_sim(data, i=0) # plot output if data.plot_pure: from plot import PsatPlots PP = PsatPlots(data.comps[0], data.model[0]) if len(PP.DBr) == 0: P_sat_store, T_sat_store = PP.psat_range(s, p) PP.plot_Psat(data.comps[0], p) if len(data.comps) > 1: # multi component simulation. from ncomp import phase_equilibrium_calculation as pec from ncomp import phase_seperation_detection as psd from ncomp import equilibrium_range as er