https://mooseframework.inl.gov
DistributedForce.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 "DistributedForce.h"
11 
12 registerMooseObject("NavierStokesApp", DistributedForce);
13 
16 {
18 
19  // The acceleration vector.
20  params.addParam<RealVectorValue>(
21  "acceleration",
22  RealVectorValue(0, 0, 0),
23  "The acceleration components for an applied distributed force in an element.");
24  params.addRequiredParam<unsigned int>("component", "acceleration vector components");
25 
26  // The body force acts on the mass of the volume
27  params.addRequiredCoupledVar("rho", "density"); // Density integrated over a volume yields mass
28  params.addClassDescription("Implements a force term in the Navier Stokes momentum equation.");
29 
30  return params;
31 }
32 
34  : Kernel(parameters),
35  _component(getParam<unsigned int>("component")),
36  _acceleration(getParam<RealVectorValue>("acceleration")(_component)),
37  _rho_var_number(coupled("rho")),
38  _rho(coupledValue("rho"))
39 {
40 }
41 
42 Real
44 {
45  // -rho * g * phi
46  return -_rho[_qp] * _acceleration * _test[_i][_qp];
47 }
48 
49 Real
51 {
52  return 0.;
53 }
54 
55 Real
57 {
58  if (jvar == _rho_var_number)
59  return -_phi[_j][_qp] * _acceleration * _test[_i][_qp];
60 
61  return 0;
62 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
registerMooseObject("NavierStokesApp", DistributedForce)
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeQpJacobian()
virtual Real computeQpResidual()
const VariableTestValue & _test
const VariableValue & _rho
unsigned int _i
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
unsigned int _rho_var_number
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
DistributedForce(const InputParameters &parameters)
static InputParameters validParams()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const VariablePhiValue & _phi
void ErrorVector unsigned int
The DistributedForce kernel computes the body force due to the acceleration of mass in an element...
unsigned int _qp