https://mooseframework.inl.gov
MaterialVectorBodyForce.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 
11 #include "Function.h"
12 
13 registerMooseObject("SolidMechanicsApp", MaterialVectorBodyForce);
14 
17 {
19  params.addClassDescription("Apply a body force vector to the coupled displacement component.");
20  params.addParam<FunctionName>(
21  "function", "1", "Function to scale the coupled body force vector property");
22  params.addParam<Real>(
23  "hht_alpha", 0.0, "alpha parameter required for HHT time integration scheme");
24  params.addRequiredParam<MaterialPropertyName>("body_force", "Force per unit volume vector");
25  params.addCoupledVar("displacements", "The displacements");
26  return params;
27 }
28 
30  : Kernel(parameters),
31  _component(libMesh::invalid_uint),
32  _body_force(getMaterialProperty<RealVectorValue>("body_force")),
33  _function(getFunction("function")),
34  _alpha(getParam<Real>("hht_alpha"))
35 {
36  for (unsigned int i = 0; i < coupledComponents("displacements"); ++i)
37  if (_var.number() == getVar("displacements", i)->number())
38  _component = i;
39 
41  this->paramError("variable",
42  "The kernel variable needs to be one of the 'displacements' variables");
43 }
44 
45 Real
47 {
48  Real factor = _function.value(_t + _alpha * _dt, _q_point[_qp]);
49  return -_body_force[_qp](_component) * _test[_i][_qp] * factor;
50 }
static InputParameters validParams()
MaterialVectorBodyForce applies a body force (force/volume) given as a vector material property...
const unsigned int invalid_uint
MooseVariable & _var
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
unsigned int number() const
const Function & _function
optional scaling function
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
Real & _dt
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
void addRequiredParam(const std::string &name, const std::string &doc_string)
const VariableTestValue & _test
const MaterialProperty< RealVectorValue > & _body_force
coupled body force vector property
static InputParameters validParams()
Real & _t
unsigned int _i
void paramError(const std::string &param, Args... args) const
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int coupledComponents(const std::string &var_name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("SolidMechanicsApp", MaterialVectorBodyForce)
unsigned int _component
coordinate axis this Kernel acts on
void addClassDescription(const std::string &doc_string)
virtual Real value(Real t, const Point &p) const
const MooseArray< Point > & _q_point
unsigned int _qp
MaterialVectorBodyForce(const InputParameters &parameters)