Skip to content

SphenHe/NDESolver

Repository files navigation

NDESolver

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 count

Skip 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-calc

Output 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 factor
  • keff_data: iteration history
  • attributes: refine, circle, case_name, figures_dir, data_dir

Space-Time Kinetics (Twigl Benchmark)

The solver now supports space-time kinetics using the Fully Implicit Backward Euler method.

Supported Perturbations

  • Step: Instantaneous change in cross-sections at t=0.
  • Ramp: Linear change in cross-sections over a specified time.

Usage

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

Kinetics Output

  • Data: output/Title_Kinetics-Refine-<refine>/data/Title_Kinetics-Refine-<refine>.h5
  • Figures: output/Title_Kinetics-Refine-<refine>/figures/
    • power.pdf: Relative Power vs Time
    • fast_flux_evolution.gif: Animated Fast Flux Distribution
    • thermal_flux_evolution.gif: Animated Thermal Flux Distribution
    • fast_flux_snapshots.pdf: Snapshots of Fast Flux at key time points
    • thermal_flux_snapshots.pdf: Snapshots of Thermal Flux at key time points

HDF5 contents for kinetics:

  • time: Time points array
  • power: Total fission power history
  • power_relative: Relative power history (P/P0)
  • phi_flat: Flux distribution over time
  • C: Delayed neutron precursor concentrations

Animation Options

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

About

multi-group neutron diffusion equation solver

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages