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
ReactorGeometryMeshBuilderBase Class Referenceabstract

A base class that contains common members for Reactor Geometry Mesh Builder mesh generators. More...

#include <ReactorGeometryMeshBuilderBase.h>

Inheritance diagram for ReactorGeometryMeshBuilderBase:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 ReactorGeometryMeshBuilderBase (const InputParameters &parameters)
 
void generateData () override
 
virtual std::unique_ptr< MeshBase > generate ()=0
 
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

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.
 
virtual std::unique_ptr< CSG::CSGBasegenerateCSG ()
 
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

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

A base class that contains common members for Reactor Geometry Mesh Builder mesh generators.

Definition at line 110 of file ReactorGeometryMeshBuilderBase.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

◆ ReactorGeometryMeshBuilderBase()

ReactorGeometryMeshBuilderBase::ReactorGeometryMeshBuilderBase ( const InputParameters parameters)

Definition at line 46 of file ReactorGeometryMeshBuilderBase.C.

48{
49}
const InputParameters & parameters() const

Member Function Documentation

◆ addDepletionId()

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

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}
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
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)
static

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)
protected

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}
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)
Factory & getFactory()
const std::string & name() const
MooseApp & _app
const T & getReactorParam(const std::string &param_name)
Returns reference of parameter in ReactorMeshParams object.
static const std::string bottom_boundary_id
static const std::string top_boundary_id
static const std::string axial_mesh_sizes
static const std::string axial_mesh_intervals

Referenced by AssemblyMeshGenerator::AssemblyMeshGenerator(), ControlDrumMeshGenerator::ControlDrumMeshGenerator(), CoreMeshGenerator::CoreMeshGenerator(), and PinMeshGenerator::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 
)
protected

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)
static const std::string mesh_geometry

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

◆ freeReactorParamsCSG()

void ReactorGeometryMeshBuilderBase::freeReactorParamsCSG ( )
protected

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 PinMeshGenerator::generateCSG().

◆ freeReactorParamsMesh()

void ReactorGeometryMeshBuilderBase::freeReactorParamsMesh ( )
protected

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 PinMeshGenerator::generate().

◆ generateData()

void ReactorGeometryMeshBuilderBase::generateData ( )
inlineoverridevirtual

Reimplemented from MeshGenerator.

Definition at line 119 of file ReactorGeometryMeshBuilderBase.h.

119{};

◆ getAxialPlaneSurfaces()

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

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
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)

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

◆ getElemIntegerFromMesh()

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

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 PinMeshGenerator::generate().

◆ getOuterRadialSurfacesForUnitCell()

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

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 PinMeshGenerator::generateCSG().

◆ getReactorParam()

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

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(), callExtrusionMeshSubgenerators(), ControlDrumMeshGenerator::ControlDrumMeshGenerator(), PinMeshGenerator::generateMetadata(), and PinMeshGenerator::PinMeshGenerator().

◆ hasReactorParam()

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

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)
protected

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< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
std::unique_ptr< CSG::CSGBase > & getCSGBaseByName(const MeshGeneratorName &mesh_generator_name)
T & declareMeshProperty(const std::string &data_name, Args &&... args)
MeshGeneratorSystem & getMeshGeneratorSystem()

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

◆ print2dMetadataToConsole()

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

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 
)
protected

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 
)
protected

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 ( )
protected

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 
)
protected

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)
protected

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 
)
protected

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 
)
protected

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 PinMeshGenerator::generate().

◆ validParams()

InputParameters ReactorGeometryMeshBuilderBase::validParams ( )
static

Definition at line 18 of file ReactorGeometryMeshBuilderBase.C.

19{
21
22 params.addDeprecatedParam<bool>("show_rgmb_metadata",
23 "Print out RGMB-related metadata to console output",
24 "This parameter is deprecated. Please use MeshMetaDataReporter "
25 "system to print out mesh metadata to JSON output file instead");
26 params.addClassDescription("A base class that contains common members and methods for Reactor "
27 "Geometry Mesh Builder mesh generators.");
28
29 // Declare that this generator has a generateData method
31 return params;
32}
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
static void setHasGenerateData(InputParameters &params)

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

Member Data Documentation

◆ _reactor_params

MeshGeneratorName ReactorGeometryMeshBuilderBase::_reactor_params
protected

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 getReactorParam(), hasReactorParam(), and initializeReactorMeshParams().

◆ _reactor_params_csg

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

◆ _reactor_params_mesh

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

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 freeReactorParamsMesh(), and initializeReactorMeshParams().


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