https://mooseframework.inl.gov
LinearFVMomentumPressure.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 pressure gradient term in the Navier Stokes momentum "
23  "equations, added to the right hand side.");
24  params.addParam<VariableName>(NS::pressure,
25  "The pressure variable whose gradient should be used.");
26  MooseEnum momentum_component("x=0 y=1 z=2");
28  "momentum_component",
29  momentum_component,
30  "The component of the momentum equation that this kernel applies to.");
31  return params;
32 }
33 
35  : LinearFVElementalKernel(params),
36  _index(getParam<MooseEnum>("momentum_component")),
37  _pressure_var(getPressureVariable(NS::pressure))
38 {
40 }
41 
44 {
45  auto * ptr = dynamic_cast<MooseLinearVariableFV<Real> *>(
46  &_fe_problem.getVariable(_tid, getParam<VariableName>(vname)));
47 
48  if (!ptr)
49  paramError(NS::pressure, "The pressure variable should be of type MooseLinearVariableFVReal!");
50 
51  return *ptr;
52 }
53 
54 Real
56 {
57  return 0.0;
58 }
59 
60 Real
62 {
64 }
const ElemInfo * _current_elem_info
MooseLinearVariableFV< Real > & _pressure_var
Pointer to the linear finite volume pressure variable.
void paramError(const std::string &param, Args... args) const
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Real gradSlnComponent(const ElemInfo &elem_info, unsigned int component) const
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
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
virtual Real computeRightHandSideContribution() override
const unsigned int _index
Index x|y|z of the momentum equation component.
const THREAD_ID _tid
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string pressure
Definition: NS.h:57
LinearFVMomentumPressure(const InputParameters &params)
Class constructor.
void addClassDescription(const std::string &doc_string)
FEProblemBase & _fe_problem
registerMooseObject("NavierStokesApp", LinearFVMomentumPressure)
Kernel that adds the component of the pressure gradient in the momentum equations to the right hand s...
MooseLinearVariableFV< Real > & getPressureVariable(const std::string &vname)
static InputParameters validParams()
virtual Real computeMatrixContribution() override