forked from idaholab/moose
/
InterfaceKernelBase.C
122 lines (109 loc) · 5.07 KB
/
InterfaceKernelBase.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//* 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 "InterfaceKernelBase.h"
// MOOSE includes
#include "Assembly.h"
#include "MooseVariableFE.h"
#include "SystemBase.h"
#include "libmesh/quadrature.h"
template <>
InputParameters
validParams<InterfaceKernelBase>()
{
InputParameters params = validParams<MooseObject>();
params += validParams<TransientInterface>();
params += validParams<BoundaryRestrictable>();
params += validParams<MeshChangedInterface>();
params += validParams<TaggingInterface>();
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.declareControllable("enable");
params.addRequiredCoupledVar("neighbor_var", "The variable on the other side of the interface.");
params.set<std::string>("_moose_base") = "InterfaceKernel";
params.addParam<std::vector<AuxVariableName>>(
"save_in",
"The name of auxiliary variables to save this Kernel's residual contributions to. "
" Everything about that variable must match everything about this variable (the "
"type, what blocks it's on, etc.)");
params.addParam<std::vector<AuxVariableName>>(
"diag_save_in",
"The name of auxiliary variables to save this Kernel's diagonal Jacobian "
"contributions to. Everything about that variable must match everything "
"about this variable (the type, what blocks it's on, etc.)");
MultiMooseEnum save_in_var_side("m s");
params.addParam<MultiMooseEnum>(
"save_in_var_side",
save_in_var_side,
"This parameter must exist if save_in variables are specified and must have the same length "
"as save_in. This vector specifies whether the corresponding aux_var should save-in "
"residual contributions from the master ('m') or slave side ('s').");
params.addParam<MultiMooseEnum>(
"diag_save_in_var_side",
save_in_var_side,
"This parameter must exist if diag_save_in variables are specified and must have the same "
"length as diag_save_in. This vector specifies whether the corresponding aux_var should "
"save-in jacobian contributions from the master ('m') or slave side ('s').");
// Need one layer of ghosting
params.addRelationshipManager("ElementSideNeighborLayers",
Moose::RelationshipManagerType::GEOMETRIC |
Moose::RelationshipManagerType::ALGEBRAIC |
Moose::RelationshipManagerType::COUPLING);
return params;
}
// Static mutex definitions
Threads::spin_mutex InterfaceKernelBase::_resid_vars_mutex;
Threads::spin_mutex InterfaceKernelBase::_jacoby_vars_mutex;
InterfaceKernelBase::InterfaceKernelBase(const InputParameters & parameters)
: MooseObject(parameters),
BoundaryRestrictable(this, false), // false for _not_ nodal
SetupInterface(this),
TransientInterface(this),
FunctionInterface(this),
UserObjectInterface(this),
PostprocessorInterface(this),
NeighborCoupleableMooseVariableDependencyIntermediateInterface(this, false, false),
Restartable(this, "InterfaceKernels"),
MeshChangedInterface(parameters),
TwoMaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, boundaryIDs()),
TaggingInterface(this),
_subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
_sys(*getCheckedPointerParam<SystemBase *>("_sys")),
_tid(parameters.get<THREAD_ID>("_tid")),
_assembly(_subproblem.assembly(_tid)),
_mesh(_subproblem.mesh()),
_current_elem(_assembly.elem()),
_current_elem_volume(_assembly.elemVolume()),
_neighbor_elem(_assembly.neighbor()),
_current_side(_assembly.side()),
_current_side_elem(_assembly.sideElem()),
_current_side_volume(_assembly.sideElemVolume()),
_coord_sys(_assembly.coordSystem()),
_q_point(_assembly.qPointsFace()),
_qrule(_assembly.qRuleFace()),
_JxW(_assembly.JxWFace()),
_coord(_assembly.coordTransformation()),
_save_in_var_side(parameters.get<MultiMooseEnum>("save_in_var_side")),
_save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")),
_diag_save_in_var_side(parameters.get<MultiMooseEnum>("diag_save_in_var_side")),
_diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in"))
{
}
const Real &
InterfaceKernelBase::getNeighborElemVolume()
{
return _assembly.neighborVolume();
}