@@ -117,8 +117,9 @@ contains
117117 real (wp) :: rho_Star, E_Star, p_Star, p_K_Star, vel_K_star
118118 real (wp) :: pres_SL, pres_SR, Ms_L, Ms_R
119119 real (wp) :: flux_ene_e
120- real (wp) :: zcoef, pcorr !< low Mach number correction
121- integer :: Re_max, i, j, k, l, q !< Generic loop iterators
120+ real (wp) :: zcoef, pcorr !< low Mach number correction
121+ integer :: Re_max, i, j, k, l, q !< Generic loop iterators
122+ integer :: Re_size_loc1, Re_size_loc2 !< host copy of Re_size; amdflang reads the declare- target original stale cross- TU
122123 ! Populating the buffers of the left and right Riemann problem states variables, based on the choice of boundary conditions
123124
124125 call s_populate_riemann_states_variables_buffers(qL_prim_rsx_vf, dqL_prim_dx_vf, dqL_prim_dy_vf, dqL_prim_dz_vf, &
@@ -127,6 +128,7 @@ contains
127128 ! Reshaping inputted data based on dimensional splitting direction
128129
129130 call s_initialize_riemann_solver(flux_src_vf, norm_dir)
131+ Re_size_loc1 = Re_size(1 ); Re_size_loc2 = Re_size(2 )
130132
131133 #:for NORM_DIR, XYZ, STENCIL_VAR, COORDS, X_BND, Y_BND, Z_BND in &
132134 [(1 , ' x' , ' j' , ' {STENCIL_IDX}, k, l' , ' is1' , ' is2' , ' is3' ), &
@@ -147,7 +149,7 @@ contains
147149 & rho_avg, H_avg, c_avg, gamma_avg, ptilde_L, ptilde_R, vel_L_rms, vel_R_rms, &
148150 & vel_avg_rms, vel_L_tmp, vel_R_tmp, Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, &
149151 & alpha_R_sum, rho_Star, E_Star, p_Star, p_K_Star, vel_K_star, s_L, s_R, s_M, s_P, s_S, &
150- & xi_M, xi_P, xi_L, xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP]' )
152+ & xi_M, xi_P, xi_L, xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP]' , firstprivate = ' [Re_size_loc1, Re_size_loc2] ' )
151153 do l = ${Z_BND}$%beg, ${Z_BND}$%end
152154 do k = ${Y_BND}$%beg, ${Y_BND}$%end
153155 do j = ${X_BND}$%beg, ${X_BND}$%end
@@ -229,10 +231,10 @@ contains
229231 do i = 1 , 2
230232 Re_L(i) = dflt_real
231233 Re_R(i) = dflt_real
232- if (Re_size(i ) > 0 ) Re_L(i) = 0._wp
233- if (Re_size(i ) > 0 ) Re_R(i) = 0._wp
234+ if (merge (Re_size_loc1, Re_size_loc2, i == 1 ) > 0 ) Re_L(i) = 0._wp
235+ if (merge (Re_size_loc1, Re_size_loc2, i == 1 ) > 0 ) Re_R(i) = 0._wp
234236 $:GPU_LOOP(parallelism= ' [seq]' )
235- do q = 1 , Re_size(i )
237+ do q = 1 , merge (Re_size_loc1, Re_size_loc2, i == 1 )
236238 Re_L(i) = qL_prim_rsx_vf(${SF(' ' )}$, eqn_idx%E + Re_idx(i, q))/ Res_gs(i, q) + Re_L(i)
237239 Re_R(i) = qR_prim_rsx_vf(${SF(' + 1' )}$, eqn_idx%E + Re_idx(i, q))/ Res_gs(i, &
238240 & q) + Re_R(i)
@@ -782,7 +784,7 @@ contains
782784 & Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, s_L, s_R, s_M, s_P, s_S, xi_M, &
783785 & xi_P, xi_L, xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP, nbub_L, nbub_R, PbwR3Lbar, PbwR3Rbar, &
784786 & R3Lbar, R3Rbar, R3V2Lbar, R3V2Rbar, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, &
785- & Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]' )
787+ & Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]' , firstprivate = ' [Re_size_loc1, Re_size_loc2] ' )
786788 do l = ${Z_BND}$%beg, ${Z_BND}$%end
787789 do k = ${Y_BND}$%beg, ${Y_BND}$%end
788790 do j = ${X_BND}$%beg, ${X_BND}$%end
@@ -851,11 +853,11 @@ contains
851853 Re_L(i) = dflt_real
852854 Re_R(i) = dflt_real
853855
854- if (Re_size(i ) > 0 ) Re_L(i) = 0._wp
855- if (Re_size(i ) > 0 ) Re_R(i) = 0._wp
856+ if (merge (Re_size_loc1, Re_size_loc2, i == 1 ) > 0 ) Re_L(i) = 0._wp
857+ if (merge (Re_size_loc1, Re_size_loc2, i == 1 ) > 0 ) Re_R(i) = 0._wp
856858
857859 $:GPU_LOOP(parallelism= ' [seq]' )
858- do q = 1 , Re_size(i )
860+ do q = 1 , merge (Re_size_loc1, Re_size_loc2, i == 1 )
859861 Re_L(i) = (1._wp - qL_prim_rsx_vf(${SF(' ' )}$, eqn_idx%E + Re_idx(i, &
860862 & q)))/ Res_gs(i, q) + Re_L(i)
861863 Re_R(i) = (1._wp - qR_prim_rsx_vf(${SF(' + 1' )}$, eqn_idx%E + Re_idx(i, &
@@ -1179,7 +1181,7 @@ contains
11791181 & vel_R, Re_L, Re_R, alpha_L, alpha_R, s_L, s_R, s_S, vel_avg_rms, pcorr, zcoef, &
11801182 & vel_L_tmp, vel_R_tmp, Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, &
11811183 & tau_e_L, tau_e_R, xi_field_L, xi_field_R, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, G_L, &
1182- & G_R]' , copyin= ' [is1, is2, is3]' )
1184+ & G_R, c_sum_Yi_Phi, flux_ene_e ]' , copyin= ' [is1, is2, is3] ' , firstprivate = ' [Re_size_loc1, Re_size_loc2 ]' )
11831185 do l = ${Z_BND}$%beg, ${Z_BND}$%end
11841186 do k = ${Y_BND}$%beg, ${Y_BND}$%end
11851187 do j = ${X_BND}$%beg, ${X_BND}$%end
@@ -1244,8 +1246,8 @@ contains
12441246 end do
12451247
12461248 Re_max = 0
1247- if (Re_size( 1 ) > 0 ) Re_max = 1
1248- if (Re_size( 2 ) > 0 ) Re_max = 2
1249+ if (Re_size_loc1 > 0 ) Re_max = 1
1250+ if (Re_size_loc2 > 0 ) Re_max = 2
12491251
12501252 if (viscous) then
12511253 $:GPU_LOOP(parallelism= ' [seq]' )
@@ -1254,7 +1256,7 @@ contains
12541256 Re_R(i) = 0._wp
12551257
12561258 $:GPU_LOOP(parallelism= ' [seq]' )
1257- do q = 1 , Re_size(i )
1259+ do q = 1 , merge (Re_size_loc1, Re_size_loc2, i == 1 )
12581260 Re_L(i) = alpha_L(Re_idx(i, q))/ Res_gs(i, q) + Re_L(i)
12591261 Re_R(i) = alpha_R(Re_idx(i, q))/ Res_gs(i, q) + Re_R(i)
12601262 end do
0 commit comments