コード例 #1
0
    def test_6_88(self):
    # Letra A
        Pa = 60E5
        Ta = 650
        benz = thermo.Chemical('benzene')
        cyclo = thermo.Chemical('cyclohexane')
        bc = thermo.Mixture(['benzene','cyclohexane'],zs = [0.5,0.5],T=Ta,P=Pa)
        Za = z_find.Lee_Kesler(bc.Tc,bc.Pc,bc.omega,Ta,Pa)
        eosamix = thermo.eos_mix.SRKMIX([benz.Tc,cyclo.Tc],[benz.Pc,cyclo.Pc],[benz.omega,cyclo.omega],[0.5,0.5],[[0,0],[0,0]],Ta,Pa)
    #    Z = thermo.utils.Z(Ta,Pa,eosamix.V_g)
    #    ZRK,eosa = z_find.SRK(bc.Tc,bc.Pc,bc.omega,Ta,Pa)
        #eos_PR = thermo.eos.PR(bc.Tc,bc.Pc,bc.omega,T,P)

    # Letra B
        Pb = 100E5
        Tb = 300
        #cd = thermo.Chemical('carbon dioxide')
        #cm = thermo.Chemical('carbon monoxide')
        cmd = thermo.Mixture(['carbon dioxide','carbon monoxide'],zs=[0.5,0.5],T=Tb,P=Pb)
        Zb = z_find.Lee_Kesler(cmd.Tc,cmd.Pc,cmd.omega,Tb,Pb)

    # Letra C
        Pc = 100E5
        Tc = 600
        cdo = thermo.Mixture(['carbon dioxide','n-octane'],zs=[0.5,0.5],T=Tc,P=Pc)
        Zc = z_find.Lee_Kesler(cdo.Tc,cdo.Pc,cdo.omega,Tc,Pc)
        self.assertEqual([Za,Zb,Zc],[0.68,0.794,0.813],'ValueError:Failed') # values are different, based on what I saw,
コード例 #2
0
    def test_10_11(self):
        ## a
        T = 340
        P = 115E3
        z1 = 0.75
        if thermo.Chemical('acetone').Tc > T and thermo.Chemical(
                'acetonitrile').Tc > T:
            #subs1 = thermo.Chemical('acetone',T)
            #subs2 = thermo.Chemical('acetonitrile',T)
            #Psat = np.array([subs1.Psat, subs2.Psat])
            #print(Psat)
            #or
            A1 = 14.3916
            B1 = 2795.82
            C1 = -43.15
            A2 = 14.7258
            B2 = 3271.24
            C2 = -31.30
            P1sat_tabela = np.exp(A1 - B1 / (T + C1)) * 10**(3)
            P2sat_tabela = np.exp(A2 - B2 / (T + C2)) * 10**(3)
            Psat = np.array([P1sat_tabela, P2sat_tabela])
            z2 = 1 - z1
            z = np.array([z1, z2])
            x, y, nv = thermo.activity.flash(P, z, Psat)
            r = y[0] * nv / z[0]
        else:
            self.fail('Temperature out of range')

        self.assertEqual(np.round(nv, 3), 0.656, 'ValueError:Failed')
        self.assertEqual(np.round(x[0], 3), 0.642, 'ValueError:Failed')
        self.assertEqual(np.round(y[0], 3), 0.807, 'ValueError:Failed')
        self.assertEqual(np.round(r, 3), 0.706, 'ValueError:Failed')
コード例 #3
0
ファイル: astro_tools.py プロジェクト: gaffarelj/DSE-Mars-SRV
    def stagnation_heating(self, nose_radius, r, mach):
        #c = 1.9027e-4
        #q = rho_inf**0.5 * V**3 * c * nose_radius**(-0.5)
        t_wall = 800

        altitude = r - self.Planet.r
        t_static = atm.get_temperature(altitude)
        p_static = atm.get_pressure(altitude)
        v = mach * np.sqrt(atm.gamma * atm.R * t_static)
        if p_static == 0:
            q, t2, rho2 = 0, t_static, 0
        else:
            p2, rho2, t2, m2 = self.normalshock(r, mach)
            gas_wall = thermo.Chemical('carbon dioxide', T=t_wall, P=p2)
            gas_post = thermo.Chemical('carbon dioxide', T=t_wall, P=p2)
            rho_wall = p2 / atm.R / t_wall
            mu_wall = gas_wall.mug
            mu_post = gas_post.mug
            t_total = t2 * (1 + 0.5 * (atm.gamma - 1) * m2**2)
            dudx = 1 / nose_radius * np.sqrt(2 * (p2 - p_static) / rho2)
            q = 0.94 * (rho2 * mu_post)**0.4 * (
                rho_wall * mu_wall)**0.1 * np.sqrt(dudx) * gas_post.Cpg * (
                    t_total - t_wall)

        #c = 1.9027e-4
        #q = atm.get_density(p_static, t_static)**0.5 * v**3 * c * nose_radius**(-0.5)

        return q, t2, rho2
コード例 #4
0
 def __init__(self,
              oxidiser,
              fuel,
              pressurant,
              massflow_oxidiser,
              massflow_fuel,
              tankpressure,
              storagepressure,
              temperature_oxidiser,
              temperature_fuel,
              temperature_pressurant,
              burntime,
              piston=False):
     self.oxidiser = thermo.Chemical(oxidiser,
                                     T=temperature_oxidiser,
                                     P=tankpressure)
     self.fuel = thermo.Chemical(fuel, T=temperature_fuel, P=tankpressure)
     self.pressurant = thermo.Chemical(pressurant,
                                       T=temperature_pressurant,
                                       P=storagepressure)
     self.tankpressure = tankpressure
     self.pressurant_pressure = storagepressure
     self.massflow_fuel = massflow_fuel
     self.massflow_oxidiser = massflow_oxidiser
     self.burntime = burntime
コード例 #5
0
 def test_6_23(self): #PERGUNTAR SE RICARDO SABE COMO ENCONTRAR A ENTALPIA DE CADA ESTADO E NÃO DA MUDANÇA DE FASE
     m = 1
     P = 1000E3
     H2O = thermo.Chemical('water')
     T = H2O.Tsat(P)
     w = thermo.Chemical('water',T, P)
     x = (w.rhog)*0.7/((w.rhog)*0.7+(w.rhol)*0.3)
     v = (1/w.rhog)*x + (1/w.rhol)*(1-x)
     print('rho',rho)
     eos = thermo.eos.SRK(w.Tc,w.Pc,w.omega,T,P)
コード例 #6
0
 def __init__(self, fluid, temperature, pressure, length, pressuredrop,
              inner_radius, outer_radius):
     self.fluid = thermo.Chemical(fluid, T=temperature, P=pressure)
     self.length = length
     self.pressuredrop = pressuredrop
     self.inner_radius = inner_radius
     self.outer_radius = outer_radius
コード例 #7
0
 def testMcCain_15_1(self):
     T = 273.15 + 87.78  #190F
     ibut = thermo.Chemical('isobutane')
     eos = thermo.eos.PR(ibut.Tc, ibut.Pc, ibut.omega, T, 1E5)
     Pvap = eos.Psat(T)
     P = Pvap / 100000  #em bar
     self.assertEqual(np.round(P, 2), 15.88, 'ValueError:Failed')  #15.78
コード例 #8
0
    def testMcCain_15_2(self):
        ## Dados de Entrada:
        T = 273.15 + 71.11  #160F
        P = 68.95E5  #1000psia
        kij = [[0., 0.02, 0.04], [0.02, 0.0, 0.0],
               [0.04, 0.0,
                0.0]]  #methane-nbutane, methane-ndecane,nbutane-ndecane
        zs = [0.5301, 0.1055, 0.3644]
        K = [3.8, 0.24, 0.0019]
        met = thermo.Chemical('methane')
        nbut = thermo.Chemical('n-butane')
        ndec = thermo.Chemical('n-decane')
        Tcs = [met.Tc, nbut.Tc, ndec.Tc]
        Pcs = [met.Pc, nbut.Pc, ndec.Pc]
        omegas = [met.omega, nbut.omega, ndec.omega]

        K = K_value_PR.K_value(Tcs, Pcs, omegas, zs, kij, T, P, K)
        print(K)
コード例 #9
0
 def __init__(self, gas, temperature, pressure, length, massflow,
              pressuredrop, upstreamdiameter, inletangle):
     self.gas = thermo.Chemical(gas, T=temperature, P=pressure)
     self.length = length
     self.massflow = massflow
     self.pressuredrop = pressuredrop
     self.chamberpressure = pressure - pressuredrop
     self.upstreamdiameter = upstreamdiameter
     self.inletangle = inletangle
コード例 #10
0
 def test_3_43(self):
     etan = thermo.Chemical('ethanol')
     T = 753.15
     P = 60E5
     Z = z_find.Lee_Kesler(etan.Tc, etan.Pc, etan.omega, T, P)
     Vm = Z * R * T / P
     Vm_i = thermo.volume.ideal_gas(T, P)
     self.assertEqual([np.round(Vm, 6), np.round(Vm_i, 6)],
                      [0.000988, 0.001044], 'ValueError: Failed')  #0.989
コード例 #11
0
ファイル: __init__.py プロジェクト: Kankelborg-Group/kgpy
 def xrt_aluminum(self) -> xrt.backends.raycing.materials.Material:
     return xrt.backends.raycing.materials.Material(
         elements='Al',
         kind='plate',
         t=self.thickness.to(u.mm).value,
         table=self.xrt_table,
         rho=self.density_ratio * (thermo.Chemical('Al').rho * u.kg /
                                   u.m**3).to(u.g / u.cm**3).value,
     )
コード例 #12
0
 def test_3_1(self):
     Pi = 101325  #bar to Pascal
     Ti = 323.15  #Kelvin
     s = thermo.Chemical('water', Ti, Pi)
     k = (44.18) * 10**(-6)  #bar-1
     rhof = 1.01 * s.rho
     deltaP = (1 / k) * np.log(rhof / s.rho)
     Pf = deltaP + Pi / 101325  #sai em bar
     self.assertAlmostEqual(
         Pf, 226.2, 1, 'ValueError:Failed'
     )  #usei 1 pois era a precisão do valor que tinha no gabarito
コード例 #13
0
 def test_10_9(self):
     ## a - flash
     T = 383.15
     P = 90E3
     benz = thermo.Chemical('benzene', T)
     tol = thermo.Chemical('toluene', T)
     etbenz = thermo.Chemical('ethylbenzene', T)
     if benz.Tc > T and tol.Tc > T and etbenz.Tc > T:
         Psat = np.array([benz.Psat, tol.Psat, etbenz.Psat])
         z = np.array([1 / 3, 1 / 3, 1 / 3])  #mole fractions
         x, y, nv = thermo.activity.flash(P, z, Psat)
     else:
         self.fail('Temperature out of range')
     x = np.round(x, 3)
     y = np.round(y, 3)
     self.assertEqual(np.round(nv, 3), 0.833,
                      'ValueError:Failed')  #0.834 in the solution
     self.assertEqual([x[0], x[1], x[2]], [0.143, 0.306, 0.551],
                      'ValueError:Failed')  # the last one 0.551 - solution
     self.assertEqual([y[0], y[1], y[2]], [0.371, 0.339, 0.290],
                      'ValueError:Failed')
コード例 #14
0
ファイル: __init__.py プロジェクト: Kankelborg-Group/kgpy
 def xrt_aluminum_oxide(self) -> xrt.backends.raycing.materials.Material:
     return xrt.backends.raycing.materials.Material(
         elements=[
             'Al',
             'O',
         ],
         quantities=[2, 3],
         kind='plate',
         t=self.thickness_oxide.to(u.mm).value,
         table=self.xrt_table,
         rho=self.density_ratio * (thermo.Chemical('Al2O3').rho * u.kg /
                                   u.m**3).to(u.g / u.cm**3).value,
     )
コード例 #15
0
    def test_6_14_15_16(self):
    ## Letra a
        Ta = 300
        Pa = 40E5
        ac = thermo.Chemical('ethyne')
        Z_acRK,eos_acRK = z_find.RK(ac.Tc,ac.Pc,Ta,Pa)
        self.assertEqual([np.round(Z_acRK,3),np.round(eos_acRK.H_dep_g),np.round(eos_acRK.S_dep_g,3)],[0.695,-2303,-5.463],'ValueError:Failed')
# H = -2302 S = -5.219 (n sei porque deu essa diferença toda, uma vez que a entalpia e Z deram aproximações bem razoáveis)

        Z_acSRK,eos_acSRK = z_find.SRK(ac.Tc,ac.Pc,ac.omega,Ta,Pa)
        self.assertEqual([np.round(Z_acSRK,3),np.round(eos_acSRK.H_dep_g),np.round(eos_acSRK.S_dep_g,3)],[0.691,-2590,-6.398],'ValueError:Failed')
# H = -2595 S = 6.165

        Z_acPR,eos_acPR = z_find.PR(ac.Tc,ac.Pc,ac.omega,Ta,Pa)
        self.assertEqual([np.round(Z_acPR,3),np.round(eos_acPR.H_dep_g),np.round(eos_acPR.S_dep_g,3)],[0.667,-2651,-6.395],'ValueError:Failed')
# H = -2655 S = -6.168

    ## Letra b
        Tb = 175
        Pb = 75E5
        ar = thermo.Chemical('argon')
        Z_arRK,eos_arRK = z_find.RK(ar.Tc,ar.Pc,Tb,Pb)
    #    self.assertEqual([np.round(Z_arRK,3),np.round(eos_arRK.H_dep_g),np.round(eos_arRK.S_dep_g,3)],[0.604,-2075,-8.798],'ValueError:Failed')
# H = -2068 e S =-7.975  (livro)

        ## Letra c
        Tc = 575
        Pc = 30E5
        bz = thermo.Chemical('benzene')
        Z_bzRK,eos_bzRK = z_find.RK(bz.Tc,bz.Pc,Tc,Pc)
        self.assertEqual([np.round(Z_bzRK,3),np.round(eos_bzRK.H_dep_g),np.round(eos_bzRK.S_dep_g,3)],[0.772,-3318,-4.026],'ValueError:Failed')
# H = -3319, S = -3.879 as diferenças tão maiores na entropia

        ## Letra d
        Td = 500
        Pd = 50E5
        nb = thermo.Chemical('n-butane')
        Z_nbRK,eos_nbRK = z_find.RK(nb.Tc,nb.Pc,Td,Pd)
        self.assertEqual([np.round(Z_nbRK,3),np.round(eos_nbRK.H_dep_g),np.round(eos_nbRK.S_dep_g,3)],[0.685,-4504,-6.544],'ValueError:Failed')
コード例 #16
0
 def test_10_3(self):
     ## a
     T = 328.15
     P1_sat = thermo.Chemical('n-pentane', T).Psat
     #P2_sat = thermo.Chemical('heptane',T).Psat
     A2 = 13.8587
     B2 = 2991.32
     C2 = -56.51
     P2_sat_tabela = np.exp(A2 - B2 / (T + C2)) * 10**3
     P = 0.5 * (P1_sat + P2_sat_tabela)
     x1 = (P - P2_sat_tabela) / (P1_sat - P2_sat_tabela)
     y1 = P1_sat * x1 / P
     self.assertEqual([np.round(x1, 1), np.round(y1, 3)], [0.5, 0.915],
                      'ValueError:Failed')
コード例 #17
0
 def test_3_44(self):
     V = 0.35
     prop = thermo.Chemical('propane')
     P = 16E5  #propanes vapor pressure at 320K
     T = 320
     Vliq = 0.8 * V
     Vvap = 0.2 * V
     Z = z_find.Lee_Kesler(prop.Tc, prop.Pc, prop.omega, T, P)
     mvap = P * Vvap * prop.MW * 10**(-3) / (Z * R * T)
     Vmlsat = thermo.volume.Rackett(T, prop.Tc, prop.Pc, prop.Zc)
     nliq = Vliq / Vmlsat
     mliq = nliq * prop.MW * 10**(-3)
     self.assertEqual(
         [np.round(mliq, 1), np.round(mvap, 3)],
         [127.5, 2.341])  #mliq = 127.522,127.549
コード例 #18
0
    def __init__(self, fluid, temperature, pressure, length, annulusdiameter,
                 massflow, pressuredrop, inletangle):
        """UNVARIFIED model of annular injectors. Uses turbulent boundary layer theory to determine annular gap (di) and numerical solution to Darcey Weisbach eqaution to determine discharge coefficent 

        :param fluid: fluid flowing through annulus
        :type fluid: string
        :param length: length of annulus flow passage (coaxial distance)
        :param annulusdiameter: mean diameter of annulus
        :param pressuredrop: design pressure drop over injector 
        """
        self.fluid = thermo.Chemical(fluid, T=temperature, P=pressure)
        self.annulusdiameter = annulusdiameter
        self.length = length
        self.massflow = massflow
        self.pressuredrop = pressuredrop
        self.inletangle = inletangle
コード例 #19
0
def getElementalProperties(mixture: list):
    """
    creates thermo.Chemical objects for all elements in mixture
    :param mixture:
    :return: {
    "element":(number, thermo.Chemical),
    ...
    }
    """
    elements = {}
    for species in mixture:
        e = species.getElements()
        for se in e.keys():
            if se in elements.keys():
                elements[se][0] = elements[se][0] + e[se]
            else:
                elements[se] = (e[se], thermo.Chemical(se))
    return elements
コード例 #20
0
def annulus_verification(r_inner, outer_radius, fluid, pressure_range,
                         temperature, discharge_coefficient):
    volumeflow = []
    D = 2 * ((outer_radius - r_inner) / 2 + r_inner)
    di = outer_radius - r_inner
    for p in pressure_range:
        liquid = thermo.Chemical(fluid, T=temperature, P=p)
        vel = discharge_coefficient * np.sqrt(2 * p / liquid.rho)

        q = 2 * np.pi * D * vel * (di / 2)
        q *= 60 / 0.001  # conversion to l/min

        volumeflow.append(q)
    volumeflow = np.array(volumeflow)

    def experimental_volumeflow(pressuredrop):
        deltap = pressuredrop / 1e5
        q_exp = (deltap / 0.0012)**(1 / 2.1171)  # cryo test data in l/min
        return q_exp

    exp_volumeflow = experimental_volumeflow(pressure_range)
    error = np.dot(
        (exp_volumeflow - volumeflow),
        (exp_volumeflow - volumeflow)) / np.dot(exp_volumeflow, exp_volumeflow)
    print('error: ', abs(error))

    idx = np.where(pressure_range == 12e5)
    e = exp_volumeflow[idx] - volumeflow[idx]
    print(e)

    plt.plot(experimental_volumeflow(pressure_range),
             pressure_range / 1e5,
             color='red',
             label='experimental volumeflow')
    plt.plot(volumeflow,
             pressure_range / 1e5,
             color='blue',
             label='calculated volumeflow')
    #plt.loglog()
    plt.grid()
    plt.xlabel('volume flow [l/min]')
    plt.ylabel('pressure drop [bar]')
    plt.legend(loc='best')
    plt.show()
コード例 #21
0
    def test_3_38_39_40(self):
        ## Letra a
        prop = thermo.Chemical('propane')
        T = 313.15
        Psat = 13.71E5

        eos_RK = thermo.eos.RK(prop.Tc, prop.Pc, T, Psat)
        ans_a38 = [np.round(eos_RK.V_l, 7), np.round(eos_RK.V_g, 7)]
        self.assertEqual(ans_a38, [0.0001081, 0.0014991],
                         'ValueError: Failed')  #Vg = 0.0014992

        eos_SRK = thermo.eos.SRK(prop.Tc, prop.Pc, prop.omega, T, Psat)
        ans_a39 = [np.round(eos_SRK.V_l, 7), np.round(eos_SRK.V_g, 7)]
        self.assertEqual(ans_a39, [0.0001047, 0.0014806],
                         'ValueError: Failed')  #Vg = 0.0014807

        eos_PR = thermo.eos.PR(prop.Tc, prop.Pc, prop.omega, T, Psat)
        ans_a40 = [np.round(eos_PR.V_l, 7), np.round(eos_PR.V_g, 7)]
        self.assertEqual(ans_a40, [0.0000922, 0.0014545], 'ValueError: Failed')
コード例 #22
0
    def test_3_41(self):
        et = thermo.Chemical('ethylene')
        ## Letra a
        m = 18  #kg
        T = 328.15  #K
        P = 35E5  #bar to Pa
        # estado gasoso, calcular pelo fator de compressibilidade
        Z, eos_SRK = z_find.SRK(et.Tc, et.Pc, et.omega, T, P)
        V = (m * 10**3 / et.MW) * Z * R * T / (P)  #MW EM GRAMAS/MOL
        self.assertAlmostEqual(V, 0.4215, 3, 'ValueError: Failed')

        ## Letra b - retirada daqui uma vez que o thermo não ta confiável
        V_ = 0.25
        T_ = 323.15
        P_ = 115E5
        # estado supercrítico - líquido - utilizar a relação virial
        Z_ = z_find.Lee_Kesler(et.Tc, et.Pc, et.omega, T_, P_)
        n = P_ * V_ / (Z_ * R * T_)
        m = n * et.MW * 10**(-3)  #MW EM G/MOL - deu próximo 60.675
コード例 #23
0
    def test_3_35(self):
        B = -152.5E-6
        C = -5800E-12
        T = 523.15
        P = 1800E3
        ## Letra a
        Z_virial = thermo.utils.Z_from_virial_density_form(T, P, B, C)
        V_virial = R * T * Z_virial / P
        ans_a = [np.round(Z_virial, 3),
                 np.round(V_virial, 6)]

        ## Letra b
        st = thermo.Chemical('steam')
        Z_pitzer = z_find.Lee_Kesler(st.Tc, st.Pc, st.omega, T, P)
        V_pitzer = R * T * Z_pitzer / P
        ans_b = [np.round(Z_pitzer, 3), np.round(V_pitzer, 6)]

        ## Validação
        self.assertEqual(ans_a, [0.931, 0.002250], 'ValueError: Failed')
        self.assertEqual(ans_b, [0.939, 0.002268], 'ValueError: Failed')
コード例 #24
0
    def test_3_32(self):
        B = -140E-6  #m⁻3/mol
        C = 7200E-12  #m⁻12/mol⁻2
        T = 298.15  #K
        P = 12.E5  #Pa
        #R = 8.31447     #Cte geral dos gases
        ## Letra a
        Z_virial = thermo.utils.Z_from_virial_density_form(T, P, B, C)
        V_virial = R * T * Z_virial / P
        ans_a = [np.round(Z_virial, 3),
                 np.round(V_virial, 6)]

        ## Letra b
        et = thermo.Chemical('ethylene')
        #B_pitzer = thermo.virial.BVirial_Pitzer_Curl(T,et.Tc,et.Pc,et.omega)
        Z_pitzer = z_find.Lee_Kesler(et.Tc, et.Pc, et.omega, T, P)
        V_pitzer = R * T * Z_pitzer / P
        ans_b = [np.round(Z_pitzer, 3), np.round(V_pitzer, 6)]

        ## Letra c
        Z_RK, eos_RK = z_find.RK(et.Tc, et.Pc, T, P)
        ans_c = [np.round(Z_RK, 3), np.round(eos_RK.V_g, 7)]

        ## Letra d
        Z_SRK, eos_SRK = z_find.SRK(et.Tc, et.Pc, et.omega, T, P)
        ans_d = [np.round(Z_SRK, 3), np.round(eos_SRK.V_g, 6)]

        ## Letra e
        Z_PR, eos_PR = z_find.PR(et.Tc, et.Pc, et.omega, T, P)
        ans_e = [np.round(Z_PR, 2), np.round(eos_PR.V_g, 7)]

        ## Validação
        self.assertEqual(ans_a, [0.929, 0.001919], 'ValueError: Failed')
        self.assertEqual(ans_b, [0.932, 0.001924], 'ValueError: Failed')
        self.assertEqual(ans_c, [0.928, 0.0019166], 'ValueError: Failed')
        self.assertEqual(ans_d, [0.928, 0.001918], 'ValueError: Failed')
        self.assertEqual(ans_e, [0.92, 0.0019006], 'ValueError: Failed')
コード例 #25
0
def annulus_verification(inner_radius, outer_radius, fluid, pressure_range,
                         temperature, discharge_coefficient):

    volumeflow = []
    D = 2 * ((outer_radius - inner_radius) / 2 + inner_radius)
    di = outer_radius - inner_radius
    for p in pressure_range:
        liquid = thermo.Chemical(fluid, T=temperature, P=p)
        vel = discharge_coefficient * np.sqrt(2 * p / liquid.rho)
        Re = liquid.rho * vel * di / liquid.mu
        deltamax = 0.37 * 0.4 * di / (Re**0.2)

        q = 2 * np.pi * D * vel * (di / 2 - 1 / 8 * deltamax)
        q *= 60 / 0.001

        volumeflow.append(q)

    def experimental_volumeflow(pressuredrop):
        deltap = pressuredrop / 1e5
        q_exp = (deltap / 0.0012)**(1 / 2.1171)  # cryo test data in l/min
        return q_exp

    plt.plot(experimental_volumeflow(pressure_range),
             pressure_range / 1e5,
             color='red',
             label='experimental volumeflow')
    plt.plot(volumeflow,
             pressure_range / 1e5,
             color='blue',
             label='calculated volumeflow')
    plt.loglog()
    plt.grid()
    plt.xlabel('volume flow [l/min]')
    plt.ylabel('pressure drop [bar]')
    plt.legend(loc='best')
    plt.show()
コード例 #26
0
    def test_10_1(self):
        # RAOULT's Law - Conditions to use:
        #   1. Low to moderate pressures
        #   2. It can have approximate validity only when the species are chimically similar
        #   3. The ideal gas model applies to the vapor phase and the ideal solution model applies to the liquid phase, wherein
        # the molecular species have similar size and are of the same chemical nature
        #   4. It can oly be applied if the temperature of application is below the species critical temperature (subcritical state)

        ## a - benzene(1) toluene(2)
        x1 = 0.33
        T = 373.15
        x2 = 1 - x1
        P1_sat = thermo.Chemical('benzene', T).Psat
        P2_sat = thermo.Chemical('toluene', T).Psat
        # Checking the use of Raoult's Law
        if thermo.Chemical('benzene').Tc > T and thermo.Chemical(
                'toluene').Tc > T:
            P = x1 * P1_sat + x2 * P2_sat
            y1 = P1_sat * x1 / P
        else:
            ValueError

        self.assertEqual(
            [np.round(P * 10**(-3)), np.round(y1, 3)], [109, 0.545],
            'ValueError:Failed')  #P in kPa
        #actual result: 109119Pa / 109104Pa

        ##e
        T = 378.15  #378.15K=105C, and not 387.15K as it says in the text
        P = 120E3
        P1_sat = thermo.Chemical('benzene', T).Psat
        P2_sat = thermo.Chemical('toluene', T).Psat
        x1 = (P - P2_sat) / (P1_sat - P2_sat)
        y1 = P1_sat * x1 / P
        self.assertEqual([np.round(x1, 3), np.round(y1, 3)], [0.283, 0.486],
                         'ValueError:Failed')  #y1 = 0.485
コード例 #27
0
ファイル: pressuredrop.py プロジェクト: jneeser/sparrow
                              1260 + 273]))

    wall_temperature = 400
    coolant_temp = 400
    radiation = 0
    coolant_pressure = 70e5
    halpha = 3000
    t = 1.2e-3
    wt1 = 0.6e-3
    wt2 = 0.4e-3
    rf1 = 0.1e-3
    rf2 = 0.1e-3

    test = parameters(ri=25e-3, t=t, wt1=wt1, wt2=wt2, rf1=rf1, rf2=rf2, N=42)

    fluid = thermo.Chemical('C2H5OH', T=350, P=50e5)

    t1 = time.time()
    test_res = physics(test, in718, ccase, fluid)
    t2 = time.time()
    print(t2 - t1)

    print("f inner: " + str(test_res.fi))
    print("pressure drop: " + str(test_res.dp))
    print("velocity inner: " + str(test_res.vi))
    print("reynolds inner: " + str(test_res.Rei))
    print("hd inner: " + str(test_res.dhi))
    print("hd outer: " + str(test_res.dho))
    print("velocity outer: " + str(test_res.vo))
    print("reynold outer: " + str(test_res.Reo))
    print("ht inner: " + str(test_res.hi))
コード例 #28
0
def getMp(compound):
    c = cs.search(compound)[0]
    return float("{0:.3f}".format(thermo.Chemical(c.common_name).Tm - 273))
コード例 #29
0
    an_inj = AnnulusInjector(['c2h5oh', 'h2o'], [0.9, 0.1], 410, 62.5e5, 2e-3,
                             30e-3, 2.227, 13.3e5)
    an_inj.injector()
    print(an_inj.mu)
    print(an_inj.diameter * 1000)
    print(an_inj.velocity)

    an_orifice = AnnularOrifice(['c2h5oh', 'h2o'], [0.9, 0.1], 410, 62.5e5,
                                2e-3, 13.3e5, 2.227, 30e-3 / 2)
    an_orifice.injector()
    print(an_orifice.mu)
    print(an_orifice.diameter * 1000)
    print(an_orifice.velocity)

    #print((liq_inj.velocity*liq_inj.massflow*n_holes)/(an_inj.velocity*an_inj.massflow))

    mass_fraction = [0.9, 0.1]
    mole_fraction = [46 / 64, 18 / 64]
    n_holes = np.arange(20, 100, 1)
    massflow = 3.5858

    print(thermo.Mixture(['c2h5oh', 'h2o'], [0.8, 0.2], T=288.15, P=1e5).rho)
    print(thermo.Mixture(['c2h5oh', 'h2o'], [0.8, 0.2], T=288.15, P=70e5).rho)

    print(thermo.Chemical('o2', T=90, P=1e5).rho)

    #ohnesorge_number(liq_inj, n_holes, massflow, mass_fraction, mole_fraction)

    #annulus_verification(24.2e-3/2, 25.32e-3/2, 'h2o', np.arange(1e5, 15e5, 0.1e5), 288, 0.61)
コード例 #30
0
def getDensity(compound):
    c = cs.search(compound)[0]
    return float(thermo.Chemical(c.common_name).rho * .001)