forked from UK-MAC/CloverLeaf_OpenACC_3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvec_mom_kernel.f90
487 lines (443 loc) · 18.3 KB
/
advec_mom_kernel.f90
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
!Crown Copyright 2012 AWE.
!
! This file is part of CloverLeaf.
!
! CloverLeaf is free software: you can redistribute it and/or modify it under
! the terms of the GNU General Public License as published by the
! Free Software Foundation, either version 3 of the License, or (at your option)
! any later version.
!
! CloverLeaf is distributed in the hope that it will be useful, but
! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
! FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
! details.
!
! You should have received a copy of the GNU General Public License along with
! CloverLeaf. If not, see http://www.gnu.org/licenses/.
!> @brief Fortran momentum advection kernel
!> @author Wayne Gaudin
!> @details Performs a second order advective remap on the vertex momentum
!> using van-Leer limiting and directional splitting.
!> Note that although pre_vol is only set and not used in the update, please
!> leave it in the method.
MODULE advec_mom_kernel_mod
CONTAINS
SUBROUTINE advec_mom_kernel(x_min,x_max,y_min,y_max,z_min,z_max, &
xvel1, &
yvel1, &
zvel1, &
mass_flux_x, &
vol_flux_x, &
mass_flux_y, &
vol_flux_y, &
mass_flux_z, &
vol_flux_z, &
volume, &
density1, &
node_flux, &
node_mass_post, &
node_mass_pre, &
advec_vel, &
mom_flux, &
pre_vol, &
post_vol, &
celldx, &
celldy, &
celldz, &
advect_x, &
which_vel, &
sweep_number, &
direction )
IMPLICIT NONE
INTEGER :: x_min,x_max,y_min,y_max,z_min,z_max
INTEGER :: which_vel,sweep_number,direction
LOGICAL :: advect_x
REAL(KIND=8), TARGET,DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: xvel1,yvel1,zvel1
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+2,z_min-2:z_max+2) :: mass_flux_x
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+2,z_min-2:z_max+2) :: vol_flux_x
REAL(KIND=8), DIMENSION(x_min-2:x_max+2,y_min-2:y_max+3,z_min-2:z_max+2) :: mass_flux_y
REAL(KIND=8), DIMENSION(x_min-2:x_max+2,y_min-2:y_max+3,z_min-2:z_max+2) :: vol_flux_y
REAL(KIND=8), DIMENSION(x_min-2:x_max+2,y_min-2:y_max+2,z_min-2:z_max+3) :: mass_flux_z
REAL(KIND=8), DIMENSION(x_min-2:x_max+2,y_min-2:y_max+2,z_min-2:z_max+3) :: vol_flux_z
REAL(KIND=8), DIMENSION(x_min-2:x_max+2,y_min-2:y_max+2,z_min-2:z_max+2) :: volume
REAL(KIND=8), DIMENSION(x_min-2:x_max+2,y_min-2:y_max+2,z_min-2:z_max+2) :: density1
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: node_flux
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: node_mass_post
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: node_mass_pre
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: advec_vel
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: mom_flux
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: pre_vol
REAL(KIND=8), DIMENSION(x_min-2:x_max+3,y_min-2:y_max+3,z_min-2:z_max+3) :: post_vol
REAL(KIND=8), DIMENSION(x_min-2:x_max+2) :: celldx
REAL(KIND=8), DIMENSION(y_min-2:y_max+2) :: celldy
REAL(KIND=8), DIMENSION(z_min-2:z_max+2) :: celldz
INTEGER :: j,k,l
INTEGER :: upwind,donor,downwind,dif
REAL(KIND=8) :: sigma,wind,width
REAL(KIND=8) :: vdiffuw,vdiffdw,auw,adw,limiter
REAL(KIND=8) :: vdiffuw2,vdiffdw2,auw2,limiter2
REAL(KIND=8), POINTER, DIMENSION(:,:,:) :: vel1
! Choose the correct velocity, ideally, remove this pointer
! if it affects performance.
! Leave this one in as a test of performance
IF(which_vel.EQ.1)THEN
vel1=>xvel1
ELSEIF(which_vel.EQ.2)THEN
vel1=>yvel1
ELSEIF(which_vel.EQ.3)THEN
vel1=>zvel1
ENDIF
!$ACC DATA &
!$ACC COPY(vel1) &
!$ACC PCOPY(volume,mass_flux_x,mass_flux_y,vol_flux_x,vol_flux_y,celldx,celldy,mass_flux_z,density1) &
!$ACC PCOPY(mom_flux,advec_vel,node_flux,node_mass_post,node_mass_pre,post_vol,pre_vol,celldz,vol_flux_z)
! I think these only have to be done once per cell advection sweep. So put in some logic so they are just done the first time
!$ACC KERNELS
IF(sweep_number.EQ.1.AND.direction.EQ.1)THEN ! x first
!$ACC LOOP INDEPENDENT
DO l=z_min-2,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min-2,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min-2,x_max+2
post_vol(j,k,l)= volume(j,k,l)+vol_flux_y(j ,k+1,l )-vol_flux_y(j,k,l) &
+vol_flux_z(j ,k ,l+1)-vol_flux_z(j,k,l)
pre_vol(j,k,l)=post_vol(j,k,l)+vol_flux_x(j+1,k ,l )-vol_flux_x(j,k,l)
ENDDO
ENDDO
ENDDO
ELSEIF(sweep_number.EQ.1.AND.direction.EQ.3)THEN ! z first
!$ACC LOOP INDEPENDENT
DO l=z_min-2,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min-2,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min-2,x_max+2
post_vol(j,k,l)= volume(j,k,l)+vol_flux_x(j+1,k ,l )-vol_flux_x(j,k,l) &
+vol_flux_y(j ,k+1,l )-vol_flux_y(j,k,l)
pre_vol(j,k,l)=post_vol(j,k,l)+vol_flux_z(j ,k ,l+1)-vol_flux_z(j,k,l)
ENDDO
ENDDO
ENDDO
ELSEIF(sweep_number.EQ.2.AND.advect_x)THEN ! x first
!$ACC LOOP INDEPENDENT
DO l=z_min-2,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min-2,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min-2,x_max+2
post_vol(j,k,l)=volume(j,k,l) +vol_flux_z(j ,k ,l+1)-vol_flux_z(j,k,l)
pre_vol(j,k,l)=post_vol(j,k,l)+vol_flux_y(j ,k+1,l )-vol_flux_y(j,k,l)
ENDDO
ENDDO
ENDDO
ELSEIF(sweep_number.EQ.2.AND..NOT.advect_x)THEN ! Z first
!!$ACC LOOP INDEPENDENT
DO l=z_min-2,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min-2,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min-2,x_max+2
post_vol(j,k,l)=volume(j,k,l) +vol_flux_x(j+1,k ,l )-vol_flux_x(j,k,l)
pre_vol(j,k,l)=post_vol(j,k,l)+vol_flux_y(j ,k+1,l )-vol_flux_y(j,k,l)
ENDDO
ENDDO
ENDDO
ELSEIF(sweep_number.EQ.3.AND.direction.EQ.1)THEN ! z first
!$ACC LOOP INDEPENDENT
DO l=z_min-2,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min-2,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min-2,x_max+2
post_vol(j,k,l)=volume(j,k,l)
pre_vol(j,k,l)=post_vol(j,k,l)+vol_flux_x(j+1,k ,l )-vol_flux_x(j,k,l)
ENDDO
ENDDO
ENDDO
ELSEIF(sweep_number.EQ.3.AND.direction.EQ.3)THEN ! x first
!$ACC LOOP INDEPENDENT
DO l=z_min-2,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min-2,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min-2,x_max+2
post_vol(j,k,l)=volume(j,k,l)
pre_vol(j,k,l)=post_vol(j,k,l)+vol_flux_z(j ,k ,l+1)-vol_flux_z(j,k,l)
ENDDO
ENDDO
ENDDO
ENDIF
IF(direction.EQ.1)THEN
IF(which_vel.EQ.1) THEN
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min-2,x_max+2
! Find staggered mesh mass fluxes, nodal masses and volumes.
node_flux(j,k,l)=0.125_8*(mass_flux_x(j ,k-1,l )+mass_flux_x(j ,k,l ) &
+mass_flux_x(j+1,k-1,l )+mass_flux_x(j+1,k,l ) &
+mass_flux_x(j ,k-1,l-1)+mass_flux_x(j ,k,l-1) &
+mass_flux_x(j+1,k-1,l-1)+mass_flux_x(j+1,k,l-1))
ENDDO
ENDDO
ENDDO
!And do I need to calc the node mass for all 3 directions, or just once?
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min-1,x_max+2
! Staggered cell mass post advection
node_mass_post(j,k,l)=0.125_8*(density1(j ,k-1,l )*post_vol(j ,k-1,l ) &
+density1(j ,k ,l )*post_vol(j ,k ,l ) &
+density1(j-1,k-1,l )*post_vol(j-1,k-1,l ) &
+density1(j-1,k ,l )*post_vol(j-1,k ,l ) &
+density1(j ,k-1,l-1)*post_vol(j ,k-1,l-1) &
+density1(j ,k ,l-1)*post_vol(j ,k ,l-1) &
+density1(j-1,k-1,l-1)*post_vol(j-1,k-1,l-1) &
+density1(j-1,k ,l-1)*post_vol(j-1,k ,l-1))
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min-1,x_max+2
! Staggered cell mass pre advection
node_mass_pre(j,k,l)=node_mass_post(j,k,l)-node_flux(j-1,k,l)+node_flux(j,k,l)
ENDDO
ENDDO
ENDDO
ENDIF
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT PRIVATE(upwind,downwind,donor,dif,sigma,width,limiter,vdiffuw,vdiffdw,auw,adw,wind)
DO j=x_min-1,x_max+1
IF(node_flux(j,k,l).LT.0.0)THEN
upwind=j+2
donor=j+1
downwind=j
dif=donor
ELSE
upwind=j-1
donor=j
downwind=j+1
dif=upwind
ENDIF
sigma=ABS(node_flux(j,k,l))/(node_mass_pre(donor,k,l))
width=celldx(j)
vdiffuw=vel1(donor,k,l)-vel1(upwind,k,l)
vdiffdw=vel1(downwind,k,l)-vel1(donor,k,l)
limiter=0.0
IF(vdiffuw*vdiffdw.GT.0.0)THEN
auw=ABS(vdiffuw)
adw=ABS(vdiffdw)
wind=1.0_8
IF(vdiffdw.LE.0.0) wind=-1.0_8
limiter=wind*MIN(width*((2.0_8-sigma)*adw/width+(1.0_8+sigma)*auw/celldx(dif))/6.0_8,auw,adw)
ENDIF
advec_vel(j,k,l)=vel1(donor,k,l)+(1.0-sigma)*limiter
mom_flux(j,k,l)=advec_vel(j,k,l)*node_flux(j,k,l)
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
vel1 (j,k,l)=(vel1 (j,k,l)*node_mass_pre(j,k,l)+mom_flux(j-1,k,l)-mom_flux(j,k,l))/node_mass_post(j,k,l)
ENDDO
ENDDO
ENDDO
ELSEIF(direction.EQ.2)THEN
IF(which_vel.EQ.1)THEN
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min-2,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
! Find staggered mesh mass fluxes and nodal masses and volumes.
node_flux(j,k,l)=0.125_8*(mass_flux_y(j-1,k ,l )+mass_flux_y(j ,k ,l ) &
+mass_flux_y(j-1,k+1,l )+mass_flux_y(j ,k+1,l ) &
+mass_flux_y(j-1,k ,l-1)+mass_flux_y(j ,k ,l-1) &
+mass_flux_y(j-1,k+1,l-1)+mass_flux_y(j ,k+1,l-1))
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min-1,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
node_mass_post(j,k,l)=0.125_8*(density1(j ,k-1,l )*post_vol(j ,k-1,l ) &
+density1(j ,k ,l )*post_vol(j ,k ,l ) &
+density1(j-1,k-1,l )*post_vol(j-1,k-1,l ) &
+density1(j-1,k ,l )*post_vol(j-1,k ,l ) &
+density1(j ,k-1,l-1)*post_vol(j ,k-1,l-1) &
+density1(j ,k ,l-1)*post_vol(j ,k ,l-1) &
+density1(j-1,k-1,l-1)*post_vol(j-1,k-1,l-1) &
+density1(j-1,k ,l-1)*post_vol(j-1,k ,l-1))
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min-1,y_max+2
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
node_mass_pre(j,k,l)=node_mass_post(j,k,l)-node_flux(j,k-1,l)+node_flux(j,k,l)
ENDDO
ENDDO
ENDDO
ENDIF
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min-1,y_max+1
!$ACC LOOP INDEPENDENT PRIVATE(upwind,donor,downwind,dif,sigma,width,limiter,vdiffuw,vdiffdw,auw,adw,wind)
DO j=x_min,x_max+1
IF(node_flux(j,k,l).LT.0.0)THEN
upwind=k+2
donor=k+1
downwind=k
dif=donor
ELSE
upwind=k-1
donor=k
downwind=k+1
dif=upwind
ENDIF
sigma=ABS(node_flux(j,k,l))/(node_mass_pre(j,donor,l))
width=celldy(k)
vdiffuw=vel1(j,donor,l)-vel1(j,upwind,l)
vdiffdw=vel1(j,downwind,l)-vel1(j,donor,l)
limiter=0.0
IF(vdiffuw*vdiffdw.GT.0.0)THEN
auw=ABS(vdiffuw)
adw=ABS(vdiffdw)
wind=1.0_8
IF(vdiffdw.LE.0.0) wind=-1.0_8
limiter=wind*MIN(width*((2.0_8-sigma)*adw/width+(1.0_8+sigma)*auw/celldy(dif))/6.0_8,auw,adw)
ENDIF
advec_vel(j,k,l)=vel1(j,donor,l)+(1.0_8-sigma)*limiter
mom_flux(j,k,l)=advec_vel(j,k,l)*node_flux(j,k,l)
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
vel1 (j,k,l)=(vel1(j,k,l)*node_mass_pre(j,k,l)+mom_flux(j,k-1,l)-mom_flux(j,k,l))/node_mass_post(j,k,l)
ENDDO
ENDDO
ENDDO
ELSEIF(direction.EQ.3)THEN
IF(which_vel.EQ.1) THEN
!$ACC LOOP INDEPENDENT
DO l=z_min-2,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
! Find staggered mesh mass fluxes and nodal masses and volumes.
node_flux(j,k,l)=0.125_8*(mass_flux_z(j-1,k ,l )+mass_flux_z(j ,k ,l ) &
+mass_flux_z(j-1,k ,l+1)+mass_flux_z(j ,k ,l+1) &
+mass_flux_z(j-1,k-1,l )+mass_flux_z(j ,k-1,l ) &
+mass_flux_z(j-1,k-1,l+1)+mass_flux_z(j ,k-1,l+1))
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min-1,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
node_mass_post(j,k,l)=0.125_8*(density1(j ,k-1,l )*post_vol(j ,k-1,l ) &
+density1(j ,k ,l )*post_vol(j ,k ,l ) &
+density1(j-1,k-1,l )*post_vol(j-1,k-1,l ) &
+density1(j-1,k ,l )*post_vol(j-1,k ,l ) &
+density1(j ,k-1,l-1)*post_vol(j ,k-1,l-1) &
+density1(j ,k ,l-1)*post_vol(j ,k ,l-1) &
+density1(j-1,k-1,l-1)*post_vol(j-1,k-1,l-1) &
+density1(j-1,k ,l-1)*post_vol(j-1,k ,l-1))
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min-1,z_max+2
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
! Staggered cell mass pre advection
node_mass_pre(j,k,l)=node_mass_post(j,k,l)-node_flux(j,k,l-1)+node_flux(j,k,l)
ENDDO
ENDDO
ENDDO
ENDIF
!$ACC LOOP INDEPENDENT
DO l=z_min-1,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT PRIVATE(upwind,donor,downwind,dif,sigma,width,limiter,vdiffuw,vdiffdw,auw,adw,wind)
DO j=x_min,x_max+1
IF(node_flux(j,k,l).LT.0.0)THEN
upwind=l+2
donor=l+1
downwind=l
dif=donor
ELSE
upwind=l-1
donor=l
downwind=l+1
dif=upwind
ENDIF
sigma=ABS(node_flux(j,k,l))/(node_mass_pre(j,k,donor))
width=celldz(l)
vdiffuw=vel1(j,k,donor)-vel1(j,k,upwind)
vdiffdw=vel1(j,k,downwind)-vel1(j,k,donor)
limiter=0.0
IF(vdiffuw*vdiffdw.GT.0.0)THEN
auw=ABS(vdiffuw)
adw=ABS(vdiffdw)
wind=1.0_8
IF(vdiffdw.LE.0.0) wind=-1.0_8
limiter=wind*MIN(width*((2.0_8-sigma)*adw/width+(1.0_8+sigma)*auw/celldz(dif))/6.0_8,auw,adw)
ENDIF
advec_vel(j,k,l)=vel1(j,k,donor)+(1.0_8-sigma)*limiter
mom_flux(j,k,l)=advec_vel(j,k,l)*node_flux(j,k,l)
ENDDO
ENDDO
ENDDO
!$ACC LOOP INDEPENDENT
DO l=z_min,z_max+1
!$ACC LOOP INDEPENDENT
DO k=y_min,y_max+1
!$ACC LOOP INDEPENDENT
DO j=x_min,x_max+1
vel1 (j,k,l)=(vel1(j,k,l)*node_mass_pre(j,k,l)+mom_flux(j,k,l-1)-mom_flux(j,k,l))/node_mass_post(j,k,l)
ENDDO
ENDDO
ENDDO
ENDIF
!$ACC END KERNELS
!$ACC END DATA
END SUBROUTINE advec_mom_kernel
END MODULE advec_mom_kernel_mod