10 #include "Conversion.h"
11 #include "FEProblem.h"
13 #include "MooseMesh.h"
14 #include "MooseObjectAction.h"
18 #include "libmesh/string_to_enum.h"
41 params.addClassDescription(
"Sets up variables, stress divergence kernels and materials required "
42 "for a static analysis with beam or truss elements. Also sets up aux "
43 "variables, aux kernels, and consistent or nodal inertia kernels for "
44 "dynamic analysis with beam elements.");
46 params.addParam<
bool>(
49 "Set to true if the line elements are truss elements instead of the default beam elements.");
50 params.addParam<
bool>(
"add_variables",
52 "Add the displacement variables for truss elements "
53 "and both displacement and rotation variables for "
55 params.addParam<std::vector<VariableName>>(
56 "displacements",
"The nonlinear displacement variables for the problem");
61 "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
66 params.addParam<
bool>(
67 "use_displaced_mesh",
false,
"Whether to use displaced mesh in the kernels");
70 params.addParam<std::vector<SubdomainName>>(
72 "The list of ids of the blocks (subdomain) "
73 "that the stress divergence, inertia kernels and materials will be "
76 params.addParam<std::vector<AuxVariableName>>(
"save_in",
77 "The displacement and rotational residuals");
78 params.addParam<std::vector<AuxVariableName>>(
79 "diag_save_in",
"The displacement and rotational diagonal preconditioner terms");
80 params.addParamNamesToGroup(
"block",
"Advanced");
87 InputParameters params = emptyInputParameters();
89 params.addParam<std::vector<VariableName>>(
90 "rotations",
"The rotations appropriate for the simulation geometry and coordinate system");
92 MooseEnum strainType(
"SMALL FINITE",
"SMALL");
93 params.addParam<MooseEnum>(
"strain_type", strainType,
"Strain formulation");
94 params.addParam<MooseEnum>(
"rotation_type", strainType,
"Rotation formulation");
95 params.addParam<std::vector<MaterialPropertyName>>(
96 "eigenstrain_names",
"List of beam eigenstrains to be applied in this strain calculation.");
100 "Orientation of the y direction along "
101 "which Iyy is provided. This should be "
102 "perpendicular to the axis of the beam.");
103 params.addCoupledVar(
105 "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
106 params.addCoupledVar(
"Ay",
108 "First moment of area of the beam about y axis. Can be supplied "
109 "as either a number or a variable name.");
110 params.addCoupledVar(
"Az",
112 "First moment of area of the beam about z axis. Can be supplied "
113 "as either a number or a variable name.");
114 params.addCoupledVar(
"Ix",
115 "Second moment of area of the beam about x axis. Can be supplied as "
116 "either a number or a variable name.");
117 params.addCoupledVar(
"Iy",
118 "Second moment of area of the beam about y axis. Can be supplied as "
119 "either a number or a variable name.");
120 params.addCoupledVar(
"Iz",
121 "Second moment of area of the beam about z axis. Can be supplied as "
122 "either a number or a variable name.");
125 params.addParam<
bool>(
"add_dynamic_variables",
126 "Adds translational and rotational velocity and acceleration aux variables "
127 "and sets up the corresponding AuxKernels for calculating these variables "
128 "using Newmark time integration. When dynamic_consistent_inertia, "
129 "dynamic_nodal_rotational_inertia or dynamic_nodal_translational_inertia "
130 "are set to true, these variables are automatically set up.");
132 params.addParam<std::vector<VariableName>>(
"velocities",
"Translational velocity variables");
133 params.addParam<std::vector<VariableName>>(
"accelerations",
134 "Translational acceleration variables");
135 params.addParam<std::vector<VariableName>>(
"rotational_velocities",
136 "Rotational velocity variables");
137 params.addParam<std::vector<VariableName>>(
"rotational_accelerations",
138 "Rotational acceleration variables");
139 params.addRangeCheckedParam<Real>(
140 "beta",
"beta>0.0",
"beta parameter for Newmark Time integration");
141 params.addRangeCheckedParam<Real>(
142 "gamma",
"gamma>0.0",
"gamma parameter for Newmark Time integration");
143 params.addParam<MaterialPropertyName>(
"eta",
145 "Name of material property or a constant real "
146 "number defining the eta parameter for mass proportional "
147 "Rayleigh damping.");
148 params.addParam<MaterialPropertyName>(
151 "Name of material property or a constant real "
152 "number defining the zeta parameter for stiffness proportional "
153 "Rayleigh damping.");
154 params.addRangeCheckedParam<Real>(
"alpha",
156 "alpha>=-0.3333 & alpha<=0.0",
157 "alpha parameter for mass dependent numerical damping induced "
158 "by HHT time integration scheme");
161 params.addParam<
bool>(
"dynamic_consistent_inertia",
163 "If set to true, consistent mass and "
164 "inertia matrices are used for the "
165 "inertial force/torque calculations.");
166 params.addParam<MaterialPropertyName>(
168 "Name of Material Property or a constant real number defining the density of the beam.");
171 params.addParam<
bool>(
172 "dynamic_nodal_translational_inertia",
174 "If set to true, nodal mass matrix is used for the inertial force calculation.");
175 params.addRangeCheckedParam<Real>(
176 "nodal_mass",
"nodal_mass>0.0",
"Mass associated with the node");
177 params.addParam<FileName>(
179 "The file containing the nodal positions and the corresponding nodal masses.");
182 params.addParam<
bool>(
183 "dynamic_nodal_rotational_inertia",
185 "If set to true, nodal inertia matrix is used for the inertial torque calculation.");
186 params.addRangeCheckedParam<Real>(
187 "nodal_Ixx",
"nodal_Ixx>=0.0",
"Nodal moment of inertia in the x direction.");
188 params.addRangeCheckedParam<Real>(
189 "nodal_Iyy",
"nodal_Iyy>=0.0",
"Nodal moment of inertia in the y direction.");
190 params.addRangeCheckedParam<Real>(
191 "nodal_Izz",
"nodal_Izz>=0.0",
"Nodal moment of inertia in the z direction.");
192 params.addParam<Real>(
"nodal_Ixy", 0.0,
"Nodal moment of inertia in the xy direction.");
193 params.addParam<Real>(
"nodal_Ixz", 0.0,
"Nodal moment of inertia in the xz direction.");
194 params.addParam<Real>(
"nodal_Iyz", 0.0,
"Nodal moment of inertia in the yz direction.");
196 "nodal_x_orientation",
197 "Unit vector along the x direction if different from global x direction.");
199 "nodal_y_orientation",
200 "Unit vector along the y direction if different from global y direction.");
201 params.addParam<std::vector<BoundaryName>>(
203 "The list of boundary IDs from the mesh where the nodal "
204 "mass/inertia will be applied.");
214 _rot_accelerations(0),
215 _subdomain_names(getParam<std::vector<SubdomainName>>(
"block")),
217 _add_dynamic_variables(false)
221 if (action.size() == 1)
222 _pars.applyParameters(action[0]->parameters());
225 _save_in = getParam<std::vector<AuxVariableName>>(
"save_in");
226 _diag_save_in = getParam<std::vector<AuxVariableName>>(
"diag_save_in");
236 if (params.isParamSetByUser(
"add_dynamic_variables"))
238 bool user_defined_add_dynamic_variables = getParam<bool>(
"add_dynamic_variables");
242 mooseError(
"LineElementAction: When using 'dynamic_consistent_inertia', "
243 "'dynamic_nodal_rotational_inertia' or '_dynamic_nodal_translational_inertia', "
244 "the velocity and acceleration AuxVariables and the corresponding AuxKernels are "
245 "automatically set by the action and this cannot be turned off by setting "
246 "'add_dynamic_variables' to false.");
248 _truss = getParam<bool>(
"truss");
250 if (!isParamValid(
"displacements"))
251 paramError(
"displacements",
252 "LineElementAction: A vector of displacement variable names should be provided as "
253 "input using `displacements`.");
255 _displacements = getParam<std::vector<VariableName>>(
"displacements");
260 if (params.isParamSetByUser(
"use_displaced_mesh"))
262 bool use_displaced_mesh_param = getParam<bool>(
"use_displaced_mesh");
263 if (use_displaced_mesh_param !=
_use_displaced_mesh && params.isParamSetByUser(
"strain_type") &&
264 params.isParamSetByUser(
"rotation_type"))
265 paramError(
"use_displaced_mesh",
266 "LineElementAction: Wrong combination of "
267 "`use_displaced_mesh`, `strain_type` and `rotation_type`.");
272 paramError(
"save_in",
273 "LineElementAction: Number of save_in variables should equal to the number of "
274 "displacement variables ",
278 paramError(
"diag_save_in",
279 "LineElementAction: Number of diag_save_in variables should equal to the number of "
280 "displacement variables ",
288 if (!isParamValid(
"rotations"))
289 paramError(
"rotations",
290 "LineElementAction: Rotational variable names should be provided for beam "
291 "elements using `rotations` parameter.");
293 _rotations = getParam<std::vector<VariableName>>(
"rotations");
296 paramError(
"rotations",
297 "LineElementAction: Number of rotational and displacement variable names provided "
298 "as input for beam should be same.");
300 if (!isParamValid(
"y_orientation") || !isParamValid(
"area") || !isParamValid(
"Iy") ||
302 mooseError(
"LineElementAction: `y_orientation`, `area`, `Iy` and `Iz` should be provided for "
308 if (!isParamValid(
"velocities") || !isParamValid(
"accelerations") ||
309 !isParamValid(
"rotational_velocities") || !isParamValid(
"rotational_accelerations"))
311 "LineElementAction: Variable names for translational and rotational velocities "
312 "and accelerations should be provided as input to perform dynamic simulation "
313 "using beam elements using `velocities`, `accelerations`, `rotational_velocities` and "
314 "`rotational_accelerations`.");
316 _velocities = getParam<std::vector<VariableName>>(
"velocities");
317 _accelerations = getParam<std::vector<VariableName>>(
"accelerations");
318 _rot_velocities = getParam<std::vector<VariableName>>(
"rotational_velocities");
323 mooseError(
"LineElementAction: Number of translational and rotational velocity and "
324 "acceleration variable names provided as input for the beam should be same as "
325 "number of displacement variables.");
327 if (!isParamValid(
"beta") || !isParamValid(
"gamma"))
328 mooseError(
"LineElementAction: Newmark time integration parameters `beta` and `gamma` "
329 "should be provided as input to perform dynamic simulations using beams.");
333 paramError(
"density",
334 "LineElementAction: Either name of the density material property or a constant "
335 "density value should be provided as input using `density` for creating the "
336 "consistent mass/inertia matrix required for dynamic beam simulation.");
339 (!isParamValid(
"nodal_mass") && !isParamValid(
"nodal_mass_file")))
340 paramError(
"nodal_mass",
341 "LineElementAction: `nodal_mass` or `nodal_mass_file` should be provided as input "
343 "inertial forces on beam due to nodal mass.");
346 ((!isParamValid(
"nodal_Ixx") || !isParamValid(
"nodal_Iyy") || !isParamValid(
"nodal_Izz"))))
347 mooseError(
"LineElementAction: `nodal_Ixx`, `nodal_Iyy`, `nodal_Izz` should be provided as "
348 "input to calculate inertial torque on beam due to nodal inertia.");
352 if (!isParamValid(
"area"))
354 "LineElementAction: `area` should be provided as input for "
357 if (isParamValid(
"rotations"))
358 paramError(
"rotations",
359 "LineElementAction: Rotational variables cannot be set for truss elements.");
367 if (_current_task ==
"create_problem")
374 if (_current_task ==
"add_variable")
391 if (_current_task ==
"add_material")
398 if (_current_task ==
"add_kernel")
405 if (_current_task ==
"add_aux_variable")
411 if (_current_task ==
"add_aux_kernel")
419 if (_current_task ==
"add_nodal_kernel")
429 if (getParam<bool>(
"add_variables"))
432 for (
const auto & action : actions)
435 const auto added_size = action->_subdomain_ids.size();
439 if (size_after != size_before + added_size)
441 "LineElementAction: The block restrictions in the LineElement actions must be "
444 if (added_size == 0 && actions.size() > 1)
447 "LineElementAction: No LineElement action can be block unrestricted if more than one "
448 "LineElement action is specified.");
456 if (getParam<bool>(
"add_variables"))
458 auto params = _factory.getValidParams(
"MooseVariable");
461 const bool second = _problem->mesh().hasSecondOrderElements();
463 mooseError(
"LineElementAction: Only linear truss and beam elements are currently supported. "
464 "Please change the order of elements in the mesh to use first order elements.");
466 params.set<MooseEnum>(
"order") =
"FIRST";
467 params.set<MooseEnum>(
"family") =
"LAGRANGE";
473 _problem->addVariable(
"MooseVariable", disp, params);
482 _problem->addVariable(
"MooseVariable", rot, params);
496 auto params = _factory.getValidParams(
"ComputeIncrementalBeamStrain");
497 params.applyParameters(parameters(), {
"boundary",
"use_displaced_mesh"});
498 params.set<
bool>(
"use_displaced_mesh") =
false;
501 params.set<
bool>(
"large_strain") =
true;
503 _problem->addMaterial(
"ComputeIncrementalBeamStrain",
name() +
"_strain", params);
507 auto params = _factory.getValidParams(
"ComputeFiniteBeamStrain");
508 params.applyParameters(parameters(), {
"boundary",
"use_displaced_mesh"});
509 params.set<
bool>(
"use_displaced_mesh") =
false;
512 params.set<
bool>(
"large_strain") =
true;
514 _problem->addMaterial(
"ComputeFiniteBeamStrain",
name() +
"_strain", params);
525 auto params = _factory.getValidParams(
"StressDivergenceBeam");
526 params.applyParameters(parameters(), {
"use_displaced_mesh",
"save_in",
"diag_save_in"});
529 for (
unsigned int i = 0; i < 2 *
_ndisp; ++i)
531 std::string kernel_name =
name() +
"_stress_divergence_beam_" + Moose::stringify(i);
535 params.set<
unsigned int>(
"component") = i;
536 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
539 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
541 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
543 _problem->addKernel(
"StressDivergenceBeam", kernel_name, params);
547 params.set<
unsigned int>(
"component") = i;
548 params.set<NonlinearVariableName>(
"variable") =
_rotations[i - 3];
551 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
553 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
555 _problem->addKernel(
"StressDivergenceBeam", kernel_name, params);
563 params = _factory.getValidParams(
"InertialForceBeam");
564 params.applyParameters(parameters(), {
"use_displaced_mesh",
"save_in",
"diag_save_in"});
567 for (
unsigned int i = 0; i < 2 *
_ndisp; ++i)
569 std::string kernel_name =
name() +
"_inertial_force_beam_" + Moose::stringify(i);
573 params.set<
unsigned int>(
"component") = i;
574 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
577 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
579 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
581 _problem->addKernel(
"InertialForceBeam", kernel_name, params);
585 params.set<
unsigned int>(
"component") = i;
586 params.set<NonlinearVariableName>(
"variable") =
_rotations[i - 3];
589 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
591 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
593 _problem->addKernel(
"InertialForceBeam", kernel_name, params);
601 auto params = _factory.getValidParams(
"StressDivergenceTensorsTruss");
602 params.applyParameters(parameters(), {
"use_displaced_mesh",
"save_in",
"diag_save_in"});
603 params.set<
bool>(
"use_displaced_mesh") =
true;
605 for (
unsigned int i = 0; i <
_ndisp; ++i)
607 std::string kernel_name =
name() +
"_stress_divergence_truss_" + Moose::stringify(i);
608 params.set<
unsigned int>(
"component") = i;
609 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
612 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
614 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
616 _problem->addKernel(
"StressDivergenceTensorsTruss", kernel_name, params);
626 auto params = _factory.getValidParams(
"MooseVariable");
628 params.set<MooseEnum>(
"order") =
"FIRST";
629 params.set<MooseEnum>(
"family") =
"LAGRANGE";
632 _problem->addAuxVariable(
"MooseVariable", vel, params);
635 _problem->addAuxVariable(
"MooseVariable", accel, params);
638 _problem->addAuxVariable(
"MooseVariable", rot_vel, params);
641 _problem->addAuxVariable(
"MooseVariable", rot_accel, params);
650 auto params = _factory.getValidParams(
"NewmarkAccelAux");
651 params.applyParameters(parameters(), {
"boundary"});
652 params.set<ExecFlagEnum>(
"execute_on") = EXEC_TIMESTEP_END;
654 for (
unsigned i = 0; i < 2 *
_ndisp; ++i)
656 std::string aux_kernel_name =
name() +
"_newmark_accel_" + Moose::stringify(i);
661 params.set<std::vector<VariableName>>(
"velocity") = {
_velocities[i]};
662 params.set<std::vector<VariableName>>(
"displacement") = {
_displacements[i]};
664 _problem->addAuxKernel(
"NewmarkAccelAux", aux_kernel_name, params);
670 params.set<std::vector<VariableName>>(
"displacement") = {
_rotations[i -
_ndisp]};
672 _problem->addAuxKernel(
"NewmarkAccelAux", aux_kernel_name, params);
676 params = _factory.getValidParams(
"NewmarkVelAux");
677 params.applyParameters(parameters(), {
"boundary"});
678 params.set<ExecFlagEnum>(
"execute_on") = EXEC_TIMESTEP_END;
680 for (
unsigned i = 0; i < 2 *
_ndisp; ++i)
682 std::string aux_kernel_name =
name() +
"_newmark_vel_" + Moose::stringify(i);
686 params.set<AuxVariableName>(
"variable") =
_velocities[i];
687 params.set<std::vector<VariableName>>(
"acceleration") = {
_accelerations[i]};
688 _problem->addAuxKernel(
"NewmarkVelAux", aux_kernel_name, params);
694 _problem->addAuxKernel(
"NewmarkVelAux", aux_kernel_name, params);
710 std::string ss(getParam<MaterialPropertyName>(
"eta"));
711 Real real_value = MooseUtils::convert<Real>(ss);
718 auto params = _factory.getValidParams(
"NodalTranslationalInertia");
719 params.applyParameters(parameters(),
720 {
"save_in",
"diag_save_in",
"use_displaced_mesh",
"eta"});
721 params.set<Real>(
"mass") = getParam<Real>(
"nodal_mass");
722 params.set<Real>(
"eta") = eta;
725 for (
unsigned i = 0; i <
_ndisp; ++i)
727 std::string nodal_kernel_name =
728 name() +
"_nodal_translational_inertia_" + Moose::stringify(i);
730 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
731 params.set<std::vector<VariableName>>(
"velocity") = {
_velocities[i]};
732 params.set<std::vector<VariableName>>(
"acceleration") = {
_accelerations[i]};
735 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
738 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
740 _problem->addNodalKernel(
"NodalTranslationalInertia", nodal_kernel_name, params);
746 auto params = _factory.getValidParams(
"NodalRotationalInertia");
747 params.applyParameters(parameters(),
750 "use_displaced_mesh",
754 params.set<Real>(
"Ixx") = getParam<Real>(
"nodal_Ixx");
755 params.set<Real>(
"Iyy") = getParam<Real>(
"nodal_Iyy");
756 params.set<Real>(
"Izz") = getParam<Real>(
"nodal_Izz");
757 params.set<Real>(
"eta") = eta;
760 if (isParamValid(
"nodal_Ixy"))
761 params.set<Real>(
"Ixy") = getParam<Real>(
"nodal_Ixy");
763 if (isParamValid(
"nodal_Ixz"))
764 params.set<Real>(
"Ixz") = getParam<Real>(
"nodal_Ixz");
766 if (isParamValid(
"nodal_Iyz"))
767 params.set<Real>(
"Iyz") = getParam<Real>(
"nodal_Iyz");
769 if (isParamValid(
"nodal_x_orientation"))
770 params.set<Real>(
"x_orientation") = getParam<Real>(
"nodal_x_orientation");
772 if (isParamValid(
"nodal_y_orientation"))
773 params.set<Real>(
"y_orientation") = getParam<Real>(
"nodal_y_orientation");
775 for (
unsigned i = 0; i <
_ndisp; ++i)
777 std::string nodal_kernel_name =
name() +
"_nodal_rotational_inertia_" + Moose::stringify(i);
779 params.set<
unsigned int>(
"component") = i;
780 params.set<NonlinearVariableName>(
"variable") =
_rotations[i];
783 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i +
_ndisp]};
788 _problem->addNodalKernel(
"NodalRotationalInertia", nodal_kernel_name, params);