Skip to content

Commit

Permalink
Merge pull request #25398 from yjung-anl/rgmb_depletion
Browse files Browse the repository at this point in the history
Add Depletion ID Generation Capability into RGMB
  • Loading branch information
GiudGiud authored Nov 27, 2023
2 parents 5059bce + acf758c commit e982bef
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ As mentioned above, the `AssemblyMeshGenerator` object will tag all elements (th

The `AssemblyMeshGenerator` object also automatically tags all elements in the mesh with the [!param](/Mesh/AssemblyMeshGenerator/assembly_type) using the extra_integer name "assembly_type_id" and, if extruded, elements in each axial layer are tagged the axial layers using the name "plane_id". The pins composing the assembly are also tagged via [`PatternedCartesianMeshGenerator`](PatternedCartesianMeshGenerator.md) or [`PatternedHexMeshGenerator`](PatternedHexMeshGenerator.md), using the "cell" assignment type, with the extra integer name "pin_id".

## Depletion ID Information

The `AssemblyMeshGenerator` object can optionally assign a depletion ID, with the extra integer name "depletion_id", only if they are the final mesh generator.
The depletion ID generation option can be enabled by setting the [!param](/Mesh/AssemblyMeshGenerator/generate_depletion_id) to true.
The level of detail needed for depletion zones is specified in the input parameter [!param](/Mesh/AssemblyMeshGenerator/depletion_id_type).
[!param](/Mesh/AssemblyMeshGenerator/depletion_id_type) can be either `pin` and `pin_type`.
All pins in the assembly have separate depletion ID values by setting [!param](/Mesh/AssemblyMeshGenerator/depletion_id_type) to `pin`.
By setting that option to `pin_type`, unique ID values are assigned to individual pin types in assemblies.

## Exterior Boundary ID Information

The `AssemblyMeshGenerator` objects automatically assigns boundary information derived from the [!param](/Mesh/AssemblyMeshGenerator/assembly_type) parameter. The exterior assembly boundary is assigned the ID equal to 2000 + the assembly type ID and is named "outer_assembly_<assembly_type_id>" (for example an assembly with an assembly type ID of 1 will have a boundary ID of 2001 and boundary name of "outer_assembly_1").
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

This object is designed to be used in the Reactor MeshGenerator workflow, which also consists of [`ReactorMeshParams`](ReactorMeshParams.md), [`PinMeshGenerator`](PinMeshGenerator.md), and [`AssemblyMeshGenerator`](AssemblyMeshGenerator.md).

The `CoreMeshGenerator` object generates core-like reactor geometry structures in either square or hexagonal geometries with block ID assignments and reporting (extra integer) IDs, as described in [`PatternedCartesianMeshGenerator`](PatternedCartesianMeshGenerator.md and [`PatternedHexMeshGenerator`](PatternedHexMeshGenerator.md). There is expected to only be a single `CoreMeshGenerator` in a Mesh definition.
The `CoreMeshGenerator` object generates core-like reactor geometry structures in either square or hexagonal geometries with block ID assignments and reporting (extra integer) IDs, as described in [`PatternedCartesianMeshGenerator`](PatternedCartesianMeshGenerator.md) and [`PatternedHexMeshGenerator`](PatternedHexMeshGenerator.md). There is expected to only be a single `CoreMeshGenerator` in a Mesh definition.

This object automates the use and functionality of the [`PatternedCartesianMeshGenerator`](PatternedCartesianMeshGenerator.md) for cartesian reactor geometry, [`PatternedHexMeshGenerator`](PatternedHexMeshGenerator.md) for hexagonal reactor geometry and, if extruding to three dimensions, the [`AdvancedExtruderGenerator'](AdvancedExtruderGenerator.md) through the use of the `MeshSubgenerator` functionality and supporting functionality from [`RenameBoundaryGenerator`](RenameBoundaryGenerator.md) and [`PlaneIDMeshGenerator'](PlaneIDMeshGenerator.md). In addition to the functionality of the `MeshGenerators` used, this object also automates boundary ID and name assignment.

Expand All @@ -18,6 +18,16 @@ The `CoreMeshGenerator` object adopts much of the existing input structure of pa

The `CoreMeshGenerator` object automatically tags the mesh, if three dimensional, with the axial layers using the extra integer name "plane_id". The assemblies composing the core are also tagged via [`PatternedCartesianMeshGenerator`](PatternedCartesianMeshGenerator.md) or [`PatternedHexMeshGenerator`](PatternedHexMeshGenerator.md), using the "cell" assignment type, with the extra integer name "assembly_id" and any "dummy" assembly (identified via the [!param](/Mesh/CoreMeshGenerator/dummy_assembly_name) parameter) locations excluded.

## Depletion ID Information
The `CoreMeshGenerator` object can optionally assign a depletion ID, with the extra integer name "depletion_id".
The depletion ID generation option can be enabled by setting the [!param](/Mesh/CoreMeshGenerator/generate_depletion_id) to true.
The level of detail needed for depletion zones is specified in the input parameter [!param](/Mesh/CoreMeshGenerator/depletion_id_type).
For a core with heterogeneous assemblies, [!param](/Mesh/CoreMeshGenerator/depletion_id_type) can be either `pin` and `pin_type`.
All pins in the core have separate depletion ID values by setting [!param](/Mesh/CoreMeshGenerator/depletion_id_type) to `pin`.
By setting that option to `pin_type`, unique ID values are assigned to individual pin types in assemblies.
However, pins in different assemblies have different depletion IDs even if they have the same type.
For a core with homogenized assemblies (no explicit pins), [!param](/Mesh/CoreMeshGenerator/depletion_id_type) can be either `assembly` and `assembly_type`, which assign unique ID values to indvidial assemblies or to individual assembly types, respectively.

## Exterior Boundary ID Information

The `CoreMeshGenerator` objects automatically assigns boundary information. The exterior core boundary ID is assigned with the parameter [!param](/Mesh/ReactorMeshParams/radial_boundary_id) and will have the name "outer_core".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class ReactorGeometryMeshBuilderBase : public MeshGenerator
public:
static InputParameters validParams();

static void addDepletionIDParams(InputParameters & parameters);

ReactorGeometryMeshBuilderBase(const InputParameters & parameters);

protected:
Expand Down Expand Up @@ -187,6 +189,26 @@ class ReactorGeometryMeshBuilderBase : public MeshGenerator

///The ReactorMeshParams object that is storing the reactor global information for this reactor geometry mesh
MeshGeneratorName _reactor_params;
/// specify the depletion id is generated at which reactor generation level
enum class DepletionIDGenerationLevel
{
Pin,
Assembly,
Core
};

/**
* add depletion IDs
* @param input_mesh input mesh
* @param option option for specifying level of details
* @param generation_level depletion id is generated at which reactor generator level
* @param extrude whether input mesh is extruded, if false, assume that input mesh is defined in
* 2D and do not use 'plane_id` in depletion id generation
*/
void addDepletionId(MeshBase & input_mesh,
const MooseEnum & option,
const DepletionIDGenerationLevel generation_level,
const bool extrude);

private:
/// The dummy param mesh that we need to clear once we've generated (in freeReactorMeshParams)
Expand Down
8 changes: 8 additions & 0 deletions modules/reactor/src/meshgenerators/AssemblyMeshGenerator.C
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ AssemblyMeshGenerator::validParams()
"A hexagonal assembly will be placed inside of a bounding hexagon "
"consisting of a background region and, optionally,"
" duct regions.");
// depletion id generation params are added
addDepletionIDParams(params);

return params;
}
Expand Down Expand Up @@ -562,6 +564,12 @@ AssemblyMeshGenerator::generate()
}
}

if (getParam<bool>("generate_depletion_id"))
{
const MooseEnum option = getParam<MooseEnum>("depletion_id_type");
addDepletionId(*(*_build_mesh), option, DepletionIDGenerationLevel::Assembly, _extrude);
}

(*_build_mesh)->find_neighbors();

return std::move(*_build_mesh);
Expand Down
8 changes: 8 additions & 0 deletions modules/reactor/src/meshgenerators/CoreMeshGenerator.C
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ CoreMeshGenerator::validParams()
"and is permitted to have \"empty\" locations. The size and spacing "
"of the assembly-like structures is defined, and "
"enforced by declaration in the ReactorMeshParams.");
// depletion id generation params are added
addDepletionIDParams(params);

return params;
}
Expand Down Expand Up @@ -732,6 +734,12 @@ CoreMeshGenerator::generate()
}
}

if (getParam<bool>("generate_depletion_id"))
{
const MooseEnum option = getParam<MooseEnum>("depletion_id_type");
addDepletionId(*(*_build_mesh), option, DepletionIDGenerationLevel::Core, _extrude);
}

(*_build_mesh)->set_isnt_prepared();

return std::move(*_build_mesh);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "ReactorGeometryMeshBuilderBase.h"
#include "DepletionIDGenerator.h"
#include "MooseMeshUtils.h"

InputParameters
ReactorGeometryMeshBuilderBase::validParams()
Expand All @@ -22,6 +24,18 @@ ReactorGeometryMeshBuilderBase::validParams()
return params;
}

void
ReactorGeometryMeshBuilderBase::addDepletionIDParams(InputParameters & params)
{
params.addParam<bool>(
"generate_depletion_id", false, "Determine wheter the depletion ID is assigned.");
MooseEnum depletion_id_option("assembly assembly_type pin pin_type");
params.addParam<MooseEnum>("depletion_id_type",
depletion_id_option,
"Determine level of details in depletion ID assignment.");
params.addParamNamesToGroup("generate_depletion_id depletion_id_type", "Depletion ID assignment");
}

ReactorGeometryMeshBuilderBase::ReactorGeometryMeshBuilderBase(const InputParameters & parameters)
: MeshGenerator(parameters)
{
Expand Down Expand Up @@ -254,3 +268,51 @@ ReactorGeometryMeshBuilderBase::print2dMetadataToConsole(const std::string metad
for (const auto & row : metadata_value)
_console << " " << Moose::stringify(row) << std::endl;
}

void
ReactorGeometryMeshBuilderBase::addDepletionId(MeshBase & input_mesh,
const MooseEnum & option,
const DepletionIDGenerationLevel generation_level,
const bool extrude)
{
// prepare set of extra elem ids for depletion ID generation
std::vector<ExtraElementIDName> id_names = {};
if (extrude)
id_names.push_back("plane_id");
if (generation_level == DepletionIDGenerationLevel::Core)
{
if (option == "pin")
id_names.insert(id_names.end(), {"assembly_id", "pin_id"});
else if (option == "pin_type")
id_names.insert(id_names.end(), {"assembly_id", "pin_type_id"});
else if (option == "assembly")
id_names.push_back("assembly_id");
else if (option == "assembly_type")
id_names.push_back("assembly_type_id");
}
else if (generation_level == DepletionIDGenerationLevel::Assembly)
{
if (option == "pin")
id_names.push_back("pin_id");
else if (option == "pin_type")
id_names.push_back("pin_type_id");
else
paramError("depletion_id_type",
"'assembly_id' or 'assembly_type_id' is not allowd in depletion ID generation at "
"assembly level");
}
else if (generation_level == DepletionIDGenerationLevel::Pin)
mooseError("Depletion ID generation is not supported at pin level yet in RGMB");
id_names.push_back("region_id");
// no block restriction
std::set<SubdomainID> block_ids = {};
// create depletion IDs
// depletion IDs will be assigned in the following order:
// regions (materials) within pin -> pins in assembly -> assemblies in core -> axial planes
std::unordered_map<dof_id_type, dof_id_type> depl_ids =
MooseMeshUtils::getExtraIDUniqueCombinationMap(input_mesh, block_ids, id_names);
// assign depletion ids to elements
const auto depl_id_index = input_mesh.add_elem_integer("depletion_id");
for (Elem * const elem : input_mesh.active_element_ptr_range())
elem->set_extra_integer(depl_id_index, depl_ids.at(elem->id()));
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Tests]
design = 'meshgenerators/AssemblyMeshGenerator.md'
issues = '#19949'
issues = '#19949 #25396'
[square]
requirement = 'The system shall generate a 3D square assembly mesh from 2 pin types'
type = 'Exodiff'
Expand Down Expand Up @@ -56,4 +56,26 @@
exodiff = 'assembly_metadata_transfer.e'
recover = false
[]
[depletion_id_pin]
requirement = 'The system shall generate a 2D hexagonal assembly mesh with pin-wise depletion IDs'
type = 'Exodiff'
input = 'assembly_hex.i'
cli_args = "Mesh/amg/generate_depletion_id=true
Mesh/amg/depletion_id_type=pin
Outputs/file_base=assembly_depl_id_pin
Outputs/out/extra_element_ids_to_output=depletion_id"
exodiff = 'assembly_depl_id_pin.e'
recover = false
[]
[depletion_id_pin_type]
requirement = 'The system shall generate a 2D hexagonal assembly mesh with pin type-wise depletion IDs'
type = 'Exodiff'
input = 'assembly_hex.i'
cli_args = "Mesh/amg/generate_depletion_id=true
Mesh/amg/depletion_id_type=pin_type
Outputs/file_base=assembly_depl_id_pin_type
Outputs/out/extra_element_ids_to_output=depletion_id"
exodiff = 'assembly_depl_id_pin_type.e'
recover = false
[]
[]
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Tests]
design = 'meshgenerators/CoreMeshGenerator.md'
issues = '#19949'
issues = '#19949 #25396'
[square]
requirement = 'The system shall generate a full 3D square core mesh with 3 pin types and 2 assembly types'
type = 'Exodiff'
Expand Down Expand Up @@ -190,4 +190,28 @@
exodiff = 'core_periphery_prmg_in.e'
recover = false
[]
[depletion_id_pin]
requirement = 'The system shall generate a 3D hexagonal core mesh with pin-wise depletion IDs'
type = 'Exodiff'
input = 'core_hex.i'
cli_args = "Mesh/cmg/generate_depletion_id=true
Mesh/cmg/depletion_id_type=pin
Mesh/cmg/extrude=false
Outputs/file_base=core_hex_depl_pin_in
Outputs/out/extra_element_ids_to_output=depletion_id"
exodiff = 'core_hex_depl_pin_in.e'
recover = false
[]
[depletion_id_pin_type]
requirement = 'The system shall generate a 3D hexagonal core mesh with pin type-wise depletion IDs'
type = 'Exodiff'
input = 'core_hex.i'
cli_args = "Mesh/cmg/generate_depletion_id=true
Mesh/cmg/depletion_id_type=pin_type
Mesh/cmg/extrude=false
Outputs/file_base=core_hex_depl_pin_type_in
Outputs/out/extra_element_ids_to_output=depletion_id"
exodiff = 'core_hex_depl_pin_type_in.e'
recover = false
[]
[]

0 comments on commit e982bef

Please sign in to comment.