Skip to content

Commit 0013438

Browse files
committed
Refactor the use of ix, iy, and iz
1 parent 098f00f commit 0013438

File tree

7 files changed

+277
-374
lines changed

7 files changed

+277
-374
lines changed

src/simulation/m_bubbles.fpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ contains
5858
subroutine s_initialize_bubbles_module
5959

6060
integer :: i, j, k, l, q
61-
type(int_bounds_info) :: ix, iy, iz
62-
63-
! Configuring Coordinate Direction Indexes =========================
64-
ix%beg = -buff_size; iy%beg = 0; iz%beg = 0
65-
66-
if (n > 0) iy%beg = -buff_size; if (p > 0) iz%beg = -buff_size
67-
68-
ix%end = m - ix%beg; iy%end = n - iy%beg; iz%end = p - iz%beg
69-
! ==================================================================
7061

7162
@:ALLOCATE_GLOBAL(rs(1:nb))
7263
@:ALLOCATE_GLOBAL(vs(1:nb))
@@ -89,7 +80,7 @@ contains
8980
!$acc update device(ps, ms)
9081
end if
9182

92-
@:ALLOCATE(divu%sf(ix%beg:ix%end, iy%beg:iy%end, iz%beg:iz%end))
83+
@:ALLOCATE(divu%sf(idwbuff(1)%beg:idwbuff(1)%end, idwbuff(2)%beg:idwbuff(2)%end, idwbuff(3)%beg:idwbuff(3)%end))
9384
@:ACC_SETUP_SFs(divu)
9485

9586
@:ALLOCATE_GLOBAL(bub_adv_src(0:m, 0:n, 0:p))

src/simulation/m_chemistry.fpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ module m_chemistry
1717

1818
implicit none
1919

20-
type(int_bounds_info), private :: ix, iy, iz
2120
type(scalar_field), private :: grads(1:3)
2221

23-
!$acc declare create(ix, iy, iz)
2422
!$acc declare create(grads)
2523

2624
contains
@@ -29,16 +27,11 @@ contains
2927

3028
integer :: i
3129

32-
ix%beg = -buff_size
33-
if (n > 0) then; iy%beg = -buff_size; else; iy%beg = 0; end if
34-
if (p > 0) then; iz%beg = -buff_size; else; iz%beg = 0; end if
35-
36-
ix%end = m - ix%beg; iy%end = n - iy%beg; iz%end = p - iz%beg
37-
38-
!$acc update device(ix, iy, iz)
39-
4030
do i = 1, 3
41-
@:ALLOCATE(grads(i)%sf(ix%beg:ix%end, iy%beg:iy%end, iz%beg:iz%end))
31+
@:ALLOCATE(grads(i)%sf(&
32+
& idwbuff(1)%beg:idwbuff(1)%end, &
33+
& idwbuff(2)%beg:idwbuff(2)%end, &
34+
& idwbuff(3)%beg:idwbuff(3)%end))
4235
end do
4336

4437
!$acc kernels

src/simulation/m_global_parameters.fpp

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ module m_global_parameters
238238

239239
!$acc declare create(bub_idx)
240240

241+
! Cell Indices for the interior points (O-m, O-n, 0-p).
242+
type(int_bounds_info) :: idwint(1:3)
243+
!$acc declare create(idwint)
244+
245+
! Cell Indices for the entire domain, including the buffer region.
246+
type(int_bounds_info) :: idwbuff(1:3)
247+
!$acc declare create(idwbuff)
248+
241249
!> @name The number of fluids, along with their identifying indexes, respectively,
242250
!! for which viscous effects, e.g. the shear and/or the volume Reynolds (Re)
243251
!! numbers, will be non-negligible.
@@ -703,8 +711,6 @@ contains
703711
integer :: i, j, k
704712
integer :: fac
705713

706-
type(int_bounds_info) :: ix, iy, iz
707-
708714
#:if not MFC_CASE_OPTIMIZATION
709715
! Determining the degree of the WENO polynomials
710716
weno_polyn = (weno_order - 1)/2
@@ -1038,18 +1044,27 @@ contains
10381044
end if
10391045

10401046
! Configuring Coordinate Direction Indexes =========================
1041-
if (bubbles) then
1042-
ix%beg = -buff_size; iy%beg = 0; iz%beg = 0
1043-
if (n > 0) then
1044-
iy%beg = -buff_size
1045-
if (p > 0) then
1046-
iz%beg = -buff_size
1047-
end if
1048-
end if
1047+
idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
1048+
idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
10491049

1050-
ix%end = m - ix%beg; iy%end = n - iy%beg; iz%end = p - iz%beg
1050+
idwbuff(1)%beg = -buff_size
1051+
if (num_dims > 1) then; idwbuff(2)%beg = -buff_size; else; idwbuff(2)%beg = 0; end if
1052+
if (num_dims > 2) then; idwbuff(3)%beg = -buff_size; else; idwbuff(3)%beg = 0; end if
10511053

1052-
@:ALLOCATE_GLOBAL(ptil(ix%beg:ix%end, iy%beg:iy%end, iz%beg:iz%end))
1054+
idwbuff(1)%end = idwint(1)%end - idwbuff(1)%beg
1055+
idwbuff(2)%end = idwint(2)%end - idwbuff(2)%beg
1056+
idwbuff(3)%end = idwint(3)%end - idwbuff(3)%beg
1057+
1058+
!$acc update device(idwint, idwbuff)
1059+
1060+
! ==================================================================
1061+
1062+
! Configuring Coordinate Direction Indexes =========================
1063+
if (bubbles) then
1064+
@:ALLOCATE_GLOBAL(ptil(&
1065+
& idwbuff(1)%beg:idwbuff(1)%end, &
1066+
& idwbuff(2)%beg:idwbuff(2)%end, &
1067+
& idwbuff(3)%beg:idwbuff(3)%end))
10531068
end if
10541069

10551070
if (probe_wrt) then

0 commit comments

Comments
 (0)