www.mooseframework.org
Gravity.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "Gravity.h"
8 #include "Function.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<Kernel>();
15  params.addClassDescription("Apply gravity. Value is in units of acceleration.");
16  params.addParam<bool>("use_displaced_mesh", true, "Displaced mesh defaults to true");
17  params.set<Real>("value") = 0.0;
18  // A ConstantFunction of "1" is supplied as the default
19  params.addParam<FunctionName>(
20  "function", "1", "A function that describes the gravitational force");
21  params.addParam<Real>("alpha", 0.0, "alpha parameter required for HHT time integration scheme");
22  return params;
23 }
24 
25 Gravity::Gravity(const InputParameters & parameters)
26  : Kernel(parameters),
27  _density(getMaterialProperty<Real>("density")),
28  _value(getParam<Real>("value")),
29  _function(getFunction("function")),
30  _alpha(getParam<Real>("alpha"))
31 {
32 }
33 
34 Real
36 {
37  Real factor = _value * _function.value(_t + _alpha * _dt, _q_point[_qp]);
38  return _density[_qp] * _test[_i][_qp] * -factor;
39 }
Real _value
Definition: Gravity.h:34
Function & _function
Definition: Gravity.h:35
Gravity(const InputParameters &parameters)
Definition: Gravity.C:25
const MaterialProperty< Real > & _density
Definition: Gravity.h:32
const Real _alpha
Definition: Gravity.h:37
virtual Real computeQpResidual()
Definition: Gravity.C:35
InputParameters validParams< Gravity >()
Definition: Gravity.C:12