def test_dielectric_constant(self): # dielectric constant of water at [temperature(K), pressure(MPa), dielectric constant] Archer & Wang Table 4 param = np.array([[293.15, 0.1, 80.20], [318.15, 0.1, 71.50], [353.15, 0.1, 60.87], [273.15, 1, 87.94], [278.15, 60, 88.20]]) # converting param to [temperature(K), pressure(atm), dielectric constant] param[:, 1] = param[:, 1] * 1e6 / un.atm_2_pascal(1) # testing dielectric constant up to a precision of 10^-2 wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1]) test_vals = np.allclose(wfm.dielectric_constant(), param[:, 2], 0, 1e-2) self.assertTrue(test_vals)
def test_dielectric_constant(self): # dielectric constant of water at [temperature(K), pressure(MPa), dielectric constant] param = np.array([[338.15, 0.1, 65.20777], [318.15, 0.1, 71.50373], [353.15, 0.1, 60.84250], [273.15, 1, 87.89296], [278.15, 60, 88.17593]]) # converting param to [temperature(K), pressure(atm), dielectric constant] param[:, 1] = param[:, 1] * 1e6 / un.atm_2_pascal(1) # testing dielectric constant up to a precision of 10^-5 wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1]) test_vals = np.allclose(wfm.dielectric_constant(), param[:, 2], 0, 1e-5) self.assertTrue(test_vals)
def test_apparent_molal_enthalpy(self): # parameters in [molality, apparent relative molal enthalpy (kJ/mol)] param = np.array([[0.001, 0.81], [0.005, 1.65], [0.01, 2.20], [0.02, 2.87], [0.05, 3.96], [0.10, 4.97], [0.20, 6.23], [0.30, 7.18], [0.40, 7.99], [0.50, 8.72]]) # testing params up to a precision of 10^-2 salt_mgcl2 = mgcl2.MgCl2PropertiesWangPitzer(373.15, 5e6 / un.atm_2_pascal(1)) test_vals = np.allclose( salt_mgcl2.apparent_molal_enthalpy(param[:, 0]) / 1e3, param[:, 1], 0, 1e-2) self.assertTrue( test_vals, str(salt_mgcl2.apparent_molal_enthalpy(param[:, 0]) / 1e3) + " & " + str(param[:, 1]))
def test_molar_vol(self): # parameters in [pressure (Pa), molality, molar volume cm^3/mol] param = np.array([[2e6, 0.01, 10.09], [2e6, 0.10, 11.58], [2e6, 0.80, 14.60], [2e6, 1.40, 17.41], [10e6, 0.10, 11.61], [10e6, 0.80, 14.51], [10e6, 1.40, 17.43], [20e6, 0.10, 12.07], [20e6, 0.80, 14.83], [20e6, 1.40, 17.89]]) # converting to [pressure (atm), molality, molar volume m^3/mol] param[:, 0] = param[:, 0] / un.atm_2_pascal(1) param[:, 2] = param[:, 2] / 1e6 # testing params up to a precision of 10^-8 salt_mgcl2 = mgcl2.MgCl2PropertiesWangPitzer(373.15, param[:, 0]) test_vals = np.allclose(salt_mgcl2.molar_vol(param[:, 1]), param[:, 2], 0, 1e-8) self.assertTrue( test_vals, str(salt_mgcl2.molar_vol(param[:, 1])) + " & " + str(param[:, 2]))
def test_molar_vol(self): # parameters in [temperature (C), pressure (bar), molality, molar volume cm^3/mol] param = np.array([[0.0, 1.0, 0.05, -7.39], [0.0, 1.0, 0.20, -3.72], [0.0, 100, 0.25, -1.14], [25.0, 1.0, 0.05, -2.16], [25.0, 1.0, 0.20, 0.76], [25.0, 100, 0.25, 3.27], [60.0, 1.0, 0.05, -1.23], [60.0, 1.0, 0.20, 1.17], [60.0, 100, 0.25, 3.68]]) # converting to [temperature (C), pressure (atm), molality, molar volume m^3/mol] param[:, 0] = un.celsius_2_kelvin(param[:, 0]) param[:, 1] = param[:, 1] / un.atm_2_pascal(1) param[:, 3] = param[:, 3] / 1e6 # testing params up to a precision of 10^-8 salt_mgso4 = mgso4.MgSO4PropertiesPhutelaPitzer( param[:, 0], param[:, 1]) test_vals = np.allclose(salt_mgso4.molar_vol(param[:, 2]), param[:, 3], 0, 1e-8) self.assertTrue( test_vals, str(salt_mgso4.molar_vol(param[:, 2])) + " & " + str(param[:, 3]))
def test_molar_vol(self): # parameters in [temperature (C), pressure (bar), molality, molar volume cm^3/mol] param = np.array([[0.0, 1.0, 0.05, 4.94], [0.0, 1.0, 0.20, 8.61], [0.0, 100, 0.30, 12.06], [25.0, 1.0, 0.05, 13.89], [25.0, 1.0, 0.20, 16.81], [25.0, 100, 0.30, 19.78], [60.0, 1.0, 0.05, 17.35], [60.0, 1.0, 0.20, 19.90], [60.0, 100, 0.30, 22.62]]) # converting to [temperature (C), pressure (atm), molality, molar volume m^3/mol] param[:, 0] = un.celsius_2_kelvin(param[:, 0]) param[:, 1] = param[:, 1] / un.atm_2_pascal(1) param[:, 3] = param[:, 3] / 1e6 # testing params up to a precision of 10^-8 salt_na2so4 = na2so4.Na2SO4PropertiesPhutelaPitzer( param[:, 0], param[:, 1]) test_vals = np.allclose(salt_na2so4.molar_vol(param[:, 2]), param[:, 3], 0, 1e-8) self.assertTrue( test_vals, str(salt_na2so4.molar_vol(param[:, 2])) + " & " + str(param[:, 3]))
def __init__(self, t, pa=1, d=float("NaN")): """ constructor :param tk: temperature in kelvin :param pa: pressure in atmospheres :param d: density in SI :instantiate: temperature and pressure """ self.t = t self.p = un.atm_2_pascal(pa) self.d = d self.tc = 647.096 self.dc = 322 self.R = 0.46151805 self.delta = self.d / self.dc self.tau = self.tc / self.t
def test_atm_conversion(self): # 1 atm = 101325 Pa self.assertEqual(un.atm_2_pascal(1), 101325) # 1 atm = 1.01325 bar self.assertEqual(un.atm_2_bar(1), 1.01325)
def __init__(self, tk, pa=1): """ constructor :param tk: temperature in kelvin :param pa: pressure in atmospheres :instantiate: temperature, pressure, molecular weight, polarizability, dipole moment """ super().__init__(tk, pa) # Calculations for density self.t = self.tk - un.celsius_2_kelvin(0) # pressure in applied bar according to Fine and Millero self.y = un.atm_2_bar(self.pa - 1) self.den1 = 0.9998396 + self.t * 18.224944e-3 - 7.922210e-6 * self.t**2 - 55.44846e-9 * self.t**3 self.den2 = 149.7562e-12 * self.t**4 - 393.2952e-15 * self.t**5 self.V0 = (1 + self.t * 18.159725e-3) / (self.den1 + self.den2) self.B = 19654.320 + 147.037 * self.t - 2.21554 * self.t**2 + 1.0478e-2 * self.t**3 - 2.2789e-5 * self.t**4 self.a1 = 3.2891 - 2.3910e-3 * self.t + 2.8446e-4 * self.t**2 - 2.82e-6 * self.t**3 + 8.477e-9 * self.t**4 self.a2 = 6.245e-5 - 3.913e-6 * self.t - 3.499e-8 * self.t**2 + 7.942e-10 * self.t**3 - 3.299e-12 * self.t**4 # this in cm^3/gram self.vol = self.V0 * ( 1 - (self.y / (self.B + self.a1 * self.y + self.a2 * self.y**2))) # density in kg/m^3 self.rt = 1e3 / self.vol # Calculations for molar volume self.molVol = 1e-3 * self.MolecularWeight / self.rt # Calculations for dielectric constant # convert from atmospheres to MPa self.p_mpa = 1e-6 * un.atm_2_pascal(self.pa) # coefficients self.b = np.zeros(9) self.b[0] = -4.044525e-2 self.b[1] = 103.6180 self.b[2] = 75.32165 self.b[3] = -23.23778 self.b[4] = -3.548184 self.b[5] = -1246.311 self.b[6] = 263307.7 self.b[7] = -6.928953e-1 self.b[8] = -204.4473 def g(x, y): t1 = self.b[0] * y / x + self.b[1] / np.sqrt(x) + self.b[2] / ( x - 215) + self.b[3] / np.sqrt(x - 215) t2 = self.b[4] / (self.tk - 215)**0.25 t3 = np.exp(self.b[5] / x + self.b[6] / x**2 + self.b[7] * y / x + self.b[8] * y / x**2) return 1 + 1e-3 * self.rt * (t1 + t2 + t3) self.fac = un.one_over4pi_epsilon0() * 4 * np.pi * self.mu**2 / ( 3 * un.k_boltzmann() * self.tk) self.b_fac_0 = self.fac * g(self.tk, self.p_mpa) self.b_fac_1 = self.alpha + self.b_fac_0 self.b_fac = self.rt * un.avogadro() * self.b_fac_1 / ( 3.0 * self.MolecularWeight / 1000) self.dielectricConstant = 0.25 * ( 1 + 9 * self.b_fac + 3 * np.sqrt(1 + 2 * self.b_fac + 9 * self.b_fac**2)) # Calculations for compressibility self.beta = self.V0 * (self.B - self.a2 * self.y**2) / ( self.vol * (self.B + self.a1 * self.y + self.a2 * self.y**2)**2) self.comp = un.atm_2_bar(self.beta)
def __init__(self, tk, pa=1): """ constructor :param tk: temperature in kelvin :param pa: pressure in atmospheres :instantiate: temperature, pressure, stoichiometry coefficients, Pitzer Parameters """ self.tk = tk self.pa = pa # Calculations MgCl2 parameters and coefficients self.mat_stoich = np.array([[1, 2], [2, -1]]) self.m_ref = 5.550825 self.y_ref = 10 self.m_weight = 95.211 self.p_ref = np.array([self.m_weight, self.m_ref, self.y_ref]) # values for ion strength dependence and ion size constants in the extended Pitzer model self.alpha_b1 = 2.0 self.alpha_b2 = 0 self.alpha_c1 = 0.4 self.alpha_c2 = 0.28 self.alpha_d1 = 0 self.alpha_d2 = 0 self.b_param = 1.2 self.ion_param = np.array([ self.alpha_b1, self.alpha_b2, self.alpha_c1, self.alpha_c2, self.alpha_d1, self.alpha_d2, self.b_param ]) self.a = np.array([[[ -5.50111455e1, 7.2122055200e1, 5.924282400000, 0.000000000000, 0.000000000000, 4.0898005200e-2 ], [ 1.5013032600e1, -1.771450850e1, -1.65126386000, -1.02256042000, 0.000000000000, 0.0000000000000 ], [ -1.58107430e-1, 1.143971530e-1, 1.893998220e-2, 3.770186170e-2, -2.28040769e-3, -2.951198450e-4 ], [ 2.304099190e-4, 0.000000000000, -2.99972128e-5, -7.91682934e-5, 1.374258890e-5, 6.9100122700e-7 ], [ -1.31768095e-7, -1.43588435e-7, 1.891742910e-8, 5.913142580e-8, -1.94821902e-8, -5.32314849e-10 ], [ -1.26699609e-28, 1.72952766e-27, 0.00000000000, 0.000000000000, 1.04649784e-28, 3.979618090e-31 ], [ 2.821974990e2, 3.41920714000e3, 5.4903020100e1, -2.284930840e2, 0.000000000000, 0.0000000000000 ]], [[ 0.00000000000, 0.0000000000000, 4.501140480e-2, 0.000000000000, 0.000000000000, 0.0000000000000 ], [ 0.00000000000, 2.2844061200e-4, -1.08427926e-2, 0.000000000000, 0.000000000000, 0.0000000000000 ], [ 8.396619600e-5, 0.000000000000, 7.410418640e-5, -7.79259941e-5, 0.000000000000, 0.0000000000000 ], [ -4.60207270e-7, 0.000000000000, -5.99961498e-8, 4.286758760e-7, 0.000000000000, 0.0000000000000 ], [ 6.21165614e-10, 0.000000000000, 0.000000000000, -5.77509662e-10, 0.000000000000, 0.000000000000 ], [ 8.43555937e-31, -1.77573402e-29, 0.00000000000, 0.000000000000, 0.000000000000, 0.0000000000000 ], [ 0.000000000000, -2.2966887900e2, -4.6056284700, 0.000000000000, 0.000000000000, 0.0000000000000 ]], [[ 0.000000000000, 0.0000000000000, 0.00000000000, -5.13962051e-4, 0.000000000000, 0.0000000000000 ], [ 0.000000000000, 0.0000000000000, 0.00000000000, 9.307611420e-5, 0.000000000000, 0.0000000000000 ], [ 0.000000000000, -2.714850860e-7, 0.00000000000, 0.000000000000, 0.000000000000, 0.0000000000000 ], [ 0.000000000000, 0.0000000000000, 0.00000000000, 0.000000000000, 0.000000000000, 0.0000000000000 ], [ 0.000000000000, 0.0000000000000, -1.39016981e-15, -7.43350922e-13, 0.000000000000, 0.0000000000 ], [ 0.000000000000, 0.0000000000000, 0.00000000000, 0.000000000000, 0.000000000000, 0.0000000000000 ], [ -1.11176553000, 1.01000272e1, 1.40556304000e-1, 1.127215570000, 0.000000000000, 0.0000000000000 ]]]) self.b = np.array([[ -1.17446972e4, 2.865416060e3, -2.279680760e1, 3.09897542e-2, -1.92379975e-5, 1.674471870e-26, -1.91185804e6 ], [ 0.00000000000, 0.00000000000, -4.00100143e-4, 0.00000000000, -2.43204343e-8, -6.04921882e-28, 1.080249060e5 ], [ 0.00000000000, 1.19091585e-2, -4.19764987e-4, 7.93310194e-7, 0.000000000000, 0.0000000000000, -1.66310231e3 ]]) # Pitzer Parameters self.pr = un.atm_2_pascal(self.pa) / 1e6 self.tc = 298.15 def Fg(x): f_1 = self.a[0][0][x] + self.a[0][1][x] * np.log( self.tk) + self.a[0][2][x] * self.tk + self.a[0][3][ x] * self.tk**2 + self.a[0][4][x] * self.tk**3 + self.a[0][ 5][x] * self.tk**10 + self.a[0][6][x] / ( (647 - self.tk)**2) f_2 = self.a[1][0][x] + self.a[1][1][x] * np.log( self.tk) + self.a[1][2][x] * self.tk + self.a[1][3][ x] * self.tk**2 + self.a[1][4][x] * self.tk**3 + self.a[1][ 5][x] * self.tk**10 + self.a[1][6][x] / ( (647 - self.tk)**2) f_3 = self.a[2][0][x] + self.a[2][1][x] * np.log( self.tk) + self.a[2][2][x] * self.tk + self.a[2][3][ x] * self.tk**2 + self.a[2][4][x] * self.tk**3 + self.a[2][ 5][x] * self.tk**10 + self.a[2][6][x] / ( (647 - self.tk)**2) return f_1 + f_2 * self.pr + f_3 * (self.pr**2) / 2 self.beta0 = Fg(0) self.beta1 = Fg(1) self.beta2 = 0 self.C0 = Fg(2) self.C1 = Fg(3) self.C2 = Fg(4) self.D0 = Fg(5) self.D1 = 0 self.D2 = 0 self.params = np.array([ self.beta0, self.beta1, self.beta2, self.C0, self.C1, self.C2, self.D0, self.D1, self.D2 ]) # Pitzer Parameters pressure derivative def Fv(x): f_2 = self.a[1][0][x] + self.a[1][1][x] * np.log( self.tk) + self.a[1][2][x] * self.tk + self.a[1][3][ x] * self.tk**2 + self.a[1][4][x] * self.tk**3 + self.a[1][ 5][x] * self.tk**10 + self.a[1][6][x] / ( (647 - self.tk)**2) f_3 = self.a[2][0][x] + self.a[2][1][x] * np.log( self.tk) + self.a[2][2][x] * self.tk + self.a[2][3][ x] * self.tk**2 + self.a[2][4][x] * self.tk**3 + self.a[2][ 5][x] * self.tk**10 + self.a[2][6][x] / ( (647 - self.tk)**2) return f_2 + f_3 * self.pr def Fv_vp(): V_1 = self.b[0][0] + self.b[0][1] * np.log( self.tk ) + self.b[0][2] * self.tk + self.b[0][3] * self.tk**2 + self.b[0][ 4] * self.tk**3 + self.b[0][5] * self.tk**10 + self.b[0][6] / ( (647 - self.tk)**2) V_2 = self.b[1][0] + self.b[1][1] * np.log( self.tk ) + self.b[1][2] * self.tk + self.b[1][3] * self.tk**2 + self.b[1][ 4] * self.tk**3 + self.b[1][5] * self.tk**10 + self.b[1][6] / ( (647 - self.tk)**2) V_3 = self.b[2][0] + self.b[2][1] * np.log( self.tk ) + self.b[2][2] * self.tk + self.b[2][3] * self.tk**2 + self.b[2][ 4] * self.tk**3 + self.b[2][5] * self.tk**10 + self.b[2][6] / ( (647 - self.tk)**2) return V_1 + V_2 * self.pr + V_3 * self.pr**2 self.vp = Fv_vp() self.beta0_der_p = ( (Fv(0) / 1e6) * un.atm_2_pascal(1)) / un.atm_2_bar(1) self.beta1_der_p = ( (Fv(1) / 1e6) * un.atm_2_pascal(1)) / un.atm_2_bar(1) self.beta2_der_p = 0 self.C0_der_p = ((Fv(2) / 1e6) * un.atm_2_pascal(1)) / un.atm_2_bar(1) self.C1_der_p = ((Fv(3) / 1e6) * un.atm_2_pascal(1)) / un.atm_2_bar(1) self.C2_der_p = ((Fv(4) / 1e6) * un.atm_2_pascal(1)) / un.atm_2_bar(1) self.D0_der_p = ((Fv(5) / 1e6) * un.atm_2_pascal(1)) / un.atm_2_bar(1) self.D1_der_p = 0 self.D2_der_p = 0 self.params_der_p = np.array([ self.vp, self.beta0_der_p, self.beta1_der_p, self.beta2_der_p, self.C0_der_p, self.C1_der_p, self.C2_der_p, self.D0_der_p, self.D1_der_p, self.D2_der_p ]) # Pitzer Parameters temperature derivative def Fl(x): f_1 = self.a[0][1][x] / self.tk + self.a[0][2][ x] + 2 * self.a[0][3][x] * self.tk + 3 * self.a[0][4][ x] * self.tk**2 + 10 * self.a[0][5][ x] * self.tk**9 + 2 * self.a[0][6][x] / ( (647 - self.tk)**3) f_2 = self.a[1][1][x] / self.tk + self.a[1][2][ x] + 2 * self.a[1][3][x] * self.tk + 3 * self.a[1][4][ x] * self.tk**2 + 10 * self.a[1][5][ x] * self.tk**9 + 2 * self.a[1][6][x] / ( (647 - self.tk)**3) f_3 = self.a[2][1][x] / self.tk + self.a[2][2][ x] + 2 * self.a[2][3][x] * self.tk + 3 * self.a[2][4][ x] * self.tk**2 + 10 * self.a[2][5][ x] * self.tk**9 + 2 * self.a[2][6][x] / ( (647 - self.tk)**3) return f_1 + f_2 * self.pr + f_3 * (self.pr**2) / 2 self.beta0_der_t = Fl(0) self.beta1_der_t = Fl(1) self.beta2_der_t = 0 self.C0_der_t = Fl(2) self.C1_der_t = 0 self.C2_der_t = 0 self.D0_der_t = 0 self.D1_der_t = 0 self.D2_der_t = 0 self.params_der_t = np.array([ self.beta0_der_t, self.beta1_der_t, self.beta2_der_t, self.C0_der_t, self.C1_der_t, self.C2_der_t, self.D0_der_t, self.D1_der_t, self.D2_der_t ]) super().__init__(tk, pa)
def __init__(self, tk, pa=1): """ constructor :param tk: temperature in kelvin :param pa: pressure in atmospheres :instantiate: temperature, pressure, molecular weight, polarizability, dipole moment """ super().__init__(tk, pa) """ Calculations for density """ self.t = self.tk - un.celsius_2_kelvin(0) # pressure in applied bar according to Fine and Millero self.y = un.atm_2_bar(self.pa - 1) self.den1 = 0.9998396 + self.t * 18.224944e-3 - 7.922210e-6 * self.t ** 2 - 55.44846e-9 * self.t ** 3 self.den2 = 149.7562e-12 * self.t ** 4 - 393.2952e-15 * self.t ** 5 self.V0 = (1 + self.t * 18.159725e-3) / (self.den1 + self.den2) self.B = 19654.320 + 147.037 * self.t - 2.21554 * self.t ** 2 + 1.0478e-2 * self.t ** 3 - 2.2789e-5 * self.t ** 4 self.a1 = 3.2891 - 2.3910e-3 * self.t + 2.8446e-4 * self.t ** 2 - 2.82e-6 * self.t ** 3 + 8.477e-9 * self.t ** 4 self.a2 = 6.245e-5 - 3.913e-6 * self.t - 3.499e-8 * self.t ** 2 + 7.942e-10 * self.t ** 3 - 3.299e-12 * self.t ** 4 # this in cm^3/gram self.vol = self.V0 * (1 - (self.y / (self.B + self.a1 * self.y + self.a2 * self.y ** 2))) # density in kg/m^3 self.rt = 1e3 / self.vol # Calculations for molar volume self.molVol = 1e-3 * self.MolecularWeight / self.rt # Calculations for dielectric constant # coefficients self.U = np.zeros(9) self.U[0] = 3.4279e2 self.U[1] = -5.0866e-3 self.U[2] = 9.4690e-7 self.U[3] = -2.0525 self.U[4] = 3.1159e3 self.U[5] = -1.8289e2 self.U[6] = -8.0325e3 self.U[7] = 4.2142e6 self.U[8] = 2.1417 self.D100 = self.U[0] * (np.exp(self.U[1] * self.tk + self.U[2] * self.tk ** 2)) self.C = self.U[3] + self.U[4] / (self.U[5] + self.tk) self.B_dc = self.U[6] + (self.U[7] / self.tk) + self.U[8] * self.tk self.dielectricConstant = self.D100 + self.C * np.log((self.B_dc + un.atm_2_bar(self.pa)) / (self.B_dc + 1000)) # dielectric constant derivative with respect to pressure self.dielectricConstant_der_p = un.atm_2_bar(1) * self.C / (self.B_dc + (un.atm_2_bar(self.pa))) # dielectric constant derivative with respect to temperature self.val_1 = (un.atm_2_bar(self.pa) - 1000) * (self.U[3] * (self.U[5] + self.tk) + self.U[4]) * (self.U[8] * self.tk ** 2 - self.U[7]) self.val_2 = (self.U[5] + self.tk) * (self.U[6] * self.tk + self.tk * (self.U[8] * self.tk + 1000) + self.U[7]) * (self.tk * (un.atm_2_bar(self.pa) + self.U[8] * self.tk) + self.U[6] * self.tk + self.U[7]) self.val_3 = (self.U[4] * np.log((un.atm_2_bar(self.pa) + (self.U[7] / self.tk) + self.U[8] * self.tk + self.U[6]) / (1000 + (self.U[7] / self.tk) + self.U[8] * self.tk + self.U[6]))) / ((self.U[5] + self.tk) ** 2) self.val_4 = (self.U[0] * np.exp(self.U[1] * self.tk + self.U[2] * self.tk ** 2)) * (2 * self.U[2] * self.tk + self.U[1]) self.dielectricConstant_der_t = -(self.val_1 / self.val_2) - self.val_3 + self.val_4 # Calculations for compressibility self.beta = self.V0 * (self.B - self.a2 * self.y ** 2) / ( self.vol * (self.B + self.a1 * self.y + self.a2 * self.y ** 2) ** 2) self.comp = un.atm_2_bar(self.beta) # Calculations for osmotic coefficient # Bjerrum length self.l_b = un.e_square() / (un.k_boltzmann() * self.tk * self.dielectricConstant) self.fac = 2 * np.pi * un.avogadro() * self.rt * self.l_b ** 3 self.osmotic_coefficient = np.sqrt(self.fac) / 3 # Calculations for apparent molal volume # add a factor 1e6 and convert to Pascal (lat two parts of a_v_0) self.a_v_0 = 2 * self.osmotic_coefficient * un.r_gas() * self.tk * 1e6 / un.atm_2_pascal(1) self.a_v_1 = self.dielectricConstant self.a_v_2 = 3 * self.dielectricConstant_der_p self.a_v_3 = self.comp self.app_molal_vol = self.a_v_0 * (self.a_v_2 / self.a_v_1 - self.a_v_3) # Calculations for enthalpy coefficient # thermal expansion coefficient self.V0_der_1 = 2.85685e-14 * self.t ** 5 - 6.19212e-12 * self.t ** 4 + 1.41483e-9 * self.t ** 3 self.V0_der_2 = 3.10211e-7 * self.t ** 2 + 0.0000158444 * self.t - 0.0000681318 self.V0_der_3 = -3.93295e-13 * self.t ** 5 + 1.49756e-10 * self.t ** 4 - 5.54485e-8 * self.t ** 3 self.V0_der_4 = -7.92221e-6 * self.t ** 2 + 0.0182249 * self.t + 0.99984 self.V0_der = (self.V0_der_1 + self.V0_der_2) / ((self.V0_der_3 + self.V0_der_4) ** 2) self.B_der = -0.000091156 * self.t ** 3 + 0.031434 * self.t ** 2 - 4.43108 * self.t + 147.037 self.a1_der = 3.3908e-8 * self.t ** 3 - 8.46e-6 * self.t ** 2 + 0.00056892 * self.t - 0.002391 self.a2_der = -1.3196e-11 * self.t ** 3 + 2.3826e-9 * self.t ** 2 - 6.998e-8 * self.t - 3.913e-6 self.aw_term_1 = (1 / self.vol) * self.V0_der self.aw_term_2 = -((self.y * self.V0_der) / (self.vol * (self.B + self.a1 * self.y + self.a2 * self.y ** 2))) self.aw_term_3 = self.y * self.V0 * ((self.B_der + self.y * self.a1_der + self.a2_der * self.y ** 2) / (self.vol * (self.B + self.a1 * self.y + self.a2 * self.y ** 2) ** 2)) self.aw = self.aw_term_1 + self.aw_term_2 + self.aw_term_3 # enthalpy coefficient self.enthalpy_coefficient = -6 * self.osmotic_coefficient * un.r_gas() * self.tk * (1 + self.tk * (1 / self.dielectricConstant) * self.dielectricConstant_der_t + self.tk * (self.aw / 3))