https://mooseframework.inl.gov
FVBoundaryCondition.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 
10 #include "FVBoundaryCondition.h"
11 #include "Problem.h"
12 #include "SystemBase.h"
13 #include "MooseVariableFV.h"
14 
15 namespace
16 {
17 SystemBase &
18 changeSystem(const InputParameters & params_in, MooseVariableFV<Real> & fv_var)
19 {
20  SystemBase & var_sys = fv_var.sys();
21  auto & params = const_cast<InputParameters &>(params_in);
22  params.set<SystemBase *>("_sys") = &var_sys;
23  return var_sys;
24 }
25 }
26 
29 {
35 
36  params.addRequiredParam<NonlinearVariableName>(
37  "variable", "The name of the variable that this boundary condition applies to");
38  params.addParam<bool>("use_displaced_mesh",
39  false,
40  "Whether or not this object should use the "
41  "displaced mesh for computation. Note that "
42  "in the case this is true but no "
43  "displacements are provided in the Mesh block "
44  "the undisplaced mesh will still be used.");
45 
46  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
47  params.addCoupledVar("displacements", "The displacements");
48  params.declareControllable("enable");
49  params.registerBase("FVBoundaryCondition");
50  return params;
51 }
52 
54  : MooseObject(parameters),
55  BoundaryRestrictableRequired(this, false),
56  SetupInterface(this),
57  FunctionInterface(this),
59  UserObjectInterface(this),
60  TransientInterface(this),
64  MeshChangedInterface(parameters),
65  TaggingInterface(this),
67  false,
68  "variable",
72  ADFunctorInterface(this),
73  _var(*mooseVariableFV()),
74  _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
75  _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
76  _sys(changeSystem(parameters, _var)),
77  _tid(parameters.get<THREAD_ID>("_tid")),
78  _assembly(_subproblem.assembly(_tid, _var.kind() == Moose::VAR_SOLVER ? _sys.number() : 0)),
79  _mesh(_subproblem.mesh())
80 {
83 }
84 
87  const Moose::FV::LimiterType limiter_type,
88  const bool correct_skewness,
89  const Moose::StateArg * state_limiter) const
90 {
91  if (!fi)
92  fi = _face_info;
93 
94  return makeFace(*fi, limiter_type, true, correct_skewness, state_limiter);
95 }
96 
97 bool
98 FVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const
99 {
100  const auto ft = fi.faceType(std::make_pair(_var.number(), _var.sys().number()));
101  if (fi_elem_side)
103  else
105 }
VarFieldType
Definition: MooseTypes.h:721
A class for requiring an object to be boundary restricted.
const FaceInfo * _face_info
Holds information for the face we are currently examining.
virtual void haveADObjects(bool have_ad_objects)
Method for setting whether we have any ad objects.
Definition: SubProblem.h:767
unsigned int number() const
Get variable number coming from libMesh.
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
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
static InputParameters validParams()
MeshBase & mesh
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi=nullptr, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
Determine the single sided face argument when evaluating a functor on a face.
MooseVariableFV< Real > & _var
static InputParameters validParams()
Base class for a system (of equations)
Definition: SystemBase.h:84
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...
An interface for accessing Moose::Functors for systems that care about automatic differentiation, e.g.
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
Interface for notifications that the mesh has changed.
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
bool hasFaceSide(const FaceInfo &fi, bool fi_elem_side) const override
SubProblem & _subproblem
Reference to SubProblem.
Interface for objects that need to use distributions.
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:714
LimiterType
Definition: Limiter.h:26
FVBoundaryCondition(const InputParameters &parameters)
Class constructor.
Interface for objects that need to use UserObjects.
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1159
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
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
Interface for objects that need to get values of MooseVariables.
State argument for evaluating functors.
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...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
static InputParameters validParams()
Definition: MooseObject.C:25
static InputParameters validParams()
static InputParameters validParams()
SystemBase & sys()
Get the system this variable is part of.
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.
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
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...