www.mooseframework.org
LineElementAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "Conversion.h"
11 #include "FEProblem.h"
12 #include "Factory.h"
13 #include "MooseMesh.h"
14 #include "MooseObjectAction.h"
15 #include "LineElementAction.h"
17 
18 #include "libmesh/string_to_enum.h"
19 #include <algorithm>
20 
21 registerMooseAction("TensorMechanicsApp", LineElementAction, "create_problem");
22 
23 registerMooseAction("TensorMechanicsApp", LineElementAction, "add_variable");
24 
25 registerMooseAction("TensorMechanicsApp", LineElementAction, "add_aux_variable");
26 
27 registerMooseAction("TensorMechanicsApp", LineElementAction, "add_kernel");
28 
29 registerMooseAction("TensorMechanicsApp", LineElementAction, "add_aux_kernel");
30 
31 registerMooseAction("TensorMechanicsApp", LineElementAction, "add_nodal_kernel");
32 
33 registerMooseAction("TensorMechanicsApp", LineElementAction, "add_material");
34 
36 
37 InputParameters
39 {
40  InputParameters params = Action::validParams();
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.");
45 
46  params.addParam<bool>(
47  "truss",
48  false,
49  "Set to true if the line elements are truss elements instead of the default beam elements.");
50  params.addParam<bool>("add_variables",
51  false,
52  "Add the displacement variables for truss elements "
53  "and both displacement and rotation variables for "
54  "beam elements.");
55  params.addParam<std::vector<VariableName>>(
56  "displacements", "The nonlinear displacement variables for the problem");
57 
58  // Common geometry parameters between beam and truss
59  params.addCoupledVar(
60  "area",
61  "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
62 
63  // Beam Parameters
65 
66  params.addParam<bool>(
67  "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
68  // parameters specified here only appear in the input file sub-blocks of the
69  // Master action, not in the common parameters area
70  params.addParam<std::vector<SubdomainName>>(
71  "block",
72  "The list of ids of the blocks (subdomain) "
73  "that the stress divergence, inertia kernels and materials will be "
74  "applied to");
75  // Advanced
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");
81  return params;
82 }
83 
84 InputParameters
86 {
87  InputParameters params = emptyInputParameters();
88 
89  params.addParam<std::vector<VariableName>>(
90  "rotations", "The rotations appropriate for the simulation geometry and coordinate system");
91 
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.");
97 
98  // Beam geometry
99  params.addParam<RealGradient>("y_orientation",
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(
104  "area",
105  "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
106  params.addCoupledVar("Ay",
107  0.0,
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",
111  0.0,
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.");
123 
124  // Common parameters for both dynamic consistent and nodal mass/inertia
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.");
131 
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",
144  0.0,
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>(
149  "zeta",
150  0.0,
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",
155  0,
156  "alpha>=-0.3333 & alpha<=0.0",
157  "alpha parameter for mass dependent numerical damping induced "
158  "by HHT time integration scheme");
159 
160  // dynamic consistent mass/inertia
161  params.addParam<bool>("dynamic_consistent_inertia",
162  false,
163  "If set to true, consistent mass and "
164  "inertia matrices are used for the "
165  "inertial force/torque calculations.");
166  params.addParam<MaterialPropertyName>(
167  "density",
168  "Name of Material Property or a constant real number defining the density of the beam.");
169 
170  // dynamic nodal translational inertia
171  params.addParam<bool>(
172  "dynamic_nodal_translational_inertia",
173  false,
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>(
178  "nodal_mass_file",
179  "The file containing the nodal positions and the corresponding nodal masses.");
180 
181  // dynamic nodal rotational inertia
182  params.addParam<bool>(
183  "dynamic_nodal_rotational_inertia",
184  false,
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.");
195  params.addParam<RealGradient>(
196  "nodal_x_orientation",
197  "Unit vector along the x direction if different from global x direction.");
198  params.addParam<RealGradient>(
199  "nodal_y_orientation",
200  "Unit vector along the y direction if different from global y direction.");
201  params.addParam<std::vector<BoundaryName>>(
202  "boundary",
203  "The list of boundary IDs from the mesh where the nodal "
204  "mass/inertia will be applied.");
205  return params;
206 }
207 
208 LineElementAction::LineElementAction(const InputParameters & params)
209  : Action(params),
210  _rotations(0),
211  _velocities(0),
212  _accelerations(0),
213  _rot_velocities(0),
214  _rot_accelerations(0),
215  _subdomain_names(getParam<std::vector<SubdomainName>>("block")),
216  _subdomain_ids(),
217  _add_dynamic_variables(false)
218 {
219  // check if a container block with common parameters is found
220  auto action = _awh.getActions<CommonLineElementAction>();
221  if (action.size() == 1)
222  _pars.applyParameters(action[0]->parameters());
223 
224  // Set values to variables after common parameters are applied
225  _save_in = getParam<std::vector<AuxVariableName>>("save_in");
226  _diag_save_in = getParam<std::vector<AuxVariableName>>("diag_save_in");
227  _strain_type = getParam<MooseEnum>("strain_type").getEnum<Strain>();
228  _rotation_type = getParam<MooseEnum>("rotation_type").getEnum<Strain>();
229  _dynamic_consistent_inertia = getParam<bool>("dynamic_consistent_inertia");
230  _dynamic_nodal_translational_inertia = getParam<bool>("dynamic_nodal_translational_inertia");
231  _dynamic_nodal_rotational_inertia = getParam<bool>("dynamic_nodal_rotational_inertia");
234  _add_dynamic_variables = true;
235 
236  if (params.isParamSetByUser("add_dynamic_variables"))
237  {
238  bool user_defined_add_dynamic_variables = getParam<bool>("add_dynamic_variables");
239  if (!_add_dynamic_variables && user_defined_add_dynamic_variables)
240  _add_dynamic_variables = true;
241  else if (_add_dynamic_variables && !user_defined_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.");
247  }
248  _truss = getParam<bool>("truss");
249 
250  if (!isParamValid("displacements"))
251  paramError("displacements",
252  "LineElementAction: A vector of displacement variable names should be provided as "
253  "input using `displacements`.");
254 
255  _displacements = getParam<std::vector<VariableName>>("displacements");
256  _ndisp = _displacements.size();
257 
258  // determine if displaced mesh is to be used
260  if (params.isParamSetByUser("use_displaced_mesh"))
261  {
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`.");
268  _use_displaced_mesh = use_displaced_mesh_param;
269  }
270 
271  if (_save_in.size() != 0 && _save_in.size() != _ndisp)
272  paramError("save_in",
273  "LineElementAction: Number of save_in variables should equal to the number of "
274  "displacement variables ",
275  _ndisp);
276 
277  if (_diag_save_in.size() != 0 && _diag_save_in.size() != _ndisp)
278  paramError("diag_save_in",
279  "LineElementAction: Number of diag_save_in variables should equal to the number of "
280  "displacement variables ",
281  _ndisp);
282 
283  // Check if all the parameters required for static and dynamic beam simulation are provided as
284  // input
285  if (!_truss)
286  {
287  // Parameters required for static simulation using beams
288  if (!isParamValid("rotations"))
289  paramError("rotations",
290  "LineElementAction: Rotational variable names should be provided for beam "
291  "elements using `rotations` parameter.");
292 
293  _rotations = getParam<std::vector<VariableName>>("rotations");
294 
295  if (_rotations.size() != _ndisp)
296  paramError("rotations",
297  "LineElementAction: Number of rotational and displacement variable names provided "
298  "as input for beam should be same.");
299 
300  if (!isParamValid("y_orientation") || !isParamValid("area") || !isParamValid("Iy") ||
301  !isParamValid("Iz"))
302  mooseError("LineElementAction: `y_orientation`, `area`, `Iy` and `Iz` should be provided for "
303  "beam elements.");
304 
305  // Parameters required for dynamic simulation using beams
307  {
308  if (!isParamValid("velocities") || !isParamValid("accelerations") ||
309  !isParamValid("rotational_velocities") || !isParamValid("rotational_accelerations"))
310  mooseError(
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`.");
315 
316  _velocities = getParam<std::vector<VariableName>>("velocities");
317  _accelerations = getParam<std::vector<VariableName>>("accelerations");
318  _rot_velocities = getParam<std::vector<VariableName>>("rotational_velocities");
319  _rot_accelerations = getParam<std::vector<VariableName>>("rotational_accelerations");
320 
321  if (_velocities.size() != _ndisp || _accelerations.size() != _ndisp ||
322  _rot_velocities.size() != _ndisp || _rot_accelerations.size() != _ndisp)
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.");
326 
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.");
330  }
331 
332  if (_dynamic_consistent_inertia && !isParamValid("density"))
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.");
337 
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 "
342  "to calculate "
343  "inertial forces on beam due to nodal mass.");
344 
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.");
349  }
350  else // if truss
351  {
352  if (!isParamValid("area"))
353  paramError("area",
354  "LineElementAction: `area` should be provided as input for "
355  "truss elements.");
356 
357  if (isParamValid("rotations"))
358  paramError("rotations",
359  "LineElementAction: Rotational variables cannot be set for truss elements.");
360  }
361 }
362 
363 void
365 {
366  // Get the subdomain involved in the action once the mesh setup is complete
367  if (_current_task == "create_problem")
368  {
369  // get subdomain IDs
370  for (auto & name : _subdomain_names)
371  _subdomain_ids.insert(_mesh->getSubdomainID(name));
372  }
373 
374  if (_current_task == "add_variable")
375  {
376  //
377  // Gather info from all other LineElementAction
378  //
380 
381  //
382  // Add variables (optional)
383  //
384  actAddVariables();
385  }
386 
387  //
388  // Add Materials - ComputeIncrementalBeamStrain or ComputeFiniteBeamStrain
389  // for beam elements
390  //
391  if (_current_task == "add_material")
392  actAddMaterials();
393 
394  //
395  // Add Kernels - StressDivergenceBeam and InertialForceBeam (if dynamic_consistent_inertia is
396  // turned on) for beams and StressDivergenceTensorsTruss for truss elements
397  //
398  if (_current_task == "add_kernel")
399  actAddKernels();
400 
401  //
402  // Add aux variables for translational and Rotational velocities and acceleration for dynamic
403  // analysis using beams
404  //
405  if (_current_task == "add_aux_variable")
407 
408  //
409  // Add NewmarkVelAux and NewarkAccelAux auxkernels for dynamic simulation using beams
410  //
411  if (_current_task == "add_aux_kernel")
413 
414  //
415  // Add NodalKernels - NodalTranslationalInertia (if dynamic_nodal_translational_inertia is turned
416  // on) and NodalRotattionalInertia (if dynamic_nodal_rotational_inertia) for dynamic simulations
417  // using beams
418  //
419  if (_current_task == "add_nodal_kernel")
421 }
422 
423 void
425 {
426  //
427  // Gather info about all other master actions when we add variables
428  //
429  if (getParam<bool>("add_variables"))
430  {
431  auto actions = _awh.getActions<LineElementAction>();
432  for (const auto & action : actions)
433  {
434  const auto size_before = _subdomain_id_union.size();
435  const auto added_size = action->_subdomain_ids.size();
436  _subdomain_id_union.insert(action->_subdomain_ids.begin(), action->_subdomain_ids.end());
437  const auto size_after = _subdomain_id_union.size();
438 
439  if (size_after != size_before + added_size)
440  paramError("block",
441  "LineElementAction: The block restrictions in the LineElement actions must be "
442  "non-overlapping.");
443 
444  if (added_size == 0 && actions.size() > 1)
445  paramError(
446  "block",
447  "LineElementAction: No LineElement action can be block unrestricted if more than one "
448  "LineElement action is specified.");
449  }
450  }
451 }
452 
453 void
455 {
456  if (getParam<bool>("add_variables"))
457  {
458  auto params = _factory.getValidParams("MooseVariable");
459 
460  // determine order of elements in mesh
461  const bool second = _problem->mesh().hasSecondOrderElements();
462  if (second)
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.");
465 
466  params.set<MooseEnum>("order") = "FIRST";
467  params.set<MooseEnum>("family") = "LAGRANGE";
468 
469  // Loop through the displacement variables
470  for (const auto & disp : _displacements)
471  {
472  // Create displacement variables
473  _problem->addVariable("MooseVariable", disp, params);
474  }
475 
476  // Add rotation variables if line element is a beam.
477  if (!_truss)
478  {
479  for (const auto & rot : _rotations)
480  {
481  // Create rotation variables
482  _problem->addVariable("MooseVariable", rot, params);
483  }
484  }
485  }
486 }
487 
488 void
490 {
491  if (!_truss)
492  {
493  // Add Strain
495  {
496  auto params = _factory.getValidParams("ComputeIncrementalBeamStrain");
497  params.applyParameters(parameters(), {"boundary", "use_displaced_mesh"});
498  params.set<bool>("use_displaced_mesh") = false;
499 
501  params.set<bool>("large_strain") = true;
502 
503  _problem->addMaterial("ComputeIncrementalBeamStrain", name() + "_strain", params);
504  }
505  else if (_rotation_type == Strain::FINITE)
506  {
507  auto params = _factory.getValidParams("ComputeFiniteBeamStrain");
508  params.applyParameters(parameters(), {"boundary", "use_displaced_mesh"});
509  params.set<bool>("use_displaced_mesh") = false;
510 
512  params.set<bool>("large_strain") = true;
513 
514  _problem->addMaterial("ComputeFiniteBeamStrain", name() + "_strain", params);
515  }
516  }
517 }
518 
519 void
521 {
522  if (!_truss)
523  {
524  // add StressDivergenceBeam kernels
525  auto params = _factory.getValidParams("StressDivergenceBeam");
526  params.applyParameters(parameters(), {"use_displaced_mesh", "save_in", "diag_save_in"});
527  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
528 
529  for (unsigned int i = 0; i < 2 * _ndisp; ++i)
530  {
531  std::string kernel_name = name() + "_stress_divergence_beam_" + Moose::stringify(i);
532 
533  if (i < _ndisp)
534  {
535  params.set<unsigned int>("component") = i;
536  params.set<NonlinearVariableName>("variable") = _displacements[i];
537 
538  if (_save_in.size() == 2 * _ndisp)
539  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
540  if (_diag_save_in.size() == 2 * _ndisp)
541  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
542 
543  _problem->addKernel("StressDivergenceBeam", kernel_name, params);
544  }
545  else
546  {
547  params.set<unsigned int>("component") = i;
548  params.set<NonlinearVariableName>("variable") = _rotations[i - 3];
549 
550  if (_save_in.size() == 2 * _ndisp)
551  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
552  if (_diag_save_in.size() == 2 * _ndisp)
553  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
554 
555  _problem->addKernel("StressDivergenceBeam", kernel_name, params);
556  }
557  }
558  // Add InertialForceBeam if dynamic simulation using consistent mass/inertia matrix has to be
559  // performed
561  {
562  // add InertialForceBeam
563  params = _factory.getValidParams("InertialForceBeam");
564  params.applyParameters(parameters(), {"use_displaced_mesh", "save_in", "diag_save_in"});
565  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
566 
567  for (unsigned int i = 0; i < 2 * _ndisp; ++i)
568  {
569  std::string kernel_name = name() + "_inertial_force_beam_" + Moose::stringify(i);
570 
571  if (i < _ndisp)
572  {
573  params.set<unsigned int>("component") = i;
574  params.set<NonlinearVariableName>("variable") = _displacements[i];
575 
576  if (_save_in.size() == 2 * _ndisp)
577  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
578  if (_diag_save_in.size() == 2 * _ndisp)
579  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
580 
581  _problem->addKernel("InertialForceBeam", kernel_name, params);
582  }
583  else
584  {
585  params.set<unsigned int>("component") = i;
586  params.set<NonlinearVariableName>("variable") = _rotations[i - 3];
587 
588  if (_save_in.size() == 2 * _ndisp)
589  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
590  if (_diag_save_in.size() == 2 * _ndisp)
591  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
592 
593  _problem->addKernel("InertialForceBeam", kernel_name, params);
594  }
595  }
596  }
597  }
598  else
599  {
600  // Add StressDivergenceTensorsTruss kernels
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;
604 
605  for (unsigned int i = 0; i < _ndisp; ++i)
606  {
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];
610 
611  if (_save_in.size() == _ndisp)
612  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
613  if (_diag_save_in.size() == _ndisp)
614  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
615 
616  _problem->addKernel("StressDivergenceTensorsTruss", kernel_name, params);
617  }
618  }
619 }
620 
621 void
623 {
625  {
626  auto params = _factory.getValidParams("MooseVariable");
627 
628  params.set<MooseEnum>("order") = "FIRST";
629  params.set<MooseEnum>("family") = "LAGRANGE";
630 
631  for (auto vel : _velocities)
632  _problem->addAuxVariable("MooseVariable", vel, params);
633 
634  for (auto accel : _accelerations)
635  _problem->addAuxVariable("MooseVariable", accel, params);
636 
637  for (auto rot_vel : _rot_velocities)
638  _problem->addAuxVariable("MooseVariable", rot_vel, params);
639 
640  for (auto rot_accel : _rot_accelerations)
641  _problem->addAuxVariable("MooseVariable", rot_accel, params);
642  }
643 }
644 
645 void
647 {
649  {
650  auto params = _factory.getValidParams("NewmarkAccelAux");
651  params.applyParameters(parameters(), {"boundary"});
652  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
653 
654  for (unsigned i = 0; i < 2 * _ndisp; ++i)
655  {
656  std::string aux_kernel_name = name() + "_newmark_accel_" + Moose::stringify(i);
657 
658  if (i < _ndisp)
659  {
660  params.set<AuxVariableName>("variable") = _accelerations[i];
661  params.set<std::vector<VariableName>>("velocity") = {_velocities[i]};
662  params.set<std::vector<VariableName>>("displacement") = {_displacements[i]};
663 
664  _problem->addAuxKernel("NewmarkAccelAux", aux_kernel_name, params);
665  }
666  else
667  {
668  params.set<AuxVariableName>("variable") = _rot_accelerations[i - _ndisp];
669  params.set<std::vector<VariableName>>("velocity") = {_rot_velocities[i - _ndisp]};
670  params.set<std::vector<VariableName>>("displacement") = {_rotations[i - _ndisp]};
671 
672  _problem->addAuxKernel("NewmarkAccelAux", aux_kernel_name, params);
673  }
674  }
675 
676  params = _factory.getValidParams("NewmarkVelAux");
677  params.applyParameters(parameters(), {"boundary"});
678  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
679 
680  for (unsigned i = 0; i < 2 * _ndisp; ++i)
681  {
682  std::string aux_kernel_name = name() + "_newmark_vel_" + Moose::stringify(i);
683 
684  if (i < _ndisp)
685  {
686  params.set<AuxVariableName>("variable") = _velocities[i];
687  params.set<std::vector<VariableName>>("acceleration") = {_accelerations[i]};
688  _problem->addAuxKernel("NewmarkVelAux", aux_kernel_name, params);
689  }
690  else
691  {
692  params.set<AuxVariableName>("variable") = _rot_velocities[i - _ndisp];
693  params.set<std::vector<VariableName>>("acceleration") = {_rot_accelerations[i - _ndisp]};
694  _problem->addAuxKernel("NewmarkVelAux", aux_kernel_name, params);
695  }
696  }
697  }
698 }
699 
700 void
702 {
703  if (!_truss)
704  {
705  // NodalTranslationalInertia and NodalRotattionalInertia currently accept only constant real
706  // numbers for eta
707  Real eta = 0.0;
709  {
710  std::string ss(getParam<MaterialPropertyName>("eta"));
711  Real real_value = MooseUtils::convert<Real>(ss);
712 
713  eta = real_value;
714  }
715 
717  {
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;
723  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
724 
725  for (unsigned i = 0; i < _ndisp; ++i)
726  {
727  std::string nodal_kernel_name =
728  name() + "_nodal_translational_inertia_" + Moose::stringify(i);
729 
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]};
733 
734  if (_save_in.size() == 2 * _ndisp)
735  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
736 
737  if (_diag_save_in.size() == 2 * _ndisp)
738  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
739 
740  _problem->addNodalKernel("NodalTranslationalInertia", nodal_kernel_name, params);
741  }
742  }
743 
745  {
746  auto params = _factory.getValidParams("NodalRotationalInertia");
747  params.applyParameters(parameters(),
748  {"save_in",
749  "diag_save_in",
750  "use_displaced_mesh",
751  "eta",
752  "x_orientation",
753  "y_orientation"});
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;
758  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
759 
760  if (isParamValid("nodal_Ixy"))
761  params.set<Real>("Ixy") = getParam<Real>("nodal_Ixy");
762 
763  if (isParamValid("nodal_Ixz"))
764  params.set<Real>("Ixz") = getParam<Real>("nodal_Ixz");
765 
766  if (isParamValid("nodal_Iyz"))
767  params.set<Real>("Iyz") = getParam<Real>("nodal_Iyz");
768 
769  if (isParamValid("nodal_x_orientation"))
770  params.set<Real>("x_orientation") = getParam<Real>("nodal_x_orientation");
771 
772  if (isParamValid("nodal_y_orientation"))
773  params.set<Real>("y_orientation") = getParam<Real>("nodal_y_orientation");
774 
775  for (unsigned i = 0; i < _ndisp; ++i)
776  {
777  std::string nodal_kernel_name = name() + "_nodal_rotational_inertia_" + Moose::stringify(i);
778 
779  params.set<unsigned int>("component") = i;
780  params.set<NonlinearVariableName>("variable") = _rotations[i];
781 
782  if (_save_in.size() == 2 * _ndisp)
783  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i + _ndisp]};
784 
785  if (_diag_save_in.size() == 2 * _ndisp)
786  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i + _ndisp]};
787 
788  _problem->addNodalKernel("NodalRotationalInertia", nodal_kernel_name, params);
789  }
790  }
791  }
792 }
LineElementAction::_accelerations
std::vector< VariableName > _accelerations
Names of translational acceleration variables for dynamic simulation beam element.
Definition: LineElementAction.h:87
LineElementAction::Strain::FINITE
LineElementAction::_rot_velocities
std::vector< VariableName > _rot_velocities
Names of rotational velocity variables for dynamic simulation using beam element.
Definition: LineElementAction.h:93
defineLegacyParams
defineLegacyParams(LineElementAction)
LineElementAction::_rotation_type
Strain _rotation_type
Definition: LineElementAction.h:128
LineElementAction::_rot_accelerations
std::vector< VariableName > _rot_accelerations
Names of rotational acceleration variables for dynamic simulation beam element.
Definition: LineElementAction.h:99
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
LineElementAction::_dynamic_nodal_translational_inertia
bool _dynamic_nodal_translational_inertia
Set to true to use nodal mass matrix to calculate inertial forces in dynamic beam simulations.
Definition: LineElementAction.h:150
LineElementAction::actAddAuxVariables
void actAddAuxVariables()
Adds translational and rotational velocity and acceleration aux variables for dynamic beam simulation...
Definition: LineElementAction.C:622
LineElementAction::_add_dynamic_variables
bool _add_dynamic_variables
Set to true to set up translational and acceleration AuxVariables and the corresponding AuxKernels us...
Definition: LineElementAction.h:138
LineElementAction::actGatherActionParameters
void actGatherActionParameters()
Gather all the block ids from all the actions of this type to create variables spanning all the block...
Definition: LineElementAction.C:424
LineElementAction::LineElementAction
LineElementAction(const InputParameters &params)
Definition: LineElementAction.C:208
LineElementAction
Definition: LineElementAction.h:19
LineElementAction::Strain
Strain
strain formulation
Definition: LineElementAction.h:122
LineElementAction::_save_in
std::vector< AuxVariableName > _save_in
residual debugging
Definition: LineElementAction.h:102
LineElementAction::validParams
static InputParameters validParams()
Definition: LineElementAction.C:38
LineElementAction::_truss
bool _truss
Set to true if line element is a truss.
Definition: LineElementAction.h:159
LineElementAction::Strain::SMALL
LineElementAction::_velocities
std::vector< VariableName > _velocities
Names of translational velocity variables for dynamic simulation using beam element.
Definition: LineElementAction.h:81
LineElementAction::_diag_save_in
std::vector< AuxVariableName > _diag_save_in
Definition: LineElementAction.h:103
CommonLineElementAction.h
LineElementAction::_subdomain_ids
std::set< SubdomainID > _subdomain_ids
set generated from the passed in vector of subdomain names
Definition: LineElementAction.h:113
CommonLineElementAction
Store common line element action parameters.
Definition: CommonLineElementAction.h:22
LineElementAction::beamParameters
static InputParameters beamParameters()
Add parameters required for a beam element.
Definition: LineElementAction.C:85
LineElementAction::_subdomain_id_union
std::set< SubdomainID > _subdomain_id_union
set generated from the combined block restrictions of all LineElementAction action blocks
Definition: LineElementAction.h:119
LineElementAction::_strain_type
enum LineElementAction::Strain _strain_type
validParams
InputParameters validParams()
LineElementAction.h
name
const std::string name
Definition: Setup.h:21
LineElementAction::actAddNodalKernels
void actAddNodalKernels()
Adds nodal kernels that calculate inertial force/torque due to mass/inertia assigned to nodes of the ...
Definition: LineElementAction.C:701
LineElementAction::actAddMaterials
void actAddMaterials()
Adds material objects required for beam and truss elements.
Definition: LineElementAction.C:489
LineElementAction::_use_displaced_mesh
bool _use_displaced_mesh
use displaced mesh (true unless _strain is SMALL_STRAIN_AND_ROTATION)
Definition: LineElementAction.h:131
LineElementAction::actAddVariables
void actAddVariables()
Adds displacement and rotation variables.
Definition: LineElementAction.C:454
registerMooseAction
registerMooseAction("TensorMechanicsApp", LineElementAction, "create_problem")
LineElementAction::_ndisp
unsigned int _ndisp
Number of displacement variables.
Definition: LineElementAction.h:72
LineElementAction::actAddAuxKernels
void actAddAuxKernels()
Adds auxkernels corresponding to the translational and rotational velocity and acceleration aux varia...
Definition: LineElementAction.C:646
LineElementAction::_dynamic_consistent_inertia
bool _dynamic_consistent_inertia
Set to true to use consistent mass and inertia matrices to calculate inertial forces/torques in dynam...
Definition: LineElementAction.h:144
LineElementAction::actAddKernels
void actAddKernels()
Adds StressDivergence kernels for beam and truss elements and inertia kernels for dynamic beam simula...
Definition: LineElementAction.C:520
LineElementAction::_displacements
std::vector< VariableName > _displacements
Names of displacement variables.
Definition: LineElementAction.h:69
LineElementAction::_dynamic_nodal_rotational_inertia
bool _dynamic_nodal_rotational_inertia
Set to true to use nodal inertia matrix to calculate inertial torques in dynamic beam simulations.
Definition: LineElementAction.h:156
LineElementAction::_rotations
std::vector< VariableName > _rotations
Names of rotational variables for beam element.
Definition: LineElementAction.h:75
LineElementAction::_subdomain_names
std::vector< SubdomainName > _subdomain_names
If this vector is not empty the variables, auxvariables, kernels, auxkernels, nodalkernels and materi...
Definition: LineElementAction.h:110
LineElementAction::act
virtual void act()
Definition: LineElementAction.C:364