www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NodalTranslationalInertia Class Reference

Calculates the inertial force and mass proportional damping for a nodal mass. More...

#include <NodalTranslationalInertia.h>

Inheritance diagram for NodalTranslationalInertia:
[legend]

Public Member Functions

 NodalTranslationalInertia (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual () override
 
virtual Real computeQpJacobian () override
 

Protected Attributes

const Real _mass
 Mass associated with the node. More...
 
const VariableValue * _u_old
 Old value of displacement. More...
 
const Real _beta
 Newmark time integration parameter. More...
 
const Real _gamma
 Newmark time integration parameter. More...
 
const Real & _eta
 Mass proportional Rayliegh damping. More...
 
const Real & _alpha
 HHT time integration parameter. More...
 
AuxiliarySystem * _aux_sys
 Auxiliary system object. More...
 
unsigned int _vel_num
 Variable number corresponding to the velocity aux variable. More...
 
unsigned int _accel_num
 Variable number corresponding to the acceleration aux variable. More...
 
std::map< dof_id_type, Real > _node_id_to_mass
 Map between boundary nodes and nodal mass. More...
 
const MooseArray< Number > * _vel
 Velocity variable value. More...
 
const MooseArray< Number > * _vel_old
 Old velocity variable value. More...
 
const MooseArray< Number > * _accel
 Acceleration variable value. More...
 
const MooseArray< Number > * _du_dot_du
 du_dot_du variable value More...
 
const MooseArray< Number > * _du_dotdot_du
 du_dotdot_du variable value More...
 

Detailed Description

Calculates the inertial force and mass proportional damping for a nodal mass.

Definition at line 29 of file NodalTranslationalInertia.h.

Constructor & Destructor Documentation

◆ NodalTranslationalInertia()

NodalTranslationalInertia::NodalTranslationalInertia ( const InputParameters &  parameters)

Definition at line 53 of file NodalTranslationalInertia.C.

54  : TimeNodalKernel(parameters),
55  _mass(isParamValid("mass") ? getParam<Real>("mass") : 0.0),
56  _beta(isParamValid("beta") ? getParam<Real>("beta") : 0.1),
57  _gamma(isParamValid("gamma") ? getParam<Real>("gamma") : 0.1),
58  _eta(getParam<Real>("eta")),
59  _alpha(getParam<Real>("alpha"))
60 {
61  if (isParamValid("beta") && isParamValid("gamma") && isParamValid("velocity") &&
62  isParamValid("acceleration"))
63  {
64  _u_old = &(_var.dofValuesOld());
65  _aux_sys = &(_fe_problem.getAuxiliarySystem());
66 
67  MooseVariable * vel_variable = getVar("velocity", 0);
68  _vel_num = vel_variable->number();
69  MooseVariable * accel_variable = getVar("acceleration", 0);
70  _accel_num = accel_variable->number();
71  }
72  else if (!isParamValid("beta") && !isParamValid("gamma") && !isParamValid("velocity") &&
73  !isParamValid("acceleration"))
74  {
75  _vel = &(_var.dofValuesDot());
76  _vel_old = &(_var.dofValuesDotOld());
77  _accel = &(_var.dofValuesDotDot());
78  _du_dot_du = &(_var.duDotDu());
79  _du_dotdot_du = &(_var.duDotDotDu());
80  }
81  else
82  mooseError("NodalTranslationalInertia: Either all or none of `beta`, `gamma`, `velocity` and "
83  "`acceleration` should be provided as input.");
84 
85  if (!isParamValid("nodal_mass_file") && !isParamValid("mass"))
86  mooseError(
87  "NodalTranslationalInertia: Please provide either mass or nodal_mass_file as input.");
88  else if (isParamValid("nodal_mass_file") && isParamValid("mass"))
89  mooseError("NodalTranslationalInertia: Please provide either mass or nodal_mass_file as input, "
90  "not both.");
91 
92  if (isParamValid("nodal_mass_file"))
93  {
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();
98  if (data.size() != 4)
99  mooseError("NodalTranslationalInertia: The number of columns in ",
100  getParam<FileName>("nodal_mass_file"),
101  " should be 4.");
102 
103  unsigned int node_found = 0;
104  const std::set<BoundaryID> bnd_ids = BoundaryRestrictable::boundaryIDs();
105  for (auto & bnd_id : bnd_ids)
106  {
107  const std::vector<dof_id_type> & bnd_node_set = _mesh.getNodeList(bnd_id);
108  for (auto & bnd_node : bnd_node_set)
109  {
110  const Node & node = _mesh.nodeRef(bnd_node);
111  _node_id_to_mass[bnd_node] = 0.0;
112 
113  for (unsigned int i = 0; i < data[0].size(); ++i)
114  {
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))
118  {
119  _node_id_to_mass[bnd_node] = data[3][i];
120  node_found += 1;
121  break;
122  }
123  }
124  }
125  }
126  if (node_found != data[0].size())
127  mooseError("NodalTranslationalInertia: Out of ",
128  data[0].size(),
129  " nodal positions in ",
130  getParam<FileName>("nodal_mass_file"),
131  " only ",
132  node_found,
133  " nodes were found in the boundary.");
134  }
135 }
const Real _mass
Mass associated with the node.
const MooseArray< Number > * _du_dot_du
du_dot_du variable value
const Real _beta
Newmark time integration parameter.
const Real & _eta
Mass proportional Rayliegh damping.
const Real & _alpha
HHT time integration parameter.
AuxiliarySystem * _aux_sys
Auxiliary system object.
unsigned int _accel_num
Variable number corresponding to the acceleration aux variable.
const VariableValue * _u_old
Old value of displacement.
std::map< dof_id_type, Real > _node_id_to_mass
Map between boundary nodes and nodal mass.
const MooseArray< Number > * _accel
Acceleration variable value.
unsigned int _vel_num
Variable number corresponding to the velocity aux variable.
const MooseArray< Number > * _du_dotdot_du
du_dotdot_du variable value
const MooseArray< Number > * _vel
Velocity variable value.
const MooseArray< Number > * _vel_old
Old velocity variable value.
const Real _gamma
Newmark time integration parameter.

Member Function Documentation

◆ computeQpJacobian()

Real NodalTranslationalInertia::computeQpJacobian ( )
overrideprotectedvirtual

Definition at line 178 of file NodalTranslationalInertia.C.

179 {
180  mooseAssert(_beta > 0.0, "NodalTranslationalInertia: Beta parameter should be positive.");
181 
182  if (_dt == 0)
183  return 0;
184  else
185  {
186  Real mass = 0.0;
187  if (isParamValid("mass"))
188  mass = _mass;
189  else
190  {
191  if (_node_id_to_mass.find(_current_node->id()) != _node_id_to_mass.end())
192  mass = _node_id_to_mass[_current_node->id()];
193  else
194  mooseError("NodalTranslationalInertia: Unable to find an entry for the current node in the "
195  "_node_id_to_mass map.");
196  }
197 
198  if (isParamValid("beta"))
199  return mass / (_beta * _dt * _dt) + _eta * (1 + _alpha) * mass * _gamma / _beta / _dt;
200  else
201  return mass * (*_du_dotdot_du)[_qp] + _eta * (1.0 + _alpha) * mass * (*_du_dot_du)[_qp];
202  }
203 }
const Real _mass
Mass associated with the node.
const MooseArray< Number > * _du_dot_du
du_dot_du variable value
const Real _beta
Newmark time integration parameter.
const Real & _eta
Mass proportional Rayliegh damping.
const Real & _alpha
HHT time integration parameter.
std::map< dof_id_type, Real > _node_id_to_mass
Map between boundary nodes and nodal mass.
const Real _gamma
Newmark time integration parameter.

◆ computeQpResidual()

Real NodalTranslationalInertia::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 138 of file NodalTranslationalInertia.C.

139 {
140  if (_dt == 0)
141  return 0;
142  else
143  {
144  Real mass = 0.0;
145  if (isParamValid("mass"))
146  mass = _mass;
147  else
148  {
149  if (_node_id_to_mass.find(_current_node->id()) != _node_id_to_mass.end())
150  mass = _node_id_to_mass[_current_node->id()];
151  else
152  mooseError("NodalTranslationalInertia: Unable to find an entry for the current node in the "
153  "_node_id_to_mass map.");
154  }
155 
156  if (isParamValid("beta"))
157  {
158  mooseAssert(_beta > 0.0, "NodalTranslationalInertia: Beta parameter should be positive.");
159  const NumericVector<Number> & aux_sol_old = _aux_sys->solutionOld();
160 
161  const Real vel_old = aux_sol_old(_current_node->dof_number(_aux_sys->number(), _vel_num, 0));
162  const Real accel_old =
163  aux_sol_old(_current_node->dof_number(_aux_sys->number(), _accel_num, 0));
164 
165  const Real accel =
166  1. / _beta *
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;
169  return mass * (accel + vel * _eta * (1 + _alpha) - _alpha * _eta * vel_old);
170  }
171  else
172  return mass * ((*_accel)[_qp] + (*_vel)[_qp] * _eta * (1.0 + _alpha) -
173  _alpha * _eta * (*_vel_old)[_qp]);
174  }
175 }
const Real _mass
Mass associated with the node.
const Real _beta
Newmark time integration parameter.
const Real & _eta
Mass proportional Rayliegh damping.
const Real & _alpha
HHT time integration parameter.
AuxiliarySystem * _aux_sys
Auxiliary system object.
unsigned int _accel_num
Variable number corresponding to the acceleration aux variable.
std::map< dof_id_type, Real > _node_id_to_mass
Map between boundary nodes and nodal mass.
unsigned int _vel_num
Variable number corresponding to the velocity aux variable.
const MooseArray< Number > * _vel_old
Old velocity variable value.
const Real _gamma
Newmark time integration parameter.

Member Data Documentation

◆ _accel

const MooseArray<Number>* NodalTranslationalInertia::_accel
protected

Acceleration variable value.

Definition at line 76 of file NodalTranslationalInertia.h.

Referenced by NodalTranslationalInertia().

◆ _accel_num

unsigned int NodalTranslationalInertia::_accel_num
protected

Variable number corresponding to the acceleration aux variable.

Definition at line 64 of file NodalTranslationalInertia.h.

Referenced by computeQpResidual(), and NodalTranslationalInertia().

◆ _alpha

const Real& NodalTranslationalInertia::_alpha
protected

HHT time integration parameter.

Definition at line 55 of file NodalTranslationalInertia.h.

Referenced by computeQpJacobian(), and computeQpResidual().

◆ _aux_sys

AuxiliarySystem* NodalTranslationalInertia::_aux_sys
protected

Auxiliary system object.

Definition at line 58 of file NodalTranslationalInertia.h.

Referenced by computeQpResidual(), and NodalTranslationalInertia().

◆ _beta

const Real NodalTranslationalInertia::_beta
protected

Newmark time integration parameter.

Definition at line 46 of file NodalTranslationalInertia.h.

Referenced by computeQpJacobian(), and computeQpResidual().

◆ _du_dot_du

const MooseArray<Number>* NodalTranslationalInertia::_du_dot_du
protected

du_dot_du variable value

Definition at line 79 of file NodalTranslationalInertia.h.

Referenced by computeQpJacobian(), and NodalTranslationalInertia().

◆ _du_dotdot_du

const MooseArray<Number>* NodalTranslationalInertia::_du_dotdot_du
protected

du_dotdot_du variable value

Definition at line 82 of file NodalTranslationalInertia.h.

Referenced by NodalTranslationalInertia().

◆ _eta

const Real& NodalTranslationalInertia::_eta
protected

Mass proportional Rayliegh damping.

Definition at line 52 of file NodalTranslationalInertia.h.

Referenced by computeQpJacobian(), and computeQpResidual().

◆ _gamma

const Real NodalTranslationalInertia::_gamma
protected

Newmark time integration parameter.

Definition at line 49 of file NodalTranslationalInertia.h.

Referenced by computeQpJacobian(), and computeQpResidual().

◆ _mass

const Real NodalTranslationalInertia::_mass
protected

Mass associated with the node.

Definition at line 40 of file NodalTranslationalInertia.h.

Referenced by computeQpJacobian(), and computeQpResidual().

◆ _node_id_to_mass

std::map<dof_id_type, Real> NodalTranslationalInertia::_node_id_to_mass
protected

Map between boundary nodes and nodal mass.

Definition at line 67 of file NodalTranslationalInertia.h.

Referenced by computeQpJacobian(), computeQpResidual(), and NodalTranslationalInertia().

◆ _u_old

const VariableValue* NodalTranslationalInertia::_u_old
protected

Old value of displacement.

Definition at line 43 of file NodalTranslationalInertia.h.

Referenced by NodalTranslationalInertia().

◆ _vel

const MooseArray<Number>* NodalTranslationalInertia::_vel
protected

Velocity variable value.

Definition at line 70 of file NodalTranslationalInertia.h.

Referenced by NodalTranslationalInertia().

◆ _vel_num

unsigned int NodalTranslationalInertia::_vel_num
protected

Variable number corresponding to the velocity aux variable.

Definition at line 61 of file NodalTranslationalInertia.h.

Referenced by computeQpResidual(), and NodalTranslationalInertia().

◆ _vel_old

const MooseArray<Number>* NodalTranslationalInertia::_vel_old
protected

Old velocity variable value.

Definition at line 73 of file NodalTranslationalInertia.h.

Referenced by computeQpResidual(), and NodalTranslationalInertia().


The documentation for this class was generated from the following files: