https://mooseframework.inl.gov
PCNSFVMomentumFriction.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 
10 #include "PCNSFVMomentumFriction.h"
11 #include "NS.h"
12 
14 
17 {
19  params.addClassDescription("Computes a friction force term on fluid in porous media in the "
20  "Navier Stokes i-th momentum equation.");
21  MooseEnum momentum_component("x=0 y=1 z=2");
23  "momentum_component",
24  momentum_component,
25  "The component of the momentum equation that this kernel applies to.");
26  params.addParam<MaterialPropertyName>("Darcy_name",
27  "Name of the Darcy coefficients material property.");
28  params.addParam<MaterialPropertyName>("Forchheimer_name",
29  "Name of the Forchheimer coefficients material property.");
30  params.addCoupledVar(NS::porosity, "Porosity variable.");
31  params.addRequiredParam<MaterialPropertyName>(
32  "momentum_name",
33  "Name of the superficial momentum material property for "
34  "the Darcy and Forchheimer friction terms.");
35  return params;
36 }
37 
39  : FVElementalKernel(params),
40  _component(getParam<MooseEnum>("momentum_component")),
41  _cL(isParamValid("Darcy_name") ? &getADMaterialProperty<RealVectorValue>("Darcy_name")
42  : nullptr),
43  _cQ(isParamValid("Forchheimer_name")
44  ? &getADMaterialProperty<RealVectorValue>("Forchheimer_name")
45  : nullptr),
46  _use_Darcy_friction_model(isParamValid("Darcy_name")),
47  _use_Forchheimer_friction_model(isParamValid("Forchheimer_name")),
48  _eps(isCoupled(NS::porosity) ? coupledValue(NS::porosity)
49  : getMaterialProperty<Real>(NS::porosity).get()),
50  _momentum(getADMaterialProperty<Real>("momentum_name"))
51 {
53  mooseError("At least one friction model needs to be specified.");
54 }
55 
56 ADReal
58 {
59  ADReal friction_term = 0;
60 
62  friction_term += (*_cL)[_qp](_component) * _momentum[_qp] / _eps[_qp];
64  friction_term += (*_cQ)[_qp](_component) * _momentum[_qp] / _eps[_qp];
65 
66  return friction_term;
67 }
Imposes a friction force on the momentum equation in porous media.
ADReal computeQpResidual() override
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
const unsigned int _component
Momentum equation component (x = 0, y = 1, z = 2)
const VariableValue & _eps
Porosity to compute the intersitial velocity from the superficial velocity.
PCNSFVMomentumFriction(const InputParameters &params)
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
static const std::string porosity
Definition: NS.h:104
const ADMaterialProperty< Real > & _momentum
Momentum as a material property.
static InputParameters validParams()
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("NavierStokesApp", PCNSFVMomentumFriction)
const unsigned int _qp
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const bool _use_Darcy_friction_model
Booleans to select the right models.
const Elem & get(const ElemType type_in)