Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand committed Sep 14, 2024
1 parent ec65ede commit 2aa9da5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ contains
! Depending on model_eqns and bubbles, the appropriate procedure
! for computing pressure is targeted by the procedure pointer

if ((model_eqns /= 4) .and. (bubbles .neqv. .true.)) then
if ((model_eqns /= 4) .and. (bubbles .neqv. .true.)) then
pres = (energy - dyn_p - pi_inf - qv)/gamma
else if ((model_eqns /= 4) .and. bubbles) then
pres = ((energy - dyn_p)/(1.d0 - alf) - pi_inf - qv)/gamma
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ contains
else if(mpi_dir == 3) then
if(pbc_loc == -1) then
if(bc_y%end >= 0) then
if(bc_z%end >= 0) then
!$acc parallel loop gang vector collapse(3) default(present) private(r)
do l = p - (buff_size - 1), p
do k = -buff_size, n + buff_size
Expand Down Expand Up @@ -1563,7 +1563,7 @@ contains
end do
else
if(bc_y%beg >= 0) then
if(bc_z%beg >= 0) then
!$acc parallel loop gang vector collapse(3) default(present) private(r)
do l = 0, buff_size - 1
do k = -buff_size, n + buff_size
Expand Down
103 changes: 52 additions & 51 deletions src/simulation/m_rhs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,8 @@ contains
!$acc update device(ix, iy, iz)

bcxb = bc_x%beg; bcxe = bc_x%end; bcyb = bc_y%beg; bcye = bc_y%end; bczb = bc_z%beg; bcze = bc_z%end
!bcxb = -1; bcxe = -1; bcyb = -1; bcye = -1
!$acc update device(bcxb, bcxe, bcyb, bcye)
!bcxb = -1; bcxe = -1; bcyb = -1; bcye = -1; bczb = -1; bcze = -1
!$acc update device(bcxb, bcxe, bcyb, bcye, bczb, bcze)


if(igr) then
Expand Down Expand Up @@ -1148,7 +1148,7 @@ contains
q_prim_qp%vf(momxb)%sf(j,k+1,l) - &
q_prim_qp%vf(momxb)%sf(j,k-1,l) )

duz_igr(j,k,k) = (1/(2d0 *dz(l))) * (&
duz_igr(j,k,l) = (1/(2d0 *dz(l))) * (&
q_prim_qp%vf(momxb)%sf(j,k,l+1) - &
q_prim_qp%vf(momxb)%sf(j,k,l-1) )
end do
Expand All @@ -1167,7 +1167,7 @@ contains
q_prim_qp%vf(momxb + 1)%sf(j,k+1,l) - &
q_prim_qp%vf(momxb + 1)%sf(j,k-1,l) )

dvz_igr(j,k,k) = (1/(2d0 *dz(l))) * (&
dvz_igr(j,k,l) = (1/(2d0 *dz(l))) * (&
q_prim_qp%vf(momxb + 1)%sf(j,k,l+1) - &
q_prim_qp%vf(momxb + 1)%sf(j,k,l-1))
end do
Expand All @@ -1186,7 +1186,7 @@ contains
q_prim_qp%vf(momxb + 2)%sf(j,k+1,l) - &
q_prim_qp%vf(momxb + 2)%sf(j,k-1,l) )

dwz_igr(j,k,k) = (1/(2d0 *dz(l))) * (&
dwz_igr(j,k,l) = (1/(2d0 *dz(l))) * (&
q_prim_qp%vf(momxb + 2)%sf(j,k,l+1) - &
q_prim_qp%vf(momxb + 2)%sf(j,k,l-1))
end do
Expand All @@ -1205,7 +1205,7 @@ contains
end do
end do

!$acc parallel loop collapse(3) gang vector default(present) private(rho_lx, rho_rx, rho_ly, rho_ry)
!$acc parallel loop collapse(3) gang vector default(present) private(rho_lx, rho_rx, rho_ly, rho_ry, rho_lz, rho_rz)
do l = iz%beg + 1, iz%end - 1
do k = iy%beg + 1, iy%end - 1
do j = ix%beg + 1, ix%end - 1
Expand All @@ -1229,7 +1229,7 @@ contains

do q = 1, num_its

!$acc parallel loop collapse(3) gang vector default(present)
!$acc parallel loop collapse(3) gang vector default(present) private(rho_lx, rho_rx, rho_ly, rho_ry, rho_lz, rho_rz)
do l = 0, p
do k = 0, n
do j = 0, m
Expand Down Expand Up @@ -1373,13 +1373,13 @@ contains
do l = 0, p
do k = iy%beg + 1, iy%end - 1
do j = ix%beg+1, ix%end-1
dux_igr(j,k,l) = (1/(dx(j))) * ( &
q_prim_qp%vf(momxb)%sf(j,k,l) - &
q_prim_qp%vf(momxb)%sf(j-1,k,l) )
!dux_igr(j,k,l) = (1/(dx(j))) * ( &
! q_prim_qp%vf(momxb)%sf(j,k,l) - &
! q_prim_qp%vf(momxb)%sf(j-1,k,l) )

duy_igr(j,k,l) = (1/(dy(k))) * ( &
q_prim_qp%vf(momxb)%sf(j,k,l) - &
q_prim_qp%vf(momxb)%sf(j,k-1,l) )
!duy_igr(j,k,l) = (1/(dy(k))) * ( &
! q_prim_qp%vf(momxb)%sf(j,k,l) - &
! q_prim_qp%vf(momxb)%sf(j,k-1,l) )
end do
end do
end do
Expand All @@ -1388,13 +1388,13 @@ contains
do l = 0, p
do k = iy%beg + 1, iy%end - 1
do j = ix%beg+1, ix%end-1
dvx_igr(j,k,l) = (1/(dx(j))) * ( &
q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
q_prim_qp%vf(momxb+1)%sf(j-1,k,l) )
!dvx_igr(j,k,l) = (1/(dx(j))) * ( &
! q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+1)%sf(j-1,k,l) )

dvy_igr(j,k,l) = (1/(dy(k))) * ( &
q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
q_prim_qp%vf(momxb+1)%sf(j,k-1,l) )
!dvy_igr(j,k,l) = (1/(dy(k))) * ( &
! q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+1)%sf(j,k-1,l) )
end do
end do
end do
Expand All @@ -1403,17 +1403,17 @@ contains
do l = iz%beg + 1, iz%end - 1
do k = iy%beg + 1, iy%end - 1
do j = ix%beg+1, ix%end-1
dux_igr(j,k,l) = (1/(dx(j))) * ( &
q_prim_qp%vf(momxb)%sf(j,k,l) - &
q_prim_qp%vf(momxb)%sf(j-1,k,l) )
!dux_igr(j,k,l) = (1/(dx(j))) * ( &
! q_prim_qp%vf(momxb)%sf(j,k,l) - &
! q_prim_qp%vf(momxb)%sf(j-1,k,l) )

duy_igr(j,k,l) = (1/(dy(k))) * ( &
q_prim_qp%vf(momxb)%sf(j,k,l) - &
q_prim_qp%vf(momxb)%sf(j,k-1,l) )
!duy_igr(j,k,l) = (1/(dy(k))) * ( &
! q_prim_qp%vf(momxb)%sf(j,k,l) - &
! q_prim_qp%vf(momxb)%sf(j,k-1,l) )

duz_igr(j, k, l) = (1/dz(l)) * ( &
q_prim_qp%vf(momxb)%sf(j,k,l) - &
q_prim_qp%vf(momxb)%sf(j,k,l-1) )
!duz_igr(j, k, l) = (1/dz(l)) * ( &
! q_prim_qp%vf(momxb)%sf(j,k,l) - &
! q_prim_qp%vf(momxb)%sf(j,k,l-1) )
end do
end do
end do
Expand All @@ -1422,17 +1422,17 @@ contains
do l = iz%beg + 1, iz%end - 1
do k = iy%beg + 1, iy%end - 1
do j = ix%beg+1, ix%end-1
dvx_igr(j,k,l) = (1/(dx(j))) * ( &
q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
q_prim_qp%vf(momxb+1)%sf(j-1,k,l) )
!dvx_igr(j,k,l) = (1/(dx(j))) * ( &
! q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+1)%sf(j-1,k,l) )

dvy_igr(j,k,l) = (1/(dy(k))) * ( &
q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
q_prim_qp%vf(momxb+1)%sf(j,k-1,l) )
!dvy_igr(j,k,l) = (1/(dy(k))) * ( &
! q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+1)%sf(j,k-1,l) )

dvz_igr(j, k, l) = (1/dz(l)) * ( &
q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
q_prim_qp%vf(momxb+1)%sf(j,k,l-1) )
!dvz_igr(j, k, l) = (1/dz(l)) * ( &
! q_prim_qp%vf(momxb+1)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+1)%sf(j,k,l-1) )
end do
end do
end do
Expand All @@ -1441,17 +1441,17 @@ contains
do l = iz%beg + 1, iz%end - 1
do k = iy%beg + 1, iy%end - 1
do j = ix%beg+1, ix%end-1
dwx_igr(j,k,l) = (1/(dx(j))) * ( &
q_prim_qp%vf(momxb+2)%sf(j,k,l) - &
q_prim_qp%vf(momxb+2)%sf(j-1,k,l) )
!dwx_igr(j,k,l) = (1/(dx(j))) * ( &
! q_prim_qp%vf(momxb+2)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+2)%sf(j-1,k,l) )

dwy_igr(j,k,l) = (1/(dy(k))) * ( &
q_prim_qp%vf(momxb+2)%sf(j,k,l) - &
q_prim_qp%vf(momxb+2)%sf(j,k-1,l) )
!dwy_igr(j,k,l) = (1/(dy(k))) * ( &
! q_prim_qp%vf(momxb+2)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+2)%sf(j,k-1,l) )

dwz_igr(j, k, l) = (1/dz(l)) * ( &
q_prim_qp%vf(momxb+2)%sf(j,k,l) - &
q_prim_qp%vf(momxb+2)%sf(j,k,l-1) )
!dwz_igr(j, k, l) = (1/dz(l)) * ( &
! q_prim_qp%vf(momxb+2)%sf(j,k,l) - &
! q_prim_qp%vf(momxb+2)%sf(j,k,l-1) )
end do
end do
end do
Expand Down Expand Up @@ -1485,7 +1485,7 @@ contains

if(any(Re_size>0)) then
flux_n(id)%vf(momxb+1)%sf(j, k, l) = flux_n(id)%vf(momxb+1)%sf(j, k, l) - &
mu*(duy_igr(j, k, l) + dvx_igr(j, k, l))
mu*(duy_igr(j, k, l) + dvx_igr(j, k, l))
end if

flux_n(id)%vf(E_idx)%sf(j, k, l) = q_prim_qp%vf(momxb)%sf(j,k,l) * (q_cons_qp%vf(e_idx)%sf(j,k,l) + q_prim_qp%vf(e_idx)%sf(j,k,l) + F_igr(j, k, l))
Expand Down Expand Up @@ -1526,15 +1526,15 @@ contains

if(any(Re_size>0)) then
flux_n(id)%vf(momxb+1)%sf(j, k, l) = flux_n(id)%vf(momxb+1)%sf(j, k, l) - &
mu*(duy_igr(j, k, l) + dvx_igr(j, k, l))
mu*(duy_igr(j, k, l) + dvx_igr(j, k, l))
end if

flux_n(id)%vf(momxb+2)%sf(j, k, l) = q_prim_qp%vf(contxb)%sf(j,k,l) * &
q_prim_qp%vf( momxb)%sf(j,k,l)*q_prim_qp%vf( momxb + 2)%sf(j,k,l)

if(any(Re_size>0)) then
flux_n(id)%vf(momxb+2)%sf(j, k, l) = flux_n(id)%vf(momxb+2)%sf(j, k, l) - &
mu*(duz_igr(j, k, l) + dwx_igr(j, k, l))
mu*(duz_igr(j, k, l) + dwx_igr(j, k, l))
end if

flux_n(id)%vf(E_idx)%sf(j, k, l) = q_prim_qp%vf(momxb)%sf(j,k,l) * (q_cons_qp%vf(e_idx)%sf(j,k,l) + q_prim_qp%vf(e_idx)%sf(j,k,l) + F_igr(j, k, l))
Expand Down Expand Up @@ -1615,7 +1615,8 @@ contains
end do
end do
end do
end do
end do

end if
else if(id == 2) then
if(p == 0) then
Expand Down Expand Up @@ -1694,7 +1695,7 @@ contains

if(any(Re_size>0)) then
flux_n(id)%vf(momxb+2)%sf(j, k, l) = flux_n(id)%vf(momxb+2)%sf(j, k, l) - &
mu*(dvz_igr(j, k, l) + dwy_igr(j, k, l))
mu*(dvz_igr(j, k, l) + dwy_igr(j, k, l))
end if

flux_n(id)%vf(E_idx)%sf(j, k, l) = q_prim_qp%vf(momxb+1)%sf(j,k,l) * (q_cons_qp%vf(e_idx)%sf(j,k,l) + q_prim_qp%vf(e_idx)%sf(j,k,l) + F_igr(j, k, l))
Expand Down
6 changes: 1 addition & 5 deletions src/simulation/m_time_steppers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,6 @@ contains
end do
end do



call s_compute_rhs(q_cons_ts(2)%vf, q_prim_vf, rhs_vf, pb_ts(2)%sf, rhs_pb, mv_ts(2)%sf, rhs_mv, t_step, time_avg, 2)

!$acc parallel loop collapse(4) gang vector default(present)
Expand Down Expand Up @@ -1071,7 +1069,6 @@ contains
end do
end do


!!!!! STEP 3 of RK3

call s_compute_rhs(q_cons_ts(1)%vf, q_prim_vf, rhs_vf, pb_ts(1)%sf, rhs_pb, mv_ts(1)%sf, rhs_mv, t_step, time_avg, 1)
Expand Down Expand Up @@ -1119,8 +1116,7 @@ contains
end do
end do
end do
end do

end do

call cpu_time(finish)

Expand Down

0 comments on commit 2aa9da5

Please sign in to comment.