https://mooseframework.inl.gov
LinearFVMomentumFriction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #include "NavierStokesMethods.h"
13 
15 
18 {
20  params.addClassDescription("Computes a Darcy friction force term on fluid in the "
21  "Navier Stokes i-th momentum equation.");
22  params.addParam<MooseFunctorName>("Darcy_name", "Name of the Darcy coefficients property.");
23  params.addRequiredParam<MooseFunctorName>(NS::mu, "The dynamic viscosity");
24 
25  MooseEnum momentum_component("x=0 y=1 z=2");
27  "momentum_component",
28  momentum_component,
29  "The component of the momentum equation that this kernel applies to.");
30 
31  return params;
32 }
33 
35  : LinearFVElementalKernel(params),
36  _index(getParam<MooseEnum>("momentum_component")),
37  _D(isParamValid("Darcy_name") ? &getFunctor<RealVectorValue>("Darcy_name") : nullptr),
38  _mu(isParamValid(NS::mu) ? &getFunctor<Real>(NS::mu) : nullptr)
39 {
40 }
41 
42 Real
44 {
45  const auto elem_arg = makeElemArg(_current_elem_info->elem());
46  const auto state = determineState();
47  return computeFrictionWCoefficient(elem_arg, state) * _current_elem_volume;
48 }
49 
50 Real
52 {
53  return 0;
54 }
55 
56 Real
58  const Moose::StateArg & state)
59 {
60  return (*_mu)(elem_arg, state) * (*_D)(elem_arg, state)(_index);
61 }
const ElemInfo * _current_elem_info
virtual Real computeRightHandSideContribution() override
Imposes a friction force on the momentum equation.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Moose::StateArg determineState() const
const Elem * elem() const
static InputParameters validParams()
const Moose::Functor< RealVectorValue > *const _D
Darcy coefficient.
void addRequiredParam(const std::string &name, const std::string &doc_string)
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
static InputParameters validParams()
const Moose::Functor< Real > *const _mu
Dynamic viscosity.
static const std::string mu
Definition: NS.h:123
registerMooseObject("NavierStokesApp", LinearFVMomentumFriction)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LinearFVMomentumFriction(const InputParameters &params)
virtual Real computeMatrixContribution() override
void addClassDescription(const std::string &doc_string)
Real computeFrictionWCoefficient(const Moose::ElemArg &elem_arg, const Moose::StateArg &state)
const unsigned int _index
Index x|y|z of the momentum equation component.