20#include "libmesh/string_to_enum.h"
35 params.
addClassDescription(
"Sets up variables, stress divergence kernels and materials required "
36 "for a static analysis with beam or truss elements. Also sets up aux "
37 "variables, aux kernels, and consistent or nodal inertia kernels for "
38 "dynamic analysis with beam elements.");
43 "Set to true if the line elements are truss elements instead of the default beam elements.");
44 params.
addParam<
bool>(
"add_variables",
46 "Add the displacement variables for truss elements "
47 "and both displacement and rotation variables for "
49 params.
addParam<std::vector<VariableName>>(
50 "displacements",
"The nonlinear displacement variables for the problem");
55 "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
61 "use_displaced_mesh",
false,
"Whether to use displaced mesh in the kernels");
64 params.
addParam<std::vector<SubdomainName>>(
67 "The list of ids of the blocks (subdomain) "
68 "that the stress divergence, inertia kernels and materials will be "
71 params.
addParam<std::vector<AuxVariableName>>(
72 "save_in", {},
"The displacement and rotational residuals");
73 params.
addParam<std::vector<AuxVariableName>>(
74 "diag_save_in", {},
"The displacement and rotational diagonal preconditioner terms");
84 params.
addParam<std::vector<VariableName>>(
85 "rotations",
"The rotations appropriate for the simulation geometry and coordinate system");
87 MooseEnum strainType(
"SMALL FINITE",
"SMALL");
90 params.
addParam<std::vector<MaterialPropertyName>>(
91 "eigenstrain_names",
"List of beam eigenstrains to be applied in this strain calculation.");
94 params.
addParam<RealGradient>(
"y_orientation",
95 "Orientation of the y direction along "
96 "which Iyy is provided. This should be "
97 "perpendicular to the axis of the beam.");
100 "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
103 "First moment of area of the beam about y axis. Can be supplied "
104 "as either a number or a variable name.");
107 "First moment of area of the beam about z axis. Can be supplied "
108 "as either a number or a variable name.");
110 "Second moment of area of the beam about x axis. Can be supplied as "
111 "either a number or a variable name.");
113 "Second moment of area of the beam about y axis. Can be supplied as "
114 "either a number or a variable name.");
116 "Second moment of area of the beam about z axis. Can be supplied as "
117 "either a number or a variable name.");
120 params.
addParam<
bool>(
"add_dynamic_variables",
121 "Adds translational and rotational velocity and acceleration aux variables "
122 "and sets up the corresponding AuxKernels for calculating these variables "
123 "using Newmark time integration. When dynamic_consistent_inertia, "
124 "dynamic_nodal_rotational_inertia or dynamic_nodal_translational_inertia "
125 "are set to true, these variables are automatically set up.");
127 params.
addParam<std::vector<VariableName>>(
"velocities",
"Translational velocity variables");
128 params.
addParam<std::vector<VariableName>>(
"accelerations",
129 "Translational acceleration variables");
130 params.
addParam<std::vector<VariableName>>(
"rotational_velocities",
131 "Rotational velocity variables");
132 params.
addParam<std::vector<VariableName>>(
"rotational_accelerations",
133 "Rotational acceleration variables");
135 "beta",
"beta>0.0",
"beta parameter for Newmark Time integration");
137 "gamma",
"gamma>0.0",
"gamma parameter for Newmark Time integration");
138 params.
addParam<MaterialPropertyName>(
"eta",
140 "Name of material property or a constant real "
141 "number defining the eta parameter for mass proportional "
142 "Rayleigh damping.");
143 params.
addParam<MaterialPropertyName>(
146 "Name of material property or a constant real "
147 "number defining the zeta parameter for stiffness proportional "
148 "Rayleigh damping.");
151 "alpha>=-0.3333 & alpha<=0.0",
152 "alpha parameter for mass dependent numerical damping induced "
153 "by HHT time integration scheme");
156 params.
addParam<
bool>(
"dynamic_consistent_inertia",
158 "If set to true, consistent mass and "
159 "inertia matrices are used for the "
160 "inertial force/torque calculations.");
161 params.
addParam<MaterialPropertyName>(
163 "Name of Material Property or a constant real number defining the density of the beam.");
167 "dynamic_nodal_translational_inertia",
169 "If set to true, nodal mass matrix is used for the inertial force calculation.");
171 "nodal_mass",
"nodal_mass>0.0",
"Mass associated with the node");
174 "The file containing the nodal positions and the corresponding nodal masses.");
178 "dynamic_nodal_rotational_inertia",
180 "If set to true, nodal inertia matrix is used for the inertial torque calculation.");
182 "nodal_Ixx",
"nodal_Ixx>=0.0",
"Nodal moment of inertia in the x direction.");
184 "nodal_Iyy",
"nodal_Iyy>=0.0",
"Nodal moment of inertia in the y direction.");
186 "nodal_Izz",
"nodal_Izz>=0.0",
"Nodal moment of inertia in the z direction.");
187 params.
addParam<Real>(
"nodal_Ixy", 0.0,
"Nodal moment of inertia in the xy direction.");
188 params.
addParam<Real>(
"nodal_Ixz", 0.0,
"Nodal moment of inertia in the xz direction.");
189 params.
addParam<Real>(
"nodal_Iyz", 0.0,
"Nodal moment of inertia in the yz direction.");
191 "nodal_x_orientation",
192 "Unit vector along the x direction if different from global x direction.");
194 "nodal_y_orientation",
195 "Unit vector along the y direction if different from global y direction.");
196 params.
addParam<std::vector<BoundaryName>>(
199 "The list of boundary IDs from the mesh where the nodal "
200 "mass/inertia will be applied.");
210 _rot_accelerations(0),
211 _subdomain_names(getParam<
std::vector<SubdomainName>>(
"block")),
213 _add_dynamic_variables(false)
222 if (action.size() == 1)
226 _save_in = getParam<std::vector<AuxVariableName>>(
"save_in");
227 _diag_save_in = getParam<std::vector<AuxVariableName>>(
"diag_save_in");
239 bool user_defined_add_dynamic_variables = getParam<bool>(
"add_dynamic_variables");
243 mooseError(
"LineElementAction: When using 'dynamic_consistent_inertia', "
244 "'dynamic_nodal_rotational_inertia' or '_dynamic_nodal_translational_inertia', "
245 "the velocity and acceleration AuxVariables and the corresponding AuxKernels are "
246 "automatically set by the action and this cannot be turned off by setting "
247 "'add_dynamic_variables' to false.");
249 _truss = getParam<bool>(
"truss");
253 "LineElementAction: A vector of displacement variable names should be provided as "
254 "input using `displacements`.");
256 _displacements = getParam<std::vector<VariableName>>(
"displacements");
263 bool use_displaced_mesh_param = getParam<bool>(
"use_displaced_mesh");
267 "LineElementAction: Wrong combination of "
268 "`use_displaced_mesh`, `strain_type` and `rotation_type`.");
274 "LineElementAction: Number of save_in variables should equal to the number of "
275 "displacement variables ",
280 "LineElementAction: Number of diag_save_in variables should equal to the number of "
281 "displacement variables ",
291 "LineElementAction: Rotational variable names should be provided for beam "
292 "elements using `rotations` parameter.");
294 _rotations = getParam<std::vector<VariableName>>(
"rotations");
298 "LineElementAction: Number of rotational and displacement variable names provided "
299 "as input for beam should be same.");
303 mooseError(
"LineElementAction: `y_orientation`, `area`, `Iy` and `Iz` should be provided for "
312 "LineElementAction: Variable names for translational and rotational velocities "
313 "and accelerations should be provided as input to perform dynamic simulation "
314 "using beam elements using `velocities`, `accelerations`, `rotational_velocities` and "
315 "`rotational_accelerations`.");
317 _velocities = getParam<std::vector<VariableName>>(
"velocities");
318 _accelerations = getParam<std::vector<VariableName>>(
"accelerations");
319 _rot_velocities = getParam<std::vector<VariableName>>(
"rotational_velocities");
324 mooseError(
"LineElementAction: Number of translational and rotational velocity and "
325 "acceleration variable names provided as input for the beam should be same as "
326 "number of displacement variables.");
329 mooseError(
"LineElementAction: Newmark time integration parameters `beta` and `gamma` "
330 "should be provided as input to perform dynamic simulations using beams.");
335 "LineElementAction: Either name of the density material property or a constant "
336 "density value should be provided as input using `density` for creating the "
337 "consistent mass/inertia matrix required for dynamic beam simulation.");
342 "LineElementAction: `nodal_mass` or `nodal_mass_file` should be provided as input "
344 "inertial forces on beam due to nodal mass.");
348 mooseError(
"LineElementAction: `nodal_Ixx`, `nodal_Iyy`, `nodal_Izz` should be provided as "
349 "input to calculate inertial torque on beam due to nodal inertia.");
355 "LineElementAction: `area` should be provided as input for "
360 "LineElementAction: Rotational variables cannot be set for truss elements.");
430 if (getParam<bool>(
"add_variables"))
433 for (
const auto & action : actions)
440 if (size_after != size_before + added_size)
442 "LineElementAction: The block restrictions in the LineElement actions must be "
445 if (added_size == 0 && actions.size() > 1)
448 "LineElementAction: No LineElement action can be block unrestricted if more than one "
449 "LineElement action is specified.");
457 if (getParam<bool>(
"add_variables"))
462 const bool second =
_problem->mesh().hasSecondOrderElements();
464 mooseError(
"LineElementAction: Only linear truss and beam elements are currently supported. "
465 "Please change the order of elements in the mesh to use first order elements.");
467 params.set<
MooseEnum>(
"order") =
"FIRST";
468 params.set<
MooseEnum>(
"family") =
"LAGRANGE";
475 _problem->addVariable(
"MooseVariable", disp, params);
485 _problem->addVariable(
"MooseVariable", rot, params);
501 params.set<
bool>(
"use_displaced_mesh") =
false;
504 params.set<
bool>(
"large_strain") =
true;
506 _problem->addMaterial(
"ComputeIncrementalBeamStrain",
name() +
"_strain", params);
512 params.set<
bool>(
"use_displaced_mesh") =
false;
515 params.set<
bool>(
"large_strain") =
true;
517 _problem->addMaterial(
"ComputeFiniteBeamStrain",
name() +
"_strain", params);
532 for (
unsigned int i = 0; i < 2 *
_ndisp; ++i)
538 params.set<
unsigned int>(
"component") = i;
539 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
542 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
544 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
546 _problem->addKernel(
"StressDivergenceBeam", kernel_name, params);
550 params.set<
unsigned int>(
"component") = i;
551 params.set<NonlinearVariableName>(
"variable") =
_rotations[i - 3];
554 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
556 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
558 _problem->addKernel(
"StressDivergenceBeam", kernel_name, params);
570 for (
unsigned int i = 0; i < 2 *
_ndisp; ++i)
576 params.set<
unsigned int>(
"component") = i;
577 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
580 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
582 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
584 _problem->addKernel(
"InertialForceBeam", kernel_name, params);
588 params.set<
unsigned int>(
"component") = i;
589 params.set<NonlinearVariableName>(
"variable") =
_rotations[i - 3];
592 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
594 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
596 _problem->addKernel(
"InertialForceBeam", kernel_name, params);
606 params.set<
bool>(
"use_displaced_mesh") =
true;
608 for (
unsigned int i = 0; i <
_ndisp; ++i)
611 params.set<
unsigned int>(
"component") = i;
612 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
615 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
617 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
619 _problem->addKernel(
"StressDivergenceTensorsTruss", kernel_name, params);
632 params.set<
MooseEnum>(
"family") =
"LAGRANGE";
635 _problem->addAuxVariable(
"MooseVariable", vel, params);
638 _problem->addAuxVariable(
"MooseVariable", accel, params);
641 _problem->addAuxVariable(
"MooseVariable", rot_vel, params);
644 _problem->addAuxVariable(
"MooseVariable", rot_accel, params);
657 for (
unsigned i = 0; i < 2 *
_ndisp; ++i)
664 params.set<std::vector<VariableName>>(
"velocity") = {
_velocities[i]};
665 params.set<std::vector<VariableName>>(
"displacement") = {
_displacements[i]};
667 _problem->addAuxKernel(
"NewmarkAccelAux", aux_kernel_name, params);
673 params.set<std::vector<VariableName>>(
"displacement") = {
_rotations[i -
_ndisp]};
675 _problem->addAuxKernel(
"NewmarkAccelAux", aux_kernel_name, params);
683 for (
unsigned i = 0; i < 2 *
_ndisp; ++i)
689 params.set<AuxVariableName>(
"variable") =
_velocities[i];
690 params.set<std::vector<VariableName>>(
"acceleration") = {
_accelerations[i]};
691 _problem->addAuxKernel(
"NewmarkVelAux", aux_kernel_name, params);
697 _problem->addAuxKernel(
"NewmarkVelAux", aux_kernel_name, params);
713 std::string ss(getParam<MaterialPropertyName>(
"eta"));
714 Real real_value = MooseUtils::convert<Real>(ss);
723 {
"save_in",
"diag_save_in",
"use_displaced_mesh",
"eta"});
724 params.set<Real>(
"mass") = getParam<Real>(
"nodal_mass");
725 params.set<Real>(
"eta") =
eta;
728 for (
unsigned i = 0; i <
_ndisp; ++i)
730 std::string nodal_kernel_name =
733 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
734 params.set<std::vector<VariableName>>(
"velocity") = {
_velocities[i]};
735 params.set<std::vector<VariableName>>(
"acceleration") = {
_accelerations[i]};
738 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i]};
741 params.set<std::vector<AuxVariableName>>(
"diag_save_in") = {
_diag_save_in[i]};
743 _problem->addNodalKernel(
"NodalTranslationalInertia", nodal_kernel_name, params);
753 "use_displaced_mesh",
757 params.set<Real>(
"Ixx") = getParam<Real>(
"nodal_Ixx");
758 params.set<Real>(
"Iyy") = getParam<Real>(
"nodal_Iyy");
759 params.set<Real>(
"Izz") = getParam<Real>(
"nodal_Izz");
760 params.set<Real>(
"eta") =
eta;
764 params.set<Real>(
"Ixy") = getParam<Real>(
"nodal_Ixy");
767 params.set<Real>(
"Ixz") = getParam<Real>(
"nodal_Ixz");
770 params.set<Real>(
"Iyz") = getParam<Real>(
"nodal_Iyz");
773 params.set<Real>(
"x_orientation") = getParam<Real>(
"nodal_x_orientation");
776 params.set<Real>(
"y_orientation") = getParam<Real>(
"nodal_y_orientation");
778 for (
unsigned i = 0; i <
_ndisp; ++i)
782 params.set<
unsigned int>(
"component") = i;
783 params.set<NonlinearVariableName>(
"variable") =
_rotations[i];
786 params.set<std::vector<AuxVariableName>>(
"save_in") = {
_save_in[i +
_ndisp]};
791 _problem->addNodalKernel(
"NodalRotationalInertia", nodal_kernel_name, params);
registerMooseAction("SolidMechanicsApp", LineElementAction, "create_problem")
const ExecFlagType EXEC_TIMESTEP_END
std::vector< const T * > getActions()
MooseObjectName uniqueActionName() const
std::shared_ptr< MooseMesh > & _mesh
static InputParameters validParams()
std::shared_ptr< FEProblemBase > & _problem
const std::string & _current_task
Store common line element action parameters.
InputParameters getValidParams(const std::string &name) const
void actAddMaterials()
Adds material objects required for beam and truss elements.
std::vector< SubdomainName > _subdomain_names
If this vector is not empty the variables, auxvariables, kernels, auxkernels, nodalkernels and materi...
void actAddAuxKernels()
Adds auxkernels corresponding to the translational and rotational velocity and acceleration aux varia...
static InputParameters validParams()
void actAddAuxVariables()
Adds translational and rotational velocity and acceleration aux variables for dynamic beam simulation...
unsigned int _ndisp
Number of displacement variables.
bool _add_dynamic_variables
Set to true to set up translational and acceleration AuxVariables and the corresponding AuxKernels us...
std::vector< VariableName > _rotations
Names of rotational variables for beam element.
void actGatherActionParameters()
Gather all the block ids from all the actions of this type to create variables spanning all the block...
static InputParameters beamParameters()
Add parameters required for a beam element.
std::vector< VariableName > _velocities
Names of translational velocity variables for dynamic simulation using beam element.
std::vector< AuxVariableName > _save_in
residual debugging
std::vector< AuxVariableName > _diag_save_in
bool _dynamic_nodal_rotational_inertia
Set to true to use nodal inertia matrix to calculate inertial torques in dynamic beam simulations.
bool _dynamic_nodal_translational_inertia
Set to true to use nodal mass matrix to calculate inertial forces in dynamic beam simulations.
std::set< SubdomainID > _subdomain_ids
set generated from the passed in vector of subdomain names
std::vector< VariableName > _rot_accelerations
Names of rotational acceleration variables for dynamic simulation beam element.
std::vector< VariableName > _accelerations
Names of translational acceleration variables for dynamic simulation beam element.
std::set< SubdomainID > _subdomain_id_union
set generated from the combined block restrictions of all LineElementAction action blocks
bool _truss
Set to true if line element is a truss.
bool _dynamic_consistent_inertia
Set to true to use consistent mass and inertia matrices to calculate inertial forces/torques in dynam...
void actAddNodalKernels()
Adds nodal kernels that calculate inertial force/torque due to mass/inertia assigned to nodes of the ...
void actAddVariables()
Adds displacement and rotation variables.
bool _use_displaced_mesh
use displaced mesh (true unless _strain is SMALL_STRAIN_AND_ROTATION)
LineElementAction(const InputParameters ¶ms)
enum LineElementAction::Strain _strain_type
std::vector< VariableName > _displacements
Names of displacement variables.
std::vector< VariableName > _rot_velocities
Names of rotational velocity variables for dynamic simulation using beam element.
void actAddKernels()
Adds StressDivergence kernels for beam and truss elements and inertia kernels for dynamic beam simula...
InputParameterWarehouse & getInputParameterWarehouse()
const InputParameters & parameters() const
const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
std::string stringify(const T &t)