https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LineElementAction.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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#include "MooseApp.h"
19
20#include "libmesh/string_to_enum.h"
21#include <algorithm>
22
23registerMooseAction("SolidMechanicsApp", LineElementAction, "create_problem");
24registerMooseAction("SolidMechanicsApp", LineElementAction, "add_variable");
25registerMooseAction("SolidMechanicsApp", LineElementAction, "add_aux_variable");
26registerMooseAction("SolidMechanicsApp", LineElementAction, "add_kernel");
27registerMooseAction("SolidMechanicsApp", LineElementAction, "add_aux_kernel");
28registerMooseAction("SolidMechanicsApp", LineElementAction, "add_nodal_kernel");
29registerMooseAction("SolidMechanicsApp", LineElementAction, "add_material");
30
33{
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.");
39
40 params.addParam<bool>(
41 "truss",
42 false,
43 "Set to true if the line elements are truss elements instead of the default beam elements.");
44 params.addParam<bool>("add_variables",
45 false,
46 "Add the displacement variables for truss elements "
47 "and both displacement and rotation variables for "
48 "beam elements.");
49 params.addParam<std::vector<VariableName>>(
50 "displacements", "The nonlinear displacement variables for the problem");
51
52 // Common geometry parameters between beam and truss
53 params.addCoupledVar(
54 "area",
55 "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
56
57 // Beam Parameters
59
60 params.addParam<bool>(
61 "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
62 // parameters specified here only appear in the input file sub-blocks of the
63 // Master action, not in the common parameters area
64 params.addParam<std::vector<SubdomainName>>(
65 "block",
66 {},
67 "The list of ids of the blocks (subdomain) "
68 "that the stress divergence, inertia kernels and materials will be "
69 "applied to");
70 // Advanced
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");
75 params.addParamNamesToGroup("block", "Advanced");
76 return params;
77}
78
81{
83
84 params.addParam<std::vector<VariableName>>(
85 "rotations", "The rotations appropriate for the simulation geometry and coordinate system");
86
87 MooseEnum strainType("SMALL FINITE", "SMALL");
88 params.addParam<MooseEnum>("strain_type", strainType, "Strain formulation");
89 params.addParam<MooseEnum>("rotation_type", strainType, "Rotation formulation");
90 params.addParam<std::vector<MaterialPropertyName>>(
91 "eigenstrain_names", "List of beam eigenstrains to be applied in this strain calculation.");
92
93 // Beam geometry
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.");
98 params.addCoupledVar(
99 "area",
100 "Cross-section area of the beam. Can be supplied as either a number or a variable name.");
101 params.addCoupledVar("Ay",
102 0.0,
103 "First moment of area of the beam about y axis. Can be supplied "
104 "as either a number or a variable name.");
105 params.addCoupledVar("Az",
106 0.0,
107 "First moment of area of the beam about z axis. Can be supplied "
108 "as either a number or a variable name.");
109 params.addCoupledVar("Ix",
110 "Second moment of area of the beam about x axis. Can be supplied as "
111 "either a number or a variable name.");
112 params.addCoupledVar("Iy",
113 "Second moment of area of the beam about y axis. Can be supplied as "
114 "either a number or a variable name.");
115 params.addCoupledVar("Iz",
116 "Second moment of area of the beam about z axis. Can be supplied as "
117 "either a number or a variable name.");
118
119 // Common parameters for both dynamic consistent and nodal mass/inertia
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.");
126
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");
134 params.addRangeCheckedParam<Real>(
135 "beta", "beta>0.0", "beta parameter for Newmark Time integration");
136 params.addRangeCheckedParam<Real>(
137 "gamma", "gamma>0.0", "gamma parameter for Newmark Time integration");
138 params.addParam<MaterialPropertyName>("eta",
139 0.0,
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>(
144 "zeta",
145 0.0,
146 "Name of material property or a constant real "
147 "number defining the zeta parameter for stiffness proportional "
148 "Rayleigh damping.");
149 params.addRangeCheckedParam<Real>("alpha",
150 0,
151 "alpha>=-0.3333 & alpha<=0.0",
152 "alpha parameter for mass dependent numerical damping induced "
153 "by HHT time integration scheme");
154
155 // dynamic consistent mass/inertia
156 params.addParam<bool>("dynamic_consistent_inertia",
157 false,
158 "If set to true, consistent mass and "
159 "inertia matrices are used for the "
160 "inertial force/torque calculations.");
161 params.addParam<MaterialPropertyName>(
162 "density",
163 "Name of Material Property or a constant real number defining the density of the beam.");
164
165 // dynamic nodal translational inertia
166 params.addParam<bool>(
167 "dynamic_nodal_translational_inertia",
168 false,
169 "If set to true, nodal mass matrix is used for the inertial force calculation.");
170 params.addRangeCheckedParam<Real>(
171 "nodal_mass", "nodal_mass>0.0", "Mass associated with the node");
172 params.addParam<FileName>(
173 "nodal_mass_file",
174 "The file containing the nodal positions and the corresponding nodal masses.");
175
176 // dynamic nodal rotational inertia
177 params.addParam<bool>(
178 "dynamic_nodal_rotational_inertia",
179 false,
180 "If set to true, nodal inertia matrix is used for the inertial torque calculation.");
181 params.addRangeCheckedParam<Real>(
182 "nodal_Ixx", "nodal_Ixx>=0.0", "Nodal moment of inertia in the x direction.");
183 params.addRangeCheckedParam<Real>(
184 "nodal_Iyy", "nodal_Iyy>=0.0", "Nodal moment of inertia in the y direction.");
185 params.addRangeCheckedParam<Real>(
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.");
190 params.addParam<RealGradient>(
191 "nodal_x_orientation",
192 "Unit vector along the x direction if different from global x direction.");
193 params.addParam<RealGradient>(
194 "nodal_y_orientation",
195 "Unit vector along the y direction if different from global y direction.");
196 params.addParam<std::vector<BoundaryName>>(
197 "boundary",
198 {},
199 "The list of boundary IDs from the mesh where the nodal "
200 "mass/inertia will be applied.");
201 return params;
202}
203
205 : Action(params),
206 _rotations(0),
207 _velocities(0),
208 _accelerations(0),
209 _rot_velocities(0),
210 _rot_accelerations(0),
211 _subdomain_names(getParam<std::vector<SubdomainName>>("block")),
212 _subdomain_ids(),
213 _add_dynamic_variables(false)
214{
215 // FIXME: suggest to use action of action to add this to avoid changing the input parameters in
216 // the warehouse.
218 InputParameters & pars(*(parameters.find(uniqueActionName())->second.get()));
219
220 // check if a container block with common parameters is found
221 auto action = _awh.getActions<CommonLineElementAction>();
222 if (action.size() == 1)
223 pars.applyParameters(action[0]->parameters());
224
225 // Set values to variables after common parameters are applied
226 _save_in = getParam<std::vector<AuxVariableName>>("save_in");
227 _diag_save_in = getParam<std::vector<AuxVariableName>>("diag_save_in");
228 _strain_type = getParam<MooseEnum>("strain_type").getEnum<Strain>();
229 _rotation_type = getParam<MooseEnum>("rotation_type").getEnum<Strain>();
230 _dynamic_consistent_inertia = getParam<bool>("dynamic_consistent_inertia");
231 _dynamic_nodal_translational_inertia = getParam<bool>("dynamic_nodal_translational_inertia");
232 _dynamic_nodal_rotational_inertia = getParam<bool>("dynamic_nodal_rotational_inertia");
236
237 if (params.isParamSetByUser("add_dynamic_variables"))
238 {
239 bool user_defined_add_dynamic_variables = getParam<bool>("add_dynamic_variables");
240 if (!_add_dynamic_variables && user_defined_add_dynamic_variables)
242 else if (_add_dynamic_variables && !user_defined_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.");
248 }
249 _truss = getParam<bool>("truss");
250
251 if (!isParamValid("displacements"))
252 paramError("displacements",
253 "LineElementAction: A vector of displacement variable names should be provided as "
254 "input using `displacements`.");
255
256 _displacements = getParam<std::vector<VariableName>>("displacements");
257 _ndisp = _displacements.size();
258
259 // determine if displaced mesh is to be used
261 if (params.isParamSetByUser("use_displaced_mesh"))
262 {
263 bool use_displaced_mesh_param = getParam<bool>("use_displaced_mesh");
264 if (use_displaced_mesh_param != _use_displaced_mesh && params.isParamSetByUser("strain_type") &&
265 params.isParamSetByUser("rotation_type"))
266 paramError("use_displaced_mesh",
267 "LineElementAction: Wrong combination of "
268 "`use_displaced_mesh`, `strain_type` and `rotation_type`.");
269 _use_displaced_mesh = use_displaced_mesh_param;
270 }
271
272 if (_save_in.size() != 0 && _save_in.size() != _ndisp)
273 paramError("save_in",
274 "LineElementAction: Number of save_in variables should equal to the number of "
275 "displacement variables ",
276 _ndisp);
277
278 if (_diag_save_in.size() != 0 && _diag_save_in.size() != _ndisp)
279 paramError("diag_save_in",
280 "LineElementAction: Number of diag_save_in variables should equal to the number of "
281 "displacement variables ",
282 _ndisp);
283
284 // Check if all the parameters required for static and dynamic beam simulation are provided as
285 // input
286 if (!_truss)
287 {
288 // Parameters required for static simulation using beams
289 if (!isParamValid("rotations"))
290 paramError("rotations",
291 "LineElementAction: Rotational variable names should be provided for beam "
292 "elements using `rotations` parameter.");
293
294 _rotations = getParam<std::vector<VariableName>>("rotations");
295
296 if (_rotations.size() != _ndisp)
297 paramError("rotations",
298 "LineElementAction: Number of rotational and displacement variable names provided "
299 "as input for beam should be same.");
300
301 if (!isParamValid("y_orientation") || !isParamValid("area") || !isParamValid("Iy") ||
302 !isParamValid("Iz"))
303 mooseError("LineElementAction: `y_orientation`, `area`, `Iy` and `Iz` should be provided for "
304 "beam elements.");
305
306 // Parameters required for dynamic simulation using beams
308 {
309 if (!isParamValid("velocities") || !isParamValid("accelerations") ||
310 !isParamValid("rotational_velocities") || !isParamValid("rotational_accelerations"))
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`.");
316
317 _velocities = getParam<std::vector<VariableName>>("velocities");
318 _accelerations = getParam<std::vector<VariableName>>("accelerations");
319 _rot_velocities = getParam<std::vector<VariableName>>("rotational_velocities");
320 _rot_accelerations = getParam<std::vector<VariableName>>("rotational_accelerations");
321
322 if (_velocities.size() != _ndisp || _accelerations.size() != _ndisp ||
323 _rot_velocities.size() != _ndisp || _rot_accelerations.size() != _ndisp)
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.");
327
328 if (!isParamValid("beta") || !isParamValid("gamma"))
329 mooseError("LineElementAction: Newmark time integration parameters `beta` and `gamma` "
330 "should be provided as input to perform dynamic simulations using beams.");
331 }
332
333 if (_dynamic_consistent_inertia && !isParamValid("density"))
334 paramError("density",
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.");
338
340 (!isParamValid("nodal_mass") && !isParamValid("nodal_mass_file")))
341 paramError("nodal_mass",
342 "LineElementAction: `nodal_mass` or `nodal_mass_file` should be provided as input "
343 "to calculate "
344 "inertial forces on beam due to nodal mass.");
345
347 ((!isParamValid("nodal_Ixx") || !isParamValid("nodal_Iyy") || !isParamValid("nodal_Izz"))))
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.");
350 }
351 else // if truss
352 {
353 if (!isParamValid("area"))
354 paramError("area",
355 "LineElementAction: `area` should be provided as input for "
356 "truss elements.");
357
358 if (isParamValid("rotations"))
359 paramError("rotations",
360 "LineElementAction: Rotational variables cannot be set for truss elements.");
361 }
362}
363
364void
366{
367 // Get the subdomain involved in the action once the mesh setup is complete
368 if (_current_task == "create_problem")
369 {
370 // get subdomain IDs
371 for (auto & name : _subdomain_names)
372 _subdomain_ids.insert(_mesh->getSubdomainID(name));
373 }
374
375 if (_current_task == "add_variable")
376 {
377 //
378 // Gather info from all other LineElementAction
379 //
381
382 //
383 // Add variables (optional)
384 //
386 }
387
388 //
389 // Add Materials - ComputeIncrementalBeamStrain or ComputeFiniteBeamStrain
390 // for beam elements
391 //
392 if (_current_task == "add_material")
394
395 //
396 // Add Kernels - StressDivergenceBeam and InertialForceBeam (if dynamic_consistent_inertia is
397 // turned on) for beams and StressDivergenceTensorsTruss for truss elements
398 //
399 if (_current_task == "add_kernel")
401
402 //
403 // Add aux variables for translational and Rotational velocities and acceleration for dynamic
404 // analysis using beams
405 //
406 if (_current_task == "add_aux_variable")
408
409 //
410 // Add NewmarkVelAux and NewarkAccelAux auxkernels for dynamic simulation using beams
411 //
412 if (_current_task == "add_aux_kernel")
414
415 //
416 // Add NodalKernels - NodalTranslationalInertia (if dynamic_nodal_translational_inertia is turned
417 // on) and NodalRotattionalInertia (if dynamic_nodal_rotational_inertia) for dynamic simulations
418 // using beams
419 //
420 if (_current_task == "add_nodal_kernel")
422}
423
424void
426{
427 //
428 // Gather info about all other master actions when we add variables
429 //
430 if (getParam<bool>("add_variables"))
431 {
432 auto actions = _awh.getActions<LineElementAction>();
433 for (const auto & action : actions)
434 {
435 const auto size_before = _subdomain_id_union.size();
436 const auto added_size = action->_subdomain_ids.size();
437 _subdomain_id_union.insert(action->_subdomain_ids.begin(), action->_subdomain_ids.end());
438 const auto size_after = _subdomain_id_union.size();
439
440 if (size_after != size_before + added_size)
441 paramError("block",
442 "LineElementAction: The block restrictions in the LineElement actions must be "
443 "non-overlapping.");
444
445 if (added_size == 0 && actions.size() > 1)
447 "block",
448 "LineElementAction: No LineElement action can be block unrestricted if more than one "
449 "LineElement action is specified.");
450 }
451 }
452}
453
454void
456{
457 if (getParam<bool>("add_variables"))
458 {
459 auto params = _factory.getValidParams("MooseVariable");
460
461 // determine order of elements in mesh
462 const bool second = _problem->mesh().hasSecondOrderElements();
463 if (second)
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.");
466
467 params.set<MooseEnum>("order") = "FIRST";
468 params.set<MooseEnum>("family") = "LAGRANGE";
469
470 // Loop through the displacement variables
471 for (const auto & disp : _displacements)
472 {
473 // Create displacement variables
474 if (!_problem->hasVariable(disp))
475 _problem->addVariable("MooseVariable", disp, params);
476 }
477
478 // Add rotation variables if line element is a beam.
479 if (!_truss)
480 {
481 for (const auto & rot : _rotations)
482 {
483 // Create rotation variables
484 if (!_problem->hasVariable(rot))
485 _problem->addVariable("MooseVariable", rot, params);
486 }
487 }
488 }
489}
490
491void
493{
494 if (!_truss)
495 {
496 // Add Strain
498 {
499 auto params = _factory.getValidParams("ComputeIncrementalBeamStrain");
500 params.applyParameters(parameters(), {"boundary", "use_displaced_mesh"});
501 params.set<bool>("use_displaced_mesh") = false;
502
504 params.set<bool>("large_strain") = true;
505
506 _problem->addMaterial("ComputeIncrementalBeamStrain", name() + "_strain", params);
507 }
508 else if (_rotation_type == Strain::FINITE)
509 {
510 auto params = _factory.getValidParams("ComputeFiniteBeamStrain");
511 params.applyParameters(parameters(), {"boundary", "use_displaced_mesh"});
512 params.set<bool>("use_displaced_mesh") = false;
513
515 params.set<bool>("large_strain") = true;
516
517 _problem->addMaterial("ComputeFiniteBeamStrain", name() + "_strain", params);
518 }
519 }
520}
521
522void
524{
525 if (!_truss)
526 {
527 // add StressDivergenceBeam kernels
528 auto params = _factory.getValidParams("StressDivergenceBeam");
529 params.applyParameters(parameters(), {"use_displaced_mesh", "save_in", "diag_save_in"});
530 params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
531
532 for (unsigned int i = 0; i < 2 * _ndisp; ++i)
533 {
534 std::string kernel_name = name() + "_stress_divergence_beam_" + Moose::stringify(i);
535
536 if (i < _ndisp)
537 {
538 params.set<unsigned int>("component") = i;
539 params.set<NonlinearVariableName>("variable") = _displacements[i];
540
541 if (_save_in.size() == 2 * _ndisp)
542 params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
543 if (_diag_save_in.size() == 2 * _ndisp)
544 params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
545
546 _problem->addKernel("StressDivergenceBeam", kernel_name, params);
547 }
548 else
549 {
550 params.set<unsigned int>("component") = i;
551 params.set<NonlinearVariableName>("variable") = _rotations[i - 3];
552
553 if (_save_in.size() == 2 * _ndisp)
554 params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
555 if (_diag_save_in.size() == 2 * _ndisp)
556 params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
557
558 _problem->addKernel("StressDivergenceBeam", kernel_name, params);
559 }
560 }
561 // Add InertialForceBeam if dynamic simulation using consistent mass/inertia matrix has to be
562 // performed
564 {
565 // add InertialForceBeam
566 params = _factory.getValidParams("InertialForceBeam");
567 params.applyParameters(parameters(), {"use_displaced_mesh", "save_in", "diag_save_in"});
568 params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
569
570 for (unsigned int i = 0; i < 2 * _ndisp; ++i)
571 {
572 std::string kernel_name = name() + "_inertial_force_beam_" + Moose::stringify(i);
573
574 if (i < _ndisp)
575 {
576 params.set<unsigned int>("component") = i;
577 params.set<NonlinearVariableName>("variable") = _displacements[i];
578
579 if (_save_in.size() == 2 * _ndisp)
580 params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
581 if (_diag_save_in.size() == 2 * _ndisp)
582 params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
583
584 _problem->addKernel("InertialForceBeam", kernel_name, params);
585 }
586 else
587 {
588 params.set<unsigned int>("component") = i;
589 params.set<NonlinearVariableName>("variable") = _rotations[i - 3];
590
591 if (_save_in.size() == 2 * _ndisp)
592 params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
593 if (_diag_save_in.size() == 2 * _ndisp)
594 params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
595
596 _problem->addKernel("InertialForceBeam", kernel_name, params);
597 }
598 }
599 }
600 }
601 else
602 {
603 // Add StressDivergenceTensorsTruss kernels
604 auto params = _factory.getValidParams("StressDivergenceTensorsTruss");
605 params.applyParameters(parameters(), {"use_displaced_mesh", "save_in", "diag_save_in"});
606 params.set<bool>("use_displaced_mesh") = true;
607
608 for (unsigned int i = 0; i < _ndisp; ++i)
609 {
610 std::string kernel_name = name() + "_stress_divergence_truss_" + Moose::stringify(i);
611 params.set<unsigned int>("component") = i;
612 params.set<NonlinearVariableName>("variable") = _displacements[i];
613
614 if (_save_in.size() == _ndisp)
615 params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
616 if (_diag_save_in.size() == _ndisp)
617 params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
618
619 _problem->addKernel("StressDivergenceTensorsTruss", kernel_name, params);
620 }
621 }
622}
623
624void
626{
628 {
629 auto params = _factory.getValidParams("MooseVariable");
630
631 params.set<MooseEnum>("order") = "FIRST";
632 params.set<MooseEnum>("family") = "LAGRANGE";
633
634 for (auto vel : _velocities)
635 _problem->addAuxVariable("MooseVariable", vel, params);
636
637 for (auto accel : _accelerations)
638 _problem->addAuxVariable("MooseVariable", accel, params);
639
640 for (auto rot_vel : _rot_velocities)
641 _problem->addAuxVariable("MooseVariable", rot_vel, params);
642
643 for (auto rot_accel : _rot_accelerations)
644 _problem->addAuxVariable("MooseVariable", rot_accel, params);
645 }
646}
647
648void
650{
652 {
653 auto params = _factory.getValidParams("NewmarkAccelAux");
654 params.applyParameters(parameters(), {"boundary"});
655 params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
656
657 for (unsigned i = 0; i < 2 * _ndisp; ++i)
658 {
659 std::string aux_kernel_name = name() + "_newmark_accel_" + Moose::stringify(i);
660
661 if (i < _ndisp)
662 {
663 params.set<AuxVariableName>("variable") = _accelerations[i];
664 params.set<std::vector<VariableName>>("velocity") = {_velocities[i]};
665 params.set<std::vector<VariableName>>("displacement") = {_displacements[i]};
666
667 _problem->addAuxKernel("NewmarkAccelAux", aux_kernel_name, params);
668 }
669 else
670 {
671 params.set<AuxVariableName>("variable") = _rot_accelerations[i - _ndisp];
672 params.set<std::vector<VariableName>>("velocity") = {_rot_velocities[i - _ndisp]};
673 params.set<std::vector<VariableName>>("displacement") = {_rotations[i - _ndisp]};
674
675 _problem->addAuxKernel("NewmarkAccelAux", aux_kernel_name, params);
676 }
677 }
678
679 params = _factory.getValidParams("NewmarkVelAux");
680 params.applyParameters(parameters(), {"boundary"});
681 params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
682
683 for (unsigned i = 0; i < 2 * _ndisp; ++i)
684 {
685 std::string aux_kernel_name = name() + "_newmark_vel_" + Moose::stringify(i);
686
687 if (i < _ndisp)
688 {
689 params.set<AuxVariableName>("variable") = _velocities[i];
690 params.set<std::vector<VariableName>>("acceleration") = {_accelerations[i]};
691 _problem->addAuxKernel("NewmarkVelAux", aux_kernel_name, params);
692 }
693 else
694 {
695 params.set<AuxVariableName>("variable") = _rot_velocities[i - _ndisp];
696 params.set<std::vector<VariableName>>("acceleration") = {_rot_accelerations[i - _ndisp]};
697 _problem->addAuxKernel("NewmarkVelAux", aux_kernel_name, params);
698 }
699 }
700 }
701}
702
703void
705{
706 if (!_truss)
707 {
708 // NodalTranslationalInertia and NodalRotattionalInertia currently accept only constant real
709 // numbers for eta
710 Real eta = 0.0;
712 {
713 std::string ss(getParam<MaterialPropertyName>("eta"));
714 Real real_value = MooseUtils::convert<Real>(ss);
715
716 eta = real_value;
717 }
718
720 {
721 auto params = _factory.getValidParams("NodalTranslationalInertia");
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;
726 params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
727
728 for (unsigned i = 0; i < _ndisp; ++i)
729 {
730 std::string nodal_kernel_name =
731 name() + "_nodal_translational_inertia_" + Moose::stringify(i);
732
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]};
736
737 if (_save_in.size() == 2 * _ndisp)
738 params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
739
740 if (_diag_save_in.size() == 2 * _ndisp)
741 params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
742
743 _problem->addNodalKernel("NodalTranslationalInertia", nodal_kernel_name, params);
744 }
745 }
746
748 {
749 auto params = _factory.getValidParams("NodalRotationalInertia");
751 {"save_in",
752 "diag_save_in",
753 "use_displaced_mesh",
754 "eta",
755 "x_orientation",
756 "y_orientation"});
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;
761 params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
762
763 if (isParamValid("nodal_Ixy"))
764 params.set<Real>("Ixy") = getParam<Real>("nodal_Ixy");
765
766 if (isParamValid("nodal_Ixz"))
767 params.set<Real>("Ixz") = getParam<Real>("nodal_Ixz");
768
769 if (isParamValid("nodal_Iyz"))
770 params.set<Real>("Iyz") = getParam<Real>("nodal_Iyz");
771
772 if (isParamValid("nodal_x_orientation"))
773 params.set<Real>("x_orientation") = getParam<Real>("nodal_x_orientation");
774
775 if (isParamValid("nodal_y_orientation"))
776 params.set<Real>("y_orientation") = getParam<Real>("nodal_y_orientation");
777
778 for (unsigned i = 0; i < _ndisp; ++i)
779 {
780 std::string nodal_kernel_name = name() + "_nodal_rotational_inertia_" + Moose::stringify(i);
781
782 params.set<unsigned int>("component") = i;
783 params.set<NonlinearVariableName>("variable") = _rotations[i];
784
785 if (_save_in.size() == 2 * _ndisp)
786 params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i + _ndisp]};
787
788 if (_diag_save_in.size() == 2 * _ndisp)
789 params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i + _ndisp]};
790
791 _problem->addNodalKernel("NodalRotationalInertia", nodal_kernel_name, params);
792 }
793 }
794 }
795}
InputParameters emptyInputParameters()
registerMooseAction("SolidMechanicsApp", LineElementAction, "create_problem")
const ExecFlagType EXEC_TIMESTEP_END
Point eta
std::vector< const T * > getActions()
MooseObjectName uniqueActionName() const
std::shared_ptr< MooseMesh > & _mesh
static InputParameters validParams()
MooseApp & _app
std::shared_ptr< FEProblemBase > & _problem
const std::string & _current_task
ActionWarehouse & _awh
Store common line element action parameters.
InputParameters getValidParams(const std::string &name) const
const std::multimap< MooseObjectName, std::shared_ptr< InputParameters > > & getInputParameters(THREAD_ID tid=0) const
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
bool isParamSetByUser(const std::string &name) const
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
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...
Strain
strain formulation
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 &params)
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 &param, Args... args) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
Factory & _factory
std::string stringify(const T &t)