From 6bed935ecc87a630f0b1a2aa05023712ecfbacd5 Mon Sep 17 00:00:00 2001 From: Henry LE BERRE Date: Sat, 26 Oct 2024 17:46:24 -0400 Subject: [PATCH] Remove Newton solve for T in buffer regions --- src/common/m_variables_conversion.fpp | 14 ++++++++++---- src/simulation/m_rhs.fpp | 27 +++++++++++++++++++++------ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/common/m_variables_conversion.fpp b/src/common/m_variables_conversion.fpp index 427767040..b013e81c6 100644 --- a/src/common/m_variables_conversion.fpp +++ b/src/common/m_variables_conversion.fpp @@ -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 @@ -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 diff --git a/src/simulation/m_rhs.fpp b/src/simulation/m_rhs.fpp index 003d1ddf9..7ece8f5c5 100644 --- a/src/simulation/m_rhs.fpp +++ b/src/simulation/m_rhs.fpp @@ -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) @@ -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 @@ -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")