https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVMomentumBoussinesq.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 Boussinesq term in the Navier Stokes momentum "
23 "equations, added to the right hand side.");
24 params.addParam<VariableName>(NS::T_fluid, "The fluid temperature variable.");
25 params.addRequiredParam<RealVectorValue>("gravity", "Gravitational acceleration vector.");
26 params.addParam<MooseFunctorName>("alpha_name",
28 "The name of the thermal expansion coefficient"
29 "this is of the form rho = rho_ref*(1-alpha (T-T_ref))");
30 params.addRequiredParam<Real>("ref_temperature", "The value for the reference temperature.");
31 params.addRequiredParam<MooseFunctorName>(NS::density, "The value for the density");
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 return params;
38}
39
42 _index(getParam<MooseEnum>("momentum_component")),
43 _temperature_var(getTemperatureVariable(NS::T_fluid)),
44 _gravity(getParam<RealVectorValue>("gravity")),
45 _alpha(getFunctor<Real>("alpha_name")),
46 _ref_temperature(getParam<Real>("ref_temperature")),
47 _rho(getFunctor<Real>(NS::density))
48{
49 if (!_rho.isConstant())
50 paramError(NS::density, "The density in the boussinesq term is not constant!");
51}
52
55{
56 auto * ptr = dynamic_cast<MooseLinearVariableFV<Real> *>(
57 &_fe_problem.getVariable(_tid, getParam<VariableName>(vname)));
58
59 if (!ptr)
61 "The fluid temperature variable should be of type MooseLinearVariableFVReal!");
62
63 return *ptr;
64}
65
66Real
71
72Real
registerMooseObject("NavierStokesApp", LinearFVMomentumBoussinesq)
const Elem * elem() const
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
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 component of the Boussinesq term in the momentum equations to the right hand sid...
const Moose::Functor< Real > & _alpha
The thermal expansion coefficient.
const Real _ref_temperature
Reference temperature at which the reference value of the density (_rho) was measured.
const MooseLinearVariableFV< Real > & _temperature_var
Pointer to the linear finite volume temperature variable.
const Moose::Functor< Real > & _rho
the density
static InputParameters validParams()
virtual Real computeMatrixContribution() override
const MooseLinearVariableFV< Real > & getTemperatureVariable(const std::string &vname)
Fluid Temperature.
LinearFVMomentumBoussinesq(const InputParameters &params)
Class constructor.
const RealVectorValue _gravity
The gravity vector.
virtual Real computeRightHandSideContribution() override
const unsigned int _index
Index x|y|z of the momentum equation component.
const THREAD_ID _tid
FEProblemBase & _fe_problem
void paramError(const std::string &param, Args... args) const
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) 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