https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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 params.addParam<MooseFunctorName>(NS::porosity,
29 "1",
30 "The porosity. With superficial velocity variables the "
31 "buoyancy force is eps (rho - rho_0) g.");
32 MooseEnum momentum_component("x=0 y=1 z=2");
34 "momentum_component",
35 momentum_component,
36 "The component of the momentum equation that this kernel applies to.");
37
38 return params;
39}
40
43 _index(getParam<MooseEnum>("momentum_component")),
44 _rho(getFunctor<Real>(NS::density)),
45 _rho_0(getParam<Real>("reference_rho")),
46 _gravity(getParam<RealVectorValue>("gravity")),
47 _eps(getFunctor<Real>(NS::porosity))
48{
49}
50
51Real
56
57Real
59{
60 const auto elem = makeElemArg(_current_elem_info->elem());
61 const auto state = determineState();
62 return _eps(elem, state) * (_rho(elem, state) - _rho_0) * _gravity(_index) * _current_elem_volume;
63}
registerMooseObject("NavierStokesApp", LinearFVMomentumBuoyancy)
const Elem * elem() const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
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)
const ElemInfo * _current_elem_info
static InputParameters validParams()
Kernel that adds the the gravity term in the momentum equations with variable density (assuming we ar...
const RealVectorValue _gravity
The gravity vector.
const Moose::Functor< Real > & _rho
the density
const unsigned int _index
Index x|y|z of the momentum equation component.
virtual Real computeMatrixContribution() override
const Moose::Functor< Real > & _eps
The porosity.
LinearFVMomentumBuoyancy(const InputParameters &params)
Class constructor.
const Real _rho_0
the reference density
static InputParameters validParams()
virtual Real computeRightHandSideContribution() override
Moose::StateArg determineState() const
static const std::string density
Definition NS.h:34
static const std::string porosity
Definition NS.h:108