def test_a_v(self):
     # apparent molal volume [temperature(C), Pressure(bar), molal vol (cc/mol)] Bradley & Pitzer TABLE IV
     param = np.array([[10, 100, 1.61], [60, 100, 2.55], [120, 100, 4.91],
                       [70, 400, 2.59], [25, 600, 1.66]])
     # converting param to [temperature(K), pressure(atm), molal vol (cc/mol)]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     param[:, 1] = param[:, 1] / un.atm_2_bar(1)
     # testing apparent molal volume up to a precision of 10^-2
     wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1])
     test_vals = np.allclose(wfm.a_v(), param[:, 2], 0, 1e-2)
     self.assertTrue(test_vals)
 def test_a_phi(self):
     # osmotic coefficient of water [temperature(C), Pressure(bar), osmotic coefficient] Bradley & Pitzer TABLE II
     param = np.array([[10, 100, 3.80e-1], [60, 100, 4.17e-1],
                       [120, 100, 4.82e-1], [70, 400, 4.19e-1],
                       [25, 600, 3.81e-1]])
     # converting param to [temperature(K), pressure(atm), osmotic coefficient]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     param[:, 1] = param[:, 1] / un.atm_2_bar(1)
     # testing osmotic coefficient up to a precision of 10^-3
     wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1])
     test_vals = np.allclose(wfm.a_phi(), param[:, 2], 0, 1e-3)
     self.assertTrue(test_vals)
示例#3
0
 def test_molar_vol_infinite_dilution(self):
     # parameters in [temperature (C), pressure (bar), partial molal volume of solute cm^3/mol]
     param = np.array([[70, 1, 1.781e1], [60, 1, 1.791e1], [90, 1, 1.710e1],
                       [80, 400, 1.884e1], [60, 800, 2.024e1]])
     # converting to [temperature (K), pressure (atm), partial molal volume of solute m^3/mol]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     param[:, 1] = param[:, 1] / un.atm_2_bar(1)
     param[:, 2] = param[:, 2] / 1e6
     # testing params up to a precision of 10^-8
     salt_nacl = nacl.NaClPropertiesRogersPitzer(param[:, 0], param[:, 1])
     test_vals = np.allclose(salt_nacl.vp * 1e-6, param[:, 2], 0, 1e-8)
     self.assertTrue(test_vals)
 def test_a_h(self):
     # enthalpy coefficient [temperature(C), Pressure(bar), enthalpy coeff (AH / RT)] Bradley & Pitzer TABLE III
     param = np.array([[10, 100, 0.641], [60, 100, 1.180], [120, 100, 2.05],
                       [70, 400, 1.24], [25, 600, 0.736]])
     # converting param to [temperature(K), pressure(atm), enthalpy coeff (AH / RT)]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     param[:, 1] = param[:, 1] / un.atm_2_bar(1)
     # testing enthalpy coeff up to a precision of 10^-2
     wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1])
     test_vals = np.allclose(
         ((2 / 3) * wfm.a_h()) / (un.r_gas() * param[:, 0]), param[:, 2], 0,
         1e-2)
     self.assertTrue(test_vals, (wfm.a_h()) / (un.r_gas() * param[:, 0]))
 def test_compressibility(self):
     # compressibility of water at [temperature(C), pressure(applied_bar), compressibility (10^6 bar-1)] Millero TABLE V
     param = np.array([[5, 0, 49.175], [30, 0, 44.771], [75, 0, 45.622],
                       [35, 100, 43.305], [55, 300, 40.911]])
     # converting param to [temperature(K), pressure(atm), compressibility (atm-1)]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # 1 atm = 1 applied_atm + 1, according to Millero
     param[:, 1] = (param[:, 1] / un.atm_2_bar(1)) + 1
     param[:, 2] = (param[:, 2] / 1e6) * un.atm_2_bar(1)
     # testing compressibility up to a precision of 10^-9
     wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1])
     test_vals = np.allclose(wfm.compressibility(), param[:, 2], 0, 1e-9)
     self.assertTrue(test_vals)
 def test_density(self):
     # density of water at [temperature(C), pressure(applied_bar), specific volume] Millero TABLEIV
     param = np.array([[5, 0, 1.000036], [30, 0, 1.004369],
                       [75, 0, 1.025805], [30, 100, 0.999939],
                       [55, 300, 1.001642]])
     # converting param to [temperature(K), pressure(atm), specific volume]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # 1 atm = 1 applied_atm + 1, according to Millero
     param[:, 1] = (param[:, 1] / un.atm_2_bar(1)) + 1
     # testing density up to a precision of 10^-6
     wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1])
     test_vals = np.allclose(1e3 / wfm.density(), param[:, 2], 0, 1e-6)
     self.assertTrue(test_vals)
示例#7
0
 def test_log_gamma(self):
     # parameters in [temperature (C), molality, activity coefficient]
     param = np.array([[0, 1, 0.640], [0, 0.1, 0.780], [0, 0.5, 0.675],
                       [25, 1, 0.656], [25, 2, 0.668], [50, 3, 0.726],
                       [50, 0.7, 0.662], [75, 3, 0.710], [75, 0.1, 0.759],
                       [100, 0.2, 0.698]])
     # converting to [temperature (K), molality, activity coefficient]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # testing params up to a precision of 10^-2
     salt_nacl = nacl.NaClPropertiesRogersPitzer(param[:, 0])
     test_vals = np.allclose(np.exp(salt_nacl.log_gamma(param[:, 1])),
                             param[:, 2], 0, 1e-2)
     self.assertTrue(test_vals)
示例#8
0
 def test_osmotic_coeff(self):
     # parameters in [temperature (C), molality, osmotic coefficient]
     param = np.array([[0, 1, 0.920], [0, 0.1, 0.932], [0, 0.5, 0.914],
                       [25, 1, 0.936], [25, 2, 0.985], [50, 3, 1.059],
                       [50, 0.7, 0.929], [75, 3, 1.056], [75, 0.1, 0.927],
                       [100, 0.2, 0.913]])
     # converting to [temperature (K), molality, osmotic coefficient]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # testing params up to a precision of 10^-3
     salt_nacl = nacl.NaClPropertiesRogersPitzer(param[:, 0])
     test_vals = np.allclose(salt_nacl.osmotic_coeff(param[:, 1]),
                             param[:, 2], 0, 1e-3)
     self.assertTrue(test_vals)
示例#9
0
 def test_density_sol(self):
     # parameters in [temperature (C), pressure (bar), molality, specific volume of NaCl(aq) cm^3/g]
     param = np.array([[60, 1, 1, 0.9797], [60, 1, 0.1, 1.0130],
                       [60, 1, 0.5, 0.9976], [80, 1, 2, 0.9581],
                       [80, 1, 3, 0.9293], [80, 1, 0.75, 0.9999],
                       [70, 200, 1, 0.9772], [90, 200, 3, 0.9280],
                       [80, 400, 0.1, 1.0074], [90, 600, 0.25, 0.9998]])
     # converting to [temperature (K), pressure (atm), molality, specific volume of NaCl(aq) cm^3/g]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     param[:, 1] = param[:, 1] / un.atm_2_bar(1)
     # testing params up to a precision of 10^-4
     salt_nacl = nacl.NaClPropertiesRogersPitzer(param[:, 0], param[:, 1])
     test_vals = np.allclose((1 / salt_nacl.density_sol(param[:, 2])) * 1e3,
                             param[:, 3], 0, 1e-4)
     self.assertTrue(test_vals)
示例#10
0
 def test_apparent_molal_enthalpy(self):
     # parameters in [temperature (C), molality, apparent relative molal enthalpy (cal/mol)]
     param = np.array([[0, 1.0, -188.11417381], [0, 0.1, 32.99636565],
                       [0, 0.5, -55.55049346], [25, 1.0, 4.22338911],
                       [25, 2.0, -134.37285678], [25, 3.0, -252.47092572],
                       [25, 1.2, -24.15561616], [50, 3.5, 135.16767688],
                       [50, 0.1, 148.41561978], [75, 0.8, 411.78485441]])
     # converting to [temperature (K), molality, apparent relative molal enthalpy (cal/mol)]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # testing params up to a precision of 10^-2
     salt_nacl = nacl.NaClPropertiesRogersPitzer(param[:, 0])
     test_vals = np.allclose(
         un.joule_2_cal(salt_nacl.apparent_molal_enthalpy(param[:, 1])),
         param[:, 2], 0, 1e-2)
     self.assertTrue(test_vals, "TEST VALUES DO NOT COME FROM LITERATURE")
示例#11
0
 def test_log_gamma(self):
     # parameters in [temperature (C), molality, activity coefficient]
     param = np.array([[25, 1, 0.605], [25, 0.1, 0.768], [25, 0.5, 0.650],
                       [25, 0.3, 0.687], [25, 2.0, 0.574], [50, 3.0, 0.584],
                       [50, 0.5, 0.646]])
     # converting to [temperature (K), molality, activity coefficient]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # testing params up to a precision of 10^-3
     salt_kcl = kcl.KClPropertiesPabalanPitzer(param[:, 0],
                                               1 / un.atm_2_bar(1))
     test_vals = np.allclose(np.exp(salt_kcl.log_gamma(param[:, 1])),
                             param[:, 2], 0, 1e-3)
     self.assertTrue(
         test_vals,
         str(np.exp(salt_kcl.log_gamma(param[:, 1]))) + " & " +
         str(param[:, 2]))
 def test_molar_volume(self):
     # molar volume of water at [temperature(C), pressure(applied_bar), specific volume] Millero TABLE IV
     param = np.array([[5, 0, 1.000036], [30, 0, 1.004369],
                       [75, 0, 1.025805], [35, 100, 1.001597],
                       [55, 300, 1.001642]])
     # converting param to [temperature(K), pressure(atm), molar volume]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # 1 atm = 1 applied_atm + 1, according to Millero
     param[:, 1] = (param[:, 1] / un.atm_2_bar(1)) + 1
     param[:,
           2] = (param[:, 2] /
                 1e6) * fm.WaterPropertiesFineMillero(300).MolecularWeight
     # testing molar volume up to a precision of 10^-11
     wfm = fm.WaterPropertiesFineMillero(param[:, 0], param[:, 1])
     test_vals = np.allclose(wfm.molar_volume(), param[:, 2], 0, 1e-11)
     self.assertTrue(test_vals)
示例#13
0
    def test_osmotic_coeff(self):
        # parameters in [temperature (C), molality, osmotic coefficient]
        param = np.array([[25, 1, 0.899], [25, 0.1, 0.927], [25, 0.5, 0.901],
                          [25, 0.3, 0.907], [25, 2, 0.914], [50, 3, 0.954],
                          [50, 0.5, 0.903]])

        # converting to [temperature (K), molality, osmotic coefficient]
        param[:, 0] = un.celsius_2_kelvin(param[:, 0])
        # testing params up to a precision of 10^-3
        salt_kcl = kcl.KClPropertiesPabalanPitzer(param[:, 0],
                                                  1 / un.atm_2_bar(1))
        test_vals = np.allclose(salt_kcl.osmotic_coeff(param[:, 1]),
                                param[:, 2], 0, 1e-3)
        self.assertTrue(
            test_vals,
            str(salt_kcl.osmotic_coeff(param[:, 1])) + " & " +
            str(param[:, 2]))
示例#14
0
 def test_apparent_molal_enthalpy(self):
     # parameters in [temperature (C), molality, apparent relative molal enthalpy (kJ/mol)]
     param = np.array([[25, 1.0, -0.06], [25, 0.1, 0.34], [25, 0.5, 0.24],
                       [25, 0.3, 0.33], [25, 2.0, -0.67], [25, 3.0, -1.21],
                       [50, 0.5, 0.79], [50, 3.0, 0.30], [50, 0.1, 0.59],
                       [50, 0.3, 0.75]])
     # converting to [temperature (K), molality, apparent relative molal enthalpy (kJ/mol)]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     # testing params up to a precision of 10^-2
     salt_kcl = kcl.KClPropertiesPabalanPitzer(param[:, 0],
                                               (1 / un.atm_2_bar(1)))
     test_vals = np.allclose(
         salt_kcl.apparent_molal_enthalpy(param[:, 1]) / 1e3, param[:, 2],
         0, 1e-2)
     self.assertTrue(
         test_vals,
         str(salt_kcl.apparent_molal_enthalpy(param[:, 1]) / 1e3) + " & " +
         str(param[:, 2]))
示例#15
0
 def test_params_der_p(self):
     # pressure derivative parameters in [temperature (C), pressure (bar), [BV, 2CV]]
     param = np.array([[70, 1, 3.513e-6, -1.22e-7],
                       [60, 1, 4.415e-6, -2.00e-7],
                       [90, 1, 2.577e-6, -6.02e-8],
                       [80, 400, 2.552e-6, -7.97e-8],
                       [60, 800, 3.062e-6, -2.00e-7]])
     # converting to [temperature (K), pressure (atm), [bp, cp]]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     param[:, 1] = param[:, 1] / un.atm_2_bar(1)
     param[:, 3] = param[:, 3] / 2
     # testing params up to a precision of 10^-9
     salt_nacl = nacl.NaClPropertiesRogersPitzer(param[:, 0], param[:, 1])
     test_vals1 = np.allclose(salt_nacl.params_der_p[1], param[:, 2], 0,
                              1e-9)
     test_vals2 = np.allclose(salt_nacl.params_der_p[4], param[:, 3], 0,
                              1e-9)
     self.assertTrue(test_vals1)
     self.assertTrue(test_vals2)
示例#16
0
 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]))
示例#17
0
 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]))
示例#18
0
 def test_molar_vol(self):
     # parameters in [temperature (C), pressure (bar), molality, molar volume cm^3/mol]
     param = np.array([[0, 196.62, 0.3331, 26.280],
                       [0, 196.62, 0.5009, 26.573],
                       [0, 196.62, 0.6693, 26.856],
                       [0, 196.62, 0.8360, 26.976],
                       [25, 196.62, 0.3331, 28.873],
                       [25, 196.62, 0.5009, 29.104],
                       [25, 196.62, 0.6693, 29.258],
                       [50, 196.62, 0.3331, 29.757],
                       [50, 196.62, 0.5009, 29.968],
                       [50, 196.62, 0.6693, 30.125]])
     # converting to [temperature (K), pressure (atm), molality, molar volume m^3/mol]
     param[:, 0] = un.celsius_2_kelvin(param[:, 0])
     param[:, 1] = param[:, 1] / un.atm_2_bar(1)
     param[:, 3] = param[:, 3] / 1e6
     # testing params up to a precision of 10^-9
     salt_kcl = kcl.KClPropertiesPabalanPitzer(param[:, 0], param[:, 1])
     test_vals = np.allclose(salt_kcl.molar_vol(param[:, 2]), param[:, 3],
                             0, 1e-9)
     self.assertTrue(
         test_vals,
         str(salt_kcl.molar_vol(param[:, 2])) + " & " + str(param[:, 3]))
示例#19
0
    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)
示例#20
0
 def test_kelvin_conversion(self):
     # 0 C = 273.15 K
     self.assertEqual(un.celsius_2_kelvin(0), 273.15)
示例#21
0
    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))