https://mooseframework.inl.gov
FVOneVarDiffusionInterface.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 
11 #include "MathFVUtils.h"
12 
14 
17 {
19  params.addClassDescription(
20  "Computes residual for diffusion operator across an interface for finite volume method.");
21  params.addRequiredParam<MaterialPropertyName>("coeff1",
22  "The diffusion coefficient on the 1st subdomains");
23  params.addRequiredParam<MaterialPropertyName>("coeff2",
24  "The diffusion coefficient on the 2nd subdomains");
25  MooseEnum coeff_interp_method("average harmonic", "harmonic");
26  params.addParam<MooseEnum>(
27  "coeff_interp_method",
28  coeff_interp_method,
29  "Switch that can select face interpolation method for diffusion coefficients.");
30  params.set<unsigned short>("ghost_layers") = 2;
31  return params;
32 }
33 
35  : FVInterfaceKernel(params),
36  _coeff1(getFunctor<ADReal>("coeff1")),
37  _coeff2(getFunctor<ADReal>("coeff2"))
38 {
39  if (&var1() != &var2())
40  paramError("variable2",
41  name(),
42  " is only designed to work with the same variable on both sides of an interface.");
43  const auto & interp_method = getParam<MooseEnum>("coeff_interp_method");
44  if (interp_method == "average")
46  else if (interp_method == "harmonic")
48 }
49 
50 ADReal
52 {
53  const auto & coef_elem = elemIsOne() ? _coeff1 : _coeff2;
54  const auto & coef_neighbor = elemIsOne() ? _coeff2 : _coeff1;
55 
56  const auto & grad = var1().adGradSln(*_face_info, determineState());
57 
58  ADReal coef;
60  coef,
61  coef_elem(elemArg(), determineState()),
62  coef_neighbor(neighborArg(), determineState()),
63  *_face_info,
64  true);
65 
66  return _normal * -coef * grad;
67 }
const FaceInfo * _face_info
The face that this object is currently operating on.
Moose::FV::InterpMethod _coeff_interp_method
Decides if a geometric arithmetic or harmonic average is used for the face interpolation of the diffu...
gc*elem+(1-gc)*neighbor
registerMooseObject("MooseApp", FVOneVarDiffusionInterface)
const MooseVariableFV< Real > & var1() const
static InputParameters validParams()
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseBase.h:435
1/(gc/elem+(1-gc)/neighbor)
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:46
const Moose::Functor< ADReal > & _coeff2
const Moose::Functor< ADReal > & _coeff1
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...
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:99
Base class for creating kernels that interface physics between subdomains.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
ADRealVectorValue _normal
The normal.
Moose::ElemArg neighborArg(bool correct_skenewss=false) const
Moose::ElemArg elemArg(bool correct_skewness=false) const
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...
FVOneVarDiffusionInterface(const InputParameters &params)
virtual bool elemIsOne() const
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
Provides interpolation of face values for non-advection-specific purposes (although it can/will still...
Definition: MathFVUtils.h:282
const MooseVariableFV< Real > & var2() const
const ADTemplateVariableGradient< OutputType > & adGradSln() const override
AD grad solution getter.