Line data Source code
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 8113 : changeSystem(const InputParameters & params_in, MooseVariableFV<Real> & fv_var)
19 : {
20 8113 : SystemBase & var_sys = fv_var.sys();
21 8113 : auto & params = const_cast<InputParameters &>(params_in);
22 8113 : params.set<SystemBase *>("_sys") = &var_sys;
23 8113 : return var_sys;
24 : }
25 : }
26 :
27 : InputParameters
28 229886 : FVBoundaryCondition::validParams()
29 : {
30 229886 : InputParameters params = MooseObject::validParams();
31 229886 : params += TransientInterface::validParams();
32 229886 : params += BoundaryRestrictableRequired::validParams();
33 229886 : params += TaggingInterface::validParams();
34 229886 : params += ADFunctorInterface::validParams();
35 :
36 229886 : params.addRequiredParam<NonlinearVariableName>(
37 : "variable", "The name of the variable that this boundary condition applies to");
38 689658 : params.addParam<bool>("use_displaced_mesh",
39 459772 : 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 229886 : params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
47 229886 : params.addCoupledVar("displacements", "The displacements");
48 229886 : params.declareControllable("enable");
49 229886 : params.registerBase("FVBoundaryCondition");
50 229886 : return params;
51 0 : }
52 :
53 8113 : FVBoundaryCondition::FVBoundaryCondition(const InputParameters & parameters)
54 : : MooseObject(parameters),
55 : BoundaryRestrictableRequired(this, false),
56 : SetupInterface(this),
57 : FunctionInterface(this),
58 : DistributionInterface(this),
59 : UserObjectInterface(this),
60 : TransientInterface(this),
61 : PostprocessorInterface(this),
62 : VectorPostprocessorInterface(this),
63 : GeometricSearchInterface(this),
64 : MeshChangedInterface(parameters),
65 : TaggingInterface(this),
66 : MooseVariableInterface<Real>(this,
67 : false,
68 : "variable",
69 : Moose::VarKindType::VAR_ANY,
70 : Moose::VarFieldType::VAR_FIELD_STANDARD),
71 : MooseVariableDependencyInterface(this),
72 : ADFunctorInterface(this),
73 16226 : _var(*mooseVariableFV()),
74 8113 : _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
75 8113 : _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
76 8113 : _sys(changeSystem(parameters, _var)),
77 8113 : _tid(parameters.get<THREAD_ID>("_tid")),
78 8113 : _assembly(_subproblem.assembly(_tid, _var.kind() == Moose::VAR_SOLVER ? _sys.number() : 0)),
79 16226 : _mesh(_subproblem.mesh())
80 : {
81 8113 : _subproblem.haveADObjects(true);
82 8113 : addMooseVariableDependency(&_var);
83 8113 : }
84 :
85 : Moose::FaceArg
86 757206 : FVBoundaryCondition::singleSidedFaceArg(const FaceInfo * fi,
87 : const Moose::FV::LimiterType limiter_type,
88 : const bool correct_skewness,
89 : const Moose::StateArg * state_limiter) const
90 : {
91 757206 : if (!fi)
92 737104 : fi = _face_info;
93 :
94 757206 : return makeFace(*fi, limiter_type, true, correct_skewness, state_limiter);
95 : }
96 :
97 : bool
98 1514772 : FVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const
99 : {
100 1514772 : const auto ft = fi.faceType(std::make_pair(_var.number(), _var.sys().number()));
101 1514772 : if (fi_elem_side)
102 757386 : return ft == FaceInfo::VarFaceNeighbors::ELEM || ft == FaceInfo::VarFaceNeighbors::BOTH;
103 : else
104 757386 : return ft == FaceInfo::VarFaceNeighbors::NEIGHBOR || ft == FaceInfo::VarFaceNeighbors::BOTH;
105 : }
|