https://mooseframework.inl.gov
LinearFVMomentumBuoyancy.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 "Assembly.h"
12 #include "SubProblem.h"
13 #include "NS.h"
14 #include "FEProblemBase.h"
15 
17 
20 {
22  params.addClassDescription("Represents the buoyancy term in the Navier Stokes momentum "
23  "equations, added to the right hand side.");
24 
25  params.addRequiredParam<RealVectorValue>("gravity", "Gravitational acceleration vector.");
26  params.addRequiredParam<MooseFunctorName>(NS::density, "The value for the density");
27  params.addRequiredParam<Real>("reference_rho", "The value for the reference density");
28  MooseEnum momentum_component("x=0 y=1 z=2");
30  "momentum_component",
31  momentum_component,
32  "The component of the momentum equation that this kernel applies to.");
33 
34  return params;
35 }
36 
38  : LinearFVElementalKernel(params),
39  _index(getParam<MooseEnum>("momentum_component")),
40  _rho(getFunctor<Real>(NS::density)),
41  _rho_0(getParam<Real>("reference_rho")),
42  _gravity(getParam<RealVectorValue>("gravity"))
43 {
44 }
45 
46 Real
48 {
49  return 0.0;
50 }
51 
52 Real
54 {
55  const auto elem = makeElemArg(_current_elem_info->elem());
56  const auto state = determineState();
57  return (_rho(elem, state) - _rho_0) * _gravity(_index) * _current_elem_volume;
58 }
const ElemInfo * _current_elem_info
const unsigned int _index
Index x|y|z of the momentum equation component.
virtual Real computeRightHandSideContribution() override
static InputParameters validParams()
Moose::StateArg determineState() const
const Elem * elem() const
static InputParameters validParams()
static const std::string density
Definition: NS.h:33
virtual Real computeMatrixContribution() override
Kernel that adds the the gravity term in the momentum equations with variable density (assuming we ar...
void addRequiredParam(const std::string &name, const std::string &doc_string)
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
LinearFVMomentumBuoyancy(const InputParameters &params)
Class constructor.
const Real _rho_0
the reference density
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
registerMooseObject("NavierStokesApp", LinearFVMomentumBuoyancy)
const RealVectorValue _gravity
The gravity vector.
const Moose::Functor< Real > & _rho
the density