From b1b4a185242de179bcfb4afcf9095032f0f5a654 Mon Sep 17 00:00:00 2001
From: Juan ESCOBAR <juan.escobar@aero.obs-mip.fr>
Date: Thu, 16 Mar 2023 18:27:49 +0100
Subject: [PATCH] Juan 16/03/2023:ZSOLVER/communication.f90, Cray OPENACC Opt,
 pass ztab* by args + dim in boundary_mnh/_dim

---
 .../communication.f90                         | 62 ++++++++++++-------
 1 file changed, 39 insertions(+), 23 deletions(-)

diff --git a/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90 b/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90
index bb9003ede..77f0f54ee 100644
--- a/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90
+++ b/src/ZSOLVER/tensorproductmultigrid_Source/communication.f90
@@ -697,6 +697,8 @@ contains
     integer :: icompx_max,icompy_max
 
     real , dimension(:,:,:) , pointer , contiguous :: za_st
+
+    integer :: nib,nie,njb,nje,nzb,nze
     
     ! Update Real Boundary for Newman case   u(0) = u(1) , etc ...
 
@@ -728,31 +730,45 @@ contains
     icompx_max = a%icompx_max
     icompy_max = a%icompy_max
 
-    !$acc kernels
-    if ( ix_min == 1 ) then
-       !acc kernels
-       za_st(0,:,:) = za_st(1,:,:)
-       !acc end kernels
-    endif
-    if ( ix_max == n ) then
-       !acc kernels
-       za_st(icompx_max+1,:,:) = za_st(icompx_max,:,:)
-       !acc end kernels
-    endif
-    if ( iy_min == 1 ) then
-       !acc kernels
-       za_st(:,0,:) = za_st(:,1,:)
-       !acc end kernels
-    endif
-    if ( iy_max == n ) then
-       !acc kernels
-       za_st(:,icompy_max+1,:) = za_st(:,icompy_max,:)
-       !acc end kernels
-    endif
-    !$acc end kernels
-   
+    nib = Lbound(za_st,1) ; nie = Ubound(za_st,1)
+    njb = Lbound(za_st,2) ; nje = Ubound(za_st,2)
+    nzb = Lbound(za_st,3) ; nze = Ubound(za_st,3)    
+
+    call boundary_mnh_dim(za_st)
+       
     endif
 
+  contains
+    subroutine boundary_mnh_dim(pza_st)
+      implicit none
+
+      real :: pza_st(nib:nie,njb:nje,nzb:nze)
+
+      !$acc kernels
+      if ( ix_min == 1 ) then
+         !acc kernels
+         pza_st(0,:,:) = pza_st(1,:,:)
+         !acc end kernels
+      endif
+      if ( ix_max == n ) then
+         !acc kernels
+         pza_st(icompx_max+1,:,:) = pza_st(icompx_max,:,:)
+         !acc end kernels
+      endif
+      if ( iy_min == 1 ) then
+         !acc kernels
+         pza_st(:,0,:) = pza_st(:,1,:)
+         !acc end kernels
+      endif
+      if ( iy_max == n ) then
+         !acc kernels
+         pza_st(:,icompy_max+1,:) = pza_st(:,icompy_max,:)
+         !acc end kernels
+      endif
+      !$acc end kernels
+      
+    end subroutine boundary_mnh_dim
+    
   end subroutine boundary_mnh
 !==================================================================
 !  Initiate asynchronous halo exchange
-- 
GitLab