def test_constant_model(): h_constant = ConvectiveModel(20 * units.W / units.meter**2 / units.kelvin) h1_constant = ConvectiveModel(20 * units.W / units.centimeter**2 / units.kelvin) assert_equal(h_constant.h0, 20 * units.W / units.meter**2 / units.kelvin) assert_equal(h1_constant.h0, 200000 * units.W / units.meter**2 / units.kelvin)
def test_wakao_model(): mat = LiquidMaterial(k=1 * units.watt / units.meter / units.kelvin, cp=1 * units.joule / units.kg / units.kelvin, mu=2 * units.pascal * units.second) h_wakao = ConvectiveModel(mat=mat, m_flow=1 * units.kg / units.g, a_flow=1 * units.meter**2, length_scale=1 * units.meter, model='wakao') assert_equal(h_wakao.mu, 2 * units.pascal * units.second) rho = 100 * units.kg / units.meter**3 assert_equal(h_wakao.h(rho, 0 * units.pascal * units.second), h_wakao.h(rho, 2 * units.pascal * units.second))
def add_convection(self, env, h, area): '''add convection in the self.conv dictionary :param env: name of the component that heat is transfered to/from :type env: str :param h: heat transfer coefficient :type h: float :param area: heat transfer area :type area: float ''' if not isinstance(h, ConvectiveModel): h = ConvectiveModel(h0=h) self.conv[env] = {"h": h, "area": area}
def addConvBC(self, env, prev_comp, h, R): '''add convective boundary condition :param env: name of the environment for convective heat transfer (the fluid) :type env: str :param prev_comp: name of the component that is immediately inside the boundary component :type prev_comp: str :param h: convective heat transfer coefficient :type h: float or obj of Convective Model :param R: radius of the sphere :type R: float ''' if not isinstance(h, ConvectiveModel): h = ConvectiveModel(h0=h) self.convBC[env] = {"h": h, "prev_comp": prev_comp, "R": R}
rho_shell = DensityModel(a=1740. * units.kg / (units.meter**3), model="constant") Shell = Material('shell', k_shell, cp_shell, rho_shell) k_cool = 1 * units.watt / (units.meter * units.kelvin) cp_cool = 2415.78 * units.joule / (units.kg * units.kelvin) rho_cool = DensityModel(a=2415.6 * units.kg / (units.meter**3), b=0.49072 * units.kg / (units.meter**3) / units.kelvin, model="linear") mu0 = 0 * units.pascal * units.second cool = LiquidMaterial('cool', k_cool, cp_cool, rho_cool, mu0) # Coolant flow properties # 4700TODO implement h(T) model h_cool = ConvectiveModel(h0=4700.0 * units.watt / units.kelvin / units.meter**2, mat=cool, model='constant') m_flow = 976.0 * units.kg / units.seconds t_inlet = units.Quantity(600.0, units.degC) mod = th.THComponent(name="mod", mat=Moderator, vol=vol_mod, T0=t_mod, alpha_temp=alpha_mod, timer=ti, sph=True, ri=0.0 * units.meter, ro=r_mod) fuel = th.THComponent(name="fuel",
def add_mass_trans(self, env, H, u): if not isinstance(H, ConvectiveModel): H = ConvectiveModel(h0=H) self.mass[env] = {"H": H, "u": u}
cp_shell = 1650.0 * units.joule / (units.kg * units.kelvin) rho_shell = DensityModel(a=1740. * units.kg / (units.meter**3), model="constant") Shell = Material('shell', k_shell, cp_shell, rho_shell) k_cool = 1 * units.watt / (units.meter * units.kelvin) cp_cool = 2415.78 * units.joule / (units.kg * units.kelvin) rho_cool = DensityModel(a=2415.6 * units.kg / (units.meter**3), b=0.49072 * units.kg / (units.meter**3) / units.kelvin, model="linear") cool = Material('cool', k_cool, cp_cool, rho_cool) cool.mu = 4.638 * 10**5 / (650**2.79) * units.pascal * units.second h_cool = ConvectiveModel(h0=4700.0 * units.watt / units.kelvin / units.meter**2, mat=cool, m_flow=m_flow, a_flow=a_flow, length_scale=dp, model='wakao') mod = th.THComponent(name="mod", mat=Moderator, vol=vol_mod, T0=t_mod, alpha_temp=alpha_mod, timer=ti, sph=True, ri=0.0 * units.meter, ro=r_mod) fuel = th.THComponent(name="fuel", mat=Fuel,