Skip to content

Commit 1d570c8

Browse files
author
Benjamin Wilfong
committed
almost working on GPUs
1 parent 3c8cf71 commit 1d570c8

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/simulation/m_rhs.f90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ module m_rhs
197197
!$acc tau_Re_vf,qL_prim, qR_prim, iv,ix, iy, iz,is1,is2,is3,bub_adv_src,bub_r_src,bub_v_src, bub_p_src, bub_m_src, &
198198
!$acc bub_mom_src, myflux_vf, myflux_src_vf,alf_sum, momxb, momxe, contxb, contxe, advxb, advxe, bubxb, bubxe, strxb, strxe, &
199199
!$acc blkmod1, blkmod2, alpha1, alpha2, Kterm, divu, qL_rsx_vf_flat, qL_rsy_vf_flat, qL_rsz_vf_flat, qR_rsx_vf_flat, qR_rsy_vf_flat, qR_rsz_vf_flat, &
200-
!$acc dqL_rsx_vf_flat, dqL_rsy_vf_flat, dqL_rsz_vf_flat, dqR_rsx_vf_flat, dqR_rsy_vf_flat, dqR_rsz_vf_flat)
200+
!$acc dqL_rsx_vf_flat, dqL_rsy_vf_flat, dqL_rsz_vf_flat, dqR_rsx_vf_flat, dqR_rsy_vf_flat, dqR_rsz_vf_flat, &
201+
!$acc ixt, iyt, izt)
201202

202203
real(kind(0d0)), allocatable, dimension(:, :, :) :: nbub !< Bubble number density
203204
integer, allocatable, dimension(:) :: rs, vs, ps, ms
@@ -239,10 +240,8 @@ subroutine s_initialize_rhs_module() ! ---------------------------------
239240
!$acc iy%beg:iy%end, &
240241
!$acc iz%beg:iz%end))
241242
end if
242-
243-
ixt = ix
244-
iyt = iy
245-
izt = iz
243+
print*, ix, iy, iz
244+
ixt = ix; iyt = iy; izt = iz
246245

247246
allocate (q_cons_qp%vf(1:sys_size))
248247
allocate (q_prim_qp%vf(1:sys_size))
@@ -570,6 +569,7 @@ subroutine s_initialize_rhs_module() ! ---------------------------------
570569
allocate (mono_mass_src(0:m, 0:n, 0:p))
571570
allocate (mono_mom_src(1:num_dims, 0:m, 0:n, 0:p))
572571
allocate (mono_E_src(0:m, 0:n, 0:p))
572+
!$acc enter data create(mono_mass_src(0:m, 0:n, 0:p), mono_mom_src(1:num_dims, 0:m, 0:n, 0:p), mono_E_src(0:m, 0:n, 0:p))
573573
end if
574574

575575
allocate (divu%sf( &
@@ -796,7 +796,7 @@ subroutine s_compute_rhs(q_cons_vf, q_prim_vf, rhs_vf, t_step) ! -------
796796
type(scalar_field), dimension(sys_size), intent(INOUT) :: q_prim_vf
797797
type(scalar_field), dimension(sys_size), intent(INOUT) :: rhs_vf
798798
integer, intent(IN) :: t_step
799-
799+
800800
real(kind(0d0)) :: top, bottom !< Numerator and denominator when evaluating flux limiter function
801801
real(kind(0d0)), dimension(num_fluids) :: myalpha_rho, myalpha
802802

src/simulation/m_time_steppers.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ subroutine s_initialize_time_steppers_module() ! -----------------------
124124

125125
! Allocating the cell-average primitive variables
126126
allocate (q_prim_vf(1:sys_size))
127-
127+
128128
do i = 1, adv_idx%end
129129
allocate (q_prim_vf(i)%sf(ix%beg:ix%end, &
130130
iy%beg:iy%end, &

src/simulation/m_viscous.f90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module m_viscous
3131

3232
integer :: momxb, momxe
3333
integer :: contxb, contxe
34+
!$acc declare create(momxb, momxe, contxb, contxe)
3435

3536
contains
3637

@@ -58,6 +59,7 @@ subroutine s_initialize_viscous_module()
5859
momxe = mom_idx%end
5960
contxb = cont_idx%beg
6061
contxe = cont_idx%end
62+
!$acc update device(momxb, momxe, contxb, contxe)
6163

6264
end subroutine s_initialize_viscous_module
6365

@@ -100,13 +102,11 @@ subroutine s_compute_viscous_stress_tensor(q_prim_vf, grad_x_vf, grad_y_vf, grad
100102
end do
101103
end do
102104
end do
103-
104105
if (Re_size(1) > 0) then ! Shear stresses
105106
!$acc parallel loop collapse(3) gang vector default(present) private(alpha_visc, alpha_rho_visc, Re_visc, tau_Re )
106107
do l = iz%beg, iz%end
107108
do k = -1, 1
108109
do j = ix%beg, ix%end
109-
110110
!$acc loop seq
111111
do i = 1, num_fluids
112112
alpha_rho_visc(i) = q_prim_vf(i)%sf(j, k, l)
@@ -180,15 +180,15 @@ subroutine s_compute_viscous_stress_tensor(q_prim_vf, grad_x_vf, grad_y_vf, grad
180180
end do
181181
end if
182182
end if
183-
183+
184184
tau_Re(2, 1) = (grad_y_vf(1)%sf(j, k, l) + &
185185
grad_x_vf(2)%sf(j, k, l))/ &
186186
Re_visc(1)
187187

188188
tau_Re(2, 2) = (4d0*grad_y_vf(2)%sf(j, k, l) &
189189
- 2d0*grad_x_vf(1)%sf(j, k, l) &
190190
- 2d0*q_prim_vf(momxb + 1)%sf(j, k, l)/y_cc(k))/ &
191-
(3d0*Re_visc(1))
191+
(3d0*Re_visc(1))
192192
!$acc loop seq
193193
do i = 1, 2
194194
tau_Re_vf(contxe + i)%sf(j, k, l) = &
@@ -715,7 +715,7 @@ subroutine s_get_viscous(qL_prim_rsx_vf_flat, qL_prim_rsy_vf_flat, qL_prim_rsz_v
715715

716716
type(vector_field) :: q_prim_qp
717717

718-
type(vector_field), dimension(sys_size), &
718+
type(vector_field), dimension(1:num_dims), &
719719
intent(INOUT) :: dqL_prim_dx_n, dqR_prim_dx_n, &
720720
dqL_prim_dy_n, dqR_prim_dy_n, &
721721
dqL_prim_dz_n, dqR_prim_dz_n
@@ -1374,7 +1374,7 @@ end subroutine s_reconstruct_cell_boundary_values_visc ! --------------------
13741374

13751375
subroutine s_finalize_viscous_module()
13761376
deallocate (gammas, pi_infs)
1377-
allocate (Res(1:2, 1:maxval(Re_size)))
1377+
deallocate (Res(1:2, 1:maxval(Re_size)))
13781378
end subroutine s_finalize_viscous_module
13791379

13801380
end module m_viscous

0 commit comments

Comments
 (0)