https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
13
16{
19 "Computes residual for diffusion operator across an interface for finite volume method.");
20 params.addRequiredParam<MaterialPropertyName>("coeff1",
21 "The diffusion coefficient on the 1st subdomains");
22 params.addRequiredParam<MaterialPropertyName>("coeff2",
23 "The diffusion coefficient on the 2nd subdomains");
24 MooseEnum coeff_interp_method("average harmonic", "harmonic");
25 params.addParam<MooseEnum>(
26 "coeff_interp_method",
27 coeff_interp_method,
28 "Switch that can select face interpolation method for diffusion coefficients.");
29 params.set<unsigned short>("ghost_layers") = 2;
30 return params;
31}
32
34 : FVInterfaceKernel(params),
35 _coeff1(getFunctor<ADReal>("coeff1")),
36 _coeff2(getFunctor<ADReal>("coeff2"))
37{
38 if (&var1() != &var2())
39 paramError("variable2",
40 name(),
41 " is only designed to work with the same variable on both sides of an interface.");
42 const auto & interp_method = getParam<MooseEnum>("coeff_interp_method");
43 if (interp_method == "average")
45 else if (interp_method == "harmonic")
47}
48
51{
52 const auto state = determineState();
53 const auto & grad = var1().adGradSln(*_face_info, state);
54
55 const auto coef = interpolateValue(
57
58 return -coef * normal() * grad;
59}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("MooseApp", FVOneVarDiffusionInterface)
Base class for creating kernels that interface physics between subdomains.
static InputParameters validParams()
Moose::ElemArg elemArg2(bool correct_skewness=false) const
Moose::ElemArg elemArg1(bool correct_skewness=false) const
const FaceInfo * _face_info
The face that this object is currently operating on.
ADReal interpolateValue(Moose::FV::InterpMethod method, const ADReal &value1, const ADReal &value2) const
Interpolate values from the two user-defined sides to the face.
const MooseVariableFV< Real > & var1() const
const MooseVariableFV< Real > & var2() const
static InputParameters validParams()
Moose::FV::InterpMethod _coeff_interp_method
Decides if a geometric arithmetic or harmonic average is used for the face interpolation of the diffu...
const Moose::Functor< ADReal > & _coeff2
FVOneVarDiffusionInterface(const InputParameters &params)
const Moose::Functor< ADReal > & _coeff1
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
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:457
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
const ADTemplateVariableGradient< OutputType > & adGradSln() const override
AD grad solution getter.
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
@ HarmonicAverage
1/(gc/elem+(1-gc)/neighbor)
@ Average
gc*elem+(1-gc)*neighbor