https://mooseframework.inl.gov
INSFVMomentumBoussinesq.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 "NS.h"
12 
14 
17 {
20  params.addClassDescription("Computes a body force for natural convection buoyancy.");
21  params.addRequiredParam<MooseFunctorName>(NS::T_fluid, "the fluid temperature");
22  params.addRequiredParam<RealVectorValue>("gravity", "Direction of the gravity vector");
23  params.addParam<MooseFunctorName>("alpha_name",
25  "The name of the thermal expansion coefficient"
26  "this is of the form rho = rho*(1-alpha (T-T_ref))");
27  params.addRequiredParam<Real>("ref_temperature", "The value for the reference temperature.");
28  params.addRequiredParam<MooseFunctorName>(NS::density, "The value for the density");
29  params.addPrivateParam("_override_constant_check", false);
30  return params;
31 }
32 
34  : FVElementalKernel(params),
36  _temperature(getFunctor<ADReal>(NS::T_fluid)),
37  _gravity(getParam<RealVectorValue>("gravity")),
38  _alpha(getFunctor<ADReal>("alpha_name")),
39  _ref_temperature(getParam<Real>("ref_temperature")),
40  _rho(getFunctor<ADReal>(NS::density))
41 {
42  if (!_rho.isConstant() && !getParam<bool>("_override_constant_check"))
43  paramError(NS::density, "The density in the boussinesq term is not constant!");
44 }
45 
46 ADReal
48 {
49  const auto elem = makeElemArg(_current_elem);
50  const auto state = determineState();
51  return _alpha(elem, state) * _gravity(_index) * _rho(elem, state) *
52  (_temperature(elem, state) - _ref_temperature);
53 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addPrivateParam(const std::string &name, const T &value)
Moose::StateArg determineState() const
static const std::string alpha_boussinesq
Definition: NS.h:113
const unsigned int _index
index x|y|z
static const std::string density
Definition: NS.h:33
DualNumber< Real, DNDerivativeType, true > ADReal
const Moose::Functor< ADReal > & _temperature
Fluid temperature.
const Moose::Functor< ADReal > & _rho
the density
void addRequiredParam(const std::string &name, const std::string &doc_string)
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
static const std::string T_fluid
Definition: NS.h:106
const Elem *const & _current_elem
static InputParameters validParams()
void paramError(const std::string &param, Args... args) const
Imposes a Boussinesq force on the momentum equation.
All objects that contribute to pressure-based (e.g.
static InputParameters validParams()
const Moose::Functor< ADReal > & _alpha
The thermal expansion coefficient.
const Real _ref_temperature
Reference temperature at which the value of _rho was measured.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const RealVectorValue _gravity
The gravity vector.
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
ADReal computeQpResidual() override
INSFVMomentumBoussinesq(const InputParameters &params)
registerMooseObject("NavierStokesApp", INSFVMomentumBoussinesq)