https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ReactorGeometryMeshBuilderBase.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "MeshGenerator.h"
13#include "libmesh/elem.h"
14
15namespace RGMB
16{
17
18// General global quantities for mesh building
19static const std::string mesh_dimensions = "mesh_dimensions";
20static const std::string mesh_geometry = "mesh_geometry";
21static const std::string top_boundary_id = "top_boundary_id";
22static const std::string bottom_boundary_id = "bottom_boundary_id";
23static const std::string radial_boundary_id = "radial_boundary_id";
24static const std::string axial_mesh_intervals = "axial_mesh_intervals";
25static const std::string axial_mesh_sizes = "axial_mesh_sizes";
26static const std::string reactor_params_name = "reactor_params_name";
27static const std::string is_single_pin = "is_single_pin";
28static const std::string is_homogenized = "is_homogenized";
29static const std::string extruded = "extruded";
30static const std::string pin_region_ids = "pin_region_ids";
31static const std::string pin_block_names = "pin_block_names";
32static const std::string pin_region_id_map = "pin_region_id_map";
33static const std::string pin_block_name_map = "pin_block_name_map";
34static const std::string flexible_assembly_stitching = "flexible_assembly_stitching";
35static const std::string num_sectors_flexible_stitching = "num_sectors_flexible_stitching";
36static const std::string is_control_drum = "is_control_drum";
37static const std::string drum_region_ids = "drum_region_ids";
38static const std::string drum_block_names = "drum_block_names";
39
40// Geometrical quantities
41static const std::string pitch = "pitch";
42static const std::string assembly_pitch = "assembly_pitch";
43static const std::string ring_radii = "ring_radii";
44static const std::string duct_halfpitches = "duct_halfpitches";
45static const std::string peripheral_ring_radius = "peripheral_ring_radius";
46static const std::string pin_lattice = "pin_lattice";
47static const std::string assembly_lattice = "assembly_lattice";
48static const std::string drum_pad_angles = "drum_pad_angles";
49static const std::string drum_radii = "drum_radii";
50
51// Quantities related to region ids, type ids, and block names
52static const std::string pin_type = "pin_type";
53static const std::string pin_names = "pin_names";
54static const std::string assembly_type = "assembly_type";
55static const std::string assembly_names = "assembly_names";
56static const std::string ring_region_ids = "ring_region_ids";
57static const std::string background_region_id = "background_region_id";
58static const std::string background_block_name = "background_block_name";
59static const std::string duct_region_ids = "duct_region_ids";
60static const std::string duct_block_names = "duct_block_names";
61static const std::string peripheral_ring_region_id = "peripheral_ring_region_id";
62static const std::string region_id_as_block_name = "region_id_as_block_name";
63
64// Name of a boolean metadata that indicates whether or not we skipped mesh generation in favor of
65// only generating the mesh metadata
66static const std::string bypass_meshgen = "bypass_meshgen";
67
68// Default values for setting block IDs and region IDs of RGMB regions
69const subdomain_id_type PIN_BLOCK_ID_TRI_FLEXIBLE = 9998;
70const subdomain_id_type PIN_BLOCK_ID_TRI = 9999;
71const subdomain_id_type PIN_BLOCK_ID_START = 10000;
72
73const subdomain_id_type CONTROL_DRUM_BLOCK_ID_INNER_TRI = 19995;
74const subdomain_id_type CONTROL_DRUM_BLOCK_ID_INNER = 19996;
75const subdomain_id_type CONTROL_DRUM_BLOCK_ID_PAD = 19997;
76const subdomain_id_type CONTROL_DRUM_BLOCK_ID_OUTER = 19998;
77
78const subdomain_id_type ASSEMBLY_BLOCK_ID_TRI_FLEXIBLE = 19999;
79const subdomain_id_type ASSEMBLY_BLOCK_ID_START = 20000;
80
81const subdomain_id_type DUMMY_ASSEMBLY_BLOCK_ID = (UINT16_MAX / 2) - 1;
82const subdomain_id_type PERIPHERAL_RING_BLOCK_ID = 25000;
83
84const subdomain_id_type MAX_PIN_TYPE_ID = (UINT16_MAX / 2) - 1;
85
86// Default values for setting block names of RGMB regions
87const SubdomainName PIN_BLOCK_NAME_PREFIX = "RGMB_PIN";
88const SubdomainName ASSEMBLY_BLOCK_NAME_PREFIX = "RGMB_ASSEMBLY";
89const SubdomainName DRUM_BLOCK_NAME_PREFIX = "RGMB_DRUM";
90const SubdomainName CORE_BLOCK_NAME_PREFIX = "RGMB_CORE";
91const SubdomainName TRI_BLOCK_NAME_SUFFIX = "_TRI";
92const SubdomainName PERIPHERAL_RING_BLOCK_NAME = "PERIPHERY_GENERATED";
93
94// Default values for setting boundary ids of RGMB regions
95static constexpr boundary_id_type PIN_BOUNDARY_ID_START = 20000;
96static constexpr boundary_id_type ASSEMBLY_BOUNDARY_ID_START = 2000;
97
98// Default values for setting boundary names of RGMB regions
99const BoundaryName PIN_BOUNDARY_NAME_PREFIX = "outer_pin_";
100const BoundaryName ASSEMBLY_BOUNDARY_NAME_PREFIX = "outer_assembly_";
101const BoundaryName CORE_BOUNDARY_NAME = "outer_core";
102
103// Default values for setting names of CSG surfaces
104static const std::string CSG_AXIAL_PLANE_PREFIX = "rgmb_axial_plane_";
105}
106
111{
112public:
114
116
118
119 void generateData() override {};
120
121protected:
130 unsigned int getElemIntegerFromMesh(MeshBase & input_mesh,
131 std::string extra_int_name,
132 bool should_exist = false);
133
138 void initializeReactorMeshParams(const std::string reactor_param_name);
139
147 void printReactorMetadata(const std::string geometry_type,
148 const std::string mg_name,
149 const bool first_function_call = true);
150
157 void printCoreMetadata(const std::string mg_name, const bool first_function_call);
158
165 void printAssemblyMetadata(const std::string mg_name, const bool first_function_call);
166
171 void printPinMetadata(const std::string mg_name);
172
177
184 template <typename T>
185 void printMetadataToConsole(const std::string metadata_name, const std::string mg_name);
186
194 template <typename T>
195 void print2dMetadataToConsole(const std::string metadata_name, const std::string mg_name);
196
207
218
225 template <typename T>
226 bool hasReactorParam(const std::string param_name);
227
234 template <typename T>
235 const T & getReactorParam(const std::string & param_name);
236
246 void updateElementBlockNameId(MeshBase & input_mesh,
247 Elem * elem,
248 std::map<std::string, SubdomainID> & name_id_map,
249 std::string elem_block_name,
250 SubdomainID & next_free_id);
251
258 MeshGeneratorName callExtrusionMeshSubgenerators(const MeshGeneratorName input_mesh_name);
259
261 MeshGeneratorName _reactor_params;
264 {
265 Pin,
266 Assembly,
267 Drum,
268 Core
269 };
270
279 void addDepletionId(MeshBase & input_mesh,
280 const MooseEnum & option,
281 const DepletionIDGenerationLevel generation_level,
282 const bool extrude);
283
292 std::vector<std::reference_wrapper<const CSG::CSGSurface>> getOuterRadialSurfacesForUnitCell(
293 unsigned int radial_index, Real halfpitch, CSG::CSGBase & csg_obj);
294
300 std::vector<std::reference_wrapper<const CSG::CSGSurface>>
302
311 const Real pitch,
312 const std::vector<std::vector<std::reference_wrapper<const CSG::CSGUniverse>>> pattern,
313 CSG::CSGBase & csg_obj);
314
315private:
317 std::unique_ptr<MeshBase> * _reactor_params_mesh;
318 std::unique_ptr<CSG::CSGBase> * _reactor_params_csg;
319};
320
321template <typename T>
322bool
324{
325 return hasMeshProperty<T>(param_name, _reactor_params);
326}
327
328template <typename T>
329const T &
331{
332 return getMeshProperty<T>(param_name, _reactor_params);
333}
const double T
const InputParameters & parameters() const
A base class that contains common members for Reactor Geometry Mesh Builder mesh generators.
void print2dMetadataToConsole(const std::string metadata_name, const std::string mg_name)
Print metadata with data type std::vector<std::vector<T>> and provided name that can be found with gi...
void printGlobalReactorMetadata()
Print global ReactorMeshParams metadata associated with ReactorGeometryMeshBuilder object.
std::unique_ptr< MeshBase > * _reactor_params_mesh
The dummy param mesh that we need to clear once we've generated (in freeReactorMeshParams)
const T & getReactorParam(const std::string &param_name)
Returns reference of parameter in ReactorMeshParams object.
void printCoreMetadata(const std::string mg_name, const bool first_function_call)
Print core-level metadata associated with ReactorGeometryMeshBuilder object.
MeshGeneratorName _reactor_params
The ReactorMeshParams object that is storing the reactor global information for this reactor geometry...
bool hasReactorParam(const std::string param_name)
Checks whether parameter is defined in ReactorMeshParams metadata.
void initializeReactorMeshParams(const std::string reactor_param_name)
Initializes and checks validity of ReactorMeshParams mesh generator object.
std::vector< std::reference_wrapper< const CSG::CSGSurface > > getAxialPlaneSurfaces(CSG::CSGBase &csg_obj)
Get CSGSurfaces corresponding to axial planes of the extruded RGMB mesh.
void printReactorMetadata(const std::string geometry_type, const std::string mg_name, const bool first_function_call=true)
Print metadata associated with ReactorGeometryMeshBuilder object.
static void addDepletionIDParams(InputParameters &parameters)
MeshGeneratorName callExtrusionMeshSubgenerators(const MeshGeneratorName input_mesh_name)
Calls mesh subgenerators related to extrusion, renaming of top / bottom boundaries,...
void printMetadataToConsole(const std::string metadata_name, const std::string mg_name)
Print metadata with provided name that can be found with given mesh generator name.
void freeReactorParamsMesh()
Releases the mesh obtained in _reactor_params_mesh.
std::vector< std::reference_wrapper< const CSG::CSGSurface > > getOuterRadialSurfacesForUnitCell(unsigned int radial_index, Real halfpitch, CSG::CSGBase &csg_obj)
Get CSGSurfaces corresponding to hexagonal or square region with given halfpitch and centered around ...
DepletionIDGenerationLevel
specify the depletion id is generated at which reactor generation level
std::unique_ptr< CSG::CSGBase > * _reactor_params_csg
void printAssemblyMetadata(const std::string mg_name, const bool first_function_call)
Print assembly-level metadata associated with ReactorGeometryMeshBuilder object.
void updateElementBlockNameId(MeshBase &input_mesh, Elem *elem, std::map< std::string, SubdomainID > &name_id_map, std::string elem_block_name, SubdomainID &next_free_id)
Updates the block names and ids of the element in an input mesh according to a map of block name to b...
void addDepletionId(MeshBase &input_mesh, const MooseEnum &option, const DepletionIDGenerationLevel generation_level, const bool extrude)
add depletion IDs
void printPinMetadata(const std::string mg_name)
Print pin-level metadata associated with ReactorGeometryMeshBuilder object.
const CSG::CSGLattice & createRGMBLattice(const Real pitch, const std::vector< std::vector< std::reference_wrapper< const CSG::CSGUniverse > > > pattern, CSG::CSGBase &csg_obj)
Create CSG lattice for assembly and core lattices.
void freeReactorParamsCSG()
Releases the CSG base object obtained in _reactor_params_csg.
unsigned int getElemIntegerFromMesh(MeshBase &input_mesh, std::string extra_int_name, bool should_exist=false)
Initializes extra element integer from id name for a given mesh and throws an error if it should exis...
const subdomain_id_type PERIPHERAL_RING_BLOCK_ID
static const std::string peripheral_ring_radius
const subdomain_id_type MAX_PIN_TYPE_ID
static const std::string bottom_boundary_id
const SubdomainName DRUM_BLOCK_NAME_PREFIX
static const std::string is_single_pin
const SubdomainName ASSEMBLY_BLOCK_NAME_PREFIX
static const std::string pin_region_id_map
const BoundaryName PIN_BOUNDARY_NAME_PREFIX
static const std::string pin_lattice
static const std::string peripheral_ring_region_id
const subdomain_id_type PIN_BLOCK_ID_TRI_FLEXIBLE
static const std::string radial_boundary_id
const SubdomainName CORE_BLOCK_NAME_PREFIX
static const std::string is_control_drum
static const std::string bypass_meshgen
const subdomain_id_type PIN_BLOCK_ID_START
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_PAD
const subdomain_id_type ASSEMBLY_BLOCK_ID_START
static constexpr boundary_id_type ASSEMBLY_BOUNDARY_ID_START
static const std::string ring_radii
static const std::string drum_radii
const subdomain_id_type DUMMY_ASSEMBLY_BLOCK_ID
static const std::string assembly_names
static const std::string top_boundary_id
const subdomain_id_type PIN_BLOCK_ID_TRI
static const std::string drum_region_ids
static const std::string assembly_type
static const std::string pin_block_name_map
const SubdomainName PERIPHERAL_RING_BLOCK_NAME
static const std::string duct_block_names
static const std::string duct_halfpitches
const SubdomainName TRI_BLOCK_NAME_SUFFIX
const BoundaryName ASSEMBLY_BOUNDARY_NAME_PREFIX
static const std::string assembly_pitch
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_INNER_TRI
static const std::string mesh_dimensions
static const std::string duct_region_ids
const BoundaryName CORE_BOUNDARY_NAME
static const std::string pin_region_ids
static const std::string extruded
static constexpr boundary_id_type PIN_BOUNDARY_ID_START
static const std::string num_sectors_flexible_stitching
static const std::string background_region_id
static const std::string assembly_lattice
static const std::string ring_region_ids
static const std::string flexible_assembly_stitching
static const std::string is_homogenized
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_OUTER
static const std::string axial_mesh_sizes
static const std::string drum_block_names
static const std::string CSG_AXIAL_PLANE_PREFIX
const subdomain_id_type ASSEMBLY_BLOCK_ID_TRI_FLEXIBLE
static const std::string region_id_as_block_name
static const std::string background_block_name
static const std::string reactor_params_name
static const std::string axial_mesh_intervals
static const std::string pin_names
static const std::string pitch
static const std::string drum_pad_angles
static const std::string pin_block_names
static const std::string mesh_geometry
static const std::string pin_type
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_INNER
const SubdomainName PIN_BLOCK_NAME_PREFIX