https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
42Real
44{
45 // -rho * g * phi
46 return -_rho[_qp] * _acceleration * _test[_i][_qp];
47}
48
49Real
54
55Real
57{
58 if (jvar == _rho_var_number)
59 return -_phi[_j][_qp] * _acceleration * _test[_i][_qp];
60
61 return 0;
62}
registerMooseObject("NavierStokesApp", DistributedForce)
void ErrorVector unsigned int
The DistributedForce kernel computes the body force due to the acceleration of mass in an element.
unsigned int _rho_var_number
const VariableValue & _rho
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
static InputParameters validParams()
virtual Real computeQpResidual()
DistributedForce(const InputParameters &parameters)
virtual Real computeQpJacobian()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(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)
unsigned int _qp
unsigned int _j
unsigned int _i
const VariablePhiValue & _phi
const VariableTestValue & _test
static InputParameters validParams()