https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14
15template <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
36template <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
47template <bool is_ad>
48Real
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
57template class KineticEnergyAuxTempl<false>;
58template class KineticEnergyAuxTempl<true>;
registerMooseObject("SolidMechanicsApp", KineticEnergyAux)
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
virtual Real computeValue()
static InputParameters validParams()
KineticEnergyAuxTempl(const InputParameters &parameters)
auto raw_value(const Eigen::Map< T > &in)