Skip to content

Commit

Permalink
Remove Newton solve for T in buffer regions
Browse files Browse the repository at this point in the history
  • Loading branch information
henryleberre committed Nov 2, 2024
1 parent 06a757a commit 6bed935
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
14 changes: 10 additions & 4 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ contains

type(int_bounds_info), optional, intent(in) :: ix, iy, iz

type(int_bounds_info) :: aix, aiy, aiz

real(kind(0d0)), dimension(num_fluids) :: alpha_K, alpha_rho_K
real(kind(0d0)), dimension(2) :: Re_K
real(kind(0d0)) :: rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K
Expand Down Expand Up @@ -908,10 +910,14 @@ contains
end if
#:endif

!$acc parallel loop collapse(3) gang vector default(present) private(alpha_K, alpha_rho_K, Re_K, nRtmp, rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K, R3tmp, rhoyks)
do l = izb, ize
do k = iyb, iye
do j = ixb, ixe
if (present(ix)) then; aix = ix; else; aix%beg = ixb; aix%end = ixe; end if
if (present(iy)) then; aiy = iy; else; aiy%beg = iyb; aiy%end = iye; end if
if (present(iz)) then; aiz = iz; else; aiz%beg = izb; aiz%end = ize; end if

!$acc parallel loop collapse(3) gang vector default(present) copyin(aix, aiy, aiz) private(alpha_K, alpha_rho_K, Re_K, nRtmp, rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K, R3tmp, rhoyks)
do l = aiz%beg, aiz%end
do k = aiy%beg, aiy%end
do j = aix%beg, aix%end
dyn_pres_K = 0d0

!$acc loop seq
Expand Down
27 changes: 21 additions & 6 deletions src/simulation/m_rhs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ module m_rhs
type(int_bounds_info) :: ix, iy, iz
!$acc declare create(ix, iy, iz)

type(int_bounds_info) :: ibounds_interior(1:3)
!$acc declare create(ibounds_interior)

type(int_bounds_info) :: ibounds_wbuffer(1:3)
!$acc declare create(ibounds_wbuffer)

type(int_bounds_info) :: is1, is2, is3
!$acc declare create(is1, is2, is3)

Expand Down Expand Up @@ -236,15 +242,24 @@ contains
integer :: i, j, k, l, id !< Generic loop iterators

! Configuring Coordinate Direction Indexes =========================
ix%beg = -buff_size; iy%beg = 0; iz%beg = 0
ibounds_interior(1)%beg = 0; ibounds_interior(2)%beg = 0; ibounds_interior(3)%beg = 0
ibounds_interior(1)%end = m; ibounds_interior(2)%end = n; ibounds_interior(3)%end = p

if (n > 0) iy%beg = -buff_size; if (p > 0) iz%beg = -buff_size
ibounds_wbuffer(1)%beg = -buff_size
ibounds_wbuffer(2)%beg = 0
ibounds_wbuffer(3)%beg = 0
if (num_dims > 1) then ibounds_wbuffer(2)%beg = -buff_size; end if
if (num_dims > 2) then ibounds_wbuffer(3)%beg = -buff_size; end if

ix%end = m - ix%beg; iy%end = n - iy%beg; iz%end = p - iz%beg
ibounds_wbuffer(1)%end = m + buff_size
ibounds_wbuffer(2)%end = n + buff_size
ibounds_wbuffer(3)%end = p + buff_size

ix = ibounds_interior(1); iy = ibounds_interior(2); iz = ibounds_interior(3)
! ==================================================================

!$acc enter data copyin(ix, iy, iz)
!$acc update device(ix, iy, iz)
!$acc enter data copyin(ibounds_interior, ibounds_wbuffer, ix, iy, iz)
!$acc update device(ibounds_interior, ibounds_wbuffer, ix, iy, iz)

ixt = ix; iyt = iy; izt = iz

Expand Down Expand Up @@ -797,7 +812,7 @@ contains
q_cons_qp%vf, &
q_prim_qp%vf, &
gm_alpha_qp%vf, &
ix, iy, iz)
ibounds_interior(1), ibounds_interior(2), ibounds_interior(3))
call nvtxEndRange

call nvtxStartRange("RHS-MPI")
Expand Down

0 comments on commit 6bed935

Please sign in to comment.