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 7751 : changeSystem(const InputParameters & params_in, MooseVariableFV<Real> & fv_var)
19 : {
20 7751 : SystemBase & var_sys = fv_var.sys();
21 7751 : auto & params = const_cast<InputParameters &>(params_in);
22 7751 : params.set<SystemBase *>("_sys") = &var_sys;
23 7751 : return var_sys;
24 : }
25 : }
26 :
27 : InputParameters
28 229163 : FVBoundaryCondition::validParams()
29 : {
30 229163 : InputParameters params = MooseObject::validParams();
31 229163 : params += TransientInterface::validParams();
32 229163 : params += BoundaryRestrictableRequired::validParams();
33 229163 : params += TaggingInterface::validParams();
34 229163 : params += ADFunctorInterface::validParams();
35 :
36 229163 : params.addRequiredParam<NonlinearVariableName>(
37 : "variable", "The name of the variable that this boundary condition applies to");
38 687489 : params.addParam<bool>("use_displaced_mesh",
39 458326 : 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 229163 : params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
47 229163 : params.addCoupledVar("displacements", "The displacements");
48 229163 : params.declareControllable("enable");
49 229163 : params.registerBase("FVBoundaryCondition");
50 229163 : return params;
51 0 : }
52 :
53 7751 : 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 15502 : _var(*mooseVariableFV()),
74 7751 : _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
75 7751 : _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
76 7751 : _sys(changeSystem(parameters, _var)),
77 7751 : _tid(parameters.get<THREAD_ID>("_tid")),
78 7751 : _assembly(_subproblem.assembly(_tid, _var.kind() == Moose::VAR_SOLVER ? _sys.number() : 0)),
79 15502 : _mesh(_subproblem.mesh())
80 : {
81 7751 : _subproblem.haveADObjects(true);
82 7751 : addMooseVariableDependency(&_var);
83 7751 : }
84 :
85 : Moose::FaceArg
86 674157 : 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 674157 : if (!fi)
92 666155 : fi = _face_info;
93 :
94 674157 : return makeFace(*fi, limiter_type, true, correct_skewness, state_limiter);
95 : }
96 :
97 : bool
98 1348634 : FVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const
99 : {
100 1348634 : const auto ft = fi.faceType(std::make_pair(_var.number(), _var.sys().number()));
101 1348634 : if (fi_elem_side)
102 674317 : return ft == FaceInfo::VarFaceNeighbors::ELEM || ft == FaceInfo::VarFaceNeighbors::BOTH;
103 : else
104 674317 : return ft == FaceInfo::VarFaceNeighbors::NEIGHBOR || ft == FaceInfo::VarFaceNeighbors::BOTH;
105 : }
|