Skip to content

Commit ea0d2c6

Browse files
committed
save
1 parent ee8e4d8 commit ea0d2c6

File tree

3 files changed

+44
-53
lines changed

3 files changed

+44
-53
lines changed

src/simulation/m_chemistry.fpp

Lines changed: 10 additions & 17 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
@@ -78,9 +71,9 @@ contains
7871
#:if chemistry
7972

8073
!$acc parallel loop collapse(3) private(rho)
81-
do x = 0, m
82-
do y = 0, n
83-
do z = 0, p
74+
do x = idwint(1)%beg, idwint(1)%end
75+
do y = idwint(2)%beg, idwint(2)%end
76+
do z = idwint(3)%beg, idwint(3)%end
8477

8578
rho = 0d0
8679
do eqn = chemxb, chemxe
@@ -133,9 +126,9 @@ contains
133126
integer :: eqn
134127

135128
!$acc parallel loop collapse(4)
136-
do x = 0, m
137-
do y = 0, n
138-
do z = 0, p
129+
do x = idwint(1)%beg, idwint(1)%end
130+
do y = idwint(2)%beg, idwint(2)%end
131+
do z = idwint(3)%beg, idwint(3)%end
139132

140133
do eqn = chemxb, chemxe
141134
q_cons_qp(eqn)%sf(x, y, z) = max(0d0, q_cons_qp(eqn)%sf(x, y, z))

src/simulation/m_global_parameters.fpp

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ module m_global_parameters
238238

239239
!$acc declare create(bub_idx)
240240

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

706-
type(int_bounds_info) :: ix, iy, iz
707-
708715
#:if not MFC_CASE_OPTIMIZATION
709716
! Determining the degree of the WENO polynomials
710717
weno_polyn = (weno_order - 1)/2
@@ -1038,18 +1045,30 @@ contains
10381045
end if
10391046

10401047
! 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+
idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
1049+
idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
1050+
1051+
idwbuff(1)%beg = -buff_size
1052+
idwbuff(1)%end = m + buff_size
1053+
if (num_dims > 1) then
1054+
idwbuff(2)%beg = -buff_size
1055+
idwbuff(2)%end = n + buff_size
1056+
if (num_dims > 2) then
1057+
idwbuff(3)%beg = -buff_size
1058+
idwbuff(3)%end = p + buff_size
10481059
end if
1060+
end if
1061+
1062+
!$acc update device(idwint, idwbuff)
10491063

1050-
ix%end = m - ix%beg; iy%end = n - iy%beg; iz%end = p - iz%beg
1064+
! ==================================================================
10511065

1052-
@:ALLOCATE_GLOBAL(ptil(ix%beg:ix%end, iy%beg:iy%end, iz%beg:iz%end))
1066+
! Configuring Coordinate Direction Indexes =========================
1067+
if (bubbles) then
1068+
@:ALLOCATE_GLOBAL(ptil(&
1069+
& idwbuff(1)%beg:idwbuff(1)%end, &
1070+
& idwbuff(2)%beg:idwbuff(2)%end, &
1071+
& idwbuff(3)%beg:idwbuff(3)%end))
10531072
end if
10541073

10551074
if (probe_wrt) then

src/simulation/m_rhs.fpp

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,6 @@ module m_rhs
172172
type(int_bounds_info) :: ix, iy, iz
173173
!$acc declare create(ix, iy, iz)
174174

175-
type(int_bounds_info) :: ibounds_interior(1:3)
176-
!$acc declare create(ibounds_interior)
177-
178-
type(int_bounds_info) :: ibounds_wbuffer(1:3)
179-
!$acc declare create(ibounds_wbuffer)
180-
181175
type(int_bounds_info) :: is1, is2, is3
182176
!$acc declare create(is1, is2, is3)
183177

@@ -241,25 +235,10 @@ contains
241235

242236
integer :: i, j, k, l, id !< Generic loop iterators
243237

244-
! Configuring Coordinate Direction Indexes =========================
245-
ibounds_interior(1)%beg = 0; ibounds_interior(2)%beg = 0; ibounds_interior(3)%beg = 0
246-
ibounds_interior(1)%end = m; ibounds_interior(2)%end = n; ibounds_interior(3)%end = p
247-
248-
ibounds_wbuffer(1)%beg = -buff_size
249-
ibounds_wbuffer(2)%beg = 0
250-
ibounds_wbuffer(3)%beg = 0
251-
if (num_dims > 1) then ibounds_wbuffer(2)%beg = -buff_size; end if
252-
if (num_dims > 2) then ibounds_wbuffer(3)%beg = -buff_size; end if
253-
254-
ibounds_wbuffer(1)%end = m + buff_size
255-
ibounds_wbuffer(2)%end = n + buff_size
256-
ibounds_wbuffer(3)%end = p + buff_size
257-
258-
ix = ibounds_interior(1); iy = ibounds_interior(2); iz = ibounds_interior(3)
259-
! ==================================================================
238+
!$acc enter data copyin(idwint, idwbuff, ix, iy, iz)
239+
!$acc update device(idwint, idwbuff, ix, iy, iz)
260240

261-
!$acc enter data copyin(ibounds_interior, ibounds_wbuffer, ix, iy, iz)
262-
!$acc update device(ibounds_interior, ibounds_wbuffer, ix, iy, iz)
241+
ix = idwbuff(1); iy = idwbuff(2); iz = idwbuff(3)
263242

264243
ixt = ix; iyt = iy; izt = iz
265244

@@ -819,7 +798,7 @@ contains
819798
q_cons_qp%vf, &
820799
q_prim_qp%vf, &
821800
gm_alpha_qp%vf, &
822-
ibounds_interior(1), ibounds_interior(2), ibounds_interior(3))
801+
idwint(1), idwint(2), idwint(3))
823802
call nvtxEndRange
824803

825804
call nvtxStartRange("RHS-MPI")

0 commit comments

Comments
 (0)