Skip to content

Commit 45da453

Browse files
committed
frontier changes
1 parent 9f0c644 commit 45da453

File tree

2 files changed

+48
-23
lines changed

2 files changed

+48
-23
lines changed

src/simulation/m_bubbles_EL.fpp

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ module m_bubbles_EL
7474
7575
!$acc declare create(nBubs, Rmax_glb, Rmin_glb, q_beta, q_beta_idx)
7676
77+
integer :: remove_id !< Module variable for s_update_tmp_rkck
78+
!$acc declare create(remove_id)
79+
80+
! Module variables for s_write_void_evol
81+
real(kind(0d0)) :: lag_voidmax, lag_voidavg, lag_vol
82+
!$acc declare create(lag_voidmax, lag_voidavg, lag_vol)
83+
7784
contains
7885
7986
!> Initializes the lagrangian subgrid bubble solver
@@ -1161,13 +1168,16 @@ contains
11611168

11621169
integer :: i, j, k, l, q
11631170
real(kind(0d0)) :: radiusOld, velOld, aux_glb
1164-
integer :: remove_id
11651171

11661172
call s_transfer_data_to_tmp()
11671173

11681174
lag_largestep = 0d0
11691175
remove_id = 0
1170-
!$acc parallel loop gang vector default(present) reduction(+: lag_largestep) reduction(MAX: remove_id) private(k) copyin(RKstep)
1176+
1177+
!$acc update device(lag_largestep, remove_id)
1178+
1179+
!$acc parallel loop gang vector default(present) reduction(+:lag_largestep) &
1180+
!%acc reduction(MAX: remove_id) private(k) copyin(RKstep) copy(largstep, remove_id)
11711181
do k = 1, nBubs
11721182

11731183
radiusOld = intfc_rad(k, 2)
@@ -1194,6 +1204,8 @@ contains
11941204

11951205
end do
11961206

1207+
!$acc update host(lag_largestep, remove_id)
1208+
11971209
if (remove_id /= 0) call s_remove_lag_bubble(remove_id)
11981210

11991211
#ifdef MFC_MPI
@@ -1239,7 +1251,11 @@ contains
12391251
integer :: i, j, k
12401252

12411253
rkck_errmax = 0d0
1242-
!$acc parallel loop gang vector default(present) reduction(MAX: rkck_errmax) private(k)
1254+
1255+
!$acc update device(rkck_errmax)
1256+
1257+
!$acc parallel loop gang vector default(present) reduction(MAX: rkck_errmax) &
1258+
!$acc private(k) copy(rkck_errmax)
12431259
do k = 1, nBubs
12441260
errb = 0d0
12451261

@@ -1272,6 +1288,8 @@ contains
12721288
rkck_errmax = max(rkck_errmax, errb)
12731289
end do
12741290

1291+
!$acc update host(rkck_errmax)
1292+
12751293
end subroutine s_calculate_rkck_truncation_error
12761294

12771295
!> This subroutine updates the conservative fields and the lagrangian variables after accepting the performed time step.
@@ -1294,10 +1312,10 @@ contains
12941312
end do
12951313

12961314
!$acc parallel loop collapse(4) gang vector default(present)
1297-
do i = 0, m
1298-
do j = 0, n
1299-
do k = 0, p
1300-
do l = 1, sys_size
1315+
do l = 1, sys_size
1316+
do k = 0, p
1317+
do j = 0, n
1318+
do i = 0, m
13011319
q_cons_ts(1)%vf(l)%sf(i, j, k) = q_cons_ts(2)%vf(l)%sf(i, j, k)
13021320
end do
13031321
end do
@@ -1628,11 +1646,9 @@ contains
16281646
subroutine s_write_void_evol(qtime)
16291647

16301648
real(kind(0d0)) :: qtime, volcell, voltot
1631-
real(kind(0d0)) :: lag_voidmax, lag_voidavg, lag_vol
16321649
real(kind(0d0)) :: voidmax_glb, voidavg_glb, vol_glb
16331650

16341651
integer :: i, j, k
1635-
integer, dimension(3) :: cell
16361652

16371653
character(LEN=path_len + 2*name_len) :: file_loc
16381654

@@ -1641,11 +1657,6 @@ contains
16411657
file_loc = trim(case_dir)//'/D/'//trim(file_loc)
16421658
if (qtime == 0d0) then
16431659
open (12, FILE=trim(file_loc), FORM='formatted', position='rewind')
1644-
!write (12, *) 'currentTime, averageVoidFraction, ', &
1645-
! 'maximumVoidFraction, totalParticlesVolume'
1646-
!write (12, *) 'The averageVoidFraction value does ', &
1647-
! 'not reflect the real void fraction in the cloud since the ', &
1648-
! 'cells which do not have bubbles are not accounted'
16491660
else
16501661
open (12, FILE=trim(file_loc), FORM='formatted', position='append')
16511662
end if
@@ -1654,16 +1665,16 @@ contains
16541665
lag_voidmax = 0d0
16551666
lag_voidavg = 0d0
16561667
lag_vol = 0d0
1668+
1669+
!$acc update device(lag_voidmax, lag_voidavg, lag_vol)
1670+
16571671
!$acc parallel loop collapse(3) gang vector default(present) reduction(+:lag_vol,lag_voidavg) &
1658-
!$acc reduction(MAX:lag_voidmax) private(cell)
1659-
do i = 0, m
1672+
!$acc reduction(MAX:lag_voidmax) copy(lag_voidmax,lag_voidavg, lag_vol)
1673+
do k = 0, p
16601674
do j = 0, n
1661-
do k = 0, p
1675+
do i = 0, p
16621676
lag_voidmax = max(lag_voidmax, 1d0 - q_beta%vf(1)%sf(i, j, k))
1663-
cell(1) = i
1664-
cell(2) = j
1665-
cell(3) = k
1666-
call s_get_char_vol(cell(1), cell(2), cell(3), volcell)
1677+
call s_get_char_vol(i, j, k, volcell)
16671678
if ((1d0 - q_beta%vf(1)%sf(i, j, k)) > 5.0d-11) then
16681679
lag_voidavg = lag_voidavg + (1d0 - q_beta%vf(1)%sf(i, j, k))*volcell
16691680
lag_vol = lag_vol + volcell
@@ -1672,6 +1683,8 @@ contains
16721683
end do
16731684
end do
16741685

1686+
!$acc update host(lag_voidmax, lag_voidavg, lag_vol)
1687+
16751688
#ifdef MFC_MPI
16761689
if (num_procs > 1) then
16771690
call s_mpi_allreduce_max(lag_voidmax, voidmax_glb)
@@ -1841,14 +1854,22 @@ contains
18411854

18421855
integer :: k
18431856

1844-
!$acc parallel loop gang vector default(present) reduction(MAX: Rmax_glb) reduction(MIN: Rmin_glb) private(k)
1857+
Rmax_glb = 0d0
1858+
Rmin_glb = 0d0
1859+
1860+
!$acc update device(Rmax_glb, Rmin_glb)
1861+
1862+
!$acc parallel loop gang vector default(present) reduction(MAX: Rmax_glb) reduction(MIN: Rmin_glb) &
1863+
!$acc private(k) copy(Rmax_glb, Rmin_glb)
18451864
do k = 1, nBubs
18461865
Rmax_glb = max(Rmax_glb, intfc_rad(k, 1)/bub_R0(k))
18471866
Rmin_glb = min(Rmin_glb, intfc_rad(k, 1)/bub_R0(k))
18481867
Rmax_stats(k) = max(Rmax_stats(k), intfc_rad(k, 1)/bub_R0(k))
18491868
Rmin_stats(k) = min(Rmin_stats(k), intfc_rad(k, 1)/bub_R0(k))
18501869
end do
18511870

1871+
!$acc update host(Rmax_glb, Rmin_glb)
1872+
18521873
end subroutine s_calculate_lag_bubble_stats
18531874

18541875
!> Subroutine that writes the maximum and minimum radius of each bubble.

src/simulation/m_time_steppers.fpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ module m_time_steppers
7373

7474
!$acc declare create(q_cons_ts,q_prim_vf,rhs_vf,rhs_ts_rkck,q_prim_ts, rhs_mv, rhs_pb, max_dt)
7575

76+
! Module variables for rkck timestepper
77+
real(kind(0d0)) :: lag_largestep, rkck_errmax
78+
!$acc declare create(lag_largestep, rkck_errmax)
79+
7680
contains
7781

7882
!> The computation of parameters, the allocation of memory,
@@ -1044,7 +1048,7 @@ contains
10441048
real(kind(0d0)), intent(out) :: time_avg
10451049

10461050
logical :: restart_rkck_step, start_rkck_step
1047-
real(kind(0.d0)) :: lag_largestep, rkck_errmax, dt_did
1051+
real(kind(0.d0)) :: dt_did
10481052
integer :: RKstep
10491053

10501054
mytime = mytime - dt

0 commit comments

Comments
 (0)