182 _input_names(getParam<
std::vector<MeshGeneratorName>>(
"inputs")),
183 _boundary_type(getParam<
MooseEnum>(
"boundary_type").template getEnum<
BdryType>()),
184 _boundary_mesh_name(isParamValid(
"boundary_mesh") ? getParam<MeshGeneratorName>(
"boundary_mesh")
185 : MeshGeneratorName()),
186 _boundary_sectors(isParamValid(
"boundary_sectors") ? getParam<unsigned
int>(
"boundary_sectors")
188 _boundary_size(isParamValid(
"boundary_size") ? getParam<Real>(
"boundary_size") : 0.0),
190 isParamValid(
"hex_patterns")
191 ? getParam<
std::vector<
std::vector<
std::vector<unsigned
int>>>>(
"hex_patterns")
192 :
std::vector<
std::vector<
std::vector<unsigned
int>>>()),
193 _hex_pitches(isParamValid(
"hex_pitches") ? getParam<
std::vector<Real>>(
"hex_pitches")
194 :
std::vector<Real>()),
195 _hex_origins(isParamValid(
"hex_origins")
196 ? getParam<
std::vector<Point>>(
"hex_origins")
197 :
std::vector<Point>(_hex_patterns.size(), Point(0.0, 0.0, 0.0))),
198 _hex_rotations(isParamValid(
"hex_rotations") ? getParam<
std::vector<Real>>(
"hex_rotations")
199 :
std::vector<Real>(_hex_patterns.size(), 0.0)),
201 isParamValid(
"rect_patterns")
202 ? getParam<
std::vector<
std::vector<
std::vector<unsigned
int>>>>(
"rect_patterns")
203 :
std::vector<
std::vector<
std::vector<unsigned
int>>>()),
204 _rect_pitches_x(isParamValid(
"rect_pitches_x") ? getParam<
std::vector<Real>>(
"rect_pitches_x")
205 :
std::vector<Real>()),
206 _rect_pitches_y(isParamValid(
"rect_pitches_y") ? getParam<
std::vector<Real>>(
"rect_pitches_y")
207 :
std::vector<Real>()),
208 _rect_origins(isParamValid(
"rect_origins")
209 ? getParam<
std::vector<Point>>(
"rect_origins")
210 :
std::vector<Point>(_rect_patterns.size(), Point(0.0, 0.0, 0.0))),
211 _rect_rotations(isParamValid(
"rect_rotations") ? getParam<
std::vector<Real>>(
"rect_rotations")
212 :
std::vector<Real>(_rect_patterns.size(), 0.0)),
213 _circ_patterns(isParamValid(
"circular_patterns")
214 ? getParam<
std::vector<
std::vector<unsigned
int>>>(
"circular_patterns")
215 :
std::vector<
std::vector<unsigned
int>>()),
216 _circ_radii(isParamValid(
"circular_radii") ? getParam<
std::vector<Real>>(
"circular_radii")
217 :
std::vector<Real>()),
218 _circ_origins(isParamValid(
"circular_origins")
219 ? getParam<
std::vector<Point>>(
"circular_origins")
220 :
std::vector<Point>(_circ_patterns.size(), Point(0.0, 0.0, 0.0))),
221 _circ_rotations(isParamValid(
"circular_rotations")
222 ? getParam<
std::vector<Real>>(
"circular_rotations")
223 :
std::vector<Real>(_circ_patterns.size(), 0.0)),
224 _background_subdomain_id(isParamValid(
"background_subdomain_id")
225 ? getParam<subdomain_id_type>(
"background_subdomain_id")
226 :
Moose::INVALID_BLOCK_ID),
227 _background_subdomain_name(isParamValid(
"background_subdomain_name")
228 ? getParam<SubdomainName>(
"background_subdomain_name")
230 _delete_default_external_boundary_from_inputs(
231 getParam<bool>(
"delete_default_external_boundary_from_inputs")),
232 _cell_id_name(isParamValid(
"cell_id_name") ? getParam<ExtraElementIDName>(
"cell_id_name")
233 : ExtraElementIDName()),
234 _cell_id_shift(getParam<dof_id_type>(
"cell_id_shift")),
235 _pattern_id_name(isParamValid(
"pattern_id_name")
236 ? getParam<ExtraElementIDName>(
"pattern_id_name")
237 : ExtraElementIDName()),
238 _pattern_id_shift(getParam<dof_id_type>(
"pattern_id_shift")),
239 _external_boundary_id(isParamValid(
"external_boundary_id")
240 ? getParam<boundary_id_type>(
"external_boundary_id")
241 : (boundary_id_type)OUTER_SIDESET_ID),
242 _external_boundary_name(isParamValid(
"external_boundary_name")
243 ? getParam<BoundaryName>(
"external_boundary_name")
250 paramError(
"cell_id_name",
"This parameter must be non empty if provided.");
252 paramError(
"cell_id_name",
"This parameter must be provided if cell_id_shift is set.");
254 paramError(
"pattern_id_name",
"This parameter must be non empty if provided.");
256 paramError(
"pattern_id_name",
"This parameter must be provided if pattern_id_shift is set.");
258 const std::vector<Point> extra_positions(
getParam<std::vector<Point>>(
"extra_positions"));
259 const std::vector<unsigned int> extra_positions_mg_indices(
260 getParam<std::vector<unsigned int>>(
"extra_positions_mg_indices"));
261 if (extra_positions.size() != extra_positions_mg_indices.size())
263 "This parameter must have the same size as extra_positions.");
264 std::vector<unsigned int> input_usage_count(
_input_names.size(), 0);
265 for (
unsigned int i = 0; i < extra_positions.size(); i++)
267 if (extra_positions_mg_indices[i] >=
_input_names.size())
269 "the index used for extra positions must be available in 'inputs'.");
270 input_usage_count[extra_positions_mg_indices[i]]++;
271 _positions.push_back(std::make_pair(extra_positions[i], extra_positions_mg_indices[i]));
276 "This parameter must be provided if background_subdomain_name is provided.");
281 paramError(
"boundary_mesh",
"boundary_mesh must be specified for CUSTOM boundary_type.");
285 "this parameter should not be provided for CUSTOM boundary_type.");
288 "this parameter should not be provided for CUSTOM boundary_type.");
294 "this parameter should not be provided for non-CUSTOM "
298 "this parameter must be provided for non-CUSTOM "
301 paramError(
"boundary_size",
"this parameter must be provided for non-CUSTOM boundary_type.");
308 params.
set<
bool>(
"loop") =
true;
310 params.set<std::vector<Point>>(
"points") = {
325 params.
set<
bool>(
"loop") =
true;
327 params.set<std::vector<Point>>(
"points") = {
341 params.
set<
bool>(
"loop") =
true;
342 params.set<
unsigned int>(
"num_edges_between_points") = 1;
346 std::vector<Point> circular_points;
350 circular_points.push_back(Point(
_boundary_size * corr_factor * std::cos(angle) / 2.0,
354 params.set<std::vector<Point>>(
"points") = circular_points;
360 declareMeshProperty<bool>(
"is_control_drum_meta",
false);
366 "The length of this parameter must be the same as that of hex_patterns.");
370 "if provided, the length of this parameter must be the same as that of hex_patterns.");
374 "if provided, the length of this parameter must be the same as that of hex_patterns.");
375 std::vector<Point> hex_positions;
378 unsigned int hex_index = 0;
381 const unsigned int n_hex_pattern_layers = hex_pattern.size();
382 if (n_hex_pattern_layers % 2 == 0)
384 "The length (layer number) of each element of this parameter must be odd to "
385 "ensure hexagonal shapes.");
386 if (n_hex_pattern_layers == 1)
388 "The length (layer number) of each element of this parameter must be larger "
390 for (
unsigned int i = 0; i <= n_hex_pattern_layers / 2; i++)
392 if (hex_pattern[i].size() != n_hex_pattern_layers / 2 + i + 1 ||
393 hex_pattern[n_hex_pattern_layers - 1 - i].size() != n_hex_pattern_layers / 2 + i + 1)
395 "The two-dimentional array element of this parameter must have a correct "
399 const Point unit_shift_1 = Point(
_hex_pitches[hex_index], 0.0, 0.0);
400 const Point unit_shift_2 =
403 for (
unsigned int i = 0; i < hex_pattern.size(); i++)
405 const Real param_2 = ((Real)hex_pattern.size() - 1.0) / 2.0 - (Real)i;
406 const Real param_1_init = -((Real)hex_pattern.size() - 1.0) / 2.0 -
407 ((i <= (hex_pattern.size() - 1) / 2)
409 : (((Real)(hex_pattern.size() - 1) / 2) - (Real)i));
410 for (
unsigned int j = 0; j < hex_pattern[i].size(); j++)
415 input_usage_count[hex_pattern[i][j]]++;
416 Point pt_buffer = unit_shift_1 * (param_1_init + (Real)j) + unit_shift_2 * param_2;
419 std::make_pair(pt_buffer +
_hex_origins[hex_index], hex_pattern[i][j]));
430 "The length of this parameter must be the same as that of rect_patterns.");
433 "The length of this parameter must be the same as that of rect_patterns.");
437 "if provided, the length of this parameter must be the same as that of rect_patterns.");
441 "if provided, the length of this parameter must be the same as that of rect_patterns.");
444 unsigned int rect_index = 0;
447 std::set<unsigned int> rect_pattern_elem_size;
448 for (
const auto & rect_pattern_elem : rect_pattern)
450 if (rect_pattern_elem.empty())
451 paramError(
"rect_patterns",
"Each row of the element pattern must not be empty.");
452 rect_pattern_elem_size.emplace(rect_pattern_elem.size());
454 if (rect_pattern_elem_size.size() > 1)
456 "The two-dimensional array element of this parameter must have a correct "
457 "rectangular shape.");
459 const Point unit_shift_1 = Point(
_rect_pitches_x[rect_index], 0.0, 0.0);
460 const Point unit_shift_2 = Point(0.0,
_rect_pitches_y[rect_index], 0.0);
462 for (
unsigned int i = 0; i < rect_pattern.size(); i++)
464 const Real param_2 = ((Real)rect_pattern.size() - 1.0) / 2.0 - (Real)i;
465 const Real param_1_init = -((Real)rect_pattern[i].size() - 1.0) / 2.0;
466 for (
unsigned int j = 0; j < rect_pattern[i].size(); j++)
470 input_usage_count[rect_pattern[i][j]]++;
471 Point pt_buffer = unit_shift_1 * (param_1_init + (Real)j) + unit_shift_2 * param_2;
474 std::make_pair(pt_buffer +
_rect_origins[rect_index], rect_pattern[i][j]));
485 "The length of this parameter must be the same as that of circular_patterns.");
489 "if provided, the length of this parameter must be the same as that of circular_patterns.");
492 "circular_rotations",
493 "if provided, the length of this parameter must be the same as that of circular_patterns.");
496 unsigned int circ_index = 0;
499 const Real angle_step = 2.0 * M_PI / (Real)circ_pattern.size();
501 for (
unsigned int i = 0; i < circ_pattern.size(); i++)
505 input_usage_count[circ_pattern[i]]++;
506 Point pt_buffer = Point(
_circ_radii[circ_index] * std::cos((Real)i * angle_step),
507 _circ_radii[circ_index] * std::sin((Real)i * angle_step),
511 std::make_pair(pt_buffer +
_circ_origins[circ_index], circ_pattern[i]));
518 if (std::count(input_usage_count.begin(), input_usage_count.end(), 0))
519 paramError(
"inputs",
"All the input mesh generator names are not used.");
526 params.
set<MeshGeneratorName>(
"input") = input_name;
527 params.set<std::vector<BoundaryName>>(
"boundary_names") = {std::to_string(
OUTER_SIDESET_ID)};
531 static_cast<MeshGeneratorName
>(
"_" +
name() +
"_del_ext_bdry"),
536 std::vector<MeshGeneratorName> patterned_pin_mg_series;
537 for (
unsigned int i = 0; i <
_positions.size(); i++)
540 params.
set<MeshGeneratorName>(
"input") =
542 static_cast<MeshGeneratorName
>(
545 params.set<RealVectorValue>(
"vector_value") =
_positions[i].first;
547 patterned_pin_mg_series.push_back(
name() +
"_pos_" + std::to_string(i));
554 params.
set<MeshGeneratorName>(
"input") = patterned_pin_mg_series.back();
555 params.set<std::string>(
"expression") = std::to_string(i +
_cell_id_shift);
556 params.set<std::string>(
"extra_elem_integer_name") =
_cell_id_name;
558 patterned_pin_mg_series.back() =
name() +
"_ceeid_" + std::to_string(i);
559 addMeshSubgenerator(
"ParsedExtraElementIDGenerator", patterned_pin_mg_series.back(), params);
564 params.
set<MeshGeneratorName>(
"input") = patterned_pin_mg_series.back();
565 params.set<std::string>(
"expression") =
569 patterned_pin_mg_series.back() =
name() +
"_peeid_" + std::to_string(i);
570 addMeshSubgenerator(
"ParsedExtraElementIDGenerator", patterned_pin_mg_series.back(), params);
576 params.set<std::vector<MeshGeneratorName>>(
"holes") = patterned_pin_mg_series;
577 params.set<
bool>(
"refine_boundary") =
false;
579 params.set<
bool>(
"verify_holes") = getParam<bool>(
"verify_holes");
580 params.set<std::vector<bool>>(
"stitch_holes") =
581 std::vector<bool>(patterned_pin_mg_series.size(),
true);
582 params.set<std::vector<bool>>(
"refine_holes") =
583 std::vector<bool>(patterned_pin_mg_series.size(),
false);
584 params.set<Real>(
"desired_area") = getParam<Real>(
"desired_area");
585 params.set<std::string>(
"desired_area_func") = getParam<std::string>(
"desired_area_func");
586 params.set<
bool>(
"use_auto_area_func") = getParam<bool>(
"use_auto_area_func");
588 params.set<Real>(
"auto_area_func_default_size") = getParam<Real>(
"auto_area_func_default_size");
590 params.set<Real>(
"auto_area_func_default_size_dist") =
591 getParam<Real>(
"auto_area_func_default_size_dist");
593 params.set<
unsigned int>(
"auto_area_function_num_points") =
594 getParam<unsigned int>(
"auto_area_function_num_points");
596 params.set<Real>(
"auto_area_function_power") = getParam<Real>(
"auto_area_function_power");
597 params.set<BoundaryName>(
"output_boundary") = std::to_string(
OUTER_SIDESET_ID);
598 params.set<
MooseEnum>(
"tri_element_type") = getParam<MooseEnum>(
"tri_element_type");
601 MeshGeneratorName final_mg_name(
name() +
"_pattern");
605 params.
set<MeshGeneratorName>(
"input") =
name() +
"_pattern";
606 params.set<std::vector<SubdomainName>>(
"old_block") = {
"0"};
607 params.set<std::vector<SubdomainName>>(
"new_block") = {
613 params.
set<MeshGeneratorName>(
"input") =
name() +
"_back_rename_1";
614 params.set<std::vector<SubdomainName>>(
"old_block") = {
618 final_mg_name =
name() +
"_back_rename_2";
621 final_mg_name =
name() +
"_back_rename_1";