https://mooseframework.inl.gov
Loading...
Searching...
No Matches
INSFVMeshAdvection.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 "INSFVMeshAdvection.h"
11#include "NS.h"
12
14
17{
20 "Implements a source/sink term for this object's variable/advected-quantity "
21 "proportional to the divergence of the mesh velocity");
22 params.addRequiredParam<MooseFunctorName>(NS::density, "The density. This should be constant");
23 params.addRequiredParam<MooseFunctorName>("disp_x", "The x-displacement");
24 params.addParam<MooseFunctorName>("disp_y", 0, "The y-displacement");
25 params.addParam<MooseFunctorName>("disp_z", 0, "The z-displacement");
26 params.addParam<MooseFunctorName>(
27 "advected_quantity",
28 "An optional parameter for a functor describing the advected quantity. If this is not "
29 "provided, then the 'variable' will be used");
30 return params;
31}
32
34 : FVElementalKernel(parameters),
35 _rho(getFunctor<ADReal>(NS::density)),
36 _disp_x(getFunctor<ADReal>("disp_x")),
37 _disp_y(getFunctor<ADReal>("disp_y")),
38 _disp_z(getFunctor<ADReal>("disp_z")),
39 _adv_quant(isParamValid("advected_quantity") ? static_cast<const Moose::FunctorBase<ADReal> &>(
40 getFunctor<ADReal>("advected_quantity"))
41 : static_cast<Moose::FunctorBase<ADReal> &>(_var))
42{
43}
44
47 const Moose::StateArg & state) const
48{
49 const auto div_mesh_velocity = _disp_x.gradDot(elem_arg, state)(0) +
50 _disp_y.gradDot(elem_arg, state)(1) +
51 _disp_z.gradDot(elem_arg, state)(2);
52 return _rho(elem_arg, state) * div_mesh_velocity;
53}
54
57{
58 const auto elem_arg = makeElemArg(_current_elem);
59 const auto state = determineState();
60 return advQuantCoeff(elem_arg, state) * _adv_quant(elem_arg, state);
61}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", INSFVMeshAdvection)
static InputParameters validParams()
const Elem *const & _current_elem
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
Implements a source/sink term for this object's variable/advected-quantity proportional to the diverg...
const Moose::Functor< ADReal > & _disp_x
x-displacement
const Moose::Functor< ADReal > & _disp_y
y-displacement
ADReal computeQpResidual() override
const Moose::Functor< ADReal > & _rho
The density.
const Moose::FunctorBase< ADReal > & _adv_quant
The advected quantity.
const Moose::Functor< ADReal > & _disp_z
z-displacement
static InputParameters validParams()
ADReal advQuantCoeff(const Moose::ElemArg &elem_arg, const Moose::StateArg &state) const
INSFVMeshAdvection(const InputParameters &parameters)
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)
Moose::StateArg determineState() const
static const std::string density
Definition NS.h:34