Skip to content

Repository files navigation

Shield for Fusion (S4F)

Shield4Fusion provides intelligent shielding design for fusion reactors using multi-objective GA optimization. It includes an inverse material design feature to investigates optimal shielding configurations based on input neutron flux and desired output parameters. For the time being the only geometry set up includes a 4 layers shielding cabinets, but it can be extended for different fusion application problems with few modifications to the template script. Depending on the desired output and input geometry modifications to the job generation and evolve scripts may be required as well.

Features

  • Multi-objective genetic algorithm for dataset generation
  • Data visualization and Pareto analysis
  • Inverse material design for shielding investigation from dataset
  • Modular and pip-installable structure

Installation

Clone the repository and run:

pip install .

Usage

Inverse Design Tool (No OpenMC Required)

The inverse design tool allows you to query pre-computed datasets to find optimal shielding configurations without needing OpenMC installed:

cd shield4fusion/shielding_cabinets/dataset
python ../inverse_design.py

The tool will interactively prompt you to:

  1. Select neutron source type (DD or DT spectrum)
  2. Choose target property (flux or dose attenuation)
  3. Specify desired attenuation value

Creating a New Dataset (OpenMC Required)

To generate a new dataset using the genetic algorithm optimization:

1. Prepare Initial Generation

The first_gen.txt file contains the initial population. Modify if needed or use the provided default.

2. Generate and Run OpenMC Simulations

For HPC with SLURM:

cd shield4fusion/shielding_cabinets
python generate_slurm_jobs.py
# Submit generated job scripts to SLURM

For HPC with PBS:

python generate_pbs_jobs.py
# Submit generated job scripts to PBS

For local/serial execution:

python generate_serial_jobs.py

3. Post-Process Results

After simulations complete for generation N:

python postprocess_gen.py N

This reads tallies.out files and creates genN/results_gen.txt.

4. Evolve to Next Generation

python evolve_generation.py N

This creates genN+1/encodings.txt with offspring configurations.

5. Repeat Steps 2-4

Continue until convergence (typically 100-120 simulations with current setup, ~4 generations).

6. Create Final Dataset

python create_dataset.py

This consolidates all generation results into a single CSV file, removing duplicates.

7. Visualize and Analyze

# Plot Pareto front
python plot_pareto.py --dataset your_dataset.csv

# Compare two datasets
python plot_pareto_diff.py --dataset1 dd_dataset.csv --dataset2 dt_dataset.csv

# Visualize search space coverage
python plot_search_space.py --dataset1 ga_dataset.csv --dataset2 uniform_dataset.csv

Folder Structure

  • shield4fusion/ — Main package code
    • shielding_cabinets/ — GA optimization scripts
      • dataset/ — Pre-computed datasets
      • template_parametric.py — OpenMC simulation template
      • material_library.py — Material definitions
  • tests/ — Unit tests
  • docs/ — Documentation and paper
  • README.md, setup.py, pyproject.toml — Project metadata

Requirements

  • For Inverse Design (query only):
    • numpy
    • pandas
  • For Dataset Generation (full GA):
    • OpenMC
    • numpy
    • pandas
    • matplotlib
    • seaborn

Contributing

Contributions are welcome! Please submit issues or pull requests.

License

MIT

Citation

If you use Shield4Fusion in your research, please cite:

Di Giacomo, M. et al. (2026). Shield for Fusion (S4F): A Proof-of-Concept Neutronics Genetic Algorithm Optimization of Shielding Cabinets for Fusion Applications. GitHub repository.
https://github.com/digiacomo4/shield4fusion

Author

Matteo Di Giacomo

About

Genetic algorithm optimization for shielding configurations given input neutron flux and desired output.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages