https://mooseframework.inl.gov
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 | List of all members
ControlDrumMeshGenerator Class Reference

Mesh generator for defining a reactor control drum that can be used in a Cartesian or hexagonal lattice with the option to be 2-D or 3-D. More...

#include <ControlDrumMeshGenerator.h>

Inheritance diagram for ControlDrumMeshGenerator:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 ControlDrumMeshGenerator (const InputParameters &parameters)
 
std::unique_ptr< MeshBase > generate () override
 
void generateData () override
 
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 isDataOnly () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (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
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) 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 void setHasGenerateData (InputParameters &params)
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

static const std::string data_only_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Types

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

Protected Member Functions

void generateMetadata ()
 Define metadata associated with ControlDrumMeshGenerator. More...
 
unsigned int getDrumIdxFromRadialIdx (const unsigned int radial_idx, const Real elem_x, const Real elem_y)
 Get drum index from radial index of mesh element, drum index is used to retrieve region ID and block names for each element. More...
 
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. More...
 
void initializeReactorMeshParams (const std::string reactor_param_name)
 Initializes and checks validity of ReactorMeshParams mesh generator object. More...
 
void printReactorMetadata (const std::string geometry_type, const std::string mg_name, const bool first_function_call=true)
 Print metadata associated with ReactorGeometryMeshBuilder object. More...
 
void printCoreMetadata (const std::string mg_name, const bool first_function_call)
 Print core-level metadata associated with ReactorGeometryMeshBuilder object. More...
 
void printAssemblyMetadata (const std::string mg_name, const bool first_function_call)
 Print assembly-level metadata associated with ReactorGeometryMeshBuilder object. More...
 
void printPinMetadata (const std::string mg_name)
 Print pin-level metadata associated with ReactorGeometryMeshBuilder object. More...
 
void printGlobalReactorMetadata ()
 Print global ReactorMeshParams metadata associated with ReactorGeometryMeshBuilder object. More...
 
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. More...
 
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. More...
 
void freeReactorMeshParams ()
 Releases the mesh obtained in _reactor_params_mesh. More...
 
template<typename T >
bool hasReactorParam (const std::string param_name)
 Checks whether parameter is defined in ReactorMeshParams metadata. More...
 
template<typename T >
const T & getReactorParam (const std::string &param_name)
 Returns reference of parameter in ReactorMeshParams object. More...
 
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. More...
 
MeshGeneratorName callExtrusionMeshSubgenerators (const MeshGeneratorName input_mesh_name)
 Calls mesh subgenerators related to extrusion, renaming of top / bottom boundaries, and defining plane IDs. More...
 
void addDepletionId (MeshBase &input_mesh, const MooseEnum &option, const DepletionIDGenerationLevel generation_level, const bool extrude)
 add depletion IDs More...
 
T & copyMeshProperty (const std::string &target_data_name, const std::string &source_data_name, const std::string &source_mesh)
 
T & copyMeshProperty (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)
 
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)
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (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
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (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

std::string _geom_type
 The type of geometry that is being described (Square or Hex, declared in the ReactorMeshParams object) More...
 
unsigned int _mesh_dimensions
 The number of dimensions the mesh is ultimately going to have (2 or 3, declared in the ReactorMeshParams object) More...
 
const subdomain_id_type _assembly_type
 The id number for the type of the assembly. More...
 
const Real _drum_inner_radius
 The inner radius of drum region. More...
 
const Real _drum_outer_radius
 The outer radius of drum region. More...
 
const bool _extrude
 Whether this mesh should be extruded to 3-D, making it the final structure in the reactor mesh. More...
 
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 control drum mesh elements More...
 
bool _has_block_names
 Whether block names have been provided by user. More...
 
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 More...
 
Real _pad_start_angle
 Starting angle of drum pad region. More...
 
Real _pad_end_angle
 Ending angle of drum pad region. More...
 
bool _has_pad_region
 Whether pad start and end angles are provided by user. More...
 
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. More...
 
MeshGeneratorName _reactor_params
 The ReactorMeshParams object that is storing the reactor global information for this reactor geometry mesh. More...
 
MooseMesh *const _mesh
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const Parallel::Communicator & _communicator
 

Detailed Description

Mesh generator for defining a reactor control drum that can be used in a Cartesian or hexagonal lattice with the option to be 2-D or 3-D.

Definition at line 18 of file ControlDrumMeshGenerator.h.

Member Enumeration Documentation

◆ DepletionIDGenerationLevel

specify the depletion id is generated at which reactor generation level

Enumerator
Pin 
Assembly 
Drum 
Core 

Definition at line 249 of file ReactorGeometryMeshBuilderBase.h.

250  {
251  Pin,
252  Assembly,
253  Drum,
254  Core
255  };

Constructor & Destructor Documentation

◆ ControlDrumMeshGenerator()

ControlDrumMeshGenerator::ControlDrumMeshGenerator ( const InputParameters parameters)

Definition at line 92 of file ControlDrumMeshGenerator.C.

94  _assembly_type(getParam<subdomain_id_type>("assembly_type")),
95  _drum_inner_radius(getParam<Real>("drum_inner_radius")),
96  _drum_outer_radius(getParam<Real>("drum_outer_radius")),
97  _extrude(getParam<bool>("extrude")),
98  _region_ids(getParam<std::vector<std::vector<subdomain_id_type>>>("region_ids"))
99 {
100  // Initialize ReactorMeshParams object
101  initializeReactorMeshParams(getParam<MeshGeneratorName>("reactor_params"));
102 
103  // Flexible stitching needs to be invoked in order to create control drum mesh
104  if (!getReactorParam<bool>(RGMB::flexible_assembly_stitching))
105  mooseError("'flexible_assembly_stitching' needs to be set to true in ReactorMeshParams in "
106  "order to use ControlDrumMeshGenerator");
107 
108  _geom_type = getReactorParam<std::string>(RGMB::mesh_geometry);
109  _mesh_dimensions = getReactorParam<unsigned int>(RGMB::mesh_dimensions);
110 
111  const auto drum_inner_intervals = getParam<unsigned int>("drum_inner_intervals");
112  const auto drum_intervals = getParam<unsigned int>("drum_intervals");
113  const auto num_sectors = getParam<unsigned int>("num_azimuthal_sectors");
114  const auto assembly_pitch = getReactorParam<Real>(RGMB::assembly_pitch);
115 
116  // Check drum pad parameters
117  if (isParamSetByUser("pad_start_angle"))
118  {
119  _pad_start_angle = getParam<Real>("pad_start_angle");
120  if (!isParamSetByUser("pad_end_angle"))
121  paramError("pad_start_angle",
122  "If 'pad_start_angle' is set, 'pad_end_angle' needs to also be set.");
123  _pad_end_angle = getParam<Real>("pad_end_angle");
124 
126  paramError("pad_start_angle",
127  "The difference between 'pad_end_angle' and 'pad_start_angle' must be between 0 "
128  "and 360 exclusive.");
129  _has_pad_region = true;
130  }
131  else
132  {
133  if (isParamSetByUser("pad_end_angle"))
134  paramError("pad_end_angle",
135  "If 'pad_end_angle' is set, 'pad_start_angle' needs to also be set.");
136  _has_pad_region = false;
137  }
138 
139  // Error checking for azimuthal node tolerance
140  const auto azimuthal_node_tolerance = getParam<Real>("azimuthal_node_tolerance");
141  if (!_has_pad_region && isParamSetByUser("azimuthal_node_tolerance"))
142  paramError("azimuthal_node_tolerance",
143  "This parameter is relevant only when pad start and end angles are defined");
144  if (_has_pad_region && MooseUtils::absoluteFuzzyGreaterEqual(2. * azimuthal_node_tolerance,
145  360. / (Real)num_sectors))
146  paramError("azimuthal_node_tolerance",
147  "Azimuthal node tolerance should be smaller than half the azimuthal interval size "
148  "as defined by 'num_azimuthal_sectors'");
149  if (_has_pad_region && MooseUtils::absoluteFuzzyGreaterEqual(2. * azimuthal_node_tolerance,
151  paramError("azimuthal_node_tolerance",
152  "Azimuthal node tolerance should be smaller than half the difference of the pad "
153  "angle range");
154 
155  // Check region IDs have correct size
156  const unsigned int n_radial_regions = _has_pad_region ? 4 : 3;
157  unsigned int n_axial_levels =
158  (_mesh_dimensions == 3)
159  ? getReactorParam<std::vector<unsigned int>>(RGMB::axial_mesh_intervals).size()
160  : 1;
161  if (_region_ids.size() != n_axial_levels)
162  mooseError("The size of region IDs must be equal to the number of axial levels as defined in "
163  "the ReactorMeshParams object");
164  if (_region_ids[0].size() != n_radial_regions)
165  {
166  std::string err_msg =
167  "'region_ids' parameter does not have the correct number of elements per axial zone. ";
168  err_msg += _has_pad_region
169  ? "For control drums with a pad region, 4 radial IDs need to be provided per "
170  "axial zone (drum inner, drum pad, drum ex-pad, and drum outer)"
171  : "For control drums with no pad region, 3 radial IDs need to be provided per "
172  "axial zone (drum inner, drum, and drum outer)";
173  paramError("region_ids", err_msg);
174  }
175 
176  // Check block names have the correct size
177  if (isParamValid("block_names"))
178  {
179  if (getReactorParam<bool>(RGMB::region_id_as_block_name))
180  paramError("block_names",
181  "If ReactorMeshParams/region_id_as_block_name is set, block_names should not be "
182  "specified in ControlDrumMeshGenerator");
183  _has_block_names = true;
184  _block_names = getParam<std::vector<std::vector<std::string>>>("block_names");
185  if (_region_ids.size() != _block_names.size())
186  mooseError("The size of block_names must match the size of region_ids");
187  for (const auto i : index_range(_region_ids))
188  if (_region_ids[i].size() != _block_names[i].size())
189  mooseError("The size of block_names must match the size of region_ids");
190  }
191  else
192  _has_block_names = false;
193 
194  // Check extrusion parameters
195  if (_extrude && _mesh_dimensions != 3)
196  paramError("extrude",
197  "In order to extrude this mesh, ReactorMeshParams/dim needs to be set to 3\n");
198  if (_extrude && (!hasReactorParam<boundary_id_type>(RGMB::top_boundary_id) ||
199  !hasReactorParam<boundary_id_type>(RGMB::bottom_boundary_id)))
200  mooseError("Both top_boundary_id and bottom_boundary_id must be provided in ReactorMeshParams "
201  "if using extruded geometry");
202 
203  // Define azimuthal angles explicitly based on num_azimuthal_sectors and manually add pad start
204  // angle and end angle if they are not contained within these angle intervals
205  std::vector<Real> azimuthal_angles;
206  const auto custom_start_angle = _has_pad_region ? _pad_start_angle : 0.;
207  const auto custom_end_angle =
208  _has_pad_region ? ((_pad_end_angle > 360) ? _pad_end_angle - 360. : _pad_end_angle) : 0.;
209  for (unsigned int i = 0; i < num_sectors; ++i)
210  {
211  Real current_azim_angle = (Real)i * 360. / (Real)num_sectors;
212  Real next_azim_angle = (Real)(i + 1) * 360. / (Real)num_sectors;
213  if (!_has_pad_region)
214  azimuthal_angles.push_back(current_azim_angle);
215  else
216  {
217  // When pad regions are involved, check if the current azimuthal node angle coincides with
218  // pad start/end angle to within tolerance. If it does, then shift the azimuthal node location
219  // to match the pad angle location. If it does not and the pad angle falls within the
220  // azimuthal sector, then create an additional node for the pad location
221  if (MooseUtils::absoluteFuzzyLessEqual(std::abs(current_azim_angle - custom_start_angle),
222  azimuthal_node_tolerance))
223  {
224  azimuthal_angles.push_back(custom_start_angle);
225  }
226  else if (MooseUtils::absoluteFuzzyLessEqual(std::abs(current_azim_angle - custom_end_angle),
227  azimuthal_node_tolerance))
228  {
229  azimuthal_angles.push_back(custom_end_angle);
230  }
231  else if (MooseUtils::absoluteFuzzyGreaterThan(custom_start_angle - current_azim_angle,
232  azimuthal_node_tolerance) &&
233  MooseUtils::absoluteFuzzyGreaterThan(next_azim_angle - custom_start_angle,
234  azimuthal_node_tolerance))
235  {
236  mooseWarning("pad_start_angle not contained within drum azimuthal discretization so "
237  "additional azimuthal nodes are created to align mesh with this angle");
238  azimuthal_angles.push_back(current_azim_angle);
239  azimuthal_angles.push_back(custom_start_angle);
240  }
241  else if (MooseUtils::absoluteFuzzyGreaterThan(custom_end_angle - current_azim_angle,
242  azimuthal_node_tolerance) &&
243  MooseUtils::absoluteFuzzyGreaterThan(next_azim_angle - custom_end_angle,
244  azimuthal_node_tolerance))
245  {
246  mooseWarning("pad_end_angle not contained within drum azimuthal discretization so "
247  "additional azimuthal nodes are created to align mesh with this angle");
248  azimuthal_angles.push_back(current_azim_angle);
249  azimuthal_angles.push_back(custom_end_angle);
250  }
251  else
252  azimuthal_angles.push_back(current_azim_angle);
253  }
254  }
255 
256  // Check drum radius parameters
258  paramError("drum_outer_radius", "Drum outer radius must be larger than the inner radius");
259  // Check if volume preserved radius of outer radius exceeds assembly halfpitch. In data driven
260  // mode, radius is assumed not to need volume preservation
261  auto radius_corrfac =
262  getReactorParam<bool>(RGMB::bypass_meshgen)
263  ? 1.0
265  if (_drum_outer_radius * radius_corrfac >= assembly_pitch / 2.)
266  paramError("drum_outer_radius",
267  "Volume-corrected outer radius of drum region must be smaller than half the "
268  "assembly pitch as "
269  "defined by 'ReactorMeshParams/assembly_pitch'");
270 
271  // No subgenerators will be called if option to bypass mesh generators is enabled
272  if (!getReactorParam<bool>(RGMB::bypass_meshgen))
273  {
274  const std::string block_name_prefix =
276 
277  {
278  // Invoke AdvancedConcentricCircleGenerator to define drum mesh without background region
279  auto params = _app.getFactory().getValidParams("AdvancedConcentricCircleGenerator");
280 
281  params.set<std::vector<Real>>("customized_azimuthal_angles") = azimuthal_angles;
282  params.set<std::vector<double>>("ring_radii") = {_drum_inner_radius, _drum_outer_radius};
283  params.set<std::vector<unsigned int>>("ring_intervals") = {drum_inner_intervals,
284  drum_intervals};
285  if (drum_inner_intervals > 1)
286  {
287  params.set<std::vector<subdomain_id_type>>("ring_block_ids") = {
291  params.set<std::vector<SubdomainName>>("ring_block_names") = {
292  block_name_prefix + "_R0_TRI", block_name_prefix + "_R0", block_name_prefix + "_R1"};
293  }
294  else
295  {
296  params.set<std::vector<subdomain_id_type>>("ring_block_ids") = {
298  params.set<std::vector<SubdomainName>>("ring_block_names") = {block_name_prefix + "_R0",
299  block_name_prefix + "_R1"};
300  }
301  params.set<bool>("create_outward_interface_boundaries") = false;
302 
303  addMeshSubgenerator("AdvancedConcentricCircleGenerator", name() + "_accg", params);
304  }
305  {
306  // Invoke FlexiblePatternGenerator to triangulate drum background region
307  auto params = _app.getFactory().getValidParams("FlexiblePatternGenerator");
308 
309  params.set<std::vector<MeshGeneratorName>>("inputs") = {name() + "_accg"};
310  params.set<std::vector<libMesh::Point>>("extra_positions") = {libMesh::Point(0, 0, 0)};
311  params.set<std::vector<unsigned int>>("extra_positions_mg_indices") = {0};
312  params.set<bool>("use_auto_area_func") = true;
313  // `verify_holes` is set to false to prevent false positive instances of points outside of
314  // defined holes, which can create test failures on certain dev environments
315  params.set<bool>("verify_holes") = false;
316  params.set<MooseEnum>("boundary_type") = (_geom_type == "Hex") ? "HEXAGON" : "CARTESIAN";
317  params.set<unsigned int>("boundary_sectors") =
318  getReactorParam<unsigned int>(RGMB::num_sectors_flexible_stitching);
319  params.set<Real>("boundary_size") = assembly_pitch;
320  params.set<boundary_id_type>("external_boundary_id") =
322  params.set<BoundaryName>("external_boundary_name") =
324  params.set<SubdomainName>("background_subdomain_name") = block_name_prefix + "_R2_TRI";
325  params.set<subdomain_id_type>("background_subdomain_id") = RGMB::CONTROL_DRUM_BLOCK_ID_OUTER;
326 
327  addMeshSubgenerator("FlexiblePatternGenerator", name() + "_fpg", params);
328 
329  // Pass mesh meta-data defined in subgenerator constructor to this MeshGenerator
330  copyMeshProperty<bool>("is_control_drum_meta", name() + "_fpg");
331  copyMeshProperty<Real>("pattern_pitch_meta", name() + "_fpg");
332  }
333  std::string build_mesh_name = name() + "_delbds";
334  {
335  // Invoke BoundaryDeletionGenerator to delete extra sidesets created by
336  // AdvancedConcentricCircleGenerator
337  auto params = _app.getFactory().getValidParams("BoundaryDeletionGenerator");
338 
339  params.set<MeshGeneratorName>("input") = name() + "_fpg";
340  params.set<std::vector<BoundaryName>>("boundary_names") = {"0", "2"};
341 
342  addMeshSubgenerator("BoundaryDeletionGenerator", build_mesh_name, params);
343  }
344  if (_extrude && _mesh_dimensions == 3)
345  build_mesh_name = callExtrusionMeshSubgenerators(build_mesh_name);
346 
347  // Store final mesh subgenerator
348  _build_mesh = &getMeshByName(build_mesh_name);
349  }
350 
352 }
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
const bool _extrude
Whether this mesh should be extruded to 3-D, making it the final structure in the reactor mesh...
static const std::string region_id_as_block_name
const SubdomainName DRUM_BLOCK_NAME_PREFIX
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_PAD
T & set(const std::string &name, bool quiet_mode=false)
std::unique_ptr< MeshBase > * _build_mesh
The final mesh that is generated by the subgenerators; This mesh is generated by the subgenerators wi...
static constexpr boundary_id_type ASSEMBLY_BOUNDARY_ID_START
static const std::string mesh_geometry
void initializeReactorMeshParams(const std::string reactor_param_name)
Initializes and checks validity of ReactorMeshParams mesh generator object.
InputParameters getValidParams(const std::string &name) const
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_OUTER
std::string _geom_type
The type of geometry that is being described (Square or Hex, declared in the ReactorMeshParams object...
static const std::string assembly_pitch
virtual const std::string & name() const
void mooseWarning(Args &&... args) const
Factory & getFactory()
bool isParamValid(const std::string &name) const
const T & getReactorParam(const std::string &param_name)
Returns reference of parameter in ReactorMeshParams object.
int8_t boundary_id_type
static const std::string mesh_dimensions
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
MeshGeneratorName callExtrusionMeshSubgenerators(const MeshGeneratorName input_mesh_name)
Calls mesh subgenerators related to extrusion, renaming of top / bottom boundaries, and defining plane IDs.
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...
const T & getParam(const std::string &name) const
bool _has_pad_region
Whether pad start and end angles are provided by user.
static const std::string top_boundary_id
void paramError(const std::string &param, Args... args) const
ReactorGeometryMeshBuilderBase(const InputParameters &parameters)
const Real _drum_outer_radius
The outer radius of drum region.
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_INNER_TRI
bool _has_block_names
Whether block names have been provided by user.
bool isParamSetByUser(const std::string &nm) const
static const std::string flexible_assembly_stitching
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseApp & _app
const subdomain_id_type CONTROL_DRUM_BLOCK_ID_INNER
bool absoluteFuzzyLessEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
static const std::string axial_mesh_intervals
void generateMetadata()
Define metadata associated with ControlDrumMeshGenerator.
bool absoluteFuzzyGreaterEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const subdomain_id_type _assembly_type
The id number for the type of the assembly.
const BoundaryName ASSEMBLY_BOUNDARY_NAME_PREFIX
void mooseError(Args &&... args) const
Real _pad_start_angle
Starting angle of drum pad region.
const InputParameters & parameters() const
static const std::string bypass_meshgen
unsigned int _mesh_dimensions
The number of dimensions the mesh is ultimately going to have (2 or 3, declared in the ReactorMeshPar...
Real radiusCorrectionFactor(const std::vector< Real > &azimuthal_list, const bool full_circle=true, const unsigned int order=1, const bool is_first_value_vertex=true)
Makes radial correction to preserve ring area.
static const std::string num_sectors_flexible_stitching
auto index_range(const T &sizable)
static const std::string bottom_boundary_id
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Real _pad_end_angle
Ending angle of drum pad region.
const Real _drum_inner_radius
The inner radius of drum region.
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...

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 115 of file ReactorGeometryMeshBuilderBase.C.

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

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

◆ addDepletionIDParams()

void ReactorGeometryMeshBuilderBase::addDepletionIDParams ( InputParameters parameters)
staticinherited

Definition at line 32 of file ReactorGeometryMeshBuilderBase.C.

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

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

◆ 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 172 of file ReactorGeometryMeshBuilderBase.C.

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

174 {
175  std::vector<Real> axial_boundaries = getReactorParam<std::vector<Real>>(RGMB::axial_mesh_sizes);
176  const auto top_boundary = getReactorParam<boundary_id_type>(RGMB::top_boundary_id);
177  const auto bottom_boundary = getReactorParam<boundary_id_type>(RGMB::bottom_boundary_id);
178 
179  {
180  auto params = _app.getFactory().getValidParams("AdvancedExtruderGenerator");
181 
182  params.set<MeshGeneratorName>("input") = input_mesh_name;
183  params.set<Point>("direction") = Point(0, 0, 1);
184  params.set<std::vector<unsigned int>>("num_layers") =
185  getReactorParam<std::vector<unsigned int>>(RGMB::axial_mesh_intervals);
186  params.set<std::vector<Real>>("heights") = axial_boundaries;
187  params.set<BoundaryName>("bottom_boundary") = std::to_string(bottom_boundary);
188  params.set<BoundaryName>("top_boundary") = std::to_string(top_boundary);
189  addMeshSubgenerator("AdvancedExtruderGenerator", name() + "_extruded", params);
190  }
191 
192  {
193  auto params = _app.getFactory().getValidParams("RenameBoundaryGenerator");
194 
195  params.set<MeshGeneratorName>("input") = name() + "_extruded";
196  params.set<std::vector<BoundaryName>>("old_boundary") = {
197  std::to_string(top_boundary),
198  std::to_string(bottom_boundary)}; // hard coded boundary IDs in patterned mesh generator
199  params.set<std::vector<BoundaryName>>("new_boundary") = {"top", "bottom"};
200  addMeshSubgenerator("RenameBoundaryGenerator", name() + "_change_plane_name", params);
201  }
202 
203  const MeshGeneratorName output_mesh_name = name() + "_extrudedIDs";
204  {
205  auto params = _app.getFactory().getValidParams("PlaneIDMeshGenerator");
206 
207  params.set<MeshGeneratorName>("input") = name() + "_change_plane_name";
208 
209  std::vector<Real> plane_heights{0};
210  for (Real z : axial_boundaries)
211  plane_heights.push_back(z + plane_heights.back());
212 
213  params.set<std::vector<Real>>("plane_coordinates") = plane_heights;
214 
215  std::string plane_id_name = "plane_id";
216  params.set<std::string>("id_name") = "plane_id";
217 
218  addMeshSubgenerator("PlaneIDMeshGenerator", output_mesh_name, params);
219  }
220 
221  return output_mesh_name;
222 }
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
static const std::string axial_mesh_sizes
virtual const std::string & name() const
Factory & getFactory()
const T & getReactorParam(const std::string &param_name)
Returns reference of parameter in ReactorMeshParams object.
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
static const std::string top_boundary_id
MooseApp & _app
static const std::string axial_mesh_intervals
static const std::string bottom_boundary_id

◆ freeReactorMeshParams()

void ReactorGeometryMeshBuilderBase::freeReactorMeshParams ( )
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 68 of file ReactorGeometryMeshBuilderBase.C.

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

69 {
70  _reactor_params_mesh->reset();
71 }
std::unique_ptr< MeshBase > * _reactor_params_mesh
The dummy param mesh that we need to clear once we&#39;ve generated (in freeReactorMeshParams) ...

◆ generate()

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

Implements MeshGenerator.

Definition at line 374 of file ControlDrumMeshGenerator.C.

375 {
376  // Must be called to free the ReactorMeshParams mesh
378 
379  // If bypass_mesh is true, return a null mesh. In this mode, an output mesh is not
380  // generated and only metadata is defined on the generator, so logic related to
381  // generation of output mesh will not be called
382  if (getReactorParam<bool>(RGMB::bypass_meshgen))
383  {
384  auto null_mesh = nullptr;
385  return null_mesh;
386  }
387 
388  // This generate() method will be called once the subgenerators that we depend on are
389  // called. This is where we reassign subdomain ids/name in case they were merged when
390  // stitching pins into an assembly. This is also where we set region_id and
391  // assembly_type_id element integers.
392 
393  // Define all extra element names and integers
394  std::string plane_id_name = "plane_id";
395  std::string region_id_name = "region_id";
396  std::string pin_type_id_name = "pin_type_id";
397  std::string assembly_type_id_name = "assembly_type_id";
398  const std::string default_block_name =
400 
401  auto pin_type_id_int = getElemIntegerFromMesh(*(*_build_mesh), pin_type_id_name);
402  auto region_id_int = getElemIntegerFromMesh(*(*_build_mesh), region_id_name);
403  auto assembly_type_id_int = getElemIntegerFromMesh(*(*_build_mesh), assembly_type_id_name);
404 
405  unsigned int plane_id_int = 0;
406  if (_extrude)
407  plane_id_int = getElemIntegerFromMesh(*(*_build_mesh), plane_id_name, true);
408 
409  // Get next free block ID in mesh in case subdomain ids need to be remapped
410  auto next_block_id = MooseMeshUtils::getNextFreeSubdomainID(*(*(_build_mesh)));
411  std::map<std::string, SubdomainID> rgmb_name_id_map;
412 
413  // Loop through all mesh elements and set region ids and reassign block IDs/names
414  // if they were merged during pin stitching
415  for (auto & elem : (*_build_mesh)->active_element_ptr_range())
416  {
417  elem->set_extra_integer(assembly_type_id_int, _assembly_type);
418  const dof_id_type z_id = _extrude ? elem->get_extra_integer(plane_id_int) : 0;
419 
420  // Assembly peripheral element (background / duct), set subdomains according
421  // to user preferences and set pin type id to RGMB::MAX_PIN_TYPE_ID - peripheral index
422  // Region id is inferred from z_id and peripheral_idx
423  const auto base_block_id = elem->subdomain_id();
424  const auto base_block_name = (*_build_mesh)->subdomain_name(base_block_id);
425 
426  // Check if block name has correct prefix
427  std::string prefix = RGMB::DRUM_BLOCK_NAME_PREFIX + std::to_string(_assembly_type) + "_R";
428  if (!(base_block_name.find(prefix, 0) == 0))
429  continue;
430 
431  // Radial index is integer value of substring after prefix
432  const unsigned int radial_idx = std::stoi(base_block_name.substr(prefix.length()));
433 
434  // Drum index distinguishes between elements in pad and ex-pad regions that have the same radial
435  // index
436  const unsigned int drum_idx =
437  getDrumIdxFromRadialIdx(radial_idx, elem->true_centroid()(0), elem->true_centroid()(1));
439  elem->set_extra_integer(pin_type_id_int, pin_type);
440 
441  const auto elem_rid = _region_ids[z_id][drum_idx];
442  elem->set_extra_integer(region_id_int, elem_rid);
443 
444  // Set element block name and block id
445  auto elem_block_name = default_block_name;
446  if (getReactorParam<bool>(RGMB::region_id_as_block_name))
447  elem_block_name += "_REG" + std::to_string(elem_rid);
448  else if (_has_block_names)
449  elem_block_name += "_" + _block_names[z_id][drum_idx];
450  if (elem->type() == TRI3 || elem->type() == PRISM6)
451  elem_block_name += RGMB::TRI_BLOCK_NAME_SUFFIX;
453  *(*_build_mesh), elem, rgmb_name_id_map, elem_block_name, next_block_id);
454  }
455 
456  if (getParam<bool>("generate_depletion_id"))
457  {
458  const MooseEnum option = getParam<MooseEnum>("depletion_id_type");
460  }
461 
462  // Mark mesh as not prepared, as block ID's were re-assigned in this method
463  (*_build_mesh)->set_isnt_prepared();
464 
465  return std::move(*_build_mesh);
466 }
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...
const bool _extrude
Whether this mesh should be extruded to 3-D, making it the final structure in the reactor mesh...
static const std::string region_id_as_block_name
const SubdomainName DRUM_BLOCK_NAME_PREFIX
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...
std::unique_ptr< MeshBase > * _build_mesh
The final mesh that is generated by the subgenerators; This mesh is generated by the subgenerators wi...
void addDepletionId(MeshBase &input_mesh, const MooseEnum &option, const DepletionIDGenerationLevel generation_level, const bool extrude)
add depletion IDs
static const std::string pin_type
const SubdomainName TRI_BLOCK_NAME_SUFFIX
TRI3
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...
bool _has_block_names
Whether block names have been provided by user.
unsigned int getDrumIdxFromRadialIdx(const unsigned int radial_idx, const Real elem_x, const Real elem_y)
Get drum index from radial index of mesh element, drum index is used to retrieve region ID and block ...
const subdomain_id_type _assembly_type
The id number for the type of the assembly.
void freeReactorMeshParams()
Releases the mesh obtained in _reactor_params_mesh.
static const std::string bypass_meshgen
PRISM6
SubdomainID getNextFreeSubdomainID(MeshBase &input_mesh)
const subdomain_id_type MAX_PIN_TYPE_ID
uint8_t dof_id_type
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...

◆ generateData()

void ReactorGeometryMeshBuilderBase::generateData ( )
inlineoverridevirtualinherited

Reimplemented from MeshGenerator.

Definition at line 116 of file ReactorGeometryMeshBuilderBase.h.

116 {};

◆ generateMetadata()

void ControlDrumMeshGenerator::generateMetadata ( )
protected

Define metadata associated with ControlDrumMeshGenerator.

Definition at line 355 of file ControlDrumMeshGenerator.C.

Referenced by ControlDrumMeshGenerator().

356 {
357  // Declare metadata for use in downstream mesh generators
359  declareMeshProperty(RGMB::pitch, getReactorParam<Real>(RGMB::assembly_pitch));
364  std::vector<Real> drum_pad_angles =
365  _has_pad_region ? std::vector<Real>({_pad_start_angle, _pad_end_angle}) : std::vector<Real>();
367  std::vector<Real> drum_radii = std::vector<Real>({_drum_inner_radius, _drum_outer_radius});
371 }
static const std::string drum_radii
static const std::string assembly_type
const bool _extrude
Whether this mesh should be extruded to 3-D, making it the final structure in the reactor mesh...
static const std::string is_single_pin
static const std::string assembly_pitch
static const std::string drum_block_names
static const std::string extruded
static const std::string drum_pad_angles
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...
static const std::string pitch
bool _has_pad_region
Whether pad start and end angles are provided by user.
const Real _drum_outer_radius
The outer radius of drum region.
static const std::string is_homogenized
static const std::string is_control_drum
const subdomain_id_type _assembly_type
The id number for the type of the assembly.
Real _pad_start_angle
Starting angle of drum pad region.
T & declareMeshProperty(const std::string &data_name, Args &&... args)
static const std::string drum_region_ids
unsigned int _mesh_dimensions
The number of dimensions the mesh is ultimately going to have (2 or 3, declared in the ReactorMeshPar...
Real _pad_end_angle
Ending angle of drum pad region.
const Real _drum_inner_radius
The inner radius of drum region.
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...

◆ getDrumIdxFromRadialIdx()

unsigned int ControlDrumMeshGenerator::getDrumIdxFromRadialIdx ( const unsigned int  radial_idx,
const Real  elem_x,
const Real  elem_y 
)
protected

Get drum index from radial index of mesh element, drum index is used to retrieve region ID and block names for each element.

Definition at line 469 of file ControlDrumMeshGenerator.C.

Referenced by generate().

472 {
473  // By default, drum index will match radial index unless a pad region is defined
474  unsigned int drum_idx = radial_idx;
475  if (_has_pad_region)
476  {
477  if (radial_idx == 1)
478  {
479  // This is an element in the drum region, use drum angle to determine whether it belongs to
480  // pad or ex-pad region Note: drum angle of 0 degrees starts in positive y-direction and
481  // increments in clockwise direction, which is consistent
482  // with how AdvancedConcentricCircleMeshGenerator defines azimuthal angles
483  Real drum_angle = std::atan2(elem_x, elem_y) * 180. / M_PI;
484  if (drum_angle < 0)
485  drum_angle += 360;
486 
487  // If _pad_end_angle does not exceed 360 degrees, check if drum angle lies within
488  // _pad_start_angle and _pad_end_angle. Drum index needs to be incremented if element in
489  // ex-pad region
490  if (_pad_end_angle <= 360)
491  {
492  if ((drum_angle < _pad_start_angle) || (drum_angle > _pad_end_angle))
493  ++drum_idx;
494  }
495  else
496  {
497  // If _pad_end_angle exceeds 360 degrees, check two intervals - _pad_start_angle to 360, and
498  // 0 to _pad_end_angle - 360 Drum index needs to be incremented if element in ex-pad region
499  if ((drum_angle < _pad_start_angle) && (drum_angle > _pad_end_angle - 360.))
500  ++drum_idx;
501  }
502  }
503  else if (radial_idx == 2)
504  {
505  // Element is in outer drum region, drum index needs to be incremented to account for presence
506  // of ex-pad region
507  ++drum_idx;
508  }
509  }
510  return drum_idx;
511 }
bool _has_pad_region
Whether pad start and end angles are provided by user.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real _pad_start_angle
Starting angle of drum pad region.
Real _pad_end_angle
Ending angle of drum pad region.

◆ 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 74 of file ReactorGeometryMeshBuilderBase.C.

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

77 {
78  if (input_mesh.has_elem_integer(extra_int_name))
79  return input_mesh.get_elem_integer_index(extra_int_name);
80  else
81  {
82  if (should_exist)
83  mooseError("Expected extruded mesh to have " + extra_int_name + " extra integers");
84  else
85  return input_mesh.add_elem_integer(extra_int_name);
86  }
87 }
void mooseError(Args &&... args) const

◆ 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 284 of file ReactorGeometryMeshBuilderBase.h.

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

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

◆ 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 277 of file ReactorGeometryMeshBuilderBase.h.

278 {
279  return hasMeshProperty<T>(param_name, _reactor_params);
280 }
MeshGeneratorName _reactor_params
The ReactorMeshParams object that is storing the reactor global information for this reactor geometry...

◆ 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 49 of file ReactorGeometryMeshBuilderBase.C.

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

50 {
51  _reactor_params = reactor_param_name;
52 
53  // Ensure that the user has supplied a valid ReactorMeshParams object
54  _reactor_params_mesh = &getMeshByName(reactor_param_name);
56  mooseError("The reactor_params mesh is not of the correct type");
57 
58  if (!hasMeshProperty<unsigned int>("mesh_dimensions", _reactor_params) ||
59  !hasMeshProperty<std::string>("mesh_geometry", _reactor_params))
60  mooseError("The reactor_params input must be a ReactorMeshParams type MeshGenerator\n Please "
61  "check that a valid definition and name of ReactorMeshParams has been provided.");
62 
63  // Set reactor_params_name metadata for use by future mesh generators
64  declareMeshProperty("reactor_params_name", std::string(_reactor_params));
65 }
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
std::unique_ptr< MeshBase > * _reactor_params_mesh
The dummy param mesh that we need to clear once we&#39;ve generated (in freeReactorMeshParams) ...
MeshGeneratorName _reactor_params
The ReactorMeshParams object that is storing the reactor global information for this reactor geometry...
void mooseError(Args &&... args) const
T & declareMeshProperty(const std::string &data_name, Args &&... args)

◆ 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 90 of file ReactorGeometryMeshBuilderBase.C.

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

96 {
97  SubdomainID elem_block_id;
98  if (name_id_map.find(elem_block_name) == name_id_map.end())
99  {
100  // Block name does not exist in mesh yet, assign new block id and name
101  elem_block_id = next_free_id++;
102  elem->subdomain_id() = elem_block_id;
103  input_mesh.subdomain_name(elem_block_id) = elem_block_name;
104  name_id_map[elem_block_name] = elem_block_id;
105  }
106  else
107  {
108  // Block name exists in mesh, reuse block id
109  elem_block_id = name_id_map[elem_block_name];
110  elem->subdomain_id() = elem_block_id;
111  }
112 }

◆ validParams()

InputParameters ControlDrumMeshGenerator::validParams ( )
static

Definition at line 23 of file ControlDrumMeshGenerator.C.

24 {
26 
27  params.addRequiredParam<MeshGeneratorName>(
28  "reactor_params",
29  "The ReactorMeshParams MeshGenerator that is the basis for this component mesh.");
30  params.addRequiredParam<subdomain_id_type>(
31  "assembly_type",
32  "The assembly type integer ID to use for this control drum definition. "
33  "This parameter should be uniquely defined for each ControlDrumMeshGenerator "
34  "and AssemblyMeshGenerator structure in the RGMB workflow.");
35  params.addParam<bool>("extrude",
36  false,
37  "Determines if this is the final step in the geometry construction"
38  " and extrudes the 2D geometry to 3D. If this is true then this mesh "
39  "cannot be used in further mesh building in the Reactor workflow");
40  params.addRequiredRangeCheckedParam<Real>(
41  "drum_inner_radius", "drum_inner_radius>0", "Inner radius of drum region");
42  params.addRequiredRangeCheckedParam<Real>(
43  "drum_outer_radius", "drum_outer_radius>0", "Outer radius of drum region");
44  params.addRangeCheckedParam<unsigned int>(
45  "drum_inner_intervals",
46  1,
47  "drum_inner_intervals>0",
48  "Number of radial mesh intervals in region up to inner drum radius");
49  params.addRangeCheckedParam<unsigned int>(
50  "drum_intervals", 1, "drum_intervals>0", "Number of radial mesh intervals in drum region");
51  params.addRangeCheckedParam<Real>("pad_start_angle",
52  "pad_start_angle>=0 & pad_start_angle < 360",
53  "Starting angle of drum pad region");
54  params.addRangeCheckedParam<Real>(
55  "pad_end_angle", "pad_end_angle>0 & pad_end_angle < 720", "Ending angle of drum pad region");
56  params.addRequiredRangeCheckedParam<unsigned int>(
57  "num_azimuthal_sectors",
58  "num_azimuthal_sectors>2",
59  "Number of azimuthal sectors to sub-divide the drum region into");
60  params.addRequiredParam<std::vector<std::vector<subdomain_id_type>>>(
61  "region_ids",
62  "IDs for each radial and axial zone for assignment of region_id extra element "
63  "id. "
64  "Inner indexing is radial zones (drum inner/drum/drum outer), outer indexing is axial");
65  params.addParam<std::vector<std::vector<std::string>>>(
66  "block_names",
67  "Block names for each radial and axial zone. "
68  "Inner indexing is radial zones (drum inner/drum/drum outer), outer indexing is axial");
69  params.addParam<Real>("azimuthal_node_tolerance",
70  0.1,
71  "(in degrees) The absolute tolerance for which to shift an azimuthal node "
72  "to match the pad start/end angles");
73 
74  params.addParamNamesToGroup("region_ids assembly_type", "ID assigment");
75  params.addParamNamesToGroup("drum_inner_radius drum_outer_radius drum_inner_intervals "
76  "drum_intervals num_azimuthal_sectors",
77  "Drum specifications");
78  params.addParamNamesToGroup("pad_start_angle pad_end_angle azimuthal_node_tolerance",
79  "Control pad specifications");
80 
81  params.addClassDescription(
82  "This ControlDrumMeshGenerator object is designed to generate "
83  "drum-like structures, with IDs, from a reactor geometry. "
84  "These structures can be used directly within CoreMeshGenerator to stitch"
85  "control drums into a core lattice alongside AssemblyMeshGenerator structures");
86  // depletion id generation params are added
87  addDepletionIDParams(params);
88 
89  return params;
90 }
static void addDepletionIDParams(InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Member Data Documentation

◆ _assembly_type

const subdomain_id_type ControlDrumMeshGenerator::_assembly_type
protected

The id number for the type of the assembly.

Definition at line 42 of file ControlDrumMeshGenerator.h.

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

◆ _block_names

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

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

Definition at line 60 of file ControlDrumMeshGenerator.h.

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

◆ _build_mesh

std::unique_ptr<MeshBase>* ControlDrumMeshGenerator::_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 73 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), and generate().

◆ _drum_inner_radius

const Real ControlDrumMeshGenerator::_drum_inner_radius
protected

The inner radius of drum region.

Definition at line 45 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), and generateMetadata().

◆ _drum_outer_radius

const Real ControlDrumMeshGenerator::_drum_outer_radius
protected

The outer radius of drum region.

Definition at line 48 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), and generateMetadata().

◆ _extrude

const bool ControlDrumMeshGenerator::_extrude
protected

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

Definition at line 51 of file ControlDrumMeshGenerator.h.

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

◆ _geom_type

std::string ControlDrumMeshGenerator::_geom_type
protected

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

Definition at line 36 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator().

◆ _has_block_names

bool ControlDrumMeshGenerator::_has_block_names
protected

Whether block names have been provided by user.

Definition at line 57 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), and generate().

◆ _has_pad_region

bool ControlDrumMeshGenerator::_has_pad_region
protected

Whether pad start and end angles are provided by user.

Definition at line 69 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), generateMetadata(), and getDrumIdxFromRadialIdx().

◆ _mesh_dimensions

unsigned int ControlDrumMeshGenerator::_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 39 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), and generateMetadata().

◆ _pad_end_angle

Real ControlDrumMeshGenerator::_pad_end_angle
protected

Ending angle of drum pad region.

Definition at line 66 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), generateMetadata(), and getDrumIdxFromRadialIdx().

◆ _pad_start_angle

Real ControlDrumMeshGenerator::_pad_start_angle
protected

Starting angle of drum pad region.

Definition at line 63 of file ControlDrumMeshGenerator.h.

Referenced by ControlDrumMeshGenerator(), generateMetadata(), and getDrumIdxFromRadialIdx().

◆ _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 247 of file ReactorGeometryMeshBuilderBase.h.

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

◆ _region_ids

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

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

Definition at line 54 of file ControlDrumMeshGenerator.h.

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


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