https://mooseframework.inl.gov
Loading...
Searching...
No Matches
InterfaceIntegralVariableValuePostprocessor.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 "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)
36 MooseVariableInterface<Real>(this,
37 false,
38 "variable",
39 Moose::VarKindType::VAR_ANY,
40 Moose::VarFieldType::VAR_FIELD_STANDARD),
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
65Real
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
91bool
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}
registerMooseObject("MooseApp", InterfaceIntegralVariableValuePostprocessor)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
const MooseVariableFieldBase * getFieldVar(const std::string &var_name, unsigned int comp) const
Definition Coupleable.C:307
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
Make a functor face argument with a central differencing limiter, e.g.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
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 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 addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
This postprocessor add generel capabilities to the InterfacePostprocessor to compute an integral over...
This postprocessor computes a weighted (by area) integral of the specified variable.
virtual Real computeQpIntegral() override
the contribution of a qp to the integral
bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const override
const MooseEnum _interface_value_type
the type of interface value we want to compute
const MooseVariableFV< Real > *const _neighbor_fv_variable
the fv variable for the neighbor variable
const VariableValue & _u
Holds the solution at current quadrature points.
const VariableValue & _u_neighbor
Holds the solution at current quadrature points on the neighbor side.
const FaceInfo * _fi
A pointer to a face info, useful when working with FV.
bool _has_fv_vars
Whether finite volume variables are involved in the user object.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
This class provides variable solution values for other classes/objects to bind to when looping over f...
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.
MooseVariableFV< Real > * _fv_variable
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
MooseEnum InterfaceAverageOptions()
Real getQuantity(const MooseEnum, const Real, const Real)
auto raw_value(const Eigen::Map< T > &in)
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...