https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PinMeshGenerator Class Reference

Mesh generator for defining a reactor pin with background and duct regions, with the option to be 2-D or 3-D. More...

#include <PinMeshGenerator.h>

Inheritance diagram for PinMeshGenerator:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 PinMeshGenerator (const InputParameters &parameters)
 
std::unique_ptr< MeshBase > generate () override
 
std::unique_ptr< CSG::CSGBasegenerateCSG () override
 
void generateData () override
 
std::unique_ptr< CSG::CSGBasegenerateInternalCSG ()
 
std::unique_ptr< MeshBase > generateInternal ()
 
const std::set< MeshGeneratorName > & getRequestedMeshGenerators () const
 
const std::set< MeshGeneratorName > & getRequestedMeshGeneratorsForSub () const
 
void addParentMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
void addChildMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
const std::set< const MeshGenerator *, Comparator > & getParentMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getChildMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getSubMeshGenerators () const
 
bool isParentMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isChildMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isNullMeshName (const MeshGeneratorName &name) const
 
bool hasSaveMesh () const
 
bool hasOutput () const
 
const std::string & getSavedMeshName () const
 
bool hasGenerateData () const
 
bool hasGenerateCSG () const
 
bool isDataOnly () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
bool isKokkosObject () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void addDepletionIDParams (InputParameters &parameters)
 
static bool hasGenerateData (const InputParameters &params)
 
static bool hasGenerateCSG (const InputParameters &params)
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 
static void setHasGenerateData (InputParameters &params)
 
static void setHasGenerateCSG (InputParameters &params)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string data_only_param
 
static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Types

enum class  DepletionIDGenerationLevel { Pin , Assembly , Drum , Core }
 specify the depletion id is generated at which reactor generation level More...
 

Protected Member Functions

void generateFlexibleAssemblyBoundaries ()
 
void generateMetadata ()
 
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 exist but cannot be found within the mesh.
 
void initializeReactorMeshParams (const std::string reactor_param_name)
 Initializes and checks validity of ReactorMeshParams mesh generator object.
 
void printReactorMetadata (const std::string geometry_type, const std::string mg_name, const bool first_function_call=true)
 Print metadata associated with ReactorGeometryMeshBuilder object.
 
void printCoreMetadata (const std::string mg_name, const bool first_function_call)
 Print core-level metadata associated with ReactorGeometryMeshBuilder object.
 
void printAssemblyMetadata (const std::string mg_name, const bool first_function_call)
 Print assembly-level metadata associated with ReactorGeometryMeshBuilder object.
 
void printPinMetadata (const std::string mg_name)
 Print pin-level metadata associated with ReactorGeometryMeshBuilder object.
 
void printGlobalReactorMetadata ()
 Print global ReactorMeshParams metadata associated with ReactorGeometryMeshBuilder object.
 
template<typename T >
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.
 
template<typename T >
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 given mesh generator name.
 
void freeReactorParamsMesh ()
 Releases the mesh obtained in _reactor_params_mesh.
 
void freeReactorParamsCSG ()
 Releases the CSG base object obtained in _reactor_params_csg.
 
template<typename T >
bool hasReactorParam (const std::string param_name)
 Checks whether parameter is defined in ReactorMeshParams metadata.
 
template<typename T >
const TgetReactorParam (const std::string &param_name)
 Returns reference of parameter in ReactorMeshParams 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 block ids.
 
MeshGeneratorName callExtrusionMeshSubgenerators (const MeshGeneratorName input_mesh_name)
 Calls mesh subgenerators related to extrusion, renaming of top / bottom boundaries, and defining plane IDs.
 
void addDepletionId (MeshBase &input_mesh, const MooseEnum &option, const DepletionIDGenerationLevel generation_level, const bool extrude)
 add depletion IDs
 
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 (0, 0, 0)
 
std::vector< std::reference_wrapper< const CSG::CSGSurface > > getAxialPlaneSurfaces (CSG::CSGBase &csg_obj)
 Get CSGSurfaces corresponding to axial planes of the extruded RGMB mesh.
 
const CSG::CSGLatticecreateRGMBLattice (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.
 
TcopyMeshProperty (const std::string &target_data_name, const std::string &source_data_name, const std::string &source_mesh)
 
TcopyMeshProperty (const std::string &source_data_name, const std::string &source_mesh)
 
std::unique_ptr< MeshBase > & getMesh (const std::string &param_name, const bool allow_invalid=false)
 
std::vector< std::unique_ptr< MeshBase > * > getMeshes (const std::string &param_name)
 
std::unique_ptr< MeshBase > & getMeshByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< MeshBase > * > getMeshesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< CSG::CSGBase > & getCSGBase (const std::string &param_name)
 
std::unique_ptr< CSG::CSGBase > & getCSGBaseByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< CSG::CSGBase > * > getCSGBases (const std::string &param_name)
 
std::vector< std::unique_ptr< CSG::CSGBase > * > getCSGBasesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
void declareMeshForSub (const std::string &param_name)
 
void declareMeshesForSub (const std::string &param_name)
 
void declareMeshForSubByName (const MeshGeneratorName &mesh_generator_name)
 
void declareMeshesForSubByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< MeshBase > buildMeshBaseObject (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< ReplicatedMesh > buildReplicatedMesh (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< DistributedMesh > buildDistributedMesh (unsigned int dim=libMesh::invalid_uint)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, Ts... extra_input_parameters)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, InputParameters params)
 
void declareNullMeshName (const MeshGeneratorName &name)
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
const TgetMeshProperty (const std::string &data_name, const std::string &prefix)
 
const TgetMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
TdeclareMeshProperty (const std::string &data_name, Args &&... args)
 
TdeclareMeshProperty (const std::string &data_name, const T &data_value)
 
TdeclareMeshProperty (const std::string &data_name, Args &&... args)
 
TdeclareMeshProperty (const std::string &data_name, const T &data_value)
 
TsetMeshProperty (const std::string &data_name, Args &&... args)
 
TsetMeshProperty (const std::string &data_name, const T &data_value)
 
TsetMeshProperty (const std::string &data_name, Args &&... args)
 
TsetMeshProperty (const std::string &data_name, const T &data_value)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const subdomain_id_type _pin_type
 The id number for this pin type.
 
const Real _pitch
 The face-to-face size of this pin.
 
const unsigned int _num_sectors
 The number of azimuthal divisions.
 
std::vector< Real > _ring_radii
 The outer radii of concentric rings in the pin.
 
const std::vector< Real > _duct_halfpitch
 The inner apothem of any surrounding ducts in the pin.
 
std::vector< unsigned int_intervals
 The number of mesh intervals in a radial division starting from the center.
 
std::vector< std::vector< subdomain_id_type > > _region_ids
 2-D vector (axial outer indexing, radial inner indexing) used to set "region_id" extra-element integer of the pin mesh elements
 
bool _has_block_names
 Whether block names have been provided by user.
 
std::vector< std::vector< std::string > > _block_names
 2-D vector (axial outer indexing, radial inner indexing) used to set block names of pin mesh elements
 
std::string _mesh_geometry
 The type of geometry that is being described (Square or Hex, declared in the ReactorMeshParams object)
 
unsigned int _mesh_dimensions
 The number of dimensions the mesh is ultimately going to have (2 or 3, declared in the ReactorMeshParams object)
 
const bool _extrude
 Whether this mesh should be extruded to 3-D, making it the final structure in the reactor mesh.
 
bool _quad_center
 Whether the centermost elements in the pin should be quad elements as opposed to tri elements.
 
bool _homogenized
 Whether the resulting pin mesh should be homogenized.
 
bool _is_assembly
 Whether the resulting pin mesh should also be used as an assembly mesh.
 
std::unique_ptr< MeshBase > * _build_mesh
 The final mesh that is generated by the subgenerators; This mesh is generated by the subgenerators with only element and boundary ids changed.
 
MeshGeneratorName _reactor_params
 The ReactorMeshParams object that is storing the reactor global information for this reactor geometry mesh.
 
MooseMesh *const _mesh
 
const bool & _enabled
 
MooseApp_app
 
Factory_factory
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
const Parallel::Communicator & _communicator
 

Private Member Functions

virtual std::string meshPropertyPrefix (const std::string &) const override final
 
void checkGetMesh (const MeshGeneratorName &mesh_generator_name, const std::string &param_name) const
 
const MeshGeneratorName * getMeshGeneratorNameFromParam (const std::string &param_name, const bool allow_invalid) const
 
const std::vector< MeshGeneratorName > & getMeshGeneratorNamesFromParam (const std::string &param_name) const
 
RestartableDataValuesetMeshPropertyHelper (const std::string &data_name)
 
const RestartableDataValuegetMeshPropertyInternal (const std::string &data_name, const std::string &prefix) const
 
void mooseErrorInternal (Args &&... args) const
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 

Private Attributes

std::unique_ptr< MeshBase > * _reactor_params_mesh
 The dummy param mesh that we need to clear once we've generated (in freeReactorMeshParams)
 
std::unique_ptr< CSG::CSGBase > * _reactor_params_csg
 
std::set< MeshGeneratorName > _requested_mesh_generators
 
std::set< MeshGeneratorName > _requested_mesh_generators_for_sub
 
std::vector< std::pair< std::string, std::unique_ptr< MeshBase > * > > _requested_meshes
 
std::vector< std::pair< std::string, std::unique_ptr< CSG::CSGBase > * > > _requested_csg_bases
 
std::unique_ptr< MeshBase > _null_mesh
 
std::unique_ptr< CSG::CSGBase_null_csg_base
 
std::set< const MeshGenerator *, Comparator > _parent_mesh_generators
 
std::set< const MeshGenerator *, Comparator > _child_mesh_generators
 
std::set< const MeshGenerator *, Comparator > _sub_mesh_generators
 
std::set< std::string > _null_mesh_names
 
const std::string & _save_with_name
 
const bool _data_only
 
const ParallelParamObject_parent
 
const MooseBase_si_moose_base
 
const FEProblemBase_si_problem
 
MooseApp_meta_data_app
 
const MooseObject *const _meta_data_object
 

Detailed Description

Mesh generator for defining a reactor pin with background and duct regions, with the option to be 2-D or 3-D.

Definition at line 18 of file PinMeshGenerator.h.

Member Enumeration Documentation

◆ DepletionIDGenerationLevel

specify the depletion id is generated at which reactor generation level

Enumerator
Pin 
Assembly 
Drum 
Core 

Definition at line 263 of file ReactorGeometryMeshBuilderBase.h.

Constructor & Destructor Documentation

◆ PinMeshGenerator()

PinMeshGenerator::PinMeshGenerator ( const InputParameters parameters)

Definition at line 103 of file PinMeshGenerator.C.

105 _pin_type(getParam<subdomain_id_type>("pin_type")),
106 _pitch(getParam<Real>("pitch")),
107 _num_sectors(isParamValid("num_sectors") ? getParam<unsigned int>("num_sectors") : 0),
108 _ring_radii(isParamValid("ring_radii") ? getParam<std::vector<Real>>("ring_radii")
109 : std::vector<Real>()),
110 _duct_halfpitch(isParamValid("duct_halfpitch") ? getParam<std::vector<Real>>("duct_halfpitch")
111 : std::vector<Real>()),
112 _intervals(getParam<std::vector<unsigned int>>("mesh_intervals")),
113 _region_ids(isParamValid("region_ids")
114 ? getParam<std::vector<std::vector<subdomain_id_type>>>("region_ids")
115 : std::vector<std::vector<subdomain_id_type>>()),
116 _extrude(getParam<bool>("extrude")),
117 _quad_center(getParam<bool>("quad_center_elements")),
118 _homogenized(getParam<bool>("homogenized")),
119 _is_assembly(getParam<bool>("use_as_assembly"))
120{
121 // Initialize ReactorMeshParams object
122 initializeReactorMeshParams(getParam<MeshGeneratorName>("reactor_params"));
123
124 _mesh_dimensions = getReactorParam<unsigned int>(RGMB::mesh_dimensions);
125 _mesh_geometry = getReactorParam<std::string>(RGMB::mesh_geometry);
126
127 if (_is_assembly)
128 {
129 auto assembly_pitch = getReactorParam<Real>(RGMB::assembly_pitch);
130 if (assembly_pitch != _pitch)
131 mooseError("Pitch defined in PinMeshGenerator must match assembly_pitch defined in "
132 "ReactorMeshParams if use_as_assembly is set to true");
133 }
134
135 if (_extrude && _mesh_dimensions != 3)
136 paramError("extrude",
137 "In order to extrude this mesh, ReactorMeshParams/dim needs to be set to 3\n");
138 if (_extrude && (!hasReactorParam<boundary_id_type>(RGMB::top_boundary_id) ||
139 !hasReactorParam<boundary_id_type>(RGMB::bottom_boundary_id)))
140 mooseError("Both top_boundary_id and bottom_boundary_id must be provided in ReactorMeshParams "
141 "if using extruded geometry");
142
143 if (_homogenized)
144 {
145 if (_mesh_geometry == "Square")
146 mooseError("Homogenization in PinMeshGenerator is only supported for hexagonal geometries");
147 const std::vector<std::string> disallowed_parameters = {
148 "num_sectors", "ring_radii", "duct_halfpitch", "mesh_intervals"};
149 for (const auto & parameter : disallowed_parameters)
150 if (parameters.isParamSetByUser(parameter))
151 paramError(parameter,
152 "Parameter " + parameter + " should not be defined for a homogenized pin mesh");
153 }
154 else
155 {
156 if (_num_sectors == 0)
158 "Number of sectors must be assigned with parameter num_sectors for non-homogenized pins");
159 if (_intervals.size() != (_ring_radii.size() + _duct_halfpitch.size() + 1))
161 "The number of mesh intervals must be equal to the number of annular regions + the "
162 "number of duct regions + 1"
163 " for the region between the rings and ducts\n");
164 }
165
166 if (isParamValid("region_ids"))
167 {
168 unsigned int n_axial_levels =
169 (_mesh_dimensions == 3)
170 ? getReactorParam<std::vector<unsigned int>>(RGMB::axial_mesh_intervals).size()
171 : 1;
172 if (_region_ids.size() != n_axial_levels)
173 mooseError("The size of region IDs must be equal to the number of axial levels as defined in "
174 "the ReactorMeshParams object");
175 if (_region_ids[0].size() != (_ring_radii.size() + _duct_halfpitch.size() + 1))
176 mooseError("The number of region IDs given needs to be one more than the number of "
177 "ring_radii + the number of duct_radii\n");
178 }
179 else
180 {
181 mooseError("Region IDs must be assigned with parameter region_ids");
182 }
183 if (isParamValid("block_names"))
184 {
185 if (getReactorParam<bool>(RGMB::region_id_as_block_name))
186 paramError("block_names",
187 "If ReactorMeshParams/region_id_as_block_name is set, block_names should not be "
188 "specified in PinMeshGenerator");
189 _has_block_names = true;
190 _block_names = getParam<std::vector<std::vector<std::string>>>("block_names");
191 if (_region_ids.size() != _block_names.size())
192 mooseError("The size of block_names must match the size of region_ids");
193 for (const auto i : index_range(_region_ids))
194 if (_region_ids[i].size() != _block_names[i].size())
195 mooseError("The size of block_names must match the size of region_ids");
196 }
197 else
198 _has_block_names = false;
199
200 const auto use_flexible_stitching = getReactorParam<bool>(RGMB::flexible_assembly_stitching);
201 std::string build_mesh_name;
202
203 // No subgenerators will be called if option to bypass mesh generators is enabled
204 if (!getReactorParam<bool>(RGMB::bypass_meshgen))
205 {
206 if (_homogenized)
207 {
208 // If flexible assembly stitching is invoked and this is a homogeneous assembly mesh, do not
209 // call mesh subgenerators here. The homogeneous assembly mesh should be created entirely in
210 // generateFlexibleAssemblyBoundaries()
211 bool skip_assembly_generation = _is_assembly && use_flexible_stitching;
212
213 auto params = _app.getFactory().getValidParams("SimpleHexagonGenerator");
214
215 params.set<Real>("hexagon_size") = _pitch / 2.0;
216 params.set<boundary_id_type>("external_boundary_id") =
218 const auto boundary_name =
220 std::to_string(_pin_type);
221 params.set<BoundaryName>("external_boundary_name") = boundary_name;
222 params.set<std::vector<subdomain_id_type>>("block_id") = {
224 params.set<MooseEnum>("element_type") = _quad_center ? "QUAD" : "TRI";
225 auto block_name = RGMB::PIN_BLOCK_NAME_PREFIX + std::to_string(_pin_type) + "_R0";
226 if (!_quad_center)
227 block_name += RGMB::TRI_BLOCK_NAME_SUFFIX;
228 params.set<std::vector<SubdomainName>>("block_name") = {block_name};
229
230 if (!skip_assembly_generation)
231 {
232 build_mesh_name = name() + "_2D";
233 addMeshSubgenerator("SimpleHexagonGenerator", build_mesh_name, params);
234 }
235 }
236 else
237 {
238 // Define all id variables used in the pin
239 std::vector<unsigned int> ring_intervals;
240 std::vector<subdomain_id_type> ring_blk_ids;
241 std::vector<SubdomainName> ring_blk_names;
242 unsigned int background_intervals = 1;
243 std::vector<subdomain_id_type> background_blk_ids;
244 std::vector<SubdomainName> background_blk_names;
245 std::vector<unsigned int> duct_intervals;
246 std::vector<subdomain_id_type> duct_blk_ids;
247 std::vector<SubdomainName> duct_blk_names;
248
249 for (const auto i : index_range(_intervals))
250 {
251 const auto block_name =
252 RGMB::PIN_BLOCK_NAME_PREFIX + std::to_string(_pin_type) + "_R" + std::to_string(i);
253 const auto block_id = RGMB::PIN_BLOCK_ID_START + i;
254
255 if (i < _ring_radii.size())
256 {
257 ring_intervals.push_back(_intervals[i]);
258 ring_blk_ids.push_back(block_id);
259 ring_blk_names.push_back(block_name);
260 }
261 else if (i > _ring_radii.size())
262 {
263 duct_intervals.push_back(_intervals[i]);
264 duct_blk_ids.push_back(block_id);
265 duct_blk_names.push_back(block_name);
266 }
267 else
268 {
269 background_intervals = _intervals[i];
270 background_blk_ids.push_back(block_id);
271 background_blk_names.push_back(block_name);
272 }
273 }
274 if (ring_intervals.size() > 0)
275 {
276 if (ring_intervals.front() != 1)
277 {
278 // If quad center elements, copy element at beginning of block names and
279 // block ids. Otherwise add RGMB::TRI_BLOCK_NAME_SUFFIX to block names and generate new
280 // block id
281 if (_quad_center)
282 {
283 ring_blk_ids.insert(ring_blk_ids.begin(), ring_blk_ids.front());
284 ring_blk_names.insert(ring_blk_names.begin(), ring_blk_names.front());
285 }
286 else
287 {
288 const auto block_name = ring_blk_names.front() + RGMB::TRI_BLOCK_NAME_SUFFIX;
289 const auto block_id = RGMB::PIN_BLOCK_ID_TRI;
290 ring_blk_ids.insert(ring_blk_ids.begin(), block_id);
291 ring_blk_names.insert(ring_blk_names.begin(), block_name);
292 }
293 }
294 // Add RGMB::TRI_BLOCK_NAME_SUFFIX if only one radial region and tri center elements
295 else if (!_quad_center)
296 {
297 ring_blk_ids[0] = RGMB::PIN_BLOCK_ID_TRI;
298 ring_blk_names[0] += RGMB::TRI_BLOCK_NAME_SUFFIX;
299 }
300 }
301 else
302 {
303 if (background_intervals > 1)
304 {
305 // If quad center elements, copy element at beginning of block names and
306 // block ids. Otherwise add RGMB::TRI_BLOCK_NAME_SUFFIX to block names and generate new
307 // block id
308 if (_quad_center)
309 {
310 background_blk_ids.insert(background_blk_ids.begin(), background_blk_ids.front());
311 background_blk_names.insert(background_blk_names.begin(), background_blk_names.front());
312 }
313 else
314 {
315 const auto block_name = background_blk_names.front() + RGMB::TRI_BLOCK_NAME_SUFFIX;
316 const auto block_id = RGMB::PIN_BLOCK_ID_TRI;
317 background_blk_ids.insert(background_blk_ids.begin(), block_id);
318 background_blk_names.insert(background_blk_names.begin(), block_name);
319 }
320 }
321 // Add RGMB::TRI_BLOCK_NAME_SUFFIX if only one background region and tri center elements
322 // and no ring regions
323 else if (!_quad_center)
324 {
325 background_blk_ids[0] = RGMB::PIN_BLOCK_ID_TRI;
326 background_blk_names[0] += RGMB::TRI_BLOCK_NAME_SUFFIX;
327 }
328 }
329
330 // If flexible assembly stitching is invoked and this is an assembly mesh with only a
331 // background region, do not call mesh subgenerators here. This assembly mesh should be
332 // created entirely in generateFlexibleAssemblyBoundaries()
333 bool skip_assembly_generation =
334 _is_assembly && use_flexible_stitching && _intervals.size() == 1;
335
336 if (!skip_assembly_generation)
337 {
338 // Generate Cartesian/hex pin using PolygonConcentricCircleMeshGenerator
339 {
340 // Get and assign parameters for the main geometry feature of the Pin
341 // which is created with a PolygonConcentricCircleMeshGenerator subgenerator
342 auto params = _app.getFactory().getValidParams("PolygonConcentricCircleMeshGenerator");
343 params.set<bool>("preserve_volumes") = true;
344 params.set<bool>("quad_center_elements") = _quad_center;
345 params.set<MooseEnum>("polygon_size_style") = "apothem";
346 params.set<Real>("polygon_size") = _pitch / 2.0;
347 params.set<boundary_id_type>("external_boundary_id") =
349 const auto boundary_name = (_is_assembly ? RGMB::ASSEMBLY_BOUNDARY_NAME_PREFIX
351 std::to_string(_pin_type);
352 params.set<BoundaryName>("external_boundary_name") = boundary_name;
353 bool flat_side_up = (_mesh_geometry == "Square");
354 params.set<bool>("flat_side_up") = flat_side_up;
355 params.set<bool>("create_outward_interface_boundaries") = false;
356
357 const auto num_sides = (_mesh_geometry == "Square") ? 4 : 6;
358 params.set<unsigned int>("num_sides") = num_sides;
359 params.set<std::vector<unsigned int>>("num_sectors_per_side") =
360 std::vector<unsigned int>(num_sides, _num_sectors);
361
362 if (ring_intervals.size() > 0)
363 {
364 params.set<std::vector<Real>>("ring_radii") = _ring_radii;
365 params.set<std::vector<subdomain_id_type>>("ring_block_ids") = ring_blk_ids;
366 params.set<std::vector<SubdomainName>>("ring_block_names") = ring_blk_names;
367 params.set<std::vector<unsigned int>>("ring_intervals") = ring_intervals;
368 }
369
370 params.set<std::vector<subdomain_id_type>>("background_block_ids") = background_blk_ids;
371 params.set<std::vector<SubdomainName>>("background_block_names") = background_blk_names;
372 params.set<unsigned int>("background_intervals") = background_intervals;
373
374 if (duct_intervals.size() > 0)
375 {
376 params.set<MooseEnum>("duct_sizes_style") = "apothem";
377 params.set<std::vector<Real>>("duct_sizes") = _duct_halfpitch;
378 params.set<std::vector<subdomain_id_type>>("duct_block_ids") = duct_blk_ids;
379 params.set<std::vector<SubdomainName>>("duct_block_names") = duct_blk_names;
380 params.set<std::vector<unsigned int>>("duct_intervals") = duct_intervals;
381 }
382
383 addMeshSubgenerator("PolygonConcentricCircleMeshGenerator", name() + "_2D", params);
384 }
385
386 // Remove extra sidesets created by PolygonConcentricCircleMeshGenerator
387 {
388 auto params = _app.getFactory().getValidParams("BoundaryDeletionGenerator");
389
390 params.set<MeshGeneratorName>("input") = name() + "_2D";
391
392 auto num_sides = (_mesh_geometry == "Square") ? 4 : 6;
393 std::vector<BoundaryName> boundaries_to_delete = {};
394 for (const auto i : make_range(num_sides))
395 boundaries_to_delete.insert(boundaries_to_delete.end(),
396 {std::to_string(10001 + i), std::to_string(15001 + i)});
397 params.set<std::vector<BoundaryName>>("boundary_names") = boundaries_to_delete;
398
399 build_mesh_name = name() + "_delbds";
400 addMeshSubgenerator("BoundaryDeletionGenerator", build_mesh_name, params);
401 }
402 }
403 }
404
405 // For pin acting as assembly, modify outermost mesh interval to enable flexible assembly
406 // stitching
407 if (_is_assembly && use_flexible_stitching)
408 {
410 build_mesh_name = name() + "_fpg_delbds";
411 }
412
413 // Pass mesh meta-data defined in subgenerator constructor to this MeshGenerator
414 if (hasMeshProperty<Real>("pitch_meta", name() + "_2D"))
415 copyMeshProperty<Real>("pitch_meta", name() + "_2D");
416 if (hasMeshProperty<std::vector<unsigned int>>("num_sectors_per_side_meta", name() + "_2D"))
417 copyMeshProperty<std::vector<unsigned int>>("num_sectors_per_side_meta", name() + "_2D");
418 if (hasMeshProperty<Real>("max_radius_meta", name() + "_2D"))
419 copyMeshProperty<Real>("max_radius_meta", name() + "_2D");
420 if (hasMeshProperty<unsigned int>("background_intervals_meta", name() + "_2D"))
421 copyMeshProperty<unsigned int>("background_intervals_meta", name() + "_2D");
422 if (hasMeshProperty<dof_id_type>("node_id_background_meta", name() + "_2D"))
423 copyMeshProperty<dof_id_type>("node_id_background_meta", name() + "_2D");
424
425 if (_is_assembly)
426 declareMeshProperty("pattern_pitch_meta", getReactorParam<Real>(RGMB::assembly_pitch));
427 else if (hasMeshProperty<Real>("pattern_pitch_meta", name() + "_2D"))
428 copyMeshProperty<Real>("pattern_pitch_meta", name() + "_2D");
429 declareMeshProperty("is_control_drum_meta", false);
430
431 if (_extrude)
432 build_mesh_name = callExtrusionMeshSubgenerators(build_mesh_name);
433
434 // Store final mesh subgenerator
435 _build_mesh = &getMeshByName(build_mesh_name);
436 }
437
439}
void ErrorVector unsigned int
InputParameters getValidParams(const std::string &name) const
T & set(const std::string &name, bool quiet_mode=false)
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
T & declareMeshProperty(const std::string &data_name, Args &&... args)
bool hasMeshProperty(const std::string &data_name, const std::string &prefix) const
Factory & getFactory()
const InputParameters & parameters() const
const std::string & name() const
void paramError(const std::string &param, Args... args) const
bool isParamSetByUser(const std::string &name) const
void mooseError(Args &&... args) const
const T & getParam(const std::string &name) const
bool isParamValid(const std::string &name) const
MooseApp & _app
std::vector< unsigned int > _intervals
The number of mesh intervals in a radial division starting from the center.
const std::vector< Real > _duct_halfpitch
The inner apothem of any surrounding ducts in the pin.
bool _homogenized
Whether the resulting pin mesh should be homogenized.
unsigned int _mesh_dimensions
The number of dimensions the mesh is ultimately going to have (2 or 3, declared in the ReactorMeshPar...
void generateFlexibleAssemblyBoundaries()
const unsigned int _num_sectors
The number of azimuthal divisions.
std::vector< Real > _ring_radii
The outer radii of concentric rings in the pin.
bool _quad_center
Whether the centermost elements in the pin should be quad elements as opposed to tri elements.
std::unique_ptr< MeshBase > * _build_mesh
The final mesh that is generated by the subgenerators; This mesh is generated by the subgenerators wi...
const bool _extrude
Whether this mesh should be extruded to 3-D, making it the final structure in the reactor mesh.
bool _has_block_names
Whether block names have been provided by user.
std::vector< std::vector< subdomain_id_type > > _region_ids
2-D vector (axial outer indexing, radial inner indexing) used to set "region_id" extra-element intege...
const Real _pitch
The face-to-face size of this pin.
std::vector< std::vector< std::string > > _block_names
2-D vector (axial outer indexing, radial inner indexing) used to set block names of pin mesh elements
std::string _mesh_geometry
The type of geometry that is being described (Square or Hex, declared in the ReactorMeshParams object...
const subdomain_id_type _pin_type
The id number for this pin type.
bool _is_assembly
Whether the resulting pin mesh should also be used as an assembly mesh.
A base class that contains common members for Reactor Geometry Mesh Builder mesh generators.
const T & getReactorParam(const std::string &param_name)
Returns reference of parameter in ReactorMeshParams object.
void initializeReactorMeshParams(const std::string reactor_param_name)
Initializes and checks validity of ReactorMeshParams mesh generator object.
MeshGeneratorName callExtrusionMeshSubgenerators(const MeshGeneratorName input_mesh_name)
Calls mesh subgenerators related to extrusion, renaming of top / bottom boundaries,...
static const std::string bottom_boundary_id
const BoundaryName PIN_BOUNDARY_NAME_PREFIX
static const std::string bypass_meshgen
const subdomain_id_type PIN_BLOCK_ID_START
static const std::string top_boundary_id
const subdomain_id_type PIN_BLOCK_ID_TRI
const SubdomainName TRI_BLOCK_NAME_SUFFIX
const BoundaryName ASSEMBLY_BOUNDARY_NAME_PREFIX
static const std::string assembly_pitch
static const std::string mesh_dimensions
static constexpr boundary_id_type PIN_BOUNDARY_ID_START
static const std::string flexible_assembly_stitching
static const std::string region_id_as_block_name
static const std::string axial_mesh_intervals
static const std::string mesh_geometry
const SubdomainName PIN_BLOCK_NAME_PREFIX
auto index_range(const T &sizable)
int8_t boundary_id_type
if(subdm)
TestClass subdomain_id_type
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)

Member Function Documentation

◆ addDepletionId()

void ReactorGeometryMeshBuilderBase::addDepletionId ( MeshBase &  input_mesh,
const MooseEnum option,
const DepletionIDGenerationLevel  generation_level,
const bool  extrude 
)
protectedinherited

add depletion IDs

Parameters
input_meshinput mesh
optionoption for specifying level of details
generation_leveldepletion id is generated at which reactor generator level
extrudewhether input mesh is extruded, if false, assume that input mesh is defined in 2D and do not use 'plane_id` in depletion id generation

Definition at line 130 of file ReactorGeometryMeshBuilderBase.C.

134{
135 // prepare set of extra elem ids for depletion ID generation
136 std::vector<ExtraElementIDName> id_names = {};
137 if (extrude)
138 id_names.push_back("plane_id");
139 if (generation_level == DepletionIDGenerationLevel::Core)
140 {
141 if (option == "pin")
142 id_names.insert(id_names.end(), {"assembly_id", "pin_id"});
143 else if (option == "pin_type")
144 id_names.insert(id_names.end(), {"assembly_id", "pin_type_id"});
145 else if (option == "assembly")
146 id_names.push_back("assembly_id");
147 else if (option == "assembly_type")
148 id_names.push_back("assembly_type_id");
149 }
150 else if (generation_level == DepletionIDGenerationLevel::Assembly)
151 {
152 if (option == "pin")
153 id_names.push_back("pin_id");
154 else if (option == "pin_type")
155 id_names.push_back("pin_type_id");
156 else
157 paramError("depletion_id_type",
158 "'assembly_id' or 'assembly_type_id' is not allowed in depletion ID generation at "
159 "assembly level");
160 }
161 else if (generation_level == DepletionIDGenerationLevel::Drum)
162 {
163 if (option == "pin_type")
164 id_names.push_back("pin_type_id");
165 else
166 paramError("depletion_id_type",
167 "Only 'pin_type' is allowed in depletion ID generation at "
168 "drum level");
169 }
170 else if (generation_level == DepletionIDGenerationLevel::Pin)
171 mooseError("Depletion ID generation is not supported at pin level yet in RGMB");
172 id_names.push_back("region_id");
173 // no block restriction
174 std::set<SubdomainID> block_ids = {};
175 // create depletion IDs
176 // depletion IDs will be assigned in the following order:
177 // regions (materials) within pin -> pins in assembly -> assemblies in core -> axial planes
178 std::unordered_map<dof_id_type, dof_id_type> depl_ids =
179 MooseMeshUtils::getExtraIDUniqueCombinationMap(input_mesh, block_ids, id_names);
180 // assign depletion ids to elements
181 const auto depl_id_index = input_mesh.add_elem_integer("depletion_id");
182 for (Elem * const elem : input_mesh.active_element_ptr_range())
183 elem->set_extra_integer(depl_id_index, depl_ids.at(elem->id()));
184}
std::unordered_map< dof_id_type, dof_id_type > getExtraIDUniqueCombinationMap(const MeshBase &mesh, const std::set< SubdomainID > &block_ids, std::vector< ExtraElementIDName > extra_ids)

Referenced by AssemblyMeshGenerator::generate(), ControlDrumMeshGenerator::generate(), and CoreMeshGenerator::generate().

◆ addDepletionIDParams()

void ReactorGeometryMeshBuilderBase::addDepletionIDParams ( InputParameters parameters)
staticinherited

Definition at line 35 of file ReactorGeometryMeshBuilderBase.C.

36{
37 params.addParam<bool>(
38 "generate_depletion_id", false, "Determine wheter the depletion ID is assigned.");
39 MooseEnum depletion_id_option("assembly assembly_type pin pin_type");
40 params.addParam<MooseEnum>("depletion_id_type",
41 depletion_id_option,
42 "Determine level of details in depletion ID assignment.");
43 params.addParamNamesToGroup("generate_depletion_id depletion_id_type", "Depletion ID assignment");
44}

Referenced by AssemblyMeshGenerator::validParams(), ControlDrumMeshGenerator::validParams(), and CoreMeshGenerator::validParams().

◆ callExtrusionMeshSubgenerators()

MeshGeneratorName ReactorGeometryMeshBuilderBase::callExtrusionMeshSubgenerators ( const MeshGeneratorName  input_mesh_name)
protectedinherited

Calls mesh subgenerators related to extrusion, renaming of top / bottom boundaries, and defining plane IDs.

Parameters
input_mesh_namename of input 2D mesh generator to extrude
Returns
name of final output 3D mesh generator

Definition at line 187 of file ReactorGeometryMeshBuilderBase.C.

189{
190 std::vector<Real> axial_boundaries = getReactorParam<std::vector<Real>>(RGMB::axial_mesh_sizes);
191 const auto top_boundary = getReactorParam<boundary_id_type>(RGMB::top_boundary_id);
192 const auto bottom_boundary = getReactorParam<boundary_id_type>(RGMB::bottom_boundary_id);
193
194 {
195 auto params = _app.getFactory().getValidParams("AdvancedExtruderGenerator");
196
197 params.set<MeshGeneratorName>("input") = input_mesh_name;
198 params.set<Point>("direction") = Point(0, 0, 1);
199 params.set<std::vector<unsigned int>>("num_layers") =
200 getReactorParam<std::vector<unsigned int>>(RGMB::axial_mesh_intervals);
201 params.set<std::vector<Real>>("heights") = axial_boundaries;
202 params.set<BoundaryName>("bottom_boundary") = std::to_string(bottom_boundary);
203 params.set<BoundaryName>("top_boundary") = std::to_string(top_boundary);
204 addMeshSubgenerator("AdvancedExtruderGenerator", name() + "_extruded", params);
205 }
206
207 {
208 auto params = _app.getFactory().getValidParams("RenameBoundaryGenerator");
209
210 params.set<MeshGeneratorName>("input") = name() + "_extruded";
211 params.set<std::vector<BoundaryName>>("old_boundary") = {
212 std::to_string(top_boundary),
213 std::to_string(bottom_boundary)}; // hard coded boundary IDs in patterned mesh generator
214 params.set<std::vector<BoundaryName>>("new_boundary") = {"top", "bottom"};
215 addMeshSubgenerator("RenameBoundaryGenerator", name() + "_change_plane_name", params);
216 }
217
218 const MeshGeneratorName output_mesh_name = name() + "_extrudedIDs";
219 {
220 auto params = _app.getFactory().getValidParams("PlaneIDMeshGenerator");
221
222 params.set<MeshGeneratorName>("input") = name() + "_change_plane_name";
223
224 std::vector<Real> plane_heights{0};
225 for (Real z : axial_boundaries)
226 plane_heights.push_back(z + plane_heights.back());
227
228 params.set<std::vector<Real>>("plane_coordinates") = plane_heights;
229
230 std::string plane_id_name = "plane_id";
231 params.set<std::string>("id_name") = "plane_id";
232
233 addMeshSubgenerator("PlaneIDMeshGenerator", output_mesh_name, params);
234 }
235
236 return output_mesh_name;
237}
static const std::string axial_mesh_sizes

Referenced by AssemblyMeshGenerator::AssemblyMeshGenerator(), ControlDrumMeshGenerator::ControlDrumMeshGenerator(), CoreMeshGenerator::CoreMeshGenerator(), and PinMeshGenerator().

◆ createRGMBLattice()

const CSG::CSGLattice & ReactorGeometryMeshBuilderBase::createRGMBLattice ( const Real  pitch,
const std::vector< std::vector< std::reference_wrapper< const CSG::CSGUniverse > > >  pattern,
CSG::CSGBase csg_obj 
)
protectedinherited

Create CSG lattice for assembly and core lattices.

This method does not set the outer universe of the lattice

Parameters
pitchlattice pitch
patternpattern of universes in the lattice
csg_objreference to CSGBase object

Definition at line 311 of file ReactorGeometryMeshBuilderBase.C.

315{
316 // Create lattice based on whether it is hexagonal or Cartesian
317 std::string lat_name = name() + "_lattice";
318 std::unique_ptr<CSG::CSGLattice> lat_ptr;
319 const auto mesh_geometry = getReactorParam<std::string>(RGMB::mesh_geometry);
320 if (mesh_geometry == "Square")
321 lat_ptr = std::make_unique<CSG::CSGCartesianLattice>(lat_name, pitch, pattern);
322 else // _geom_type == "Hex"
323 lat_ptr = std::make_unique<CSG::CSGHexagonalLattice>(lat_name, pitch, pattern);
324
325 auto & assembly_lattice = csg_obj.addLattice(std::move(lat_ptr));
326 return assembly_lattice;
327}
const LatticeType & addLattice(std::unique_ptr< LatticeType > lattice)

Referenced by AssemblyMeshGenerator::generateCSG(), and CoreMeshGenerator::generateCSG().

◆ freeReactorParamsCSG()

void ReactorGeometryMeshBuilderBase::freeReactorParamsCSG ( )
protectedinherited

Releases the CSG base object obtained in _reactor_params_csg.

This must be called in any object that derives from this one, because the MeshGenerator system requires that all meshes that are requested from the system are moved out of the MeshGenerator system and into the MeshGenerator that requests them. In our case, we move it into this MeshGenerator and then release (delete) it.

Definition at line 81 of file ReactorGeometryMeshBuilderBase.C.

82{
83 _reactor_params_csg->reset();
84}
std::unique_ptr< CSG::CSGBase > * _reactor_params_csg

Referenced by AssemblyMeshGenerator::generateCSG(), CoreMeshGenerator::generateCSG(), and generateCSG().

◆ freeReactorParamsMesh()

void ReactorGeometryMeshBuilderBase::freeReactorParamsMesh ( )
protectedinherited

Releases the mesh obtained in _reactor_params_mesh.

This must be called in any object that derives from this one, because the MeshGenerator system requires that all meshes that are requested from the system are moved out of the MeshGenerator system and into the MeshGenerator that requests them. In our case, we move it into this MeshGenerator and then release (delete) it.

Definition at line 75 of file ReactorGeometryMeshBuilderBase.C.

76{
77 _reactor_params_mesh->reset();
78}
std::unique_ptr< MeshBase > * _reactor_params_mesh
The dummy param mesh that we need to clear once we've generated (in freeReactorMeshParams)

Referenced by AssemblyMeshGenerator::generate(), ControlDrumMeshGenerator::generate(), CoreMeshGenerator::generate(), and generate().

◆ generate()

std::unique_ptr< MeshBase > PinMeshGenerator::generate ( )
overridevirtual

Implements MeshGenerator.

Definition at line 587 of file PinMeshGenerator.C.

588{
589 // Must be called to free the ReactorMeshParams mesh
591
592 // If bypass_mesh is true, return a null mesh. In this mode, an output mesh is not
593 // generated and only metadata is defined on the generator, so logic related to
594 // generation of output mesh will not be called
595 if (getReactorParam<bool>(RGMB::bypass_meshgen))
596 {
597 auto null_mesh = nullptr;
598 return null_mesh;
599 }
600
601 // Update metadata at this point since values for these metadata only get set by PCCMG
602 // at generate() stage
603 if (hasMeshProperty<Real>("max_radius_meta", name() + "_2D"))
604 {
605 const auto max_radius_meta = getMeshProperty<Real>("max_radius_meta", name() + "_2D");
606 setMeshProperty("max_radius_meta", max_radius_meta);
607 }
608 if (hasMeshProperty<unsigned int>("background_intervals_meta", name() + "_2D"))
609 {
610 const auto background_intervals_meta =
611 getMeshProperty<unsigned int>("background_intervals_meta", name() + "_2D");
612 setMeshProperty("background_intervals_meta", background_intervals_meta);
613 }
614 if (hasMeshProperty<dof_id_type>("node_id_background_meta", name() + "_2D"))
615 {
616 const auto node_id_background_meta =
617 getMeshProperty<dof_id_type>("node_id_background_meta", name() + "_2D");
618 setMeshProperty("node_id_background_meta", node_id_background_meta);
619 }
620
621 // This generate() method will be called once the subgenerators that we depend on
622 // have been called. This is where we reassign subdomain ids/names according to what
623 // the user has provided, and also where we set region_id, pin_type_id, and radial_id
624 // extra element integers
625
626 // Add region id, pin type id, and radial id to the mesh as element integers
627 std::string region_id_name = "region_id";
628 std::string pin_type_id_name = "pin_type_id";
629 std::string assembly_type_id_name = "assembly_type_id";
630 std::string plane_id_name = "plane_id";
631 std::string radial_id_name = "radial_id";
632 const std::string default_block_name =
634 std::to_string(_pin_type);
635
636 auto region_id_int = getElemIntegerFromMesh(*(*_build_mesh), region_id_name);
637 auto radial_id_int = getElemIntegerFromMesh(*(*_build_mesh), radial_id_name);
638 auto pin_type_id_int = getElemIntegerFromMesh(*(*_build_mesh), pin_type_id_name);
639 unsigned int plane_id_int = 0;
640 unsigned int assembly_type_id_int = 0;
641 if (_extrude)
642 plane_id_int = getElemIntegerFromMesh(*(*_build_mesh), plane_id_name, true);
643 if (_is_assembly)
644 assembly_type_id_int = getElemIntegerFromMesh(*(*_build_mesh), assembly_type_id_name);
645
646 // Get next free block ID in mesh in case subdomain ids need to be remapped
647 auto next_block_id = MooseMeshUtils::getNextFreeSubdomainID(*(*(_build_mesh)));
648 std::map<std::string, SubdomainID> rgmb_name_id_map;
649
650 // Loop through all elements and set regions ids, pin type id, and radial idx.
651 // These element integers are also used to infer the block name for the region,
652 // and block IDs/names will be reassigned on the pin mesh if necessary
653 for (auto & elem : (*_build_mesh)->active_element_ptr_range())
654 {
655 const auto base_block_id = elem->subdomain_id();
656 const auto base_block_name = (*_build_mesh)->subdomain_name(base_block_id);
657
658 // Check if block name has correct prefix
659 std::string prefix = RGMB::PIN_BLOCK_NAME_PREFIX + std::to_string(_pin_type) + "_R";
660 if (!(base_block_name.find(prefix, 0) == 0))
661 continue;
662 // Radial index is integer value of substring after prefix
663 std::string radial_str = base_block_name.substr(prefix.length());
664
665 // Filter out RGMB::TRI_BLOCK_NAME_SUFFIX if needed
666 const std::string suffix = RGMB::TRI_BLOCK_NAME_SUFFIX;
667 const std::size_t found = radial_str.find(suffix);
668 if (found != std::string::npos)
669 radial_str.replace(found, suffix.length(), "");
670 const unsigned int radial_idx = std::stoi(radial_str);
671
672 // Region id is inferred from z_id and radial_idx
673 dof_id_type z_id = _extrude ? elem->get_extra_integer(plane_id_int) : 0;
674 const subdomain_id_type elem_region_id = _region_ids[std::size_t(z_id)][radial_idx];
675
676 // Set element integers
677 elem->set_extra_integer(region_id_int, elem_region_id);
678 elem->set_extra_integer(pin_type_id_int, _pin_type);
679 elem->set_extra_integer(radial_id_int, radial_idx);
680 if (_is_assembly)
681 elem->set_extra_integer(assembly_type_id_int, _pin_type);
682
683 // Set element block name and block id
684 auto elem_block_name = default_block_name;
686 elem_block_name += "_" + _block_names[std::size_t(z_id)][radial_idx];
687 else if (getReactorParam<bool>(RGMB::region_id_as_block_name))
688 elem_block_name += "_REG" + std::to_string(elem_region_id);
689 if (elem->type() == TRI3 || elem->type() == PRISM6)
690 elem_block_name += RGMB::TRI_BLOCK_NAME_SUFFIX;
692 *(*_build_mesh), elem, rgmb_name_id_map, elem_block_name, next_block_id);
693 }
694
695 // Mark mesh as not prepared, as block IDs were re-assigned in this method
696 (*_build_mesh)->unset_is_prepared();
697
698 return std::move(*_build_mesh);
699}
T & setMeshProperty(const std::string &data_name, Args &&... args)
void freeReactorParamsMesh()
Releases the mesh obtained in _reactor_params_mesh.
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...
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...
SubdomainID getNextFreeSubdomainID(MeshBase &input_mesh)
const SubdomainName ASSEMBLY_BLOCK_NAME_PREFIX
uint8_t dof_id_type

◆ generateCSG()

std::unique_ptr< CSG::CSGBase > PinMeshGenerator::generateCSG ( )
overridevirtual

Reimplemented from MeshGenerator.

Definition at line 702 of file PinMeshGenerator.C.

703{
704 // Must be called to free the ReactorMeshParams CSGBase object
706
707 auto csg_obj = std::make_unique<CSG::CSGBase>();
708
709 unsigned int radial_index = 0;
710 std::vector<std::vector<std::reference_wrapper<const CSG::CSGSurface>>> surfaces_by_radial_region;
711
712 // Add surfaces corresponding to pin rings
713 for (const auto & radius : _ring_radii)
714 {
715 const auto surf_name = name() + "_radial_ring_" + std::to_string(radial_index);
716 std::unique_ptr<CSG::CSGSurface> ring_surf_ptr =
717 std::make_unique<CSG::CSGZCylinder>(surf_name, 0, 0, radius);
718 const auto & ring_surf = csg_obj->addSurface(std::move(ring_surf_ptr));
719 surfaces_by_radial_region.push_back({ring_surf});
720 ++radial_index;
721 }
722
723 // Add surfaces corresponding to pin ducts
724 for (const auto & duct_halfpitch : _duct_halfpitch)
725 {
726 const auto & duct_surfaces =
727 getOuterRadialSurfacesForUnitCell(radial_index, duct_halfpitch, *csg_obj);
728 surfaces_by_radial_region.push_back(duct_surfaces);
729 ++radial_index;
730 }
731
732 // Add surfaces corresponding to outer pin boundary
733 const auto & duct_surfaces =
734 getOuterRadialSurfacesForUnitCell(radial_index, _pitch / 2., *csg_obj);
735 surfaces_by_radial_region.push_back(duct_surfaces);
736
737 // Define all radial regions
738 std::vector<CSG::CSGRegion> radial_regions;
739 CSG::CSGRegion inner_region, outer_region;
740 for (const auto i : index_range(surfaces_by_radial_region))
741 {
742 const auto & radial_surfaces = surfaces_by_radial_region[i];
743 CSG::CSGRegion radial_region;
744 bool is_last_radial_region = i == surfaces_by_radial_region.size() - 1;
745 if (inner_region.getRegionType() == CSG::CSGRegion::RegionType::EMPTY)
746 {
747 if (!is_last_radial_region)
748 {
749 // We are in the innermost radial region, the radial region is inner_region
750 inner_region = CSGUtils::getInnerRegion(radial_surfaces, Point(0, 0, 0));
751 radial_region = inner_region;
752 }
753 }
754 else
755 {
756 // For all other regions, the radial region is the intersection of inner_region and
757 // outer_region
758 outer_region = ~inner_region;
759 inner_region = CSGUtils::getInnerRegion(radial_surfaces, Point(0, 0, 0));
760 radial_region = is_last_radial_region ? outer_region : (inner_region & outer_region);
761 }
762 radial_regions.push_back(radial_region);
763 }
764
765 // Define all axial surfaces and regions
766 std::vector<CSG::CSGRegion> axial_regions;
767 std::vector<std::reference_wrapper<const CSG::CSGSurface>> surfaces_by_axial_region;
768 const auto extruded_pin = _mesh_dimensions == 3;
769 if (extruded_pin)
770 {
771 surfaces_by_axial_region = getAxialPlaneSurfaces(*csg_obj);
772 for (const auto i : make_range(surfaces_by_axial_region.size()))
773 if (i != 0)
774 {
775 CSG::CSGRegion axial_region;
776 const auto & lower_surf = surfaces_by_axial_region[i - 1].get();
777 if (lower_surf != surfaces_by_axial_region.front())
778 axial_region = +lower_surf;
779 const auto & upper_surf = surfaces_by_axial_region[i].get();
780 if (upper_surf != surfaces_by_axial_region.back())
781 {
782 if (axial_region.getRegionType() == CSG::CSGRegion::RegionType::EMPTY)
783 axial_region = -upper_surf;
784 else
785 axial_region &= -upper_surf;
786 }
787 axial_regions.push_back(axial_region);
788 }
789 }
790
791 // Define all cells within pin domain and add to separate universe
792 const auto & pin_univ = csg_obj->createUniverse(name() + "_univ");
793 for (const auto i : index_range(radial_regions))
794 {
795 for (const auto j : make_range(extruded_pin ? axial_regions.size() : 1))
796 {
797 auto cell_region = radial_regions[i];
798 auto cell_name = name() + "_cell_radial_" + std::to_string(i);
799 const auto region_id = _region_ids[j][i];
800 const auto mat_name = "rgmb_region_" + std::to_string(region_id);
801 if (extruded_pin)
802 {
803 // update name and region with axial info only if extruded
804 const auto axial_region = axial_regions[j];
805 if (axial_region.getRegionType() != CSG::CSGRegion::RegionType::EMPTY)
806 {
807 if (cell_region.getRegionType() != CSG::CSGRegion::RegionType::EMPTY)
808 cell_region &= axial_region;
809 else
810 cell_region = axial_region;
811 }
812 cell_name += "_axial_" + std::to_string(j);
813 }
814 csg_obj->createCell(cell_name, mat_name, cell_region, &pin_univ);
815 }
816 }
817
818 // Create new cell to bound universe based on pin outer boundaries and add this cell to the root
819 // universe
820 auto pin_region = CSGUtils::getInnerRegion(surfaces_by_radial_region.back(), Point(0, 0, 0));
821 if (extruded_pin)
822 {
823 const auto & lowest_axial_surf = surfaces_by_axial_region.front().get();
824 const auto & highest_axial_surf = surfaces_by_axial_region.back().get();
825 auto axial_region = +lowest_axial_surf & -highest_axial_surf;
826 pin_region &= axial_region;
827 }
828 csg_obj->createCell(name() + "_root_cell", pin_univ, pin_region);
829
830 return csg_obj;
831}
RegionType getRegionType() const
std::vector< std::reference_wrapper< const CSG::CSGSurface > > getAxialPlaneSurfaces(CSG::CSGBase &csg_obj)
Get CSGSurfaces corresponding to axial planes of the extruded RGMB 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 ...
void freeReactorParamsCSG()
Releases the CSG base object obtained in _reactor_params_csg.
CSG::CSGRegion getInnerRegion(const std::vector< std::reference_wrapper< const CSG::CSGSurface > > &surfaces, const libMesh::Point &origin)

◆ generateData()

void ReactorGeometryMeshBuilderBase::generateData ( )
inlineoverridevirtualinherited

Reimplemented from MeshGenerator.

Definition at line 119 of file ReactorGeometryMeshBuilderBase.h.

119{};

◆ generateFlexibleAssemblyBoundaries()

void PinMeshGenerator::generateFlexibleAssemblyBoundaries ( )
protected

Definition at line 442 of file PinMeshGenerator.C.

443{
444 SubdomainName outermost_block_name;
445 bool has_single_mesh_interval;
446
447 // Assemblies that invoke this method are either homogenized or have a single pin. First check if
448 // the assembly only has a single region. Otherwise, determine the outermost region for deletion
449 if (_homogenized || (_intervals.size() == 1))
450 {
451 outermost_block_name = RGMB::PIN_BLOCK_NAME_PREFIX + std::to_string(_pin_type) + "_R0";
452 has_single_mesh_interval = true;
453 }
454 else
455 {
456 outermost_block_name = RGMB::PIN_BLOCK_NAME_PREFIX + std::to_string(_pin_type) + "_R" +
457 std::to_string(_intervals.size() - 1);
458 has_single_mesh_interval = false;
459
460 // Invoke BlockDeletionGenerator to delete outermost mesh interval of assembly
461 auto params = _app.getFactory().getValidParams("BlockDeletionGenerator");
462
463 params.set<std::vector<SubdomainName>>("block") = {outermost_block_name};
464 params.set<MeshGeneratorName>("input") = _homogenized ? name() + "_2D" : name() + "_delbds";
465
466 addMeshSubgenerator("BlockDeletionGenerator", name() + "_del_outer", params);
467 }
468
469 {
470 // Invoke FlexiblePatternGenerator to triangulate deleted mesh interval
471 auto params = _app.getFactory().getValidParams("FlexiblePatternGenerator");
472
473 if (has_single_mesh_interval)
474 params.set<std::vector<MeshGeneratorName>>("inputs") = {};
475 else
476 {
477 params.set<std::vector<MeshGeneratorName>>("inputs") = {name() + "_del_outer"};
478 params.set<std::vector<libMesh::Point>>("extra_positions") = {libMesh::Point(0, 0, 0)};
479 params.set<std::vector<unsigned int>>("extra_positions_mg_indices") = {0};
480 }
481 params.set<bool>("use_auto_area_func") = true;
482 params.set<bool>("verify_holes") = false;
483 params.set<MooseEnum>("boundary_type") = (_mesh_geometry == "Hex") ? "HEXAGON" : "CARTESIAN";
484 params.set<unsigned int>("boundary_sectors") =
485 getReactorParam<unsigned int>(RGMB::num_sectors_flexible_stitching);
486 params.set<Real>("boundary_size") = getReactorParam<Real>(RGMB::assembly_pitch);
487 params.set<boundary_id_type>("external_boundary_id") = RGMB::PIN_BOUNDARY_ID_START + _pin_type;
488 params.set<BoundaryName>("external_boundary_name") =
490 params.set<SubdomainName>("background_subdomain_name") =
491 outermost_block_name + RGMB::TRI_BLOCK_NAME_SUFFIX;
492 params.set<unsigned short>("background_subdomain_id") = RGMB::PIN_BLOCK_ID_TRI_FLEXIBLE;
493
494 addMeshSubgenerator("FlexiblePatternGenerator", name() + "_fpg", params);
495 }
496 {
497 // Delete extra boundary created by FlexiblePatternGenerator
498 auto params = _app.getFactory().getValidParams("BoundaryDeletionGenerator");
499
500 params.set<MeshGeneratorName>("input") = name() + "_fpg";
501 std::vector<BoundaryName> boundaries_to_delete = {};
502 if (!has_single_mesh_interval)
503 boundaries_to_delete.push_back(std::to_string(1));
504 params.set<std::vector<BoundaryName>>("boundary_names") = boundaries_to_delete;
505
506 addMeshSubgenerator("BoundaryDeletionGenerator", name() + "_fpg_delbds", params);
507 }
508}
const subdomain_id_type PIN_BLOCK_ID_TRI_FLEXIBLE
static const std::string num_sectors_flexible_stitching

Referenced by PinMeshGenerator().

◆ generateMetadata()

void PinMeshGenerator::generateMetadata ( )
protected

Definition at line 511 of file PinMeshGenerator.C.

512{
513 // Store pin region ids and block names for id swap after extrusion if needed
514 // by future mesh generators
515 std::map<subdomain_id_type, std::vector<std::vector<subdomain_id_type>>> region_id_map{
517
518 // Declare mesh properties that need to be moved up to the assembly level
519 if (_is_assembly)
520 {
522 declareMeshProperty(RGMB::background_block_name, std::vector<std::string>());
523 declareMeshProperty(RGMB::duct_block_names, std::vector<std::vector<std::string>>());
526 // Following metadata is only relevant if an output mesh is generated by RGMB
527 // because it pertains to region & block ids of elements in the output mesh
528 if (!getReactorParam<bool>(RGMB::bypass_meshgen))
529 {
530 std::map<subdomain_id_type, std::vector<std::vector<subdomain_id_type>>> pin_region_id_map;
531 pin_region_id_map.insert(
532 std::pair<subdomain_id_type, std::vector<std::vector<subdomain_id_type>>>(
533 region_id_map.begin()->first, region_id_map.begin()->second));
535 std::map<subdomain_id_type, std::vector<std::vector<std::string>>> pin_block_name_map;
536 pin_block_name_map.insert(std::pair<subdomain_id_type, std::vector<std::vector<std::string>>>(
539 }
540 }
541 // Declare mesh properties that are only relevant to pin meshes
542 else
543 {
547 }
548
549 // Set metadata to describe pin attributes
555
556 unsigned int n_axial_levels =
557 (_mesh_dimensions == 3)
558 ? getReactorParam<std::vector<unsigned int>>(RGMB::axial_mesh_intervals).size()
559 : 1;
560 std::vector<std::vector<subdomain_id_type>> ring_region_ids(
561 n_axial_levels, std::vector<subdomain_id_type>(_ring_radii.size()));
562 std::vector<std::vector<subdomain_id_type>> duct_region_ids(
563 n_axial_levels, std::vector<subdomain_id_type>(_duct_halfpitch.size()));
564 std::vector<subdomain_id_type> background_region_ids(n_axial_levels);
565
566 for (const auto axial_idx : make_range(n_axial_levels))
567 {
568 for (const auto ring_idx : index_range(_ring_radii))
569 ring_region_ids[axial_idx][ring_idx] = _region_ids[axial_idx][ring_idx];
570
571 background_region_ids[axial_idx] = _region_ids[axial_idx][_ring_radii.size()];
572
573 for (unsigned int duct_idx = _ring_radii.size() + 1;
574 duct_idx < _duct_halfpitch.size() + _ring_radii.size() + 1;
575 ++duct_idx)
576 duct_region_ids[axial_idx][duct_idx - _ring_radii.size() - 1] =
577 _region_ids[axial_idx][duct_idx];
578 }
579
580 // Define mesh properties related to region ids
582 declareMeshProperty(RGMB::background_region_id, background_region_ids);
584}
static const std::string is_single_pin
static const std::string pin_region_id_map
static const std::string is_control_drum
static const std::string ring_radii
static const std::string assembly_type
static const std::string pin_block_name_map
static const std::string duct_block_names
static const std::string duct_halfpitches
static const std::string duct_region_ids
static const std::string pin_region_ids
static const std::string extruded
static const std::string background_region_id
static const std::string ring_region_ids
static const std::string is_homogenized
static const std::string background_block_name
static const std::string pitch
static const std::string pin_block_names
static const std::string pin_type

Referenced by PinMeshGenerator().

◆ getAxialPlaneSurfaces()

std::vector< std::reference_wrapper< const CSG::CSGSurface > > ReactorGeometryMeshBuilderBase::getAxialPlaneSurfaces ( CSG::CSGBase csg_obj)
protectedinherited

Get CSGSurfaces corresponding to axial planes of the extruded RGMB mesh.

Parameters
csg_objReference to CSGBase object for adding defined surfaces to
Returns
vector of surfaces that correspond to axial planes of extruded RGMB mesh

Definition at line 279 of file ReactorGeometryMeshBuilderBase.C.

280{
281 std::vector<std::reference_wrapper<const CSG::CSGSurface>> surfaces_by_axial_region;
282 const auto axial_boundaries = getReactorParam<std::vector<Real>>(RGMB::axial_mesh_sizes);
283 Real axial_level = 0.;
284
285 // Check if axial planes have been defined in CSGBase based on a surface name we expect
286 // to find
287 auto axial_surf_name = RGMB::CSG_AXIAL_PLANE_PREFIX + "0";
288 const auto has_axial_surfaces = csg_obj.hasSurface(axial_surf_name);
289
290 for (const auto i : make_range(axial_boundaries.size() + 1))
291 {
292 axial_surf_name = RGMB::CSG_AXIAL_PLANE_PREFIX + std::to_string(i);
293 if (has_axial_surfaces)
294 // Surface should exist in CSGBase, retrieve from object
295 surfaces_by_axial_region.push_back(csg_obj.getSurfaceByName(axial_surf_name));
296 else
297 {
298 // Surface has not been defined, create it and add to CSGBase
299 axial_level += (i != 0) ? axial_boundaries[i - 1] : 0.;
300 std::unique_ptr<CSG::CSGSurface> plane_surf_ptr =
301 std::make_unique<CSG::CSGPlane>(axial_surf_name, 0, 0, 1, axial_level);
302 const auto & plane_surf = csg_obj.addSurface(std::move(plane_surf_ptr));
303 surfaces_by_axial_region.push_back(plane_surf);
304 }
305 }
306
307 return surfaces_by_axial_region;
308}
const CSGSurface & getSurfaceByName(const std::string &name) const
const CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf)
bool hasSurface(const std::string &name) const
static const std::string CSG_AXIAL_PLANE_PREFIX

Referenced by AssemblyMeshGenerator::generateCSG(), CoreMeshGenerator::generateCSG(), and generateCSG().

◆ getElemIntegerFromMesh()

unsigned int ReactorGeometryMeshBuilderBase::getElemIntegerFromMesh ( MeshBase &  input_mesh,
std::string  extra_int_name,
bool  should_exist = false 
)
protectedinherited

Initializes extra element integer from id name for a given mesh and throws an error if it should exist but cannot be found within the mesh.

Parameters
input_meshinput mesh
extra_int_nameextra element id name
should_existwhether extra element integer should already exist in mesh
Returns
extra element integer

Definition at line 87 of file ReactorGeometryMeshBuilderBase.C.

90{
91 if (input_mesh.has_elem_integer(extra_int_name))
92 return input_mesh.get_elem_integer_index(extra_int_name);
93 else
94 {
95 if (should_exist)
96 mooseError("Expected extruded mesh to have " + extra_int_name + " extra integers");
97 else
98 return input_mesh.add_elem_integer(extra_int_name);
99 }
100}

Referenced by AssemblyMeshGenerator::generate(), ControlDrumMeshGenerator::generate(), CoreMeshGenerator::generate(), and generate().

◆ getOuterRadialSurfacesForUnitCell()

std::vector< std::reference_wrapper< const CSG::CSGSurface > > ReactorGeometryMeshBuilderBase::getOuterRadialSurfacesForUnitCell ( unsigned int  radial_index,
Real  halfpitch,
CSG::CSGBase csg_obj 
)
protectedinherited

Get CSGSurfaces corresponding to hexagonal or square region with given halfpitch and centered around (0, 0, 0)

Parameters
radial_indexRadial index of hex / square region, for surface naming
halfpitchHalfpitch of square or hexagon
csg_objReference to CSGBase object for adding defined surfaces to
Returns
vector of surfaces that correspond to hexagonal or square region

Definition at line 240 of file ReactorGeometryMeshBuilderBase.C.

243{
244 std::vector<std::reference_wrapper<const CSG::CSGSurface>> duct_surfaces;
245 const auto mesh_geometry = getReactorParam<std::string>(RGMB::mesh_geometry);
246 const auto n_azim_surfaces = mesh_geometry == "Square" ? 4 : 6;
247
248 // Convert halfpitch to radius (distance from vertex to center)
249 const Real angle_offset_degrees = mesh_geometry == "Square" ? 45. : 30.;
250 const Real angle_offset_radians = angle_offset_degrees * (M_PI / 180.);
251 const auto radius = halfpitch / std::cos(angle_offset_radians);
252
253 Real angle_increment_radians = 360. / n_azim_surfaces * (M_PI / 180.);
254
255 for (const auto i : make_range(n_azim_surfaces))
256 {
257 const auto surf_name =
258 name() + "_radial_duct_" + std::to_string(radial_index) + "_surf_" + std::to_string(i);
259
260 // Define 3 points on the surface
261 const auto current_angle = i * angle_increment_radians + angle_offset_radians;
262 const auto next_angle = (i + 1) * angle_increment_radians + angle_offset_radians;
263 libMesh::Point p0(radius * std::cos(current_angle), radius * std::sin(current_angle), 0.);
264 libMesh::Point p1(radius * std::cos(next_angle), radius * std::sin(next_angle), 0.);
265 libMesh::Point p2 = (p0 + p1) / 2.;
266 // Place third point above the two others to form a vertical plane
267 p2(2) = angle_offset_degrees;
268
269 std::unique_ptr<CSG::CSGSurface> duct_surf_ptr =
270 std::make_unique<CSG::CSGPlane>(surf_name, p0, p1, p2);
271 const auto & duct_surf = csg_obj.addSurface(std::move(duct_surf_ptr));
272 duct_surfaces.push_back(duct_surf);
273 }
274
275 return duct_surfaces;
276}
const Real radius

Referenced by AssemblyMeshGenerator::generateCSG(), and generateCSG().

◆ getReactorParam()

template<typename T >
const T & ReactorGeometryMeshBuilderBase::getReactorParam ( const std::string &  param_name)
protectedinherited

Returns reference of parameter in ReactorMeshParams object.

Template Parameters
Tdatatype of metadata value associated with metadata name
Parameters
param_namename of ReactorMeshParams parameter
Returns
reference to parameter defined in ReactorMeshParams metadata

Definition at line 330 of file ReactorGeometryMeshBuilderBase.h.

331{
332 return getMeshProperty<T>(param_name, _reactor_params);
333}
MeshGeneratorName _reactor_params
The ReactorMeshParams object that is storing the reactor global information for this reactor geometry...

Referenced by AssemblyMeshGenerator::AssemblyMeshGenerator(), ReactorGeometryMeshBuilderBase::callExtrusionMeshSubgenerators(), ControlDrumMeshGenerator::ControlDrumMeshGenerator(), generateMetadata(), and PinMeshGenerator().

◆ hasReactorParam()

template<typename T >
bool ReactorGeometryMeshBuilderBase::hasReactorParam ( const std::string  param_name)
protectedinherited

Checks whether parameter is defined in ReactorMeshParams metadata.

Template Parameters
Tdatatype of metadata value associated with metadata name
Parameters
param_namename of ReactorMeshParams parameter
Returns
whether parameter is defined in ReactorMeshParams metadata

Definition at line 323 of file ReactorGeometryMeshBuilderBase.h.

324{
325 return hasMeshProperty<T>(param_name, _reactor_params);
326}

◆ initializeReactorMeshParams()

void ReactorGeometryMeshBuilderBase::initializeReactorMeshParams ( const std::string  reactor_param_name)
protectedinherited

Initializes and checks validity of ReactorMeshParams mesh generator object.

Parameters
reactor_param_namename of ReactorMeshParams mesh generator

Definition at line 52 of file ReactorGeometryMeshBuilderBase.C.

53{
54 _reactor_params = reactor_param_name;
55
56 // Ensure that the user has supplied a valid ReactorMeshParams object
57 _reactor_params_mesh = &getMeshByName(reactor_param_name);
59 mooseError("The reactor_params mesh is not of the correct type");
60
61 if (!hasMeshProperty<unsigned int>("mesh_dimensions", _reactor_params) ||
62 !hasMeshProperty<std::string>("mesh_geometry", _reactor_params))
63 mooseError("The reactor_params input must be a ReactorMeshParams type MeshGenerator\n Please "
64 "check that a valid definition and name of ReactorMeshParams has been provided.");
65
66 // Set reactor_params_name metadata for use by future mesh generators
67 declareMeshProperty("reactor_params_name", std::string(_reactor_params));
68
69 // Store CSGBase object if we are in CSG only mode
72}
bool getCSGOnly() const
std::unique_ptr< CSG::CSGBase > & getCSGBaseByName(const MeshGeneratorName &mesh_generator_name)
MeshGeneratorSystem & getMeshGeneratorSystem()

Referenced by AssemblyMeshGenerator::AssemblyMeshGenerator(), ControlDrumMeshGenerator::ControlDrumMeshGenerator(), CoreMeshGenerator::CoreMeshGenerator(), and PinMeshGenerator().

◆ print2dMetadataToConsole()

template<typename T >
void ReactorGeometryMeshBuilderBase::print2dMetadataToConsole ( const std::string  metadata_name,
const std::string  mg_name 
)
protectedinherited

Print metadata with data type std::vector<std::vector<T>> and provided name that can be found with given mesh generator name.

Template Parameters
Tdatatype of elements in 2-D vector to output
Parameters
metadata_nameName of metadata to output
mg_nameName of mesh generator that stores metadata

◆ printAssemblyMetadata()

void ReactorGeometryMeshBuilderBase::printAssemblyMetadata ( const std::string  mg_name,
const bool  first_function_call 
)
protectedinherited

Print assembly-level metadata associated with ReactorGeometryMeshBuilder object.

Parameters
mg_namename of mesh generator associated with assembly
whetherthis is the original function call, which will trigger additional output messages

◆ printCoreMetadata()

void ReactorGeometryMeshBuilderBase::printCoreMetadata ( const std::string  mg_name,
const bool  first_function_call 
)
protectedinherited

Print core-level metadata associated with ReactorGeometryMeshBuilder object.

Parameters
mg_namename of mesh generator associated with core
first_function_callwhether this is the original function call, which will trigger additional output messages

◆ printGlobalReactorMetadata()

void ReactorGeometryMeshBuilderBase::printGlobalReactorMetadata ( )
protectedinherited

Print global ReactorMeshParams metadata associated with ReactorGeometryMeshBuilder object.

◆ printMetadataToConsole()

template<typename T >
void ReactorGeometryMeshBuilderBase::printMetadataToConsole ( const std::string  metadata_name,
const std::string  mg_name 
)
protectedinherited

Print metadata with provided name that can be found with given mesh generator name.

Template Parameters
Tdatatype of metadata value to output
Parameters
metadata_nameName of metadata to output
mg_nameName of mesh generator that stores metadata

◆ printPinMetadata()

void ReactorGeometryMeshBuilderBase::printPinMetadata ( const std::string  mg_name)
protectedinherited

Print pin-level metadata associated with ReactorGeometryMeshBuilder object.

Parameters
mg_namename of mesh generator associated with assembly

◆ printReactorMetadata()

void ReactorGeometryMeshBuilderBase::printReactorMetadata ( const std::string  geometry_type,
const std::string  mg_name,
const bool  first_function_call = true 
)
protectedinherited

Print metadata associated with ReactorGeometryMeshBuilder object.

Parameters
geometry_typetype of geometry (pin / assembly / core) under consideration
mg_namename of mesh generator associated with this object
first_function_callwhether this is the original function call, which will trigger additional output messages

◆ updateElementBlockNameId()

void ReactorGeometryMeshBuilderBase::updateElementBlockNameId ( MeshBase &  input_mesh,
Elem *  elem,
std::map< std::string, SubdomainID > &  name_id_map,
std::string  elem_block_name,
SubdomainID next_free_id 
)
protectedinherited

Updates the block names and ids of the element in an input mesh according to a map of block name to block ids.

Updates the map if the block name is not in the map

Parameters
input_nameinput mesh
elemiterator to mesh element
name_id_mapmap of name-id pairs used in mesh
elem_block_nameblock name to set for element
next_free_idnext free block id to use if block name does not exist in map

Definition at line 103 of file ReactorGeometryMeshBuilderBase.C.

109{
110 SubdomainID elem_block_id;
111 if (name_id_map.find(elem_block_name) == name_id_map.end())
112 {
113 // Block name does not exist in mesh yet, assign new block id and name
114 elem_block_id = next_free_id++;
115 elem->subdomain_id() = elem_block_id;
116 input_mesh.set_subdomain_name(elem_block_id, elem_block_name);
117 name_id_map[elem_block_name] = elem_block_id;
118 }
119 else
120 {
121 // Block name exists in mesh, reuse block id
122 elem_block_id = name_id_map[elem_block_name];
123 elem->subdomain_id() = elem_block_id;
124 }
125
126 input_mesh.unset_has_cached_elem_data();
127}

Referenced by AssemblyMeshGenerator::generate(), ControlDrumMeshGenerator::generate(), CoreMeshGenerator::generate(), and generate().

◆ validParams()

InputParameters PinMeshGenerator::validParams ( )
static

Definition at line 26 of file PinMeshGenerator.C.

27{
29
30 params.addRequiredParam<MeshGeneratorName>(
31 "reactor_params",
32 "The ReactorMeshParams MeshGenerator that is the basis for this component conformal mesh.");
33
34 params.addRequiredParam<subdomain_id_type>("pin_type",
35 "The integer ID for this pin type definition");
36
37 params.addRequiredRangeCheckedParam<Real>(
38 "pitch", "pitch>0.0", "The pitch for the outermost boundary polygon");
39
40 params.addRangeCheckedParam<unsigned int>(
41 "num_sectors", "num_sectors>0", "Number of azimuthal sectors in each quadrant");
42
43 params.addRangeCheckedParam<std::vector<Real>>(
44 "ring_radii",
45 "ring_radii>0.0",
46 "Radii of major concentric circles of the pin. If unspecified, no pin is present.");
47
48 params.addRangeCheckedParam<std::vector<Real>>(
49 "duct_halfpitch",
50 "duct_halfpitch>0.0",
51 "Apothem of the ducts. If unspecified, no duct is present.");
52
53 params.addRangeCheckedParam<std::vector<unsigned int>>(
54 "mesh_intervals",
55 std::vector<unsigned int>{1},
56 "mesh_intervals>0",
57 "The number of meshing intervals for each region starting at the center. Parameter should be "
58 "size:"
59 "((length(ring_radii) + length(duct_halfpitch) + 1");
60
61 params.addParam<std::vector<std::vector<std::string>>>(
62 "block_names",
63 "Block names for each radial and axial zone. "
64 "Inner indexing is radial zones (pin/background/duct), outer indexing is axial");
65
66 params.addParam<std::vector<std::vector<subdomain_id_type>>>(
67 "region_ids",
68 "IDs for each radial and axial zone for assignment of region_id extra element "
69 "id. "
70 "Inner indexing is radial zones (pin/background/duct), outer indexing is axial");
71
72 params.addParam<bool>("extrude",
73 false,
74 "Determines if this is the final step in the geometry construction"
75 " and extrudes the 2D geometry to 3D. If this is true then this mesh "
76 "cannot be used in further mesh building in the Reactor workflow");
77 params.addParam<bool>(
78 "homogenized", false, "Determines whether homogenized pin mesh should be generated");
79 params.addParam<bool>(
80 "use_as_assembly", false, "Determines whether pin mesh should be used as an assembly mesh");
81
82 params.addParam<bool>(
83 "quad_center_elements", true, "Whether the center elements are quad or triangular.");
84 params.addParamNamesToGroup("region_ids pin_type", "ID assigment");
85 params.addParamNamesToGroup(
86 "mesh_intervals ring_radii num_sectors pin_type homogenized use_as_assembly",
87 "Pin specifications");
88 params.addParamNamesToGroup("mesh_intervals duct_halfpitch num_sectors", "Duct specifications");
89
90 params.addClassDescription("This PinMeshGenerator object is designed to generate pin-like "
91 "structures, with IDs, from a reactor geometry. "
92 "Whether it be a square or hexagonal pin, they are divided into three "
93 "substructures - the innermost "
94 "radial pin regions, the single bridging background region, and the "
95 "square or hexagonal ducts regions.");
96
97 // Declare that this generator has a generateCSG method
99
100 return params;
101}
static void setHasGenerateCSG(InputParameters &params)

Member Data Documentation

◆ _block_names

std::vector<std::vector<std::string> > PinMeshGenerator::_block_names
protected

2-D vector (axial outer indexing, radial inner indexing) used to set block names of pin mesh elements

Definition at line 62 of file PinMeshGenerator.h.

Referenced by generate(), generateMetadata(), and PinMeshGenerator().

◆ _build_mesh

std::unique_ptr<MeshBase>* PinMeshGenerator::_build_mesh
protected

The final mesh that is generated by the subgenerators; This mesh is generated by the subgenerators with only element and boundary ids changed.

Definition at line 84 of file PinMeshGenerator.h.

Referenced by generate(), and PinMeshGenerator().

◆ _duct_halfpitch

const std::vector<Real> PinMeshGenerator::_duct_halfpitch
protected

The inner apothem of any surrounding ducts in the pin.

Definition at line 50 of file PinMeshGenerator.h.

Referenced by generateCSG(), generateMetadata(), and PinMeshGenerator().

◆ _extrude

const bool PinMeshGenerator::_extrude
protected

Whether this mesh should be extruded to 3-D, making it the final structure in the reactor mesh.

Definition at line 71 of file PinMeshGenerator.h.

Referenced by generate(), generateMetadata(), and PinMeshGenerator().

◆ _has_block_names

bool PinMeshGenerator::_has_block_names
protected

Whether block names have been provided by user.

Definition at line 59 of file PinMeshGenerator.h.

Referenced by generate(), and PinMeshGenerator().

◆ _homogenized

bool PinMeshGenerator::_homogenized
protected

Whether the resulting pin mesh should be homogenized.

Definition at line 77 of file PinMeshGenerator.h.

Referenced by generateFlexibleAssemblyBoundaries(), generateMetadata(), and PinMeshGenerator().

◆ _intervals

std::vector<unsigned int> PinMeshGenerator::_intervals
protected

The number of mesh intervals in a radial division starting from the center.

Definition at line 53 of file PinMeshGenerator.h.

Referenced by generateFlexibleAssemblyBoundaries(), and PinMeshGenerator().

◆ _is_assembly

bool PinMeshGenerator::_is_assembly
protected

Whether the resulting pin mesh should also be used as an assembly mesh.

Definition at line 80 of file PinMeshGenerator.h.

Referenced by generate(), generateMetadata(), and PinMeshGenerator().

◆ _mesh_dimensions

unsigned int PinMeshGenerator::_mesh_dimensions
protected

The number of dimensions the mesh is ultimately going to have (2 or 3, declared in the ReactorMeshParams object)

Definition at line 68 of file PinMeshGenerator.h.

Referenced by generateCSG(), generateMetadata(), and PinMeshGenerator().

◆ _mesh_geometry

std::string PinMeshGenerator::_mesh_geometry
protected

The type of geometry that is being described (Square or Hex, declared in the ReactorMeshParams object)

Definition at line 65 of file PinMeshGenerator.h.

Referenced by generateFlexibleAssemblyBoundaries(), and PinMeshGenerator().

◆ _num_sectors

const unsigned int PinMeshGenerator::_num_sectors
protected

The number of azimuthal divisions.

Definition at line 44 of file PinMeshGenerator.h.

Referenced by PinMeshGenerator().

◆ _pin_type

const subdomain_id_type PinMeshGenerator::_pin_type
protected

The id number for this pin type.

Definition at line 38 of file PinMeshGenerator.h.

Referenced by generate(), generateFlexibleAssemblyBoundaries(), generateMetadata(), and PinMeshGenerator().

◆ _pitch

const Real PinMeshGenerator::_pitch
protected

The face-to-face size of this pin.

Definition at line 41 of file PinMeshGenerator.h.

Referenced by generateCSG(), generateMetadata(), and PinMeshGenerator().

◆ _quad_center

bool PinMeshGenerator::_quad_center
protected

Whether the centermost elements in the pin should be quad elements as opposed to tri elements.

Definition at line 74 of file PinMeshGenerator.h.

Referenced by PinMeshGenerator().

◆ _reactor_params

MeshGeneratorName ReactorGeometryMeshBuilderBase::_reactor_params
protectedinherited

The ReactorMeshParams object that is storing the reactor global information for this reactor geometry mesh.

Definition at line 261 of file ReactorGeometryMeshBuilderBase.h.

Referenced by ReactorGeometryMeshBuilderBase::getReactorParam(), ReactorGeometryMeshBuilderBase::hasReactorParam(), and ReactorGeometryMeshBuilderBase::initializeReactorMeshParams().

◆ _reactor_params_csg

std::unique_ptr<CSG::CSGBase>* ReactorGeometryMeshBuilderBase::_reactor_params_csg
privateinherited

◆ _reactor_params_mesh

std::unique_ptr<MeshBase>* ReactorGeometryMeshBuilderBase::_reactor_params_mesh
privateinherited

The dummy param mesh that we need to clear once we've generated (in freeReactorMeshParams)

Definition at line 317 of file ReactorGeometryMeshBuilderBase.h.

Referenced by ReactorGeometryMeshBuilderBase::freeReactorParamsMesh(), and ReactorGeometryMeshBuilderBase::initializeReactorMeshParams().

◆ _region_ids

std::vector<std::vector<subdomain_id_type> > PinMeshGenerator::_region_ids
protected

2-D vector (axial outer indexing, radial inner indexing) used to set "region_id" extra-element integer of the pin mesh elements

Definition at line 56 of file PinMeshGenerator.h.

Referenced by generate(), generateCSG(), generateMetadata(), and PinMeshGenerator().

◆ _ring_radii

std::vector<Real> PinMeshGenerator::_ring_radii
protected

The outer radii of concentric rings in the pin.

Definition at line 47 of file PinMeshGenerator.h.

Referenced by generateCSG(), generateMetadata(), and PinMeshGenerator().


The documentation for this class was generated from the following files: