41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from reactor_sim.atomic import AtomicPhysics
|
|
from reactor_sim.fuel import FuelAssembly
|
|
from reactor_sim.state import CoreState
|
|
|
|
|
|
def _core_state(
|
|
temp: float = 600.0,
|
|
flux: float = 1e6,
|
|
burnup: float = 0.05,
|
|
power: float = 100.0,
|
|
) -> CoreState:
|
|
return CoreState(
|
|
fuel_temperature=temp,
|
|
neutron_flux=flux,
|
|
reactivity_margin=0.0,
|
|
power_output_mw=power,
|
|
burnup=burnup,
|
|
)
|
|
|
|
|
|
def test_decay_reaction_power_positive_and_capped():
|
|
physics = AtomicPhysics(seed=7)
|
|
fuel = FuelAssembly(enrichment=0.045, mass_kg=80_000.0, atomic_physics=physics)
|
|
state = _core_state()
|
|
power = fuel.decay_reaction_power(state)
|
|
assert power > 0
|
|
# Should stay under 10% of current power_output_mw.
|
|
assert power <= state.power_output_mw * 0.1 + 1e-6
|
|
|
|
|
|
def test_decay_reaction_power_scales_with_burnup_and_flux():
|
|
physics = AtomicPhysics(seed=9)
|
|
fuel = FuelAssembly(enrichment=0.045, mass_kg=80_000.0, atomic_physics=physics)
|
|
low = _core_state(burnup=0.01, flux=1e5, power=50.0)
|
|
high = _core_state(burnup=0.5, flux=5e6, power=200.0)
|
|
low_power = fuel.decay_reaction_power(low)
|
|
high_power = fuel.decay_reaction_power(high)
|
|
assert high_power > low_power
|
|
# Still capped to a reasonable fraction of the prevailing power.
|
|
assert high_power <= high.power_output_mw * 0.1 + 1e-6
|