https://mooseframework.inl.gov
PINSFVMomentumPressurePorosityGradient.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 
12 #include "NS.h"
13 
15 
18 {
20  params.addClassDescription("Introduces the coupled pressure times porosity gradient term "
21  "into the Navier-Stokes porous media momentum equation.");
22  params.addRequiredParam<MooseFunctorName>(NS::pressure, "The pressure");
23  MooseEnum momentum_component("x=0 y=1 z=2");
25  "momentum_component",
26  momentum_component,
27  "The component of the momentum equation that this kernel applies to.");
28  params.addRequiredParam<MooseFunctorName>(NS::porosity, "Porosity auxiliary variable");
29 
30  return params;
31 }
32 
34  const InputParameters & params)
35  : FVElementalKernel(params),
36  _p(getFunctor<ADReal>(NS::pressure)),
37  _eps(getFunctor<ADReal>(NS::porosity)),
38  _index(getParam<MooseEnum>("momentum_component"))
39 {
40  if (!dynamic_cast<PINSFVSuperficialVelocityVariable *>(&_var))
41  mooseError(
42  "PINSFVMomentumPressurePorosityGradient may only be used with a superficial velocity "
43  "variable, of variable type PINSFVSuperficialVelocityVariable.");
44 }
45 
46 ADReal
48 {
49  const auto & elem = makeElemArg(_current_elem);
50  const auto state = determineState();
51  return -_p(elem, state) * _eps.gradient(elem, state)(_index);
52 }
Moose::StateArg determineState() const
DualNumber< Real, DNDerivativeType, true > ADReal
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 porosity
Definition: NS.h:104
const Elem *const & _current_elem
static InputParameters validParams()
static const std::string pressure
Definition: NS.h:56
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const Moose::Functor< ADReal > & _eps
the porosity variable
const Moose::Functor< ADReal > & _p
the pressure
registerMooseObject("NavierStokesApp", PINSFVMomentumPressurePorosityGradient)
MooseVariableFV< Real > & _var
PINSFVMomentumPressurePorosityGradient(const InputParameters &params)