17 "ring_radii",
"ring_radii>0",
"Radii of major concentric circles (rings).");
21 "Number of radial mesh intervals within each major concentric circle excluding their " 25 "ring_radial_biases>0",
26 "Values used to create biasing in radial meshing for ring regions.");
28 "ring_inner_boundary_layer_widths",
29 "ring_inner_boundary_layer_widths>=0",
30 "Widths of each ring regions that are assigned to be each ring's inner boundary layers.");
31 params.
addParam<std::vector<unsigned int>>(
32 "ring_inner_boundary_layer_intervals",
33 "Number of radial intervals of the rings' inner boundary layers");
35 "ring_inner_boundary_layer_biases",
36 "ring_inner_boundary_layer_biases>0",
37 "Growth factors used for mesh biasing of the rings' inner boundary layers.");
39 "ring_outer_boundary_layer_widths",
40 "ring_outer_boundary_layer_widths>=0",
41 "Widths of each ring regions that are assigned to be each ring's outer boundary layers.");
42 params.
addParam<std::vector<unsigned int>>(
43 "ring_outer_boundary_layer_intervals",
44 "Number of radial intervals of the rings' outer boundary layers");
46 "ring_outer_boundary_layer_biases",
47 "ring_outer_boundary_layer_biases>0",
48 "Growth factors used for mesh biasing of the rings' outer boundary layers.");
49 params.
addParam<std::vector<subdomain_id_type>>(
50 "ring_block_ids",
"Optional customized block ids for each ring geometry block.");
51 params.
addParam<std::vector<SubdomainName>>(
52 "ring_block_names",
"Optional customized block names for each ring geometry block.");
53 params.
addParam<
bool>(
"preserve_volumes",
55 "Volume of concentric circles can be preserved using this function.");
57 params.
addParam<
bool>(
"create_inward_interface_boundaries",
59 "Whether the inward interface boundaries are created.");
60 params.
addParam<
bool>(
"create_outward_interface_boundaries",
62 "Whether the outward interface boundaries are created.");
64 "interface_boundary_id_shift", 0,
"Integer used to shift interface boundary IDs.");
65 params.
addParam<
bool>(
"generate_side_specific_boundaries",
67 "whether the side-specific external boundaries are generated or not");
69 "external_boundary_id>0",
70 "Optional customized external boundary id.");
72 "external_boundary_name",
"",
"Optional customized external boundary name.");
74 MooseEnum tri_elem_type(
"TRI3 TRI6 TRI7",
"TRI3");
76 "tri_element_type", tri_elem_type,
"Type of the triangular elements to be generated.");
77 MooseEnum quad_elem_type(
"QUAD4 QUAD8 QUAD9",
"QUAD4");
79 "quad_element_type", quad_elem_type,
"Type of the quadrilateral elements to be generated.");
81 params.
addParam<std::vector<std::string>>(
82 "inward_interface_boundary_names",
83 "Optional customized boundary names for the internal inward interfaces between block.");
84 params.
addParam<std::vector<std::string>>(
85 "outward_interface_boundary_names",
86 "Optional customized boundary names for the internal outward interfaces between block.");
89 "ring_block_ids ring_block_names external_boundary_id external_boundary_name " 90 "inward_interface_boundary_names outward_interface_boundary_names " 91 "block_id_shift create_inward_interface_boundaries create_outward_interface_boundaries " 92 "interface_boundary_id_shift generate_side_specific_boundaries",
93 "Customized Subdomain/Boundary");
96 "ring_radial_biases ring_inner_boundary_layer_biases ring_inner_boundary_layer_widths " 97 "ring_inner_boundary_layer_intervals ring_outer_boundary_layer_biases " 98 "ring_outer_boundary_layer_widths ring_outer_boundary_layer_intervals ",
99 "Mesh Boundary Layers and Biasing Options");
101 params.
addClassDescription(
"This ConcentricCircleGeneratorBase object is a base class to be " 102 "inherited for mesh generators that involve concentric circles.");
108 _ring_radii(isParamValid(
"ring_radii") ? getParam<
std::vector<
Real>>(
"ring_radii")
110 _ring_intervals(isParamValid(
"ring_intervals")
111 ? getParam<
std::vector<unsigned
int>>(
"ring_intervals")
112 :
std::vector<unsigned
int>()),
113 _ring_radial_biases(isParamValid(
"ring_radial_biases")
114 ? getParam<
std::vector<
Real>>(
"ring_radial_biases")
115 :
std::vector<
Real>(_ring_intervals.size(), 1.0)),
116 _ring_inner_boundary_layer_params(
118 ? getParam<std::vector<Real>>(
"ring_inner_boundary_layer_widths")
122 ? getParam<std::vector<unsigned int>>(
"ring_inner_boundary_layer_intervals")
125 ? getParam<std::vector<Real>>(
"ring_inner_boundary_layer_biases")
127 _ring_outer_boundary_layer_params(
128 {isParamValid(
"ring_outer_boundary_layer_widths")
129 ? getParam<std::vector<Real>>(
"ring_outer_boundary_layer_widths")
130 : std::vector<Real>(_ring_intervals.size(), 0.0),
132 isParamValid(
"ring_outer_boundary_layer_intervals")
133 ? getParam<std::vector<unsigned int>>(
"ring_outer_boundary_layer_intervals")
134 : std::vector<unsigned int>(_ring_intervals.size(), 0),
135 isParamValid(
"ring_outer_boundary_layer_biases")
136 ? getParam<std::vector<Real>>(
"ring_outer_boundary_layer_biases")
137 : std::vector<Real>(_ring_intervals.size(), 0.0)}),
138 _ring_block_ids(isParamValid(
"ring_block_ids")
139 ? getParam<std::vector<subdomain_id_type>>(
"ring_block_ids")
140 : std::vector<subdomain_id_type>()),
141 _ring_block_names(isParamValid(
"ring_block_names")
142 ? getParam<std::vector<SubdomainName>>(
"ring_block_names")
143 : std::vector<SubdomainName>()),
144 _preserve_volumes(getParam<bool>(
"preserve_volumes")),
145 _block_id_shift(getParam<subdomain_id_type>(
"block_id_shift")),
146 _create_inward_interface_boundaries(getParam<bool>(
"create_inward_interface_boundaries")),
147 _create_outward_interface_boundaries(getParam<bool>(
"create_outward_interface_boundaries")),
148 _interface_boundary_id_shift(getParam<boundary_id_type>(
"interface_boundary_id_shift")),
149 _generate_side_specific_boundaries(getParam<bool>(
"generate_side_specific_boundaries")),
150 _external_boundary_id(isParamValid(
"external_boundary_id")
151 ? getParam<boundary_id_type>(
"external_boundary_id")
153 _external_boundary_name(getParam<BoundaryName>(
"external_boundary_name")),
154 _inward_interface_boundary_names(
155 isParamValid(
"inward_interface_boundary_names")
156 ? getParam<std::vector<std::string>>(
"inward_interface_boundary_names")
157 : std::vector<std::string>()),
158 _outward_interface_boundary_names(
159 isParamValid(
"outward_interface_boundary_names")
160 ? getParam<std::vector<std::string>>(
"outward_interface_boundary_names")
161 : std::vector<std::string>()),
162 _tri_elem_type(getParam<MooseEnum>(
"tri_element_type").
template getEnum<TRI_ELEM_TYPE>()),
163 _quad_elem_type(getParam<MooseEnum>(
"quad_element_type").
template getEnum<QUAD_ELEM_TYPE>())
166 if (!_create_inward_interface_boundaries && _inward_interface_boundary_names.size() > 0)
167 paramError(
"create_inward_interface_boundaries",
168 "If set false, 'inward_interface_boundary_names' " 169 "should not be provided as they are not used.");
170 if (!_create_outward_interface_boundaries && _outward_interface_boundary_names.size() > 0)
171 paramError(
"create_outward_interface_boundaries",
172 "If set false, 'outward_interface_boundary_names' " 173 "should not be provided as they are not used.");
174 if (!_create_outward_interface_boundaries && !_create_inward_interface_boundaries &&
175 _interface_boundary_id_shift != 0)
176 paramError(
"interface_boundary_id_shift",
177 "this parameter should not be set if no interface boundaries are created.");
180 if (_ring_radii.size() != _ring_intervals.size())
181 paramError(
"ring_radii",
"This parameter and ring_intervals must have the same length.");
182 if (_ring_radii.size() != _ring_radial_biases.size())
183 paramError(
"ring_radii",
"This parameter and ring_radial_biases must have the same length.");
184 for (
unsigned int i = 1; i < _ring_intervals.size(); i++)
185 if (_ring_radii[i] <= _ring_radii[i - 1])
186 paramError(
"ring_radii",
"This parameter must be strictly ascending.");
187 if (_ring_radii.size() != _ring_inner_boundary_layer_params.widths.size() ||
188 _ring_radii.size() != _ring_inner_boundary_layer_params.intervals.size() ||
189 _ring_radii.size() != _ring_inner_boundary_layer_params.biases.size() ||
190 _ring_radii.size() != _ring_outer_boundary_layer_params.widths.size() ||
191 _ring_radii.size() != _ring_outer_boundary_layer_params.intervals.size() ||
192 _ring_radii.size() != _ring_outer_boundary_layer_params.biases.size())
193 paramError(
"ring_radii",
194 "The inner and outer ring boundary layer parameters must have the same sizes as " 225 std::vector<subdomain_id_type> & block_ids_old,
226 std::vector<subdomain_id_type> & block_ids_new,
227 std::vector<SubdomainName> & block_names,
228 const std::string & generator_name)
const 230 if (block_ids_old.size() != block_ids_new.size() || block_ids_old.size() != block_names.size())
235 ": block_ids_old, block_ids_new and block_names must have the same size.");
237 for (
auto it = block_names.begin(); it != block_names.end() - 1; it++)
239 auto it_tmp = std::find(block_names.begin(), it + 1, *(it + 1));
240 if (it_tmp != it + 1 && block_ids_new[std::distance(block_names.begin(), it + 1)] !=
241 block_ids_new[std::distance(block_names.begin(), it_tmp)])
246 ": blocks with different ids cannot have the same block name.");
248 for (
const auto & elem :
mesh.element_ptr_range())
249 for (
unsigned i = 0; i < block_ids_old.size(); ++i)
250 if (elem->subdomain_id() == block_ids_old[i])
252 elem->subdomain_id() = block_ids_new[i];
255 for (
unsigned i = 0; i < block_ids_new.size(); ++i)
256 mesh.subdomain_name(block_ids_new[i]) = block_names[i];
261 unsigned int & block_counter,
262 unsigned int & ring_block_num,
263 std::vector<subdomain_id_type> & block_ids_old,
264 std::vector<subdomain_id_type> & block_ids_new,
265 std::vector<SubdomainName> & block_names)
const 276 ? (SubdomainName)std::to_string(block_ids_new.back())
280 for (
unsigned int i = ring_block_num -
_ring_intervals.size(); i < ring_block_num; i++)
285 ? (SubdomainName)std::to_string(block_ids_new.back())
const std::vector< unsigned int > _ring_intervals
Number of rings in each circle or in the enclosing square.
const boundary_id_type _interface_boundary_id_shift
Shift in default boundary IDs of interfaces to avert potential conflicts.
const std::vector< std::string > _outward_interface_boundary_names
Boundary Names of the mesh's outward interface boundaries.
const subdomain_id_type _block_id_shift
Shift in default subdomain IDs to avert potential conflicts with other meshes.
static InputParameters validParams()
void assignBlockIdsNames(ReplicatedMesh &mesh, std::vector< subdomain_id_type > &block_ids_old, std::vector< subdomain_id_type > &block_ids_new, std::vector< SubdomainName > &block_names, const std::string &generator_name) const
Assign block IDs and names to the mesh if applicable.
void ringBlockIdsNamesPreparer(unsigned int &block_counter, unsigned int &ring_block_num, std::vector< subdomain_id_type > &block_ids_old, std::vector< subdomain_id_type > &block_ids_new, std::vector< SubdomainName > &block_names) const
Prepare user-defined ring block IDs and names to replace the default ones.
bool isParamValid(const std::string &name) const
const std::vector< std::string > _inward_interface_boundary_names
Boundary Names of the mesh's inward interface boundaries.
static InputParameters validParams()
ConcentricCircleGeneratorBase(const InputParameters ¶meters)
std::vector< SubdomainName > _ring_block_names
Subdomain Names of the ring regions.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
A base class that contains common members for Reactor module mesh generators.
std::vector< subdomain_id_type > _ring_block_ids
Subdomain IDs of the ring regions.
void mooseError(Args &&... args) const
void ErrorVector unsigned int
void assignInterfaceBoundaryNames(ReplicatedMesh &mesh) const
Assign interface boundary names to the mesh if applicable.