Beispiel #1
0
    def test_webbook_data(self):
        # Pick some random points of NIST webbook to calculate Reynolds numbers, instead of re-using tables of different functions
        # Source: https://webbook.nist.gov/cgi/fluid.cgi?T=300&PLow=1&PHigh=10&PInc=1&Applet=on&Digits=5&ID=C7727379&Action=Load&Type=IsoTherm&TUnit=K&PUnit=bar&DUnit=kg%2Fm3&HUnit=kJ%2Fkg&WUnit=m%2Fs&VisUnit=Pa*s&STUnit=N%2Fm&RefState=DEF

        fp = FluidProperties("nitrogen")

        T = 300  # [K]
        p = 1e5  # [Pa]
        u = 1  # [m/s]
        L = 1  # [m]

        exp_Re = 62764.70916913448
        res_Re = fp.get_Reynolds_from_velocity(T=T, p=p, u=u, L_ref=L)
        self.assertAlmostEqual(exp_Re, res_Re, places=-2)

        u = u * 2  # [m/s]
        exp_Re = 2 * 62764.70916913448
        res_Re = fp.get_Reynolds_from_velocity(T=T, p=p, u=u, L_ref=L)
        self.assertAlmostEqual(exp_Re, res_Re, places=-2)

        L = 1 / 3  # [m]
        exp_Re = 2 / 3 * 62764.70916913448
        res_Re = fp.get_Reynolds_from_velocity(T=T, p=p, u=u, L_ref=L)
        self.assertAlmostEqual(exp_Re, res_Re, places=-2)

        T = 1000  # [K]
        p = 10e5  # [Pa]
        u = 1e-3  # [m/s]
        L = 10e-3  # [m]

        exp_Re = 0.806359422656644
        res_Re = fp.get_Reynolds_from_velocity(T=T, p=p, u=u, L_ref=L)
        self.assertAlmostEqual(exp_Re, res_Re, places=2)
Beispiel #2
0
    def test_one(self):
        # Simply re-using case above, only heating
        fp = FluidProperties("HEOS::Water")
        T_inlet = 700  # [K]
        T_outlet = 900  # [K]
        # This makes the bulk temperature 800 K
        p = 5e5  # [Pa]

        D_h = 1e-3
        u = 1e-3

        T_bulk = (T_outlet + T_inlet) / 2
        Re = fp.get_Reynolds_from_velocity(T=T_bulk, p=p, L_ref=D_h, u=u)
        Pr = fp.get_Prandtl(T=T_bulk, p=p)
        arguments = {'fp': fp, 'Re': Re, 'Pr': Pr}
        exp_Nu = 0.0018785745665208552
        res_Nu = thermo.convection.Nu_DB(args=arguments)
        self.assertAlmostEqual(exp_Nu, res_Nu, delta=0.00001 * exp_Nu / res_Nu)
Beispiel #3
0
fig, axs = plt.subplots(5, 2)

# Render the mass flow and throat width as a function of temperature and area ratios
w_throat = A_throat / h_channel  # [m] Throat width, determined by assuming channel depth
# Find out the hydraulic diameter for a rectangular channel
wetted_perimeter = wetted_perimeter_rectangular(
    w_channel=w_throat, h_channel=h_channel)  # [m] Wetted perimeter
D_hydraulic_throat = hydraulic_diameter(
    A=A_throat, wetted_perimeter=wetted_perimeter)  # [m] Hydraulic diameter
# Numpy and CoolProp don't play nicely together, so iterate over each element to calculate Reynolds's number
it_AR.reset()
for AR in it_AR:
    it_T = np.nditer(T_chamber, flags=['c_index'])
    for T in it_T:
        # Calculate Reynolds number at throat
        Re_throat[it_AR.index][it_T.index] = fp.get_Reynolds_from_velocity(T=T_throat[it_AR.index][it_T.index], p=p_throat[it_AR.index][it_T.index], \
             L_ref=D_hydraulic_throat[it_AR.index][it_T.index], u=u_throat[it_AR.index][it_T.index]) # [-] Reynolds number at throat

it_AR.reset()
for AR in it_AR:
    # Left side of plot
    axs[0][0].plot(T_chamber,
                   m_dot[it_AR.index, :] * 1e6,
                   label="{:2.0f}".format(AR))
    axs[1][0].plot(T_chamber, w_throat[it_AR.index, :] * 1e6)
    axs[2][0].plot(T_chamber, Isp[it_AR.index, :])
    axs[3][0].plot(T_chamber, Pt_ideal[it_AR.index, :])
    axs[4][0].plot(T_throat[it_AR.index, :], mu_throat[it_AR.index, :])

    # Right side of plot
    axs[0][1].plot(T_chamber, D_hydraulic_throat[it_AR.index, :] * 1e6)
    axs[1][1].plot(T_chamber, Re_throat[it_AR.index, :])
Beispiel #4
0
# Hydraulic diameter and area
A_channel = h_channel * w_channel  # [m^2] Channel area through which fluid flows
wetted_perimeter = wetted_perimeter_rectangular(
    w_channel=w_channel, h_channel=h_channel)  # [m] Wetted perimeter
D_h = hydraulic_diameter(A=A_channel, wetted_perimeter=wetted_perimeter)  # [m]

print("\n Hydraulic diameter: {:4.4f} um".format(D_h * 1e6))

# Determine remaining variables at inlet
rho_inlet = fp.get_density(T=T_inlet, p=p_inlet)  # [kg/m^3]
cp_inlet = fp.get_cp(T=T_inlet, p=p_inlet)  # [J/(kg*K)]
u_inlet = velocity_from_mass_flow(m_dot=m_dot, rho=rho_inlet,
                                  A=A_channel)  # [m/s]
mass_flux = m_dot / A_channel  # [kg/(m^2*s)]
Re_Dh_inlet = fp.get_Reynolds_from_velocity(
    T=T_inlet, p=p_inlet, L_ref=D_h,
    u=u_inlet)  # [-] Reynolds number at inlet, based on hydraulic diameter
Pr_inlet = fp.get_Prandtl(T=T_inlet, p=p_inlet)  # [-] Prandtl number at inlet

print("\n-----     INLET     -----")
print("Density: {:4.8f} kg/m^3".format(rho_inlet))
print("C_p: {:4.8f} kJ/(kg*K)".format(cp_inlet * 1e-3))
print("Flow velocity: {:3.4f} m/s".format(u_inlet))
print("Mass flux: {:3.2f} kg/(m^2*s)".format(mass_flux))
print("Re_Dh: {:4.4f}".format(Re_Dh_inlet))
print("Pr {:4.4f}".format(Pr_inlet))

rho_outlet = fp.get_density(T=T_outlet, p=p_inlet)  # [kg/m^3]
cp_outlet = fp.get_cp(T=T_outlet, p=p_inlet)  # [J/(kg*K)]
u_outlet = velocity_from_mass_flow(m_dot=m_dot, rho=rho_outlet,
                                   A=A_channel)  # [m/s]