www.mooseframework.org
InterfaceIntegralVariableValuePostprocessor.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "InterfaceValueTools.h"
12 
14 
17 {
19 
20  params.addRequiredCoupledVar("variable",
21  "The name of the variable on the primary side of the interface");
22  params.addCoupledVar(
23  "neighbor_variable",
24  "The name of the variable on the secondary side of the interface. By default "
25  "the primary side variable name is used for the secondary side as well");
26  params.addClassDescription("Add access to variables and their gradient on an interface.");
27  params.addParam<MooseEnum>("interface_value_type",
29  "Type of value we want to compute");
30  return params;
31 }
32 
34  const InputParameters & parameters)
35  : InterfaceIntegralPostprocessor(parameters),
37  false,
38  "variable",
41  _u(coupledValue("variable")),
42  _grad_u(coupledGradient("variable")),
43  _u_neighbor(parameters.isParamSetByUser("neighbor_variable")
44  ? coupledNeighborValue("neighbor_variable")
45  : coupledNeighborValue("variable")),
46  _grad_u_neighbor(parameters.isParamSetByUser("neighbor_variable")
47  ? coupledNeighborGradient("neighbor_variable")
48  : coupledNeighborGradient("variable")),
49  _interface_value_type(parameters.get<MooseEnum>("interface_value_type")),
50  _neighbor_fv_variable(
51  parameters.isParamSetByUser("neighbor_variable")
52  ? dynamic_cast<const MooseVariableFV<Real> *>(getFieldVar("neighbor_variable", 0))
53  : dynamic_cast<const MooseVariableFV<Real> *>(getFieldVar("variable", 0)))
54 {
56 
57  // Primary and secondary variable should both be of a similar variable type
58  if (parameters.isParamSetByUser("neighbor_variable"))
59  if ((_has_fv_vars && !getFieldVar("neighbor_variable", 0)->isFV()) ||
60  (!_has_fv_vars && getFieldVar("neighbor_variable", 0)->isFV()))
61  mooseError("For the InterfaceIntegralVariableValuePostprocessor, variable and "
62  "neighbor_variable should be of a similar variable type.");
63 }
64 
65 Real
67 {
68  if (_has_fv_vars)
69  {
70  mooseAssert(_fi, "This should never be null. If it is then something went wrong in execute()");
71 
72  // If both variables are different, assume this is a boundary for both variables
73  Real u, u_neighbor;
75  {
77  u_neighbor = MetaPhysicL::raw_value(
79  }
80  // If only one variable is specified, assume this is an internal interface
81  // FIXME Make sure getInternalFaceValue uses the right interpolation method, see #16585
82  else
84 
86  }
87  else
89 }
90 
91 bool
93 {
94  // Our default interface kernel treats elem and neighbor sides equivalently so we will assume for
95  // now that we will happily consume functor evaluations on either side of a face and any
96  // interpolation between said evaluations
97  return true;
98 }
const FaceInfo * _fi
A pointer to a face info, useful when working with FV.
VarFieldType
Definition: MooseTypes.h:634
bool _has_fv_vars
Whether finite volume variables are involved in the user object.
const MooseVariableFV< Real > *const _neighbor_fv_variable
the fv variable for the neighbor variable
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1147
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
virtual bool isFV() const
auto raw_value(const Eigen::Map< T > &in)
Definition: ADReal.h:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MooseVariableFV< Real > * _fv_variable
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:35
bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const override
MooseEnum InterfaceAverageOptions()
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:627
registerMooseObject("MooseApp", InterfaceIntegralVariableValuePostprocessor)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
virtual Real computeQpIntegral() override
the contribution of a qp to the integral
This postprocessor add generel capabilities to the InterfacePostprocessor to compute an integral over...
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was by the user.
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseEnum _interface_value_type
the type of interface value we want to compute
ADReal getBoundaryFaceValue(const FaceInfo &fi, const StateArg &state, bool correct_skewness=false) const
Retrieve the solution value at a boundary face.
Interface for objects that need to get values of MooseVariables.
MooseVariableField< Real > & mooseVariableField()
Return the MooseVariableField object that this interface acts on.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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...
const VariableValue & _u
Holds the solution at current quadrature points.
const InputParameters & parameters() const
Get the parameters of the object.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
This postprocessor computes a weighted (by area) integral of the specified variable.
This class provides variable solution values for other classes/objects to bind to when looping over f...
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
Make a functor face argument with a central differencing limiter, e.g.
Real getQuantity(const MooseEnum, const Real, const Real)
const VariableValue & _u_neighbor
Holds the solution at current quadrature points on the neighbor side.
const MooseVariableFieldBase * getFieldVar(const std::string &var_name, unsigned int comp) const
Definition: Coupleable.C:281