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 8195 : changeSystem(const InputParameters & params_in, MooseVariableFV<Real> & fv_var)
19 : {
20 8195 : SystemBase & var_sys = fv_var.sys();
21 8195 : auto & params = const_cast<InputParameters &>(params_in);
22 16390 : params.set<SystemBase *>("_sys") = &var_sys;
23 8195 : return var_sys;
24 : }
25 : }
26 :
27 : InputParameters
28 239068 : FVBoundaryCondition::validParams()
29 : {
30 239068 : InputParameters params = MooseObject::validParams();
31 239068 : params += TransientInterface::validParams();
32 239068 : params += BoundaryRestrictableRequired::validParams();
33 239068 : params += TaggingInterface::validParams();
34 239068 : params += ADFunctorInterface::validParams();
35 239068 : params += GeometricSearchInterface::validParams();
36 :
37 956272 : params.addRequiredParam<NonlinearVariableName>(
38 : "variable", "The name of the variable that this boundary condition applies to");
39 717204 : params.addParam<bool>("use_displaced_mesh",
40 478136 : false,
41 : "Whether or not this object should use the "
42 : "displaced mesh for computation. Note that "
43 : "in the case this is true but no "
44 : "displacements are provided in the Mesh block "
45 : "the undisplaced mesh will still be used.");
46 :
47 956272 : params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
48 717204 : params.addCoupledVar("displacements", "The displacements");
49 717204 : params.declareControllable("enable");
50 239068 : params.registerBase("FVBoundaryCondition");
51 239068 : return params;
52 0 : }
53 :
54 8195 : FVBoundaryCondition::FVBoundaryCondition(const InputParameters & parameters)
55 : : MooseObject(parameters),
56 : BoundaryRestrictableRequired(this, false),
57 : SetupInterface(this),
58 : FunctionInterface(this),
59 : DistributionInterface(this),
60 : UserObjectInterface(this),
61 : TransientInterface(this),
62 : PostprocessorInterface(this),
63 : VectorPostprocessorInterface(this),
64 : GeometricSearchInterface(this),
65 : MeshChangedInterface(parameters),
66 : TaggingInterface(this),
67 : MooseVariableInterface<Real>(this,
68 : false,
69 : "variable",
70 : Moose::VarKindType::VAR_ANY,
71 : Moose::VarFieldType::VAR_FIELD_STANDARD),
72 : MooseVariableDependencyInterface(this),
73 : ADFunctorInterface(this),
74 16390 : _var(*mooseVariableFV()),
75 32780 : _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
76 32780 : _fv_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
77 8195 : _sys(changeSystem(parameters, _var)),
78 8195 : _tid(parameters.get<THREAD_ID>("_tid")),
79 8195 : _assembly(_subproblem.assembly(_tid, _var.kind() == Moose::VAR_SOLVER ? _sys.number() : 0)),
80 32780 : _mesh(_subproblem.mesh())
81 : {
82 8195 : _subproblem.haveADObjects(true);
83 8195 : addMooseVariableDependency(&_var);
84 8195 : }
85 :
86 : Moose::FaceArg
87 762930 : FVBoundaryCondition::singleSidedFaceArg(const FaceInfo * fi,
88 : const Moose::FV::LimiterType limiter_type,
89 : const bool correct_skewness,
90 : const Moose::StateArg * state_limiter) const
91 : {
92 762930 : if (!fi)
93 739804 : fi = _face_info;
94 :
95 762930 : return makeFace(*fi, limiter_type, true, correct_skewness, state_limiter);
96 : }
97 :
98 : bool
99 1526220 : FVBoundaryCondition::hasFaceSide(const FaceInfo & fi, bool fi_elem_side) const
100 : {
101 1526220 : const auto ft = fi.faceType(std::make_pair(_var.number(), _var.sys().number()));
102 1526220 : if (fi_elem_side)
103 763110 : return ft == FaceInfo::VarFaceNeighbors::ELEM || ft == FaceInfo::VarFaceNeighbors::BOTH;
104 : else
105 763110 : return ft == FaceInfo::VarFaceNeighbors::NEIGHBOR || ft == FaceInfo::VarFaceNeighbors::BOTH;
106 : }
|