SkillAgentSearch skills...

Nomad

A Genetic Algorithm (GA) / Discrete Particle Swarm Optimization/ Hybrid (GA-PSO) for nuclear fuel optimization using ML surrogates (DNN, KNN, Random Forest, Ridge) and OpenMC. Optimizes fuel loading patterns for a target k-eff and minimal Power Peaking Factor (PPF).

Install / Use

/learn @XxNILOYxX/Nomad

README

NOMAD: Nuclear Optimization with Machine-learning-Accelerated Design (A Genetic Algorithm (GA) / Discrete Particle Swarm Optimization/ Hybrid (GA-PSO) with Deep Neural Network (DNN)/KNN/Random Forest/Ridge/Gradient Boosting for Fuel Pattern Optimization)

Powered by GA Powered by PSO Powered by DNN Powered by KNN Powered by Random Forest Powered by GBM Powered by Ridge Regression License Python OpenMC

NOMAD is a sophisticated tool for optimizing nuclear reactor core fuel loading patterns. It leverages a Genetic Algorithm (GA) / Discrete Particle Swarm Optimization / Hybrid (GA-PSO) coupled with machine learning (ML) models to efficiently determine fuel assembly enrichment arrangements that achieve a target multiplication factor (k_eff) while minimizing the Power Peaking Factor (PPF). This ensures safe, efficient, and compliant reactor operation.

By integrating ML models as high-speed surrogates for computationally expensive neutron transport simulations (e.g., via OpenMC), NOMAD significantly accelerates the optimization process while maintaining accuracy. Image Alt


Table of Contents


Overview

NOMAD optimizes nuclear reactor core designs by:

  • Target: Achieving a specific k_eff while minimizing PPF.
  • Method: Combining a Genetic Algorithm with ML-based surrogates for fast fitness evaluation.
  • Simulation: Using OpenMC for high-fidelity neutron transport calculations.
  • Iterative Improvement: Continuously refining ML models with new simulation data.

This hybrid approach enables rapid exploration of fuel enrichment configurations, making it a powerful tool for nuclear reactor core design.


How It Works

  1. Initial Data Generation: Run OpenMC simulations for a diverse set of fuel enrichment configurations to create a baseline dataset.

  2. ML Model Training:

    • $k_{eff}$ Interpolator: A K-Nearest Neighbors (KNN) regressor predicts $k_{eff}$ for a given fuel pattern.
    • PPF Interpolator: Predicts the Power Peaking Factor (PPF) using KNN, Random Forest, Ridge regression, or a Deep Neural Network (DNN) (configurable). The DNN is a more advanced option capable of capturing complex non-linear relationships.
  3. Choosing the PPF Predictor (Experimental) The optimal choice for the PPF predictor is not fixed. During testing, sometimes Random Forest performs better than KNN, and sometimes the opposite is true. For best results, you should run the full optimization process with both models and use the superior result.

    Pro Tip:

    1. First, run the entire optimization with knn set as the PPF regression model.
    2. Once complete, rename the final checkpoint file in the data/ directory (e.g., from ga_checkpoint.json to ga_checkpoint_knn.json).
    3. Next, change the model in your configuration file to random_forest and run the optimization again.
    4. The Random Forest model will benefit from the large dataset (keff_interp_data.json and ppf_interp_data.json) already generated, potentially yielding more accurate predictions and a different, sometimes better, outcome.
  4. Genetic Algorithm Cycle: The GA evolves a population of fuel loading patterns over thousands of generations, evaluating fitness using the ML predictors for speed.

  5. Verification: The best fuel pattern found by the GA is verified with a full, high-fidelity OpenMC simulation.

  6. Iterative Improvement: The results from the verification simulation are added back into the dataset, and the ML models are retrained. This makes the predictors more accurate for all subsequent GA cycles.


Requirements

Software Dependencies

  • Python 3.8+ with the following packages:
    pip install numpy scipy pandas matplotlib scikit-learn torch
    
  • OpenMC: A working installation is required for physics simulations. See the OpenMC documentation for installation instructions.

Input Files

Ensure the following OpenMC input files are in the same directory as RunOptimizer.ipynb:

  • geometry.xml
  • materials.xml
  • settings.xml
  • tallies.xml

Installation

  1. Clone this repository:
    git clone https://github.com/XxNILOYxX/nomad.git
    cd nomad
    
  2. Install Python dependencies:
    pip install -r requirements.txt
    
  3. Install OpenMC following the official instructions.
  4. Ensure all OpenMC input files are correctly configured and placed in the root directory.

Step 1: Define Fuel Materials and Assemblies

This is the most critical step in setting up your model for NOMAD. The optimizer works by individually adjusting the enrichment of every single fuel assembly. For this to work, your OpenMC model must be built with a specific structure:

Each fuel assembly in your core must be represented by its own unique material and its own unique cell (or universe).

Think of it like giving each assembly a unique ID that the program can find and modify. If you define one material and use it for multiple assemblies, the optimizer will not be able to assign different enrichment values to them.

How to Structure Your Model

  1. Unique Materials: If your core has 150 fuel assemblies, you must create 150 distinct <material> blocks in your materials.xml file. It's essential that their id attributes are sequential (e.g., 3, 4, 5, ..., 152).

  2. Unique Cells/Universes: Similarly, in your geometry.xml, each of these unique materials must fill a unique cell that represents the fuel region of an assembly.

Example Scenario (150 Assemblies)

Imagine your model's material IDs start at 3. Your materials.xml must be structured as follows:

<material depletable="true" id="3" name="Fuel for Assembly 1">
</material>
<material depletable="true" id="4" name="Fuel for Assembly 2">
</material>
...
<material depletable="true" id="152" name="Fuel for Assembly 150">
</material>

In your config.ini, you would then set:

num_assemblies = 150
start_id = 3

Pro-Tip: When generating your model files programmatically (e.g., in a Jupyter Notebook), always use the "Restart Kernel and Clear All Outputs" command before running your script. This prevents old data from being cached and ensures your material and cell IDs are created fresh and correctly, avoiding hard-to-debug errors.

Example Code for Creating Individual Fissile Materials

Use the following code as inspiration and modify it for your own reactor core:

all_materials_list = []
# You can adjust this number as needed
num_assemblies = 150
print("Creating unique fuel materials...")

# This loop creates variables fuel_1, fuel_2, ... fuel_150
for i in range(1, num_assemblies + 1):
    # Define the material object
    fuel_material = openmc.Material(name=f'Fissile fuel Assembly {i}')
    fuel_material.add_nuclide('U235', use your weight fraction, 'wo')
    fuel_material.add_nuclide('U238', use your weight fraction, 'wo')
    fuel_material.add_nuclide('Pu238', use your weight fraction, 'wo')
    fuel_material.add_nuclide('Pu239', use your weight fraction, 'wo')
    fuel_material.add_nuclide('Pu240', use your weight fraction, 'wo')
    fuel_material.add_nuclide('Pu241', use your weight fraction, 'wo')
    fuel_material.add_nuclide('Pu242', use your weight fraction, 'wo')
    fuel_material.add_element('Zr', use your weight fraction, 'wo')
    fuel_material.set_density('g/cm3', use your density)
    fuel_material.depletable = True
    fuel_material.temperature = fuel_temperature
    # This line dynamically creates a variable named fuel_1, fuel_2, etc.
    globals()[f'fuel_{i}'] = fuel_material
    
    # Add the new material 

Related Skills

View on GitHub
GitHub Stars14
CategoryDesign
Updated18d ago
Forks3

Languages

Python

Security Score

95/100

Audited on Mar 21, 2026

No findings