https://mooseframework.inl.gov
KineticEnergyAux.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 "KineticEnergyAux.h"
11 
12 registerMooseObject("SolidMechanicsApp", KineticEnergyAux);
13 registerMooseObject("SolidMechanicsApp", ADKineticEnergyAux);
14 
15 template <bool is_ad>
18 {
20  params.addClassDescription("Compute the kinetic energy of continuum-based finite elements");
21  params.addRequiredCoupledVar("newmark_velocity_x",
22  "X component of the velocity from the Newmark integration scheme");
23  params.addRequiredCoupledVar("newmark_velocity_y",
24  "Y component of the velocity from the Newmark integration scheme");
25  params.addRequiredCoupledVar("newmark_velocity_z",
26  "Z component of the velocity from the Newmark integration scheme");
27 
28  params.addParam<MaterialPropertyName>("density",
29  "density",
30  "Name of material property or a constant real number "
31  "defining the density of the continuum material.");
32  params.addParam<std::string>("base_name", "Mechanical property base name");
33  return params;
34 }
35 
36 template <bool is_ad>
38  : AuxKernel(parameters),
39  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
40  _density(getGenericMaterialProperty<Real, is_ad>(_base_name + "density")),
41  _vel_x(coupledValue("newmark_velocity_x")),
42  _vel_y(coupledValue("newmark_velocity_y")),
43  _vel_z(coupledValue("newmark_velocity_z"))
44 {
45 }
46 
47 template <bool is_ad>
48 Real
50 {
51  const Real kinetic_energy = MetaPhysicL::raw_value(
52  0.5 * _density[_qp] *
53  (_vel_x[_qp] * _vel_x[_qp] + _vel_y[_qp] * _vel_y[_qp] + _vel_z[_qp] * _vel_z[_qp]));
54  return kinetic_energy;
55 }
56 
57 template class KineticEnergyAuxTempl<false>;
58 template class KineticEnergyAuxTempl<true>;
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
auto raw_value(const Eigen::Map< T > &in)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
virtual Real computeValue()
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("SolidMechanicsApp", KineticEnergyAux)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
KineticEnergyAuxTempl(const InputParameters &parameters)