https://mooseframework.inl.gov
FVMatAdvection.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 "FVMatAdvection.h"
11 
13 
16 {
18  params.addClassDescription("Computes the residual of advective term using finite volume method.");
19  params.addRequiredParam<MooseFunctorName>("vel", "advection velocity");
20  params.addParam<MooseFunctorName>(
21  "advected_quantity",
22  "An optional parameter for specifying an advected quantity from a material property. If this "
23  "is not specified, then the advected quantity will simply be the variable that this object "
24  "is acting on");
25 
26  MooseEnum advected_interp_method("average upwind skewness-corrected", "upwind");
27  params.addParam<MooseEnum>(
28  "advected_interp_method",
29  advected_interp_method,
30  "The interpolation to use for the advected quantity. Options are "
31  "'upwind', 'average', and 'skewness-corrected' with the default being 'upwind'.");
32  return params;
33 }
34 
36  : FVFluxKernel(params),
37  _vel(getFunctor<ADRealVectorValue>("vel")),
38  _adv_quant(getFunctor<ADReal>(isParamValid("advected_quantity") ? "advected_quantity"
39  : variable().name()))
40 {
41  using namespace Moose::FV;
42 
43  const auto & advected_interp_method = getParam<MooseEnum>("advected_interp_method");
44  if (advected_interp_method == "average")
45  _advected_interp_method = InterpMethod::Average;
46  else if (advected_interp_method == "skewness-corrected")
48  else if (advected_interp_method == "upwind")
49  _advected_interp_method = InterpMethod::Upwind;
50  else
51  mooseError("Unrecognized interpolation type ",
52  static_cast<std::string>(advected_interp_method));
53 }
54 
55 ADReal
57 {
58  using namespace Moose::FV;
59 
60  const auto v = _vel(makeFace(*_face_info,
61  LimiterType::CentralDifference,
62  true,
63  _advected_interp_method == InterpMethod::SkewCorrectedAverage),
64  determineState());
65  const auto adv_quant_interface =
69  _advected_interp_method == InterpMethod::SkewCorrectedAverage),
70  determineState());
71 
72  return _normal * v * adv_quant_interface;
73  ;
74 }
std::string name(const ElemQuality q)
static InputParameters validParams()
FVMatAdvection(const InputParameters &params)
const Moose::Functor< ADRealVectorValue > & _vel
const FaceInfo * _face_info
This is holds meta-data for geometric information relevant to the current face including elem+neighbo...
Definition: FVFluxKernel.h:89
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerADMooseObject("MooseApp", FVMatAdvection)
RealVectorValue _normal
This is the outward unit normal vector for the face the kernel is currently operating on...
Definition: FVFluxKernel.h:85
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:46
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
static InputParameters validParams()
Definition: FVFluxKernel.C:22
LimiterType limiterType(InterpMethod interp_method)
Return the limiter type associated with the supplied interpolation method.
Definition: Limiter.C:63
virtual ADReal computeQpResidual() override
This is the primary function that must be implemented for flux kernel terms.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
const Moose::Functor< ADReal > & _adv_quant
The advected quantity.
(gc*elem+(1-gc)*neighbor)+gradient*(rf-rf&#39;)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:267
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
Moose::FV::InterpMethod _advected_interp_method
The interpolation method to use for the advected quantity.
FVFluxKernel is used for calculating residual contributions from numerical fluxes from surface integr...
Definition: FVFluxKernel.h:30
Moose::FaceArg makeFace(const FaceInfo &fi, const Moose::FV::LimiterType limiter_type, const bool elem_is_upwind, const bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
Create a functor face argument from provided component arguments.