https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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),
65 const auto adv_quant_interface =
67 limiterType(_advected_interp_method),
69 _advected_interp_method == InterpMethod::SkewCorrectedAverage),
71
72 return _normal * v * adv_quant_interface;
73}
DualNumber< Real, DNDerivativeType, true > ADReal
registerADMooseObject("MooseApp", FVMatAdvection)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
FVFluxKernel is used for calculating residual contributions from numerical fluxes from surface integr...
static InputParameters validParams()
RealVectorValue _normal
This is the outward unit normal vector for the face the kernel is currently operating on.
const FaceInfo * _face_info
This is holds meta-data for geometric information relevant to the current face including elem+neighbo...
static InputParameters validParams()
Moose::FV::InterpMethod _advected_interp_method
The interpolation method to use for the advected quantity.
FVMatAdvection(const InputParameters &params)
virtual ADReal computeQpResidual() override
This is the primary function that must be implemented for flux kernel terms.
const Moose::Functor< ADRealVectorValue > & _vel
const Moose::Functor< ADReal > & _adv_quant
The advected quantity.
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.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
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...
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.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
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)
@ SkewCorrectedAverage
(gc*elem+(1-gc)*neighbor)+gradient*(rf-rf')