https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
42Real
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
50Real
55
56Real
58 const Moose::StateArg & state)
59{
60 return (*_mu)(elem_arg, state) * (*_D)(elem_arg, state)(_index);
61}
const double mu
registerMooseObject("NavierStokesApp", LinearFVMomentumFriction)
const Elem * elem() const
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()
Imposes a friction force on the momentum equation.
const Moose::Functor< RealVectorValue > *const _D
Darcy coefficient.
LinearFVMomentumFriction(const InputParameters &params)
const Moose::Functor< Real > *const _mu
Dynamic viscosity.
Real computeFrictionWCoefficient(const Moose::ElemArg &elem_arg, const Moose::StateArg &state)
static InputParameters validParams()
virtual Real computeMatrixContribution() override
const unsigned int _index
Index x|y|z of the momentum equation component.
virtual Real computeRightHandSideContribution() override
Moose::StateArg determineState() const
static const std::string mu
Definition NS.h:127