def test_table(self): # Page 1410 of Span2000 fp = FluidProperties("nitrogen") pressure = 1e5 # 1 bar of pressureM # T in, cpout in_out = ((300, 1041.2844102196514, 0), (330, 1041.6413812207552, 0), (450, 1049.4947432450376, 0), (600, 1075.1966553245081, 0), (1000, 1167.2951736092768, 0)) for T, cp, places in in_out: res_cp = fp.get_cp(T=T, p=pressure) self.assertAlmostEqual(res_cp, cp, places=places) # Testing again, but for another pressure pressure = 1e6 in_out = ((300, 1055.9202212649052, 0), (320, 1054.1353662593865, 0), (400, 1052.3505112538678, 0), (550, 1068.4142063035367, 0), (800, 1123.7447114746187, 0), (1000, 1168.3660866125879, 0)) for T, cp, places in in_out: res_cp = fp.get_cp(T=T, p=pressure) self.assertAlmostEqual( res_cp, cp, places=places ) # Must be divided by molar mass as CoolProp gives enthalpy for J/kg
def h_conv_from_Stanton(Stanton, u, T_ref, p_ref, fp: FluidProperties): """Return heat transfer coefficient dependent on Stanton number and thermodynamic state\ Temperature and pressure are passed instead of T and p, as these abstract away constant computations of cp and rho\ and it is easier to pass around the same state variables time and time again WARNING: REFERENCE THERMODYNAMIC STATE (T_ref, p_ref) MUST BE EQUAL TO THOSE WITH WHICH NUSSELT NUMBER WAS DETERMINED Args: Stanton (-): Stanton number: dimensionless flow characteristic u (m/s): flow velocity T_ref (K): Temperature p_ref (Pa): Pressure fp (FluidProperties): object to use to obtain properties of fluid Returns: h_conv (W/(m^2*K)): convective heat transfer coefficient based on Stanton number, flow velocity and thermodynamic state """ cp = fp.get_cp(T=T_ref, p=p_ref) # [J/kg] Specific heat capacity under constant pressure rho = fp.get_density(T=T_ref,p=p_ref) # [kg/m^3] Fluid density return Stanton*rho*u*cp # [W/(m^2*K)] h_conv: Convective heat transfer coefficient
h_channel = 100e-6 # [m] Channel height/depth w_channel = 212e-6 # [m] Channel width channel_amount = 5 # [-] m_dot = 0.55e-6 / channel_amount # [kg/s] # 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))