HARM
harm and utilities
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
boundsint.c
Go to the documentation of this file.
1
11
#include "decs.h"
12
13
14
// needed as global so all subfunctions have it set
15
int
inboundloop
[
NDIM
];
16
int
outboundloop
[
NDIM
];
17
int
innormalloop
[
NDIM
];
18
int
outnormalloop
[
NDIM
];
19
int
inoutlohi
[
NUMUPDOWN
][
NUMUPDOWN
][
NDIM
];
20
int
riin
,
riout
,
rjin
,
rjout
,
rkin
,
rkout
;
21
int
dosetbc
[
COMPDIM
*2];
22
24
int
bound_pflag_user(
int
boundstage,
int
finalstep,
SFTYPE
boundtime,
int
boundvartype,
PFTYPE
(*prim)[
NSTORE2
][
NSTORE3
][
NUMPFLAGS
])
25
{
26
int
i
,
j
,k,pl,pliter;
27
int
failreturn;
28
int
ri, rj, rk;
// reference i,j,k
29
30
// includes all conditions from global.h except NSSURFACE and FIXED
31
32
// OUTFLOW: direct copy here since value is discrete and has discrete meaning
33
// that is, properties are just copied.
34
35
/* if fixed BC: do nothing */
36
// GODMARK: no, since doing multi-steps, one should assign some fixed primitive to prim, as done for real primitives
37
// general assume flag doesn't care about FIXED, since represents a failure. One's own FIXED conditions shouldn't fail.
38
40
//
41
// set bound loop
42
//
44
set_boundloop(boundvartype,
inboundloop
,
outboundloop
,
innormalloop
,
outnormalloop
,
inoutlohi
, &
riin
, &
riout
, &
rjin
, &
rjout
, &
rkin
, &
rkout
,
dosetbc
);
45
46
48
//
49
// PERIODIC
50
//
52
53
// periodic x1
54
if
( (
mycpupos
[1] == 0)&&(
mycpupos
[1] ==
ncpux1
- 1) ) {
55
if
( (
BCtype
[
X1DN
]==
PERIODIC
)&&(
BCtype
[
X1UP
]==
PERIODIC
) ){
56
// just copy from one side to another
57
58
LOOPX1dir
{
59
60
// copy from upper side to lower boundary zones
61
ri=
riout
;
62
rj=
j
;
63
rk=k;
64
LOOPBOUND1IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri+1+i,rj,rk,pl);
65
66
// copy from lower side to upper boundary zones
67
ri=
riin
;
68
rj=
j
;
69
rk=k;
70
LOOPBOUND1OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri+(i-
N1
),rj,rk,pl);
71
}
72
}
73
}
74
75
// periodic x2
76
if
( (
mycpupos
[2] == 0)&&(
mycpupos
[2] ==
ncpux2
- 1) ) {
77
if
( (
BCtype
[
X2DN
]==
PERIODIC
)&&(
BCtype
[
X2UP
]==
PERIODIC
) ){
78
// just copy from one side to another
79
80
LOOPX2dir
{
81
82
// copy from upper side to lower boundary zones
83
ri=
i
;
84
rj=
rjout
;
85
rk=k;
86
LOOPBOUND2IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj+1+j,rk,pl);
87
88
// copy from lower side to upper boundary zones
89
ri=
i
;
90
rj=
rjin
;
91
rk=k;
92
LOOPBOUND2OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj+(j-
N2
),rk,pl);
93
}
94
}
95
}
96
97
// periodic x3
98
if
( (
mycpupos
[3] == 0)&&(
mycpupos
[3] ==
ncpux3
- 1) ) {
99
if
( (
BCtype
[
X3DN
]==
PERIODIC
)&&(
BCtype
[
X3UP
]==
PERIODIC
) ){
100
// just copy from one side to another
101
102
LOOPX3dir
{
103
104
// copy from upper side to lower boundary zones
105
ri=
i
;
106
rj=
j
;
107
rk=
rkout
;
108
LOOPBOUND3IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk+1+k,pl);
109
110
// copy from lower side to upper boundary zones
111
ri=
i
;
112
rj=
j
;
113
rk=
rkin
;
114
LOOPBOUND3OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk+(k-
N3
),pl);
115
}
116
}
117
}
118
120
//
121
// OUTFLOW/FIXEDOUTFLOW (for events, just copy)
122
//
124
125
126
// outflow inner x1
127
if
(
mycpupos
[1] == 0) {
128
if
( ((
BCtype
[
X1DN
]==
OUTFLOW
||
BCtype
[
X1DN
]==
HORIZONOUTFLOW
))||(
BCtype
[
X1DN
]==
FIXEDOUTFLOW
)||(
BCtype
[
X1DN
]==
OUTFLOWNOINFLOW
) ){
129
/* inner r boundary condition: u, just copy */
130
LOOPX1dir
{
131
ri=
riin
;
132
rj=
j
;
133
rk=k;
134
LOOPBOUND1IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk,pl);
135
}
136
}
137
}
138
139
// outflow outer x1
140
if
(
mycpupos
[1] ==
ncpux1
- 1) {
141
if
( ((
BCtype
[
X1UP
]==
OUTFLOW
||
BCtype
[
X1UP
]==
HORIZONOUTFLOW
))||(
BCtype
[
X1UP
]==
FIXEDOUTFLOW
)||(
BCtype
[
X1UP
]==
OUTFLOWNOINFLOW
) ){
142
/* outer r BC: outflow */
143
LOOPX1dir
{
144
ri=
riout
;
145
rj=
j
;
146
rk=k;
147
LOOPBOUND1OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk,pl);
148
}
149
}
150
}
151
152
// outflow inner x2
153
if
(
mycpupos
[2] == 0) {
154
if
( ((
BCtype
[
X2DN
]==
OUTFLOW
||
BCtype
[
X2DN
]==
HORIZONOUTFLOW
))||(
BCtype
[
X2DN
]==
FIXEDOUTFLOW
)||(
BCtype
[
X2DN
]==
OUTFLOWNOINFLOW
) ){
155
/* inner r boundary condition: u, just copy */
156
LOOPX2dir
{
157
ri=
i
;
158
rj=
rjin
;
159
rk=k;
160
LOOPBOUND2IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk,pl);
161
}
162
}
163
}
164
165
// outflow outer x2
166
if
(
mycpupos
[2] ==
ncpux2
- 1) {
167
if
( ((
BCtype
[
X2UP
]==
OUTFLOW
||
BCtype
[
X2UP
]==
HORIZONOUTFLOW
))||(
BCtype
[
X2UP
]==
FIXEDOUTFLOW
)||(
BCtype
[
X2UP
]==
OUTFLOWNOINFLOW
) ){
168
/* outer r BC: outflow */
169
LOOPX2dir
{
170
ri=
i
;
171
rj=
rjout
;
172
rk=k;
173
LOOPBOUND2OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk,pl);
174
}
175
}
176
}
177
178
// outflow inner x3
179
if
(
mycpupos
[3] == 0) {
180
if
( ((
BCtype
[
X3DN
]==
OUTFLOW
||
BCtype
[
X3DN
]==
HORIZONOUTFLOW
))||(
BCtype
[
X3DN
]==
FIXEDOUTFLOW
)||(
BCtype
[
X3DN
]==
OUTFLOWNOINFLOW
) ){
181
/* inner r boundary condition: u, just copy */
182
LOOPX3dir
{
183
ri=
i
;
184
rj=
j
;
185
rk=
rkin
;
186
LOOPBOUND3IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk,pl);
187
}
188
}
189
}
190
191
// outflow outer x3
192
if
(
mycpupos
[3] ==
ncpux3
- 1) {
193
if
( ((
BCtype
[
X3UP
]==
OUTFLOW
||
BCtype
[
X3UP
]==
HORIZONOUTFLOW
))||(
BCtype
[
X3UP
]==
FIXEDOUTFLOW
)||(
BCtype
[
X3UP
]==
OUTFLOWNOINFLOW
) ){
194
/* outer r BC: outflow */
195
LOOPX3dir
{
196
ri=
i
;
197
rj=
j
;
198
rk=
rkout
;
199
LOOPBOUND3OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk,pl);
200
}
201
}
202
}
203
204
206
//
207
// POLARAXIS/SYMM/ASYMM (for events (not values) these are the same)
208
//
210
211
212
// symmetry on inner x1
213
if
(
mycpupos
[1] == 0) {
214
if
( (
BCtype
[
X1DN
]==
R0SING
)||(
BCtype
[
X1DN
]==
POLARAXIS
)||(
BCtype
[
X1DN
]==
SYMM
)||(
BCtype
[
X1DN
]==
ASYMM
)) {
215
LOOPX1dir
{
216
ri=
riin
;
217
rj=
j
;
218
rk=k;
219
// symmetric copy
220
LOOPBOUND1IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri+(ri-i-1),rj,rk,pl);
221
}
222
}
223
}
224
225
// symmetry on outer x1
226
if
(
mycpupos
[1] ==
ncpux1
- 1) {
227
if
( (
BCtype
[
X1UP
]==
R0SING
)||(
BCtype
[
X1UP
]==
POLARAXIS
)||(
BCtype
[
X1UP
]==
SYMM
)||(
BCtype
[
X1UP
]==
ASYMM
)) {
228
LOOPX1dir
{
229
ri=
riout
;
230
rj=
j
;
231
rk=k;
232
LOOPBOUND1OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri+(ri-i+1),rj,rk,pl);
233
}
234
}
235
}
236
237
238
// symmetry on inner x2
239
if
(
mycpupos
[2] == 0) {
240
if
( (
BCtype
[
X2DN
]==
R0SING
)||(
BCtype
[
X2DN
]==
POLARAXIS
)||(
BCtype
[
X2DN
]==
SYMM
)||(
BCtype
[
X2DN
]==
ASYMM
)) {
241
LOOPX2dir
{
242
ri=
i
;
243
rj=
rjin
;
244
rk=k;
245
// symmetric copy
246
LOOPBOUND2IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj+(rj-j-1),rk,pl);
247
}
248
}
249
}
250
251
// symmetry on outer x2
252
if
(
mycpupos
[2] ==
ncpux2
- 1) {
253
if
( (
BCtype
[
X2UP
]==
R0SING
)||(
BCtype
[
X2UP
]==
POLARAXIS
)||(
BCtype
[
X2UP
]==
SYMM
)||(
BCtype
[
X2UP
]==
ASYMM
)) {
254
LOOPX2dir
{
255
ri=
i
;
256
rj=
rjout
;
257
rk=k;
258
LOOPBOUND2OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj+(rj-j+1),rk,pl);
259
}
260
}
261
}
262
263
// symmetry on inner x3
264
if
(
mycpupos
[3] == 0) {
265
if
( (
BCtype
[
X3DN
]==
R0SING
)||(
BCtype
[
X3DN
]==
POLARAXIS
)||(
BCtype
[
X3DN
]==
SYMM
)||(
BCtype
[
X3DN
]==
ASYMM
)) {
266
LOOPX3dir
{
267
ri=
i
;
268
rj=
j
;
269
rk=
rkin
;
270
// symmetric copy
271
LOOPBOUND3IN
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk+(rk-k-1),pl);
272
}
273
}
274
}
275
276
// symmetry on outer x3
277
if
(
mycpupos
[3] ==
ncpux3
- 1) {
278
if
( (
BCtype
[
X3UP
]==
R0SING
)||(
BCtype
[
X3UP
]==
POLARAXIS
)||(
BCtype
[
X3UP
]==
SYMM
)||(
BCtype
[
X3UP
]==
ASYMM
)) {
279
LOOPX3dir
{
280
ri=
i
;
281
rj=
j
;
282
rk=
rkout
;
283
LOOPBOUND3OUT
FBOUNDLOOP
(pl)
MACP0A1
(prim,i,j,k,pl) =
MACP0A1
(prim,ri,rj,rk+(rk-k+1),pl);
284
}
285
}
286
}
287
288
289
290
return
(0);
291
}
Generated on Fri May 20 2016 15:52:32 for HARM by
1.8.3.1