-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboundary_wrapper.cpp
executable file
·147 lines (146 loc) · 7.04 KB
/
boundary_wrapper.cpp
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include <vector>
#include "type.h"
#include "flowfield.h"
#include "flowfield_host_device.h"
#include "boundary.h"
#include "model.h"
#include "boundary_host_device.h"
#include "scheme.h"
#include "ops_seq_v2.h"
#include "boundary_kernel.inc"
#ifdef OPS_3D
void TreatBlockBoundary3D(const Block& block, const int componentID,
const Real* givenVars,
const BoundaryScheme boundaryScheme,
const BoundarySurface boundarySurface) {
const int surface{(int)boundarySurface};
const int blockIndex{block.ID()};
std::vector<int> range(2 * SpaceDim());
range.assign(block.BoundarySurfaceRange().at(boundarySurface).begin(),
block.BoundarySurfaceRange().at(boundarySurface).end());
switch (boundaryScheme) {
case BoundaryScheme::ExtrapolPressure1ST: {
ops_par_loop(
KerCutCellExtrapolPressure1ST3D,
"KerCutCellExtrapolPressure1ST3D", block.Get(), SpaceDim(),
range.data(),
ops_arg_dat(g_f()[blockIndex], NUMXI, ONEPTREGULARSTENCIL,
"double", OPS_RW),
ops_arg_dat(g_NodeType().at(componentID).at(blockIndex), 1,
ONEPTREGULARSTENCIL, "int", OPS_READ),
ops_arg_dat(g_GeometryProperty()[blockIndex], 1, LOCALSTENCIL,
"int", OPS_READ),
ops_arg_gbl(givenVars, 1, "double", OPS_READ),
ops_arg_gbl(&surface, 1, "int", OPS_READ),
ops_arg_gbl(g_Components().at(componentID).index, 2, "int",
OPS_READ));
} break;
case BoundaryScheme::EQMDiffuseRefl: {
ops_par_loop(
KerCutCellEQMDiffuseRefl3D, "KerCutCellEQMDiffuseRefl3D",
block.Get(), SpaceDim(), range.data(),
ops_arg_dat(g_f()[blockIndex], NUMXI, LOCALSTENCIL, "double",
OPS_RW),
ops_arg_dat(g_NodeType().at(componentID).at(blockIndex), 1,
LOCALSTENCIL, "int", OPS_READ),
ops_arg_dat(g_GeometryProperty()[blockIndex], 1, LOCALSTENCIL,
"int", OPS_READ),
ops_arg_gbl(givenVars, 3, "double", OPS_READ),
ops_arg_gbl(g_Components().at(componentID).index, 2, "int",
OPS_READ));
} break;
case BoundaryScheme::FDPeriodic: {
ops_par_loop(
KerCutCellPeriodic3D, "KerCutCellPeriodic3D", block.Get(),
SpaceDim(), range.data(),
ops_arg_dat(g_f()[blockIndex], NUMXI, LOCALSTENCIL, "double",
OPS_RW),
ops_arg_dat(g_NodeType().at(componentID).at(blockIndex), 1,
LOCALSTENCIL, "int", OPS_READ),
ops_arg_dat(g_GeometryProperty()[blockIndex], 1, LOCALSTENCIL,
"int", OPS_READ),
ops_arg_gbl(g_Components().at(componentID).index, 2, "int",
OPS_READ),
ops_arg_gbl(&surface, 1, "int", OPS_READ));
} break;
case BoundaryScheme::BounceBack: {
ops_par_loop(
KerBounceBack3D, "KerBounceBack3D", block.Get(),
SpaceDim(), range.data(),
ops_arg_dat(g_f()[blockIndex], NUMXI, LOCALSTENCIL, "double",
OPS_RW),
ops_arg_dat(g_fStage()[blockIndex], NUMXI, LOCALSTENCIL, "double",
OPS_READ),
ops_arg_dat(g_NodeType().at(componentID).at(blockIndex), 1,
ONEPTLATTICESTENCIL, "int", OPS_READ),
ops_arg_dat(g_GeometryProperty()[blockIndex], 1, LOCALSTENCIL,
"int", OPS_READ),
ops_arg_gbl(g_Components().at(componentID).index, 2, "int",
OPS_READ),
ops_arg_gbl(&surface, 1, "int", OPS_READ));
} break;
default:
break;
}
}
#endif //OPS_3D
#ifdef OPS_2D
void TreatBlockBoundary(const Block& block, const int componentID,
const Real* givenVars,
const BoundaryScheme boundaryScheme,
const BoundarySurface boundarySurface) {
const int surface{(int)boundarySurface};
const int blockIndex{block.ID()};
std::vector<int> range(2 * SpaceDim());
range.assign(block.BoundarySurfaceRange().at(boundarySurface).begin(),
block.BoundarySurfaceRange().at(boundarySurface).end());
switch (boundaryScheme) {
case BoundaryScheme::ExtrapolPressure1ST: {
ops_par_loop(
KerCutCellExtrapolPressure1ST,
"KerCutCellExtrapolPressure1ST", block.Get(), SpaceDim(),
range.data(),
ops_arg_dat(g_f()[blockIndex], NUMXI, ONEPTREGULARSTENCIL,
"double", OPS_RW),
ops_arg_dat(g_NodeType().at(componentID).at(blockIndex), 1,
ONEPTREGULARSTENCIL, "int", OPS_READ),
ops_arg_dat(g_GeometryProperty()[blockIndex], 1, LOCALSTENCIL,
"int", OPS_READ),
ops_arg_gbl(givenVars, 1, "double", OPS_READ),
ops_arg_gbl(&surface, 1, "int", OPS_READ),
ops_arg_gbl(g_Components().at(componentID).index, 2, "int",
OPS_READ));
} break;
case BoundaryScheme::EQMDiffuseRefl: {
ops_par_loop(
KerCutCellEQMDiffuseRefl, "KerCutCellEQMDiffuseRefl",
block.Get(), SpaceDim(), range.data(),
ops_arg_dat(g_f()[blockIndex], NUMXI, LOCALSTENCIL, "double",
OPS_RW),
ops_arg_dat(g_NodeType().at(componentID).at(blockIndex), 1,
LOCALSTENCIL, "int", OPS_READ),
ops_arg_dat(g_GeometryProperty()[blockIndex], 1, LOCALSTENCIL,
"int", OPS_READ),
ops_arg_gbl(givenVars, 2, "double", OPS_READ),
ops_arg_gbl(g_Components().at(componentID).index, 2, "int",
OPS_READ));
} break;
case BoundaryScheme::FDPeriodic: {
ops_par_loop(
KerCutCellPeriodic, "KerCutCellPeriodic", block.Get(),
SpaceDim(), range.data(),
ops_arg_dat(g_f()[blockIndex], NUMXI, LOCALSTENCIL, "double",
OPS_RW),
ops_arg_dat(g_NodeType().at(componentID).at(blockIndex), 1,
LOCALSTENCIL, "int", OPS_READ),
ops_arg_dat(g_GeometryProperty()[blockIndex], 1, LOCALSTENCIL,
"int", OPS_READ),
ops_arg_gbl(g_Components().at(componentID).index, 2, "int",
OPS_READ),
ops_arg_gbl(&surface, 1, "int", OPS_READ));
} break;
default:
break;
}
}
#endif //OPS_2D