11 #include "MooseVariable.h"
12 #include "AuxiliarySystem.h"
13 #include "MooseUtils.h"
14 #include "DelimitedFileReader.h"
24 params.addClassDescription(
"Computes the inertial forces and mass proportional damping terms "
25 "corresponding to nodal mass.");
26 params.addCoupledVar(
"velocity",
"velocity variable");
27 params.addCoupledVar(
"acceleration",
"acceleration variable");
28 params.addRangeCheckedParam<Real>(
29 "beta",
"beta>0.0",
"beta parameter for Newmark Time integration");
30 params.addRangeCheckedParam<Real>(
31 "gamma",
"gamma>0.0",
"gamma parameter for Newmark Time integration");
32 params.addRangeCheckedParam<Real>(
"eta",
35 "Constant real number defining the eta parameter for "
37 params.addRangeCheckedParam<Real>(
"alpha",
39 "alpha >= -0.3333 & alpha <= 0.0",
40 "Alpha parameter for mass dependent numerical damping induced "
41 "by HHT time integration scheme");
42 params.addParam<Real>(
"mass",
"Mass associated with the node");
43 params.addParam<FileName>(
45 "The file containing the nodal positions and the corresponding nodal masses.");
50 : TimeNodalKernel(parameters),
51 _has_mass(isParamValid(
"mass")),
52 _has_beta(isParamValid(
"beta")),
53 _has_gamma(isParamValid(
"gamma")),
54 _has_velocity(isParamValid(
"velocity")),
55 _has_acceleration(isParamValid(
"acceleration")),
56 _has_nodal_mass_file(isParamValid(
"nodal_mass_file")),
57 _mass(_has_mass ? getParam<Real>(
"mass") : 0.0),
58 _beta(_has_beta ? getParam<Real>(
"beta") : 0.1),
59 _gamma(_has_gamma ? getParam<Real>(
"gamma") : 0.1),
60 _eta(getParam<Real>(
"eta")),
61 _alpha(getParam<Real>(
"alpha"))
65 _u_old = &(_var.dofValuesOld());
66 _aux_sys = &(_fe_problem.getAuxiliarySystem());
68 MooseVariable * vel_variable = getVar(
"velocity", 0);
70 MooseVariable * accel_variable = getVar(
"acceleration", 0);
75 _vel = &(_var.dofValuesDot());
76 _vel_old = &(_var.dofValuesDotOld());
77 _accel = &(_var.dofValuesDotDot());
82 mooseError(
"NodalTranslationalInertia: Either all or none of `beta`, `gamma`, `velocity` and "
83 "`acceleration` should be provided as input.");
87 "NodalTranslationalInertia: Please provide either mass or nodal_mass_file as input.");
89 mooseError(
"NodalTranslationalInertia: Please provide either mass or nodal_mass_file as input, "
94 MooseUtils::DelimitedFileReader nodal_mass_file(getParam<FileName>(
"nodal_mass_file"));
95 nodal_mass_file.setHeaderFlag(MooseUtils::DelimitedFileReader::HeaderFlag::OFF);
96 nodal_mass_file.read();
97 std::vector<std::vector<Real>> data = nodal_mass_file.getData();
99 mooseError(
"NodalTranslationalInertia: The number of columns in ",
100 getParam<FileName>(
"nodal_mass_file"),
103 unsigned int node_found = 0;
104 const std::set<BoundaryID> bnd_ids = BoundaryRestrictable::boundaryIDs();
105 for (
auto & bnd_id : bnd_ids)
107 const std::vector<dof_id_type> & bnd_node_set = _mesh.getNodeList(bnd_id);
108 for (
auto & bnd_node : bnd_node_set)
110 const Node & node = _mesh.nodeRef(bnd_node);
113 for (
unsigned int i = 0; i < data[0].size(); ++i)
115 if (MooseUtils::absoluteFuzzyEqual(data[0][i], node(0), 1e-6) &&
116 MooseUtils::absoluteFuzzyEqual(data[1][i], node(1), 1e-6) &&
117 MooseUtils::absoluteFuzzyEqual(data[2][i], node(2), 1e-6))
126 if (node_found != data[0].size())
127 mooseError(
"NodalTranslationalInertia: Out of ",
129 " nodal positions in ",
130 getParam<FileName>(
"nodal_mass_file"),
133 " nodes were found in the boundary.");
152 mooseError(
"NodalTranslationalInertia: Unable to find an entry for the current node in the "
153 "_node_id_to_mass map.");
158 mooseAssert(
_beta > 0.0,
"NodalTranslationalInertia: Beta parameter should be positive.");
159 const NumericVector<Number> & aux_sol_old =
_aux_sys->solutionOld();
161 const Real vel_old = aux_sol_old(_current_node->dof_number(
_aux_sys->number(),
_vel_num, 0));
162 const Real accel_old =
167 (((_u[_qp] - (*_u_old)[_qp]) / (_dt * _dt)) - vel_old / _dt - accel_old * (0.5 -
_beta));
168 const Real vel = vel_old + (_dt * (1 -
_gamma)) * accel_old +
_gamma * _dt * accel;
172 return mass * ((*_accel)[_qp] + (*_vel)[_qp] *
_eta * (1.0 +
_alpha) -
180 mooseAssert(
_beta > 0.0,
"NodalTranslationalInertia: Beta parameter should be positive.");
194 mooseError(
"NodalTranslationalInertia: Unable to find an entry for the current node in the "
195 "_node_id_to_mass map.");