def test_dtempfueldt_returns_numbers(): components = [th_component.THComponent(), th_component.THComponent()] T = 750.0 th = th_system.THSystem(0, components) p = 1.0000002 omegas = np.array([0, 0, 0]) for c in components: obs = th.dtempdt(c, p, omegas, 0) assert (obs + T * units.kelvin / units.second > 0 * units.kelvin / units.second)
def test_init_reasonable_sim_w_components(): t0 = 0 * units.seconds tf = 10 * units.seconds t_feedback = 1. * units.seconds dt = 0.1 * units.seconds ti = Timer(t0=t0, tf=tf, t_feedback=t_feedback, dt=dt) iso = "u235" spectrum = "thermal" npg = 6 ndg = 11 kappa = 0.06 tester = th_component.THComponent() c = [tester, tester, tester] kappa = 0.0 testfile = 'testfile.py' open(testfile, 'w+') info = si.SimInfo(timer=ti, components=c, iso=iso, e=spectrum, n_precursors=npg, n_decay=ndg, kappa=kappa, infile=testfile, db=database.Database(mode='w')) assert_equal(t0, info.timer.t0) assert_equal(tf, info.timer.tf) assert_equal(dt, info.timer.dt) assert_equal(info.timer.timesteps(), 101) info.db.close_db() info.db.delete_db()
def test_conduction_slab(): mat = Material(k=1 * units.watt / units.meter / units.kelvin) components = [ th_component.THComponent(mat=mat, T0=700 * units.kelvin), th_component.THComponent(mat=mat, T0=700 * units.kelvin) ] th = th_system.THSystem(0, components) assert_equal( th.conduction_slab(components[0], components[1], 0, 1 * units.meter, 1 * units.meter**2), 0) components = [ th_component.THComponent(mat=mat, T0=800 * units.kelvin), th_component.THComponent(mat=mat, T0=700 * units.kelvin) ] th = th_system.THSystem(0, components) assert (th.conduction_slab(components[0], components[1], 0, 1 * units.meter, 1 * units.meter**2) > 0)
feedback = True # External Reactivity from reactivity_insertion import StepReactivityInsertion rho_ext = StepReactivityInsertion(timer=ti, t_step=1.0 * units.seconds, rho_init=0.0 * units.delta_k, rho_final=0.005 * units.delta_k) # maximum number of internal steps that the ode solver will take nsteps = 1000 fuel = th.THComponent(name="fuel", mat=Kernel(name="fuelkernel"), vol=vol_fuel, T0=t_fuel, alpha_temp=alpha_f, timer=ti, heatgen=True, power_tot=power_tot) cool = th.THComponent(name="cool", mat=Flibe(name="flibe"), vol=vol_cool, T0=t_cool, alpha_temp=alpha_c, timer=ti) refl = th.THComponent(name="refl", mat=Graphite(name="reflgraphite"), vol=vol_refl, T0=t_refl,
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", mat=Fuel, vol=vol_fuel, T0=t_fuel, alpha_temp=alpha_fuel, timer=ti, heatgen=True, power_tot=power_tot / n_pebbles, sph=True, ri=r_mod,
feedback = False # External Reactivity from reactivity_insertion import ReactivityInsertion rho_ext = ReactivityInsertion(timer=ti) # rho_ext = StepReactivityInsertion(timer=ti, t_step=1.0*units.seconds, # rho_init=0.0*units.delta_k, # rho_final=0.005*units.delta_k) # maximum number of internal steps that the ode solver will take nsteps = 1000 fuel = th.THComponent(name="fuel", mat=SFRMetal(name="sfrfuel"), vol=vol_fuel, T0=t_fuel, alpha_temp=alpha_f, timer=ti, heatgen=True, power_tot=power_tot) cool = th.THComponent(name="cool", mat=Sodium(name="sodiumcoolant"), vol=vol_cool, T0=t_cool, alpha_temp=alpha_c, timer=ti) clad = th.THComponent(name="clad", mat=SS316(name="ss316"), vol=vol_clad, T0=t_clad,
k = 10 * units.watt / units.meter / units.kelvin cp = 10 * units.joule / units.kg / units.kelvin dm = density_model.DensityModel(a=0 * units.kg / units.meter**3, b=100 * units.kg / units.kelvin / pow(units.meter, 3), model='constant') mat = Material(k=k, cp=cp, dm=dm) kappa = 0 T0 = 700 * units.kelvin t0 = 0 * units.seconds tf = 10 * units.seconds tfeedback = 5 * units.seconds dt = 0.1 * units.seconds ti = Timer(t0=t0, tf=tf, dt=dt, t_feedback=tfeedback) tester = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti) tester_sph = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti, sph=True, ri=0 * units.meter, ro=1 * units.meter) def test_constructor(): assert_equal(tester.name, name) assert_equal(tester.vol, vol) assert_equal(tester.k, k) assert_equal(tester.rho(0), dm.rho())