https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", INSFVMomentumBoussinesq)
static InputParameters validParams()
const Elem *const & _current_elem
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
Imposes a Boussinesq force on the momentum equation.
INSFVMomentumBoussinesq(const InputParameters &params)
const Moose::Functor< ADReal > & _temperature
Fluid temperature.
static InputParameters validParams()
const Moose::Functor< ADReal > & _alpha
The thermal expansion coefficient.
const RealVectorValue _gravity
The gravity vector.
const Moose::Functor< ADReal > & _rho
the density
const Real _ref_temperature
Reference temperature at which the value of _rho was measured.
All objects that contribute to pressure-based (e.g.
const unsigned int _index
index x|y|z
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addPrivateParam(const std::string &name, const T &value)
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)
void paramError(const std::string &param, Args... args) const
Moose::StateArg determineState() const
static const std::string density
Definition NS.h:34
static const std::string T_fluid
Definition NS.h:110
static const std::string alpha_boussinesq
Definition NS.h:117