34 params.
addRequiredParam<ComponentName>(
"first_component",
"First component to join");
35 params.
addRequiredParam<BoundaryName>(
"first_boundary",
"First boundary to connect to.");
36 params.
addRequiredParam<ComponentName>(
"second_component",
"Second component to join");
37 params.
addRequiredParam<BoundaryName>(
"second_boundary",
"Second boundary to connect to.");
39 MooseEnum junction_type(
"stitch_meshes extrude_boundary",
"extrude_boundary");
40 params.
addParam<
MooseEnum>(
"junction_method", junction_type,
"How to join the two components");
43 params.
addParam<
bool>(
"enforce_all_nodes_match_on_boundaries",
45 "Only stitch if all nodes match on the boundary. Defaults to true because "
46 "there is a search algorithm that forces nodes to match assuming there are "
47 "equal number of nodes on each target boundary.");
51 params.
addParam<
unsigned int>(
"n_elem_normal",
52 "Number of elements in the normal direction of the junction");
53 params.
addParam<SubdomainName>(
"block",
"Block name for the junction, if a block is created.");
56 MooseEnum radial_growth_methods(
"LINEAR CUBIC",
"CUBIC");
58 radial_growth_methods,
59 "Functional form to change radius while extruding along curve.");
60 params.
addParam<Real>(
"start_radial_growth_rate", 0,
"Starting rate of radial expansion.");
61 params.
addParam<Real>(
"end_radial_growth_rate", 0,
"Ending rate of radial expansion.");
66 "sharpness>0 & sharpness<=1",
67 "Sharpness of curve bend. See BSplineCurveGenerator "
68 "for explanation of the meaning given to sharpness");
72 "Number of control points used to draw the curve. Miniumum of degree+1 points are required.");
73 MooseEnum edge_elem_type(
"EDGE2 EDGE3 EDGE4",
"EDGE2");
75 "edge_element_type", edge_elem_type,
"Type of the EDGE elements to be generated.");
79 "radial_growth_method start_radial_growth_rate end_radial_growth_rate",
80 "Radial expansion in 2D and 3D junction");
91 _junction_method(getParam<
MooseEnum>(
"junction_method")),
92 _enforce_all_nodes_match_on_boundaries(getParam<bool>(
"enforce_all_nodes_match_on_boundaries"))
102 "radial_growth_method",
103 "start_radial_growth_rate",
104 "end_radial_growth_rate",
107 "edge_element_type"});
111 paramError(
"n_elem_normal",
"Should be specified if junction_method = 'extrude_boundary'");
119 auto & first_component =
121 auto & second_component =
123 const auto first_boundary = getParam<BoundaryName>(
"first_boundary");
124 const auto second_boundary = getParam<BoundaryName>(
"second_boundary");
127 const auto dimension_first = first_component.dimension();
128 const auto dimension_second = second_component.
dimension();
130 if (dimension_first == 0 || dimension_second == 0)
131 mooseError(
"Connecting 0 dimension meshes not implemented!");
137 if (dimension_first == dimension_second)
139 if (first_component.getCurrentTopLevelMeshGeneratorName() !=
143 params.
set<std::vector<MeshGeneratorName>>(
"inputs") = {
144 first_component.getCurrentTopLevelMeshGeneratorName(),
146 params.
set<std::vector<std::vector<std::string>>>(
"stitch_boundaries_pairs") = {
147 {first_boundary, second_boundary}};
149 params.
set<
bool>(
"enforce_all_nodes_match_on_boundaries") =
152 "StitchMeshGenerator",
name() +
"_base", params);
160 params.
set<MeshGeneratorName>(
"input") =
161 first_component.getCurrentTopLevelMeshGeneratorName();
162 params.
set<std::vector<std::vector<std::string>>>(
"stitch_boundaries_pairs") = {
163 {first_boundary, second_boundary}};
166 "StitchBoundaryMeshGenerator",
name() +
"_close", params);
171 mooseError(
"Stiching meshes of different dimensions is not implemented");
187 auto get_direction = [
this](
const auto & component,
const auto & param_name) -> RealVectorValue
189 const auto & cname = component.name();
193 else if (component.isParamValid(
"direction"))
194 return component.template getParam<RealVectorValue>(
"direction");
197 "Only components inheriting from 'ComponentMeshTransformerHelper' or with a "
198 "'direction' parameter are supported at this time");
201 RealVectorValue start_direction = get_direction(first_component,
"first_component");
202 RealVectorValue end_direction = get_direction(second_component,
"second_component");
205 bspline_params.
set<RealVectorValue>(
"start_direction") = start_direction;
206 bspline_params.
set<RealVectorValue>(
"end_direction") = -end_direction;
207 bspline_params.
set<
unsigned int>(
"num_elements") = getParam<unsigned int>(
"n_elem_normal");
209 bspline_params.
set<Real>(
"sharpness") = getParam<Real>(
"sharpness");
210 bspline_params.
set<
unsigned int>(
"num_cps") = getParam<unsigned int>(
"num_cps");
211 bspline_params.
set<MeshGeneratorName>(
"start_mesh") =
212 first_component.meshGeneratorNames().back();
213 bspline_params.
set<MeshGeneratorName>(
"end_mesh") =
215 bspline_params.
set<BoundaryName>(
"boundary_providing_start_point") =
216 getParam<BoundaryName>(
"first_boundary");
217 bspline_params.
set<BoundaryName>(
"boundary_providing_end_point") =
218 getParam<BoundaryName>(
"second_boundary");
220 if (dimension_first == 1)
223 bspline_params.
set<SubdomainName>(
"new_subdomain_name") = getParam<SubdomainName>(
"block");
224 bspline_params.
set<std::vector<BoundaryName>>(
"edge_nodesets") = {
225 name() +
"_bspline_start_node",
name() +
"_bspline_end_node"};
230 "BSplineCurveGenerator",
name() +
"_curve", bspline_params);
234 if (dimension_first > 1)
238 ld_source_params.
set<MeshGeneratorName>(
"input") =
239 first_component.meshGeneratorNames().back();
240 ld_source_params.
set<std::vector<BoundaryName>>(
"sidesets") =
241 std::vector{getParam<BoundaryName>(
"first_boundary")};
242 ld_source_params.
set<SubdomainName>(
"new_block_name") =
243 (SubdomainName)(
name() +
"_LowerDBlockSource");
245 "LowerDBlockFromSidesetGenerator",
name() +
"_lowerDGenerationSource", ld_source_params);
249 _bmc_source_params.
set<MeshGeneratorName>(
"input") =
name() +
"_lowerDGenerationSource";
250 _bmc_source_params.
set<std::vector<SubdomainName>>(
"target_blocks") = {
251 (SubdomainName)(
name() +
"_LowerDBlockSource")};
253 "BlockToMeshConverterGenerator",
name() +
"_blockToMeshSource", _bmc_source_params);
258 aeg_params.
set<MeshGeneratorName>(
"extrusion_curve") = (MeshGeneratorName)(
name() +
"_curve");
259 aeg_params.
set<MeshGeneratorName>(
"input") =
260 (MeshGeneratorName)(
name() +
"_blockToMeshSource");
262 aeg_params.
set<RealVectorValue>(
"start_extrusion_direction") = start_direction;
263 aeg_params.
set<RealVectorValue>(
"end_extrusion_direction") = end_direction;
265 aeg_params.
set<Real>(
"start_radial_growth_rate") = getParam<Real>(
"start_radial_growth_rate");
266 aeg_params.
set<Real>(
"end_radial_growth_rate") = getParam<Real>(
"end_radial_growth_rate");
268 getParam<MooseEnum>(
"radial_growth_method");
270 aeg_params.
set<BoundaryName>(
"bottom_boundary") =
name() +
"_aeg_bottom_boundary";
271 aeg_params.
set<BoundaryName>(
"top_boundary") =
name() +
"_aeg_top_boundary";
273 paramError(
"block",
"Not yet implemented for 2D or 3D junction");
277 "AdvancedExtruderGenerator",
name() +
"_aeg", aeg_params);
282 if (first_component.getCurrentTopLevelMeshGeneratorName() !=
286 stitcher_params.
set<std::vector<MeshGeneratorName>>(
"inputs") =
287 std::vector<MeshGeneratorName>{first_component.getCurrentTopLevelMeshGeneratorName(),
290 if (dimension_first > 1)
291 stitcher_params.
set<std::vector<std::vector<std::string>>>(
"stitch_boundaries_pairs") = {
292 {first_boundary,
name() +
"_aeg_bottom_boundary"},
293 {
name() +
"_aeg_top_boundary", second_boundary}};
296 stitcher_params.
set<
bool>(
"clear_stitched_boundary_ids") =
false;
297 stitcher_params.
set<std::vector<std::vector<std::string>>>(
"stitch_boundaries_pairs") = {
298 {first_boundary,
name() +
"_bspline_start_node"},
299 {
name() +
"_bspline_end_node", second_boundary}};
302 stitcher_params.
set<
bool>(
"verbose_stitching") =
_verbose;
304 stitcher_params.
set<
bool>(
"enforce_all_nodes_match_on_boundaries") =
307 "StitchMeshGenerator",
name() +
"_stitcher", stitcher_params);
315 mesh_stitcher_params.
set<std::vector<MeshGeneratorName>>(
"inputs") =
316 std::vector<MeshGeneratorName>{first_component.getCurrentTopLevelMeshGeneratorName(),
318 if (dimension_first > 1)
319 mesh_stitcher_params.
set<std::vector<std::vector<std::string>>>(
320 "stitch_boundaries_pairs") = {{first_boundary,
name() +
"_aeg_bottom_boundary"}};
322 mesh_stitcher_params.
set<std::vector<std::vector<std::string>>>(
323 "stitch_boundaries_pairs") = {{first_boundary,
name() +
"_bspline_start_node"}};
324 mesh_stitcher_params.
set<
bool>(
"verbose_stitching") =
_verbose;
326 mesh_stitcher_params.
set<
bool>(
"clear_stitched_boundary_ids") =
false;
327 mesh_stitcher_params.
set<
bool>(
"enforce_all_nodes_match_on_boundaries") =
330 "StitchMeshGenerator",
name() +
"_mesh_stitcher", mesh_stitcher_params);
335 boundary_stitcher_params.
set<MeshGeneratorName>(
"input") =
name() +
"_mesh_stitcher";
336 if (dimension_first > 1)
337 boundary_stitcher_params.
set<std::vector<std::vector<std::string>>>(
338 "stitch_boundaries_pairs") = {{
name() +
"_aeg_top_boundary", second_boundary}};
340 boundary_stitcher_params.
set<std::vector<std::vector<std::string>>>(
341 "stitch_boundaries_pairs") = {{
name() +
"_bspline_end_node", second_boundary}};
342 boundary_stitcher_params.
set<
bool>(
"show_info") =
_verbose;
344 "StitchBoundaryMeshGenerator",
name() +
"_closed", boundary_stitcher_params);
349 mooseError(
"junction_method specified is invalid!");
352 first_component.addConnectedComponent(second_component);
355 for (
auto * component : first_component.getConnectedComponents())
356 component->setCurrentTopLevelMeshGeneratorName(
_top_mg_name);
360 mooseAssert(dimension_first == dimension_second,
"Should be the same");
361 _dimension = std::max(dimension_first, dimension_second);
registerActionComponent("MooseApp", ComponentJunction)
registerMooseAction("MooseApp", ComponentJunction, "add_mesh_generator")
Base class for components that are defined using an action.
const std::vector< MeshGeneratorName > & meshGeneratorNames() const
Get the name(s) of the mesh generator(s) created by this component that generates the mesh for it.
std::vector< MeshGeneratorName > _mg_names
Name(s) of the final mesh generator(s) creating the mesh for the component.
void addRequiredTask(const std::string &task)
Add a new required task for all physics deriving from this class NOTE: This does not register the tas...
const bool _verbose
Whether the component setup should be verbose.
MeshGeneratorName _top_mg_name
Name of the top-most mesh generator in the hierarchy of MGs on top of the ones generating this compon...
static InputParameters validParams()
unsigned int _dimension
Maximum dimension of the component.
MeshGeneratorName getCurrentTopLevelMeshGeneratorName() const
Return the name of the final mesh generator that contains this component This may not be one of the m...
unsigned int dimension() const
Return the dimension of the component.
const T & getAction(const std::string &name) const
Retrieve an action with its name and the desired type.
MooseApp & _app
The MOOSE application this is associated with.
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Helper class to help Components accept boundary condition parameters that the Physics may use to gene...
static InputParameters validParams()
virtual void checkIntegrity() override
Used for various checks notably:
Helper class to help Components define the initial conditions the Physics may need from the parameter...
static InputParameters validParams()
virtual void checkIntegrity() override
Used for various checks notably:
ActionComponent to connect two components.
virtual void addMeshGenerators() override
static InputParameters validParams()
virtual void checkIntegrity() override
Used for various checks notably:
ComponentJunction(const InputParameters ¶ms)
bool _enforce_all_nodes_match_on_boundaries
Whether to enforce that all nodes match on a boundary when stitching them.
const MooseEnum _junction_method
How to connect the two components.
Helper class to help Components define the material properties the Physics may need from the paramete...
static InputParameters validParams()
Helper class to help creating an entire physics Note: Trying out virtual inheritance.
static InputParameters validParams()
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
void addMeshGenerator(const std::string &type, const std::string &name, const InputParameters ¶ms)
Add a mesh generator that will act on the meshes in the system.
MeshGeneratorSystem & getMeshGeneratorSystem()
Gets the system that manages the MeshGenerators.
const std::string & name() const
Get the name of the class.
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 ...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Factory & _factory
The Factory associated with the MooseApp.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real