Skip to content
Open
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c76b85e
move catchopenmcerror
aprilnovak Aug 1, 2025
3134f43
preliminary criticality search
aprilnovak Aug 1, 2025
3796d91
implement criticality search for density. Refs #1158
aprilnovak Aug 2, 2025
f332dd2
add documentation. Refs #1158
aprilnovak Aug 2, 2025
2b13665
clang format
aprilnovak Aug 2, 2025
758d1b3
add comments
aprilnovak Aug 2, 2025
0e48c68
initialize properly
aprilnovak Aug 2, 2025
45a7276
remove unecessary protect
aprilnovak Aug 2, 2025
b6d7783
add test for problem
aprilnovak Aug 2, 2025
13b86fe
add base class
aprilnovak Aug 2, 2025
00f1c5d
clang format
aprilnovak Aug 3, 2025
aeb5646
incorporate review feedback
aprilnovak Aug 4, 2025
f2aec3a
add test for overwriting nuclides
aprilnovak Aug 4, 2025
9197a24
Draft for BoratedWater
aprilnovak Aug 4, 2025
0ed27f3
add non-natural nuclide for testing
aprilnovak Aug 4, 2025
69f1061
add range tests for density
aprilnovak Aug 4, 2025
0d164ef
consolidate folders by using two different materials in the same model
aprilnovak Aug 4, 2025
f40ee66
add criticality search for boron. Refs #1158
aprilnovak Aug 4, 2025
e6f7e36
BoratedWater criticality search. Refs #1158
aprilnovak Aug 4, 2025
9a73e1c
add documentation. Refs #1158
aprilnovak Aug 4, 2025
b3e51df
clang format
aprilnovak Aug 4, 2025
53b23cd
protect for nekrs
aprilnovak Aug 4, 2025
c0d3642
add missing index file
aprilnovak Aug 5, 2025
c443c31
Fix errors with documentation.
aprilnovak Aug 5, 2025
7df779d
add nuclear_data submodule
aprilnovak Aug 5, 2025
4d3c0ff
use nuclear_data submodule
aprilnovak Aug 5, 2025
7ed7664
Correct typos in tests
aprilnovak Aug 5, 2025
b4d5c36
check for nuclear_data submodule
aprilnovak Aug 5, 2025
ab4fc98
add nuclear_data to build
aprilnovak Aug 5, 2025
77829fa
fix string comparison.
aprilnovak Aug 5, 2025
8dbffee
Apply suggestions from code review
aprilnovak Aug 5, 2025
952bbe9
clang format
aprilnovak Aug 5, 2025
d3635e3
Update src/criticality/BoratedWater.C
aprilnovak Aug 5, 2025
8441af4
simplify functions
aprilnovak Aug 5, 2025
8c83ffc
sqa docs need correct class name
aprilnovak Aug 6, 2025
e1465ad
correct nuclide indexing
aprilnovak Aug 12, 2025
01a3e0f
add note about S(a,b)
aprilnovak Aug 12, 2025
2a2f832
fix rebase
aprilnovak Aug 12, 2025
99e20c2
correct doc equation.
aprilnovak Aug 14, 2025
cccfccd
add publication
aprilnovak Aug 17, 2025
ea3c7c9
update test to use fewer batches to try and avoid indeterminisim on c…
aprilnovak Aug 22, 2025
cebf8b7
Add target keff not equal to 1
gonuke Sep 16, 2025
3a8e8d1
switch to a range checked param
gonuke Sep 19, 2025
a25cc4b
add a test for non-unit k_eff search
gonuke Sep 19, 2025
fb21440
modularize openmc to reuse in search for keff
gonuke Sep 30, 2025
215f046
add search wrapper
gonuke Sep 30, 2025
ae0f699
modularize borated water crit test
gonuke Sep 30, 2025
fbba00a
add search wrapper for crit boron
gonuke Sep 30, 2025
1de9cc6
allow cmd-line to change target
gonuke Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@
[submodule "contrib/embree"]
path = contrib/embree
url = https://github.com/RenderKit/embree.git
[submodule "contrib/nuclear_data"]
path = contrib/nuclear_data
url = https://github.com/OTU-Centre-for-SMRs/nuclear_data.git
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ OPENMC_INCLUDES := -I$(OPENMC_INSTALL_DIR)/include
OPENMC_LIBDIR := $(OPENMC_INSTALL_DIR)/lib
OPENMC_LIB := $(OPENMC_LIBDIR)/libopenmc.so

ADDITIONAL_INCLUDES += -I$(CONTRIB_DIR)/nuclear_data

# This is used in $(FRAMEWORK_DIR)/build.mk
HDF5_INCLUDES := -I$(HDF5_INCLUDE_DIR) -I$(HDF5_ROOT)/include

Expand Down
8 changes: 8 additions & 0 deletions config/check_deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ endef
# Set default values for all third party dependencies
NEKRS_DIR ?= $(CONTRIB_DIR)/nekRS
OPENMC_DIR ?= $(CONTRIB_DIR)/openmc
NUCLEARDATA_DIR ?= $(CONTRIB_DIR)/nuclear_data
DAGMC_DIR ?= $(CONTRIB_DIR)/DAGMC
DOUBLEDOWN_DIR ?= $(CONTRIB_DIR)/double-down
EMBREE_DIR ?= $(CONTRIB_DIR)/embree
Expand All @@ -23,6 +24,7 @@ IAPWS95_DIR ?= $(CONTRIB_DIR)/iapws95
MOOSE_CONTENT := $(shell ls $(MOOSE_DIR) 2> /dev/null)
NEKRS_CONTENT := $(shell ls $(NEKRS_DIR) 2> /dev/null)
OPENMC_CONTENT := $(shell ls $(OPENMC_DIR) 2> /dev/null)
NUCLEARDATA_CONTENT:= $(shell ls $(NUCLEARDATA_DIR) 2> /dev/null)
DAGMC_CONTENT := $(shell ls $(DAGMC_DIR) 2> /dev/null)
DOUBLEDOWN_CONTENT := $(shell ls $(DOUBLEDOWN_DIR) 2> /dev/null)
EMBREE_CONTENT := $(shell ls $(EMBREE_DIR) 2> /dev/null)
Expand Down Expand Up @@ -90,6 +92,12 @@ ifeq ($(ENABLE_OPENMC), yes)
$(info Cardinal is using OpenMC from $(OPENMC_DIR))
endif

ifeq ($(NUCLEARDATA_CONTENT),)
$(error $n"nuclear_data does not seem to be available, but ENABLE_OPENMC is enabled. Make sure that the submodule is checked out.$n$nTo fetch the nuclear_data submodule, use ./scripts/get-dependencies.sh")
else
# we dont print out anything about where nuclear_data is coming from because it's a minor dependency and we don't expect anyone to be using different versions of it (and we don't want to confuse them on the cross section library data)
endif

openmc_status := $(shell git -C $(CONTRIB_DIR) submodule status 2>/dev/null | grep openmc | cut -c1)
ifneq (,$(findstring +,$(openmc_status)))
$(warning $n"***WARNING***: Your OpenMC submodule is not pointing to the commit tied to Cardinal.$n To fetch the paired commit, use ./scripts/get-dependencies.sh"$n)
Expand Down
1 change: 1 addition & 0 deletions contrib/nuclear_data
Submodule nuclear_data added at a2ec1b
4 changes: 4 additions & 0 deletions doc/content/publications.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ H. Park, Y. Yu, E. Shemon, and A. Novak,

# Sodium Fast Reactors

A.J. Novak, C. Bourdot Dutra, D. Shaver, and E. Merzari,
["CFD Simulations of Interassembly Bypass Flow in Sodium Fast Reactors"](https://www.sciencedirect.com/science/article/pii/S0029549325002213)
*Nuclear Engineering and Design* (2025)

A.J. Novak, C. Bourdot Dutra, D. Shaver, and E. Merzari,
["NekRS CFD Simulations of Interassembly Flow in Sodium Fast Reactors"](https://www.researchgate.net/publication/373331042_NekRS_CFD_Simulations_of_Interassembly_Flow_in_Sodium_Fast_Reactors)
*Proceedings of Nureth* (2023)
Expand Down
56 changes: 56 additions & 0 deletions doc/content/source/actions/AddCriticalitySearchAction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# AddCriticalitySearchAction

## Overview

The `AddCriticalitySearchAction` is responsible for performing a complete criticality
search during the OpenMC solve. Examples of parameters which can be used for the
criticality search include:

- [OpenMCMaterialDensity](OpenMCMaterialDensity.md), to change a material's total density
- [BoratedWater](BoratedWater.md), to change the boron weight ppm in water

The converged value of the criticality search will automatically be populated into
a postprocessor named `critical_value`.

!alert warning
If the convergence `tolerance` is too small (on the order of or smaller than the statistical standard deviation),
convergence may not be possible. If the search fails to converge, use a looser `tolerance` or
increase the number of particles.

## Example Input File Syntax

As an example, a [OpenMCMaterialDensity](OpenMCMaterialDensity.md) object is used to perform
a criticality search based on the total density of material 1.

!listing /tests/criticality/material_density/openmc.i
block=Problem

When running this case, Cardinal will print out a table showing a summary of the results of
the criticality search.

```
---------------------------------------------------------------------------
| Iteration | material 1 density [kg/m3] | k (mean) | k (std dev) |
---------------------------------------------------------------------------
| 0 | 1.000000e+03 | 6.620000e-02 | 1.098139e-03 |
| 1 | 3.000000e+04 | 1.621666e+00 | 2.077345e-02 |
| 2 | 1.840971e+04 | 1.102440e+00 | 1.108761e-02 |
| 3 | 1.634907e+04 | 9.942194e-01 | 1.174444e-02 |
| 4 | 1.645914e+04 | 9.961657e-01 | 1.040603e-02 |
| 5 | 1.666816e+04 | 1.008298e+00 | 1.162806e-02 |
| 6 | 1.652520e+04 | 1.013949e+00 | 1.304124e-02 |
| 7 | 1.647338e+04 | 9.847013e-01 | 1.192703e-02 |
| 8 | 1.650048e+04 | 9.890565e-01 | 1.018419e-02 |
| 9 | 1.651135e+04 | 1.010180e+00 | 1.071604e-02 |
| 10 | 1.650611e+04 | 1.001364e+00 | 1.163008e-02 |
| 11 | 1.650539e+04 | 9.971522e-01 | 1.117813e-02 |
| 12 | 1.650588e+04 | 1.020902e+00 | 1.023352e-02 |
| 13 | 1.650545e+04 | 9.994847e-01 | 1.192011e-02 |
| 14 | 1.650546e+04 | 1.002346e+00 | 1.093321e-02 |
| 15 | 1.650546e+04 | 9.943650e-01 | 7.631514e-03 |
---------------------------------------------------------------------------
```

!syntax list /Problem/CriticalitySearch actions=false subsystems=false heading=Available CriticalitySearch Objects

!syntax parameters /Problem/CriticalitySearch/AddCriticalitySearchAction
33 changes: 33 additions & 0 deletions doc/content/source/criticalitysearch/BoratedWater.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# BoratedWater

## Description

`BoratedWater` is a [CriticalitySearch](AddCriticalitySearchAction.md) that
performs a criticality search based on the natural boron weight ppm in water.
This object will clear the nuclides in the provided material, and overwrite
with natural water and natural boron, to the specific boron weight ppm.
The density of the material remains unchanged (but it may still be being set by a
coupled thermal-fluid application).

!alert note
This object does not search in your cross section library to see what nuclides
are present (some libraries do not include O18, for instance). OpenMC will
throw an error if your library is missing a nuclide that `BoratedWater` is
trying to add. To circumvent this, please explicitly note which of the natural
nuclides from hydrogen (H1, H2), boron (B10, B11), and oxygen (O16, O17, O18)
are missing from your material with `absent_nuclides`. Currently, only O18 is supported.

!alert warning
This object does not currently add S(a,b) tables. To correctly account for thermal scattering in water, the starting material definition in OpenMC must include the correct thermal scattering library.

## Example Input File Syntax

The following input will perform a criticality search for each OpenMC solve
by searching via the boron ppm of material 2.

!listing test/tests/criticality/borated_water/openmc.i
block=Problem

!syntax parameters /Problem/CriticalitySearch/BoratedWater

!syntax inputs /Problem/CriticalitySearch/BoratedWater
18 changes: 18 additions & 0 deletions doc/content/source/criticalitysearch/OpenMCMaterialDensity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# OpenMCMaterialDensity

## Description

`OpenMCMaterialDensity` is a [CriticalitySearch](AddCriticalitySearchAction.md) that
performs a criticality search based on the total density of a provided material.

## Example Input File Syntax

The following input will perform a criticality search for each OpenMC solve
by searching via the density of material ID 1.

!listing test/tests/criticality/material_density/openmc.i
block=Problem

!syntax parameters /Problem/CriticalitySearch/OpenMCMaterialDensity

!syntax inputs /Problem/CriticalitySearch/OpenMCMaterialDensity
3 changes: 1 addition & 2 deletions doc/content/source/postprocessors/NekPressureSurfaceForce.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ stress tensor over a boundary, multiplied by negative 1 in order to compute
the force that the fluid exerts ON the boundary,

\begin{equation}
r_i=&\ -\int_{\Gamma}-Pn_i\ d\Gamma\\
=&\ \int_{\Gamma}Pn_i\ d\Gamma\\
r_i=-\int_{\Gamma}-Pn_i\ d\Gamma\rightarrow\int_{\Gamma}Pn_i\ d\Gamma
\end{equation}

where $\Gamma$ is the boundary of the NekRS mesh and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stress tensor over a boundary, multiplied by negative 1 in order to compute
the force that the fluid exerts ON the boundary,

\begin{equation}
r_i=&\ -\int_{\Gamma}2\mu e_{ij}n_j\ d\Gamma\\
r_i=-\int_{\Gamma}2\mu e_{ij}n_j\ d\Gamma
\end{equation}

where $\Gamma$ is the boundary of the NekRS mesh and
Expand Down
Empty file.
31 changes: 31 additions & 0 deletions include/actions/AddCriticalitySearchAction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/********************************************************************/
/* SOFTWARE COPYRIGHT NOTIFICATION */
/* Cardinal */
/* */
/* (c) 2021 UChicago Argonne, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by UChicago Argonne, LLC */
/* Under Contract No. DE-AC02-06CH11357 */
/* With the U. S. Department of Energy */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See LICENSE for full restrictions */
/********************************************************************/

#pragma once

#include "MooseObjectAction.h"

class AddCriticalitySearchAction : public MooseObjectAction
{
public:
static InputParameters validParams();

AddCriticalitySearchAction(const InputParameters & parameters);

virtual void act() override;
};
14 changes: 14 additions & 0 deletions include/base/OpenMCBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ class OpenMCBase
*/
Real stdev(const double & mean, const double & sum_sq, unsigned int realizations) const;

/**
* A function which computes the mean value of \f$k_{eff}\f$.
* @param[in] estimator type of estimator
* @return the mean value of the k-eigenvalue
*/
Real kMean(const eigenvalue::EigenvalueEnum estimator) const;

/**
* A function which computes the standard deviation of \f$k_{eff}\f$.
* @param[in] estimator type of estimator
* @return the standard deviation of the k-eigenvalue
*/
Real kStandardDeviation(const eigenvalue::EigenvalueEnum estimator) const;

/// The OpenMCCellAverageProblem required by all objects which inherit from OpenMCBase.
OpenMCCellAverageProblem * _openmc_problem;
};
11 changes: 4 additions & 7 deletions include/base/OpenMCProblemBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
class OpenMCNuclideDensities;
class OpenMCDomainFilterEditor;
class OpenMCTallyEditor;
class CriticalitySearchBase;

/**
* Base class for all MOOSE wrappings of OpenMC
Expand All @@ -65,13 +66,6 @@ class OpenMCProblemBase : public CardinalProblem, public PostprocessorInterface
*/
std::string subdomainName(const SubdomainID & id) const;

/**
* Print a full error message when catching errors from OpenMC
* @param[in] err OpenMC error code
* @param[in] descriptor descriptive message for error
*/
void catchOpenMCError(const int & err, const std::string descriptor) const;

/**
* Whether the score is a reaction rate score
* @return whether the tally from OpenMC has units of 1/src
Expand Down Expand Up @@ -527,4 +521,7 @@ class OpenMCProblemBase : public CardinalProblem, public PostprocessorInterface

/// ID used by OpenMC to indicate that a material fill is VOID
static constexpr int MATERIAL_VOID{-1};

/// Object to use for a criticality search
CriticalitySearchBase * _criticality_search = nullptr;
};
7 changes: 7 additions & 0 deletions include/base/UserErrorChecking.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,10 @@ void checkRequiredParam(const InputParameters & p,
void checkJointParams(const InputParameters & p,
const std::vector<std::string> & name,
const std::string & explanation);

/**
* Print a full error message when catching errors from OpenMC
* @param[in] err OpenMC error code
* @param[in] descriptor descriptive message for error
*/
void catchOpenMCError(const int & err, const std::string descriptor);
64 changes: 64 additions & 0 deletions include/criticality/BoratedWater.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/********************************************************************/
/* SOFTWARE COPYRIGHT NOTIFICATION */
/* Cardinal */
/* */
/* (c) 2021 UChicago Argonne, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by UChicago Argonne, LLC */
/* Under Contract No. DE-AC02-06CH11357 */
/* With the U. S. Department of Energy */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See LICENSE for full restrictions */
/********************************************************************/

#pragma once

#include "OpenMCMaterialSearch.h"

/**
* Perform a criticality search based on the boron ppm in water
*/
class BoratedWater : public OpenMCMaterialSearch
{
public:
static InputParameters validParams();

BoratedWater(const InputParameters & parameters);

virtual void updateOpenMCModel(const Real & input) override;

protected:
virtual std::string quantity() const override
{
return "material " + std::to_string(_material_id) + " boron";
}

virtual std::string units() const override { return "[ppm]"; }

/// Natural isotopes of hydrogen with their abundances
std::vector<std::pair<std::string, Real>> _hydrogen_natural;

/// Natural isotopes of boron with their abundances
std::vector<std::pair<std::string, Real>> _boron_natural;

/// Natural isotopes of oxygen with their abundances
std::vector<std::pair<std::string, Real>> _oxygen_natural;

/// Molar mass of water
Real _M_H2O;

/// Molar mass of boron
Real _M_B;

private:
/** Adjust the natural abundances used for the criticality search if nuclides
* are missing from the cross section library.
* @param[in] allowable possible natural isotopes that will exist in the borated water
*/
void applyAbsentNuclides(const std::vector<std::string> & allowable);
};
Loading