Skip to content

Commit 28906e6

Browse files
committed
Revert "fix: use flat arrays in GPU kernels to fix OpenMP target struct pointer dereference"
This reverts commit e651b8f.
1 parent e651b8f commit 28906e6

2 files changed

Lines changed: 77 additions & 70 deletions

File tree

src/simulation/m_ibm.fpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ contains
204204

205205
! Calculate physical location of GP
206206
if (p > 0) then
207-
physical_loc = [x_cc(j), y_cc(k), z_cc(l)]
207+
physical_loc = [x%cc(j), y%cc(k), z%cc(l)]
208208
else
209-
physical_loc = [x_cc(j), y_cc(k), 0._wp]
209+
physical_loc = [x%cc(j), y%cc(k), 0._wp]
210210
end if
211211

212212
! Interpolate primitive variables at image point associated w/ GP
@@ -404,9 +404,9 @@ contains
404404
405405
! Calculate physical location of ghost point
406406
if (p > 0) then
407-
physical_loc = [x_cc(i), y_cc(j), z_cc(k)]
407+
physical_loc = [x%cc(i), y%cc(j), z%cc(k)]
408408
else
409-
physical_loc = [x_cc(i), y_cc(j), 0._wp]
409+
physical_loc = [x%cc(i), y%cc(j), 0._wp]
410410
end if
411411
412412
! Calculate and store the precise location of the image point
@@ -419,13 +419,13 @@ contains
419419
do dim = 1, num_dims
420420
! s_cc points to the dim array we need
421421
if (dim == 1) then
422-
s_cc => x_cc
422+
s_cc => x%cc
423423
bound = m + buff_size - 1
424424
else if (dim == 2) then
425-
s_cc => y_cc
425+
s_cc => y%cc
426426
bound = n + buff_size - 1
427427
else
428-
s_cc => z_cc
428+
s_cc => z%cc
429429
bound = p + buff_size - 1
430430
end if
431431
@@ -577,26 +577,26 @@ contains
577577
ghost_points_in(local_idx)%z_periodicity = zp
578578
ghost_points_in(local_idx)%slip = patch_ib(patch_id)%slip
579579
580-
if ((x_cc(i) - dx(i)) < x_domain%beg) then
580+
if ((x%cc(i) - x%spacing(i)) < x_domain%beg) then
581581
ghost_points_in(local_idx)%DB(1) = -1
582-
else if ((x_cc(i) + dx(i)) > x_domain%end) then
582+
else if ((x%cc(i) + x%spacing(i)) > x_domain%end) then
583583
ghost_points_in(local_idx)%DB(1) = 1
584584
else
585585
ghost_points_in(local_idx)%DB(1) = 0
586586
end if
587587
588-
if ((y_cc(j) - dy(j)) < y_domain%beg) then
588+
if ((y%cc(j) - y%spacing(j)) < y_domain%beg) then
589589
ghost_points_in(local_idx)%DB(2) = -1
590-
else if ((y_cc(j) + dy(j)) > y_domain%end) then
590+
else if ((y%cc(j) + y%spacing(j)) > y_domain%end) then
591591
ghost_points_in(local_idx)%DB(2) = 1
592592
else
593593
ghost_points_in(local_idx)%DB(2) = 0
594594
end if
595595
596596
if (p /= 0) then
597-
if ((z_cc(k) - dz(k)) < z_domain%beg) then
597+
if ((z%cc(k) - z%spacing(k)) < z_domain%beg) then
598598
ghost_points_in(local_idx)%DB(3) = -1
599-
else if ((z_cc(k) + dz(k)) > z_domain%end) then
599+
else if ((z%cc(k) + z%spacing(k)) > z_domain%end) then
600600
ghost_points_in(local_idx)%DB(3) = 1
601601
else
602602
ghost_points_in(local_idx)%DB(3) = 0
@@ -643,11 +643,11 @@ contains
643643
do ii = 0, 1
644644
do jj = 0, 1
645645
if (p == 0) then
646-
dist(1 + ii, 1 + jj, 1) = sqrt((x_cc(i + ii) - gp%ip_loc(1))**2 + (y_cc(j + jj) - gp%ip_loc(2))**2)
646+
dist(1 + ii, 1 + jj, 1) = sqrt((x%cc(i + ii) - gp%ip_loc(1))**2 + (y%cc(j + jj) - gp%ip_loc(2))**2)
647647
else
648648
do kk = 0, 1
649649
dist(1 + ii, 1 + jj, &
650-
& 1 + kk) = sqrt((x_cc(i + ii) - gp%ip_loc(1))**2 + (y_cc(j + jj) - gp%ip_loc(2))**2 + (z_cc(k &
650+
& 1 + kk) = sqrt((x%cc(i + ii) - gp%ip_loc(1))**2 + (y%cc(j + jj) - gp%ip_loc(2))**2 + (z%cc(k &
651651
& + kk) - gp%ip_loc(3))**2)
652652
end do
653653
end if
@@ -926,14 +926,14 @@ contains
926926

927927
! get the vector pointing to the grid cell from the IB centroid
928928
if (num_dims == 3) then
929-
radial_vector = [x_cc(i), y_cc(j), z_cc(k)] - [patch_ib(ib_idx)%x_centroid, &
929+
radial_vector = [x%cc(i), y%cc(j), z%cc(k)] - [patch_ib(ib_idx)%x_centroid, &
930930
& patch_ib(ib_idx)%y_centroid, patch_ib(ib_idx)%z_centroid]
931931
else
932-
radial_vector = [x_cc(i), y_cc(j), 0._wp] - [patch_ib(ib_idx)%x_centroid, &
932+
radial_vector = [x%cc(i), y%cc(j), 0._wp] - [patch_ib(ib_idx)%x_centroid, &
933933
& patch_ib(ib_idx)%y_centroid, 0._wp]
934934
end if
935-
dx_loc = x_cc(i + 1) - x_cc(i)
936-
dy_loc = y_cc(j + 1) - y_cc(j)
935+
dx_loc = x%cc(i + 1) - x%cc(i)
936+
dy_loc = y%cc(j + 1) - y%cc(j)
937937

938938
local_force_contribution(:) = 0._wp
939939
do fluid_idx = 0, num_fluids - 1
@@ -946,7 +946,7 @@ contains
946946
cell_volume = abs(dx_loc*dy_loc)
947947
! add the 3D component of the pressure gradient, if we are working in 3 dimensions
948948
if (num_dims == 3) then
949-
dz_loc = z_cc(k + 1) - z_cc(k)
949+
dz_loc = z%cc(k + 1) - z%cc(k)
950950
local_force_contribution(3) = local_force_contribution(3) - (q_prim_vf(eqn_idx%E &
951951
& + fluid_idx)%sf(i, j, k + 1) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, &
952952
& j, k - 1))/(2._wp*dz_loc)
@@ -1156,10 +1156,10 @@ contains
11561156

11571157
! get the position in local coordinates so that the axis passes through 0, 0, 0
11581158
if (p == 0) then
1159-
position = [x_cc(i), y_cc(j), 0._wp] - [patch_ib(ib_marker)%x_centroid, &
1159+
position = [x%cc(i), y%cc(j), 0._wp] - [patch_ib(ib_marker)%x_centroid, &
11601160
& patch_ib(ib_marker)%y_centroid, 0._wp]
11611161
else
1162-
position = [x_cc(i), y_cc(j), z_cc(k)] - [patch_ib(ib_marker)%x_centroid, &
1162+
position = [x%cc(i), y%cc(j), z%cc(k)] - [patch_ib(ib_marker)%x_centroid, &
11631163
& patch_ib(ib_marker)%y_centroid, patch_ib(ib_marker)%z_centroid]
11641164
end if
11651165

0 commit comments

Comments
 (0)