Beispiel #1
0
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)
Beispiel #2
0
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()
Beispiel #3
0
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)
Beispiel #4
0
def test_init_reasonable_sim():
    t0 = 0 * units.seconds
    tf = 10 * units.seconds
    dt = 0.1 * units.seconds
    ti = Timer(t0=t0, tf=tf, dt=dt)
    iso = "u235"
    spectrum = "thermal"
    npg = 6
    ndg = 11
    kappa = 0.06
    tester = th_component.THComponent()
    kappa = 0.0
    info = si.SimInfo(timer=ti,
                      components={},
                      iso=iso,
                      e=spectrum,
                      n_precursors=npg,
                      n_decay=ndg,
                      kappa=kappa)
    assert_equal(t0, info.timer.t0)
    assert_equal(tf, info.timer.tf)
    assert_equal(dt, info.timer.dt)
    assert_equal(info.timer.timesteps(), 101)
Beispiel #5
0
# False to turn reactivity feedback off.
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)


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)

inlet = th.THComponent(name="inlet",
                       mat=Sodium(name="sodiumcoolant"),
                       vol=vol_cool,
                       T0=t_inlet,
Beispiel #6
0
mu0 = 0 * units.pascal * units.second
cool = LiquidMaterial('cool', k_cool, cp_cool, rho_cool, mu0)

# Coolant flow properties
h_cool_rd = random.gauss(
    4700.0, 4700.0 * 0.05) * units.watt / units.kelvin / units.meter**2
h_cool = ConvectiveModel(h0=h_cool_rd, mat=cool, model='constant')
m_flow = 976.0 * units.kg / units.second
t_inlet = units.Quantity(600.0, units.degC)  # degrees C

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,
Beispiel #7
0
# External Reactivity
from reactivity_insertion import ImpulseReactivityInsertion

rho_ext = ImpulseReactivityInsertion(timer=ti,
                                     t_start=1.0 * units.seconds,
                                     t_end=2.0 * units.seconds,
                                     rho_init=0.0 * units.delta_k,
                                     rho_max=0.001 * units.delta_k)

# maximum number of internal steps that the ode solver will take
nsteps = 10000

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,
Beispiel #8
0
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.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())
    assert_equal(tester.T0, T0)


def test_temp():
    assert_equal(tester.temp(0), T0)