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 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
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
46Real
51
52Real
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}
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 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
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