15 #include "libmesh/mesh_serializer.h" 26 "mesh generator creating the mesh on which to create the boundary transition layer on.");
28 "boundary_names",
"Boundaries that need to be converted to form a transition layer.");
30 "conversion_element_layer_number",
32 "The number of layers of elements to be converted. The farthest layer of the elements from " 33 "the given boundary are converted to elements compatible with the remainder of the mesh, " 34 "while the other layers of elements are converted into TET4.");
35 params.
addParam<SubdomainName>(
"converted_tet_element_subdomain_name_suffix",
37 "The suffix to be added to the original subdomain name for the " 38 "subdomains containing the elements converted to TET4.");
40 "converted_pyramid_element_subdomain_name_suffix",
42 "The suffix to be added to the original subdomain name for the subdomains containing the " 43 "elements converted to PYRAMID5.");
44 params.
addParam<
bool>(
"external_boundaries_checking",
46 "Whether to check if provided boundaries are external.");
48 params.
addClassDescription(
"Convert the elements involved in a set of external boundaries to " 49 "ensure that the boundary set only contains TRI3 elements");
57 _input(getMesh(
"input")),
58 _boundary_names(getParam<
std::vector<BoundaryName>>(
"boundary_names")),
59 _conversion_element_layer_number(getParam<unsigned
int>(
"conversion_element_layer_number")),
60 _external_boundaries_checking(getParam<bool>(
"external_boundaries_checking"))
64 std::unique_ptr<MeshBase>
67 UnstructuredMesh &
mesh =
dynamic_cast<UnstructuredMesh &
>(*_input);
72 std::set<subdomain_id_type> original_subdomain_ids;
73 for (
auto elem_it =
mesh.active_elements_begin(); elem_it !=
mesh.active_elements_end();
76 original_subdomain_ids.emplace((*elem_it)->subdomain_id());
85 if (((std::string)e.
what()).compare(
"subdomain id overflow") == 0)
87 "Some subdomain ids of the input mesh are too large and cause overflow when " 88 "assigning new subdomain ids during element conversion. Please consider lowering " 89 "the subdomain ids using RenameBlockGenerator.");
90 else if (((std::string)e.
what()).compare(13, 8,
"boundary") == 0)
99 original_subdomain_ids,
100 *original_subdomain_ids.rbegin() + 1,
101 getParam<SubdomainName>(
"converted_tet_element_subdomain_name_suffix"),
102 getParam<SubdomainName>(
"converted_pyramid_element_subdomain_name_suffix"));
104 catch (
const std::exception & e)
106 if (((std::string)e.what()).compare(26, 4,
"TET4") == 0)
107 paramError(
"converted_tet_element_subdomain_name_suffix", e.what());
109 paramError(
"converted_pyramid_element_subdomain_name_suffix", e.what());
113 if (!
mesh.is_replicated())
114 mesh.prepare_for_use();
116 mesh.set_isnt_prepared();
static InputParameters validParams()
void assignConvertedElementsSubdomainNameSuffix(MeshBase &mesh, const std::set< subdomain_id_type > &original_subdomain_ids, const subdomain_id_type sid_shift_base, const SubdomainName &tet_suffix, const SubdomainName &pyramid_suffix)
Assign a subdomain name suffix to the converted elements created during transition layer generation...
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
Convert the elements involved in a set of external boundaries to ensure that the boundary set only co...
const unsigned int _conversion_element_layer_number
Number of layers of elements to be converted.
virtual const char * what() const
Get out the error message.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
std::unique_ptr< MeshBase > & _input
Mesh that possibly comes from another generator.
BoundaryElementConversionGenerator(const InputParameters ¶meters)
const bool _external_boundaries_checking
Whether to check if the provided boundaries are external.
static InputParameters validParams()
Provides a way for users to bail out of the current solve.
registerMooseObject("MooseApp", BoundaryElementConversionGenerator)
const std::vector< BoundaryName > _boundary_names
The boundaries to convert the neighboring elements of.
MeshGenerators are objects that can modify or add to an existing mesh.
void transitionLayerGenerator(MeshBase &mesh, const std::vector< BoundaryName > &boundary_names, const unsigned int conversion_element_layer_number, const bool external_boundaries_checking)
Generate a transition layer of elements with TRI3 surfaces on the given boundaries.
void ErrorVector unsigned int