multi-group neutron diffusion equation solver
There are several benchmark problems for solving multi-group neutron diffusion problems:
- LRA BWR-2D
- IAEA PWR-2D
Usage (solve + plot), example for PWR-2D:
python main.py --config input/example/PWR-2D.toml --refine 4 --circle 50
# config: path to toml benchmark (now under input/example/)
# refine: mesh refinement factor
# circle: max source-iteration countSkip stages:
# only compute (no plots)
python main.py --config input/example/PWR-2D.toml --refine 4 --circle 50 --skip-plot
# only plot from existing data
python main.py --config input/example/PWR-2D.toml --refine 4 --circle 50 --skip-calcOutput layout:
- Data:
output/Title_Refine-<refine>_Circle-<circle>/data/Title_Refine-<refine>_Circle-<circle>.h5 - Figures:
output/Title_Refine-<refine>_Circle-<circle>/figures/(phi.pdf, keff.pdf)
HDF5 contents (core fields):
phi1,phi2: 2D flux arrays (shape: mesh_num_y × mesh_num_x)keff: final effective multiplication factorkeff_data: iteration history- attributes:
refine,circle,case_name,figures_dir,data_dir
The solver now supports space-time kinetics using the Fully Implicit Backward Euler method.
- Step: Instantaneous change in cross-sections at t=0.
- Ramp: Linear change in cross-sections over a specified time.
You need to adjust the perturbation type in input/example/Twigl.toml file first:
# Perturbation type: "none", "step", "ramp"
type = "step" # or "ramp"Then run the Twigl Step / Ramp perturbation:
python main.py --config input/example/Twigl.toml --refine 2 --circle 50 --kinetics- Data:
output/Title_Kinetics-Refine-<refine>/data/Title_Kinetics-Refine-<refine>.h5 - Figures:
output/Title_Kinetics-Refine-<refine>/figures/power.pdf: Relative Power vs Timefast_flux_evolution.gif: Animated Fast Flux Distributionthermal_flux_evolution.gif: Animated Thermal Flux Distributionfast_flux_snapshots.pdf: Snapshots of Fast Flux at key time pointsthermal_flux_snapshots.pdf: Snapshots of Thermal Flux at key time points
HDF5 contents for kinetics:
time: Time points arraypower: Total fission power historypower_relative: Relative power history (P/P0)phi_flat: Flux distribution over timeC: Delayed neutron precursor concentrations
You can control the animation generation with the following flags:
--no-animate: Disable animation generation (saves time).--skip-frames N: Skip N frames between animation steps to reduce file size and generation time (default: 5).
Example:
python main.py --config input/config_step.toml --refine 1 --kinetics --skip-frames 10