forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FVBoundaryCondition.C
99 lines (90 loc) · 3.6 KB
/
FVBoundaryCondition.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#include "FVBoundaryCondition.h"
#include "Problem.h"
#include "SystemBase.h"
#include "MooseVariableFV.h"
namespace
{
SystemBase &
changeSystem(const InputParameters & params_in, MooseVariableFV<Real> & fv_var)
{
SystemBase & var_sys = fv_var.sys();
auto & params = const_cast<InputParameters &>(params_in);
params.set<SystemBase *>("_sys") = &var_sys;
return var_sys;
}
}
InputParameters
FVBoundaryCondition::validParams()
{
InputParameters params = MooseObject::validParams();
params += TransientInterface::validParams();
params += BoundaryRestrictableRequired::validParams();
params += TaggingInterface::validParams();
params += FunctorInterface::validParams();
params.addRequiredParam<NonlinearVariableName>(
"variable", "The name of the variable that this boundary condition applies to");
params.addParam<bool>("use_displaced_mesh",
false,
"Whether or not this object should use the "
"displaced mesh for computation. Note that "
"in the case this is true but no "
"displacements are provided in the Mesh block "
"the undisplaced mesh will still be used.");
params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
params.addCoupledVar("displacements", "The displacements");
params.declareControllable("enable");
params.registerBase("FVBoundaryCondition");
return params;
}
FVBoundaryCondition::FVBoundaryCondition(const InputParameters & parameters)
: MooseObject(parameters),
BoundaryRestrictableRequired(this, false),
SetupInterface(this),
FunctionInterface(this),
DistributionInterface(this),
UserObjectInterface(this),
TransientInterface(this),
PostprocessorInterface(this),
VectorPostprocessorInterface(this),
GeometricSearchInterface(this),
MeshChangedInterface(parameters),
TaggingInterface(this),
MooseVariableInterface<Real>(this,
false,
"variable",
Moose::VarKindType::VAR_ANY,
Moose::VarFieldType::VAR_FIELD_STANDARD),
MooseVariableDependencyInterface(this),
FunctorInterface(this),
_var(*mooseVariableFV()),
_subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
_fv_problem(*getCheckedPointerParam<FVProblemBase *>("_fe_problem_base")),
_sys(changeSystem(parameters, _var)),
_tid(parameters.get<THREAD_ID>("_tid")),
_assembly(_subproblem.assembly(_tid)),
_mesh(_subproblem.mesh())
{
_subproblem.haveADObjects(true);
addMooseVariableDependency(&_var);
if (getParam<bool>("use_displaced_mesh"))
paramError("use_displaced_mesh", "FV boundary conditions do not yet support displaced mesh");
}
Moose::SingleSidedFaceArg
FVBoundaryCondition::singleSidedFaceArg(const FaceInfo * fi,
const Moose::FV::LimiterType limiter_type,
const bool correct_skewness) const
{
if (!fi)
fi = _face_info;
const bool use_elem = fi->faceType(_var.name()) == FaceInfo::VarFaceNeighbors::ELEM;
const auto sub_id = use_elem ? fi->elem().subdomain_id() : fi->neighborPtr()->subdomain_id();
return {fi, limiter_type, true, correct_skewness, sub_id};
}