21 MooseEnum element_type(
"TRI QUAD HYBRID",
"TRI");
24 "Whether the simple hexagon mesh is made of TRI or QUAD elements.");
26 "hexagon_size",
"hexagon_size>0.0",
"Size of the hexagon to be generated.");
27 MooseEnum hexagon_size_style(
"apothem radius",
"apothem");
31 "Style in which the hexagon size is given (default: apothem i.e. half-pitch). Option: " +
32 hexagon_size_style.getRawNames());
36 "Number of pin radial meshing rings (only applicable when 'element_type' is 'HYBRID').");
40 "Optional customized block id; two ids are needed for HYBRID 'element_type'.");
41 params.
addParam<std::vector<SubdomainName>>(
43 "Optional customized block name; two names are needed for HYBRID 'element_type'.");
45 "external_boundary_id>=0",
46 "Optional customized external boundary id.");
47 params.
addParam<BoundaryName>(
"external_boundary_name",
48 "Optional customized external boundary name.");
50 "Customized Subdomain/Boundary");
52 "This SimpleHexagonGenerator object is designed to generate a simple hexagonal mesh that "
53 "only contains six simple azimuthal triangular elements, two quadrilateral elements, or six "
54 "central azimuthal triangular elements plus a several layers of quadrilateral elements.");
62 _hexagon_size(getParam<Real>(
"hexagon_size")),
65 _radial_intervals(isParamValid(
"radial_intervals")
66 ? getParam<unsigned
int>(
"radial_intervals")
67 : (_element_type ==
ElemType::HYBRID ? 2 : 1)),
68 _block_id(isParamValid(
"block_id") ? getParam<
std::vector<subdomain_id_type>>(
"block_id")
69 :
std::vector<subdomain_id_type>()),
70 _block_name(isParamValid(
"block_name") ? getParam<
std::vector<SubdomainName>>(
"block_name")
71 :
std::vector<SubdomainName>()),
72 _boundary_id_valid(isParamValid(
"external_boundary_id")),
73 _external_boundary_id(isParamValid(
"external_boundary_id")
74 ? getParam<boundary_id_type>(
"external_boundary_id")
76 _external_boundary_name(isParamValid(
"external_boundary_name")
77 ? getParam<BoundaryName>(
"external_boundary_name")
83 "A non-unity 'radial_intervals' value is only supported when 'element_type' is 'HYBRID'.");
90 "if provided, the size of this parameter must be one if 'element_type' is TRI or QUAD.");
93 "if provided, the size of this parameter must be two if 'element_type' is HYBRID.");
95 paramError(
"block_name",
"if provided, this parameter must have the same size as 'block_id'.");
96 declareMeshProperty<unsigned int>(
"background_intervals_meta",
_radial_intervals);
97 declareMeshProperty<dof_id_type>(
"node_id_background_meta",
99 declareMeshProperty<Real>(
"max_radius_meta", 0.0);
100 declareMeshProperty<std::vector<unsigned int>>(
"num_sectors_per_side_meta", {1, 1, 1, 1, 1, 1});
101 declareMeshProperty<Real>(
"pitch_meta",
_pitch);
104std::unique_ptr<MeshBase>
109 BoundaryInfo & boundary_info =
mesh->get_boundary_info();
120 Point center_p = Point(0.0, 0.0, 0.0);
146 Elem * elem =
mesh->add_elem(
new Quad4);
156 elem->subdomain_id() = 2;
162 Elem * elem =
mesh->add_elem(
new Tri3);
172 elem->subdomain_id() = 1;
179 Elem * elem =
mesh->add_elem(
new Quad4);
180 elem->set_node(0, nodes[i * 3]);
182 elem->set_node(2, nodes[i * 3 + 2]);
183 elem->set_node(3, nodes[i * 3 + 1]);
190 elem->subdomain_id() = 1;
195 for (
const auto & elem :
mesh->active_element_ptr_range())
197 if (elem->subdomain_id() == 1)
198 elem->subdomain_id() =
_block_id.front();
203 for (
unsigned int i = 0; i <
_block_name.size(); i++)
210 mesh->get_boundary_info().sideset_name(
213 mesh->get_boundary_info().nodeset_name(
218 mesh->prepare_for_use();
219 return dynamic_pointer_cast<MeshBase>(
mesh);
registerMooseObject("ReactorApp", SimpleHexagonGenerator)
void ErrorVector unsigned int
std::unique_ptr< ReplicatedMesh > buildReplicatedMesh(unsigned int dim=libMesh::invalid_uint)
void paramError(const std::string ¶m, Args... args) const
A base class that contains common members for Reactor module mesh generators.
PolygonSizeStyle
An enum class for style of input polygon size.
static InputParameters validParams()
This SimpleHexagonGenerator object is designed to generate a simple hexagonal mesh that only contains...
enum SimpleHexagonGenerator::ElemType _element_type
ElemType
Type of elements to build the mesh.
const bool _boundary_id_valid
Whether external_boundary_id is provided.
Real _pitch
Pitch size of the hexagon.
const PolygonSizeStyle _hexagon_size_style
Style of the size parameter.
const boundary_id_type _external_boundary_id
Boundary ID of the external boundary.
const Real _hexagon_size
Size parameter of the hexagon.
SimpleHexagonGenerator(const InputParameters ¶meters)
static InputParameters validParams()
std::unique_ptr< MeshBase > generate() override
const unsigned int _radial_intervals
Number of radial meshing intervals.
const BoundaryName _external_boundary_name
Boundary Name of the external boundary.
const std::vector< subdomain_id_type > _block_id
Subdomain ID of the mesh.
const std::vector< SubdomainName > _block_name
Subdomain Name of the mesh.