https://mooseframework.inl.gov
LinearFVBoundaryCondition.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 "Problem.h"
12 #include "SystemBase.h"
13 #include "MooseVariableFV.h"
14 
17 {
23 
24  MultiMooseEnum vtags("rhs time", "rhs", true);
25  auto & vector_tag_enum = params.set<MultiMooseEnum>("vector_tags", true);
26  vector_tag_enum = vtags;
27 
28  params.addRequiredParam<LinearVariableName>(
29  "variable", "The name of the variable that this boundary condition applies to");
30  params.declareControllable("enable");
31  params.registerBase("LinearFVBoundaryCondition");
32  params.registerSystemAttributeName("LinearFVBoundaryCondition");
33  return params;
34 }
35 
37  : MooseObject(parameters),
38  BoundaryRestrictableRequired(this, false),
39  SetupInterface(this),
40  FunctionInterface(this),
42  UserObjectInterface(this),
43  TransientInterface(this),
47  MeshChangedInterface(parameters),
48  TaggingInterface(this),
50  false,
51  "variable",
57  _tid(parameters.get<THREAD_ID>("_tid")),
58  _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
59  _mesh(_subproblem.mesh()),
60  _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
61  _var(*mooseLinearVariableFV()),
62  _sys(_var.sys()),
63  _var_num(_var.number()),
64  _sys_num(_sys.number())
65 {
67 }
68 
69 bool
70 LinearFVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const
71 {
72  const auto ft = fi.faceType(std::make_pair(_var_num, _sys_num));
73  if (fi_elem_side)
75  else
77 }
78 
81  const Moose::FV::LimiterType limiter_type,
82  const bool correct_skewness) const
83 {
84  mooseAssert(fi, "FaceInfo should not be null!");
85  return makeFace(*fi, limiter_type, true, correct_skewness);
86 }
87 
88 Real
90 {
91  const auto cell_to_face_vector = computeCellToFaceVector();
92  return std::abs(cell_to_face_vector * _current_face_info->normal());
93 }
94 
97 {
98  const auto is_on_mesh_boundary = !_current_face_info->neighborPtr();
99  const auto defined_on_elem =
100  is_on_mesh_boundary ? true : (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM);
101  if (is_on_mesh_boundary)
102  return _current_face_info->dCN();
103  else
104  return (_current_face_info->faceCentroid() - (defined_on_elem
107 }
An interface for accessing Moose::Functors for systems that do not care about automatic differentiati...
VarFieldType
Definition: MooseTypes.h:721
virtual bool hasFaceSide(const FaceInfo &fi, bool fi_elem_side) const override
RealVectorValue computeCellToFaceVector() const
Computes the vector connecting the cell and boundary face centers.
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
A class for requiring an object to be boundary restricted.
Real computeCellToFaceDistance() const
Compute the distance between the cell center and the face.
const unsigned int _sys_num
Cache for the system number.
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:1155
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition: FaceInfo.h:71
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
MeshBase & mesh
void registerSystemAttributeName(const std::string &value)
This method is used to define the MOOSE system name that is used by the TheWarehouse object for stori...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Point & neighborCentroid() const
Definition: FaceInfo.h:243
static InputParameters validParams()
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
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...
static InputParameters validParams()
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System...
Interface for objects that needs transient capabilities.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
const Elem * neighborPtr() const
Definition: FaceInfo.h:84
Interface for notifications that the mesh has changed.
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face...
Definition: FaceInfo.h:95
A structure defining a "face" evaluation calling argument for Moose functors.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
An interface for producers of functor face arguments, e.g.
Interface for objects that need to use distributions.
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:714
LinearFVBoundaryCondition(const InputParameters &parameters)
Class constructor.
FaceInfo::VarFaceNeighbors _current_face_type
Face ownership information for the current face.
LimiterType
Definition: Limiter.h:26
const unsigned int _var_num
Cache for the variable number.
Interface for objects that need to use UserObjects.
const Point & normal() const
Returns the unit normal vector for the face oriented outward from the face&#39;s elem element...
Definition: FaceInfo.h:68
MooseLinearVariableFV< Real > & _var
Reference to the linear finite volume variable object.
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
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
const FaceInfo * _current_face_info
Pointer to the face info we are operating on right now.
Interface for objects that need to get values of MooseVariables.
static InputParameters validParams()
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false) const
Determine the single sided face argument when evaluating a functor on a face.
static InputParameters validParams()
Definition: MooseObject.C:25
static InputParameters validParams()
Interface for objects that need to use functions.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
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.
const Point & dCN() const
Definition: FaceInfo.h:138
Interface class for classes which interact with Postprocessors.
unsigned int THREAD_ID
Definition: MooseTypes.h:209
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const
Returns which side(s) the given variable-system number pair is defined on for this face...
Definition: FaceInfo.h:225