Пример #1
0
def model_problem_4_5(methane, carbon_dioxide):
    z = np.array([0.40, 0.60])
    omegas = np.array([methane.omega, carbon_dioxide.omega])
    Tcs = np.array([methane.Tc, carbon_dioxide.Tc])
    Pcs = np.array([methane.Pc, carbon_dioxide.Pc])
    mixture = Mixture(z, Tcs, Pcs, omegas)
    kijs = np.array([[0.000, 0.095], [0.095, 0.000]])
    return NichitaPR(mixture=mixture, bip=kijs)
Пример #2
0
def model_problem_2_4_100_bar(methane, propane):
    z = np.array([0.90, 0.10])
    omegas = np.array([methane.omega, propane.omega])
    Tcs = np.array([methane.Tc, propane.Tc])
    Pcs = np.array([methane.Pc, propane.Pc])
    mixture = Mixture(z, Tcs, Pcs, omegas)
    kijs = np.array([[0.000, 0.029], [0.029, 0.000]])
    return NichitaSRK(mixture=mixture, bip=kijs)
Пример #3
0
def model_problem_3_5(ethane, nitrogen):
    z = np.array([0.40, 0.60])
    omegas = np.array([ethane.omega, nitrogen.omega])
    Tcs = np.array([ethane.Tc, nitrogen.Tc])
    Pcs = np.array([ethane.Pc, nitrogen.Pc])
    mixture = Mixture(z, Tcs, Pcs, omegas)
    kijs = np.array([[0.000, 0.080], [0.080, 0.000]])
    return NichitaPR(mixture=mixture, bip=kijs)
Пример #4
0
def model_problem_1_5(methane, hydrogen_sulfide):
    z = np.array([0.11, 0.89])
    omegas = np.array([methane.omega, hydrogen_sulfide.omega])
    Tcs = np.array([methane.Tc, hydrogen_sulfide.Tc])
    Pcs = np.array([methane.Pc, hydrogen_sulfide.Pc])
    mixture = Mixture(z, Tcs, Pcs, omegas)
    kijs = np.array([[0.000, 0.080], [0.080, 0.000]])
    return NichitaSRK(mixture=mixture, bip=kijs)
Пример #5
0
def model_problem_5_4(methane, ethane, nitrogen):
    z = np.array([0.05, 0.90, 0.05])
    omegas = np.array([methane.omega, ethane.omega, nitrogen.omega])
    Tcs = np.array([methane.Tc, ethane.Tc, nitrogen.Tc])
    Pcs = np.array([methane.Pc, ethane.Pc, nitrogen.Pc])
    mixture = Mixture(z, Tcs, Pcs, omegas)
    kijs = np.array([[0.000, 0.021, 0.038], [0.021, 0.000, 0.080],
                     [0.038, 0.080, 0.000]])
    return NichitaPR(mixture=mixture, bip=kijs)
Пример #6
0
def mixture_nichita_ternary():
    methane = Chemical('methane')
    nhexadecane = Chemical('n-hexadecane')
    carbon_dioxide = Chemical('carbon-dioxide')

    z = np.array([0.05, 0.05, 0.90])
    omegas = np.array([methane.omega, nhexadecane.omega, carbon_dioxide.omega])
    Tcs = np.array([methane.Tc, nhexadecane.Tc, carbon_dioxide.Tc])
    Pcs = np.array([methane.Pc, nhexadecane.Pc, carbon_dioxide.Pc])
    return Mixture(z, Tcs, Pcs, omegas)
Пример #7
0
def test_non_physical_input_Pc():
    z = np.array([0.5, 0.42, 0.08])
    omegas = np.array([0.0115, 0.1928, 0.4902])
    Tcs = np.array([190.556, 425.16667, 617.666667])
    Pcs = np.array([-4604318.9, 3796942.8, 2.096e6])

    with pytest.raises(ValueError) as message:
        Mixture(z=z, Tc=Tcs, Pc=Pcs, acentric_factor=omegas)

    assert str(message.value) == 'Pressure must be greater than zero.'
Пример #8
0
def test_invalid_input_Pc():
    z = np.array([0.5, 0.42, 0.08])
    omegas = np.array([0.0115, 0.1928, 0.4902])
    Tcs = np.array([190.556, 425.16667, 617.666667])
    Pcs = np.array([4604318.9, 3796942.8])

    with pytest.raises(ValueError) as message:
        Mixture(z=z, Tc=Tcs, Pc=Pcs, acentric_factor=omegas)

    assert str(message.value) == 'Input values have incompatible dimensions.'
Пример #9
0
def test_mixture_whitson_ex18():
    z = np.array([0.5, 0.42, 0.08])
    omegas = np.array([0.0115, 0.1928, 0.4902])
    Tcs = np.array([190.556, 425.16667, 617.666667])
    Pcs = np.array([4604318.9, 3796942.8, 2.096e6])
    whiston_mixture = Mixture(z=z, Tc=Tcs, Pc=Pcs, acentric_factor=omegas)

    assert whiston_mixture.z.all() == z.all()
    assert whiston_mixture.acentric_factor.all() == omegas.all()
    assert whiston_mixture.Tc.all() == Tcs.all()
    assert whiston_mixture.Pc.all() == Pcs.all()
Пример #10
0
def test_invalid_input_composition():
    z = np.array([0.5, 0.42, 0.05])
    omegas = np.array([0.0115, 0.1928, 0.4902])
    Tcs = np.array([190.556, 425.16667, 617.666667])
    Pcs = np.array([4604318.9, 3796942.8, 2.096e6])

    with pytest.raises(ValueError) as message:
        Mixture(z=z, Tc=Tcs, Pc=Pcs, acentric_factor=omegas)

    assert str(
        message.value) == 'Overall composition must has summation equal 1.'
Пример #11
0
def mixture_whitson():
    z = np.array([0.5, 0.42, 0.08])
    omegas = np.array([0.0115, 0.1928, 0.4902])
    Tcs = np.array([190.556, 425.16667, 617.666667])
    Pcs = np.array([4604318.9, 3796942.8, 2.096e6])
    return Mixture(z=z, Tc=Tcs, Pc=Pcs, acentric_factor=omegas)
Пример #12
0
 def input_mixture(self):
     return Mixture(z=self.z,
                    Tc=self.Tc,
                    Pc=self.Pc,
                    acentric_factor=self.acentric_factor)