From be9b5564f9eb499962a905dac6ad7308eae2f3cb Mon Sep 17 00:00:00 2001
From: ESCOBAR Juan <escj@nuwa>
Date: Thu, 14 Nov 2013 19:20:31 +0100
Subject: [PATCH] Juan 14/11/2013: change dim I,J,K in PPM_01_Z

---
 MNH/ppm.f90 | 49 +++++++++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/MNH/ppm.f90 b/MNH/ppm.f90
index 08d964d71..2f678f726 100644
--- a/MNH/ppm.f90
+++ b/MNH/ppm.f90
@@ -1337,6 +1337,8 @@ CALL GET_HALO_D(ZFPOS,HDIR="01_Y")
       SUBROUTINE PPM_01_Z(KGRID, PSRC, PCR, PRHO, PTSTEP, PR)
 
   USE MODE_MNH_ZWORK, ONLY : ZT3D, MNH_GET_ZT3D , MNH_REL_ZT3D
+  USE MODE_MNH_ZWORK, ONLY : IIU,IJU,IKU
+
 
   IMPLICIT NONE
 !
@@ -1356,7 +1358,8 @@ INTEGER :: IZQL,IZQR,IZDQ,IZQ6,IZDMQ,IZQL0,IZQR0,IZQ60,IZFPOS,IZFNEG
 
         CALL  MNH_GET_ZT3D(IZQL,IZQR,IZDQ,IZQ6,IZDMQ,IZQL0,IZQR0,IZQ60,IZFPOS,IZFNEG)
 
-        CALL  PPM_01_Z_D(KGRID, PSRC, PCR, PRHO, PTSTEP, PR, &
+        CALL  PPM_01_Z_D(IIU,IJU,IKU, KGRID, &
+                     & PSRC, PCR, PRHO, PTSTEP, PR, &
                      & ZT3D(:,:,:,IZQL),ZT3D(:,:,:,IZQR),ZT3D(:,:,:,IZDQ),ZT3D(:,:,:,IZQ6), &
                      & ZT3D(:,:,:,IZDMQ),ZT3D(:,:,:,IZQL0),ZT3D(:,:,:,IZQR0), ZT3D(:,:,:,IZQ60), &
                      & ZT3D(:,:,:,IZFPOS),ZT3D(:,:,:,IZFNEG) )
@@ -1365,7 +1368,8 @@ INTEGER :: IZQL,IZQR,IZDQ,IZQ6,IZDMQ,IZQL0,IZQR0,IZQ60,IZFPOS,IZFNEG
 
 CONTAINS
 
-        SUBROUTINE  PPM_01_Z_D(KGRID, PSRC, PCR, PRHO, PTSTEP, PR, &
+        SUBROUTINE  PPM_01_Z_D(IIU,IJU,IKU,KGRID, &
+                     & PSRC, PCR, PRHO, PTSTEP, PR, &
                      & ZQL,ZQR,ZDQ,ZQ6,ZDMQ,ZQL0,ZQR0,ZQ60,ZFPOS,ZFNEG)
 !     ########################################################################
 !!
@@ -1394,18 +1398,18 @@ IMPLICIT NONE
 INTEGER,                INTENT(IN)  :: KGRID   ! C grid localisation
 REAL,                   INTENT(IN)  :: PTSTEP  ! Time step 
 !
-REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PSRC    ! variable at t
-REAL, DIMENSION(:,:,:), INTENT(IN)    :: PCR &    ! Courant number
+REAL, DIMENSION(IIU,IJU,IKU), INTENT(INOUT) :: PSRC    ! variable at t
+REAL, DIMENSION(IIU,IJU,IKU), INTENT(IN)    :: PCR &    ! Courant number
                                       ,  PRHO  ! density
 !
 ! output source term
-REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PR
+REAL, DIMENSION(IIU,IJU,IKU), INTENT(INOUT) :: PR
 !$acc declare present (PSRC,PCR,PRHO,PR)
 !
 !*       0.2   Declarations of local variables :
 !
 ! terms used in parabolic interpolation, dmq, qL, qR, dq, q6
-REAL, DIMENSION(SIZE(PCR,1),SIZE(PCR,2),SIZE(PCR,3)) :: &
+REAL, DIMENSION(IIU,IJU,IKU) :: &
                                                       ZQL, ZQR, ZDQ, ZQ6, ZDMQ &
 !
 ! extra variables for the initial guess of parabolae parameters
@@ -1419,8 +1423,9 @@ INTEGER:: IKB    ! Begining useful area in x,y,z directions
 INTEGER:: IKE    ! End useful area in x,y,z directions
 !
 !JUAN ACC
-INTEGER                          :: I,J,K ,IIU,IJU,IKU
-LOGICAL                          :: GWEST , GEAST
+INTEGER                          :: IIU,IJU,IKU
+!
+INTEGER                          :: I,J,K 
 !
 ! inline shuman with macro 
 #define dif2z(DQ,PQ) DQ(:,:,IKB:IKE) = 0.5*(PQ(:,:,IKB+1:IKE+1) - PQ(:,:,IKB-1:IKE-1)) ; \
@@ -1437,15 +1442,15 @@ DQ(:,:,IKE+1) = -DQ(:,:,IKE) ! DIF2Z(DQ,PQ)
 !
 IKB = 1 + JPVEXT
 IKE = SIZE(PSRC,3) - JPVEXT
-
-IIU=size(psrc,1)
-IJU=size(psrc,2)
-IKU=size(psrc,3)
+!!$
+!!$IIU=size(psrc,1)
+!!$IJU=size(psrc,2)
+!!$IKU=size(psrc,3)
 !
 #define JUAN_ACC_01_Z
 #ifdef JUAN_ACC_01_Z
-!$acc data 
-! create/mirror (ZDMQ,ZQL0,ZQR0,ZDQ,ZQ60,ZQL,ZQR,ZQ6,ZFPOS,ZFNEG)
+!acc data 
+! create/mirror (ZDMQ,ZQL0,ZQR0,ZDQ,ZQ60,ZQL,ZQR,ZQ6,ZFPOS,ZFNEG) 
 !$acc kernels  
 #endif
 !
@@ -1495,31 +1500,31 @@ ZQ60 = 6.0*(PSRC - 0.5*(ZQL0 + ZQR0))
 !
 ! initialize final parabolae parameters
 !
-ZQL(:,:,:) = ZQL0
+ZQL = ZQL0
 ZQR = ZQR0
 ZQ6 = ZQ60 
 !
 ! eliminate over and undershoots and create qL and qR as in Lin96
 !
    WHERE ( ZDMQ == 0.0 )
-      ZQL(:,:,:) = PSRC
+      ZQL = PSRC
       ZQR = PSRC
       ZQ6 = 0.0
    END WHERE
    WHERE ( ( ZDMQ /= 0.0 ) .AND. ( ZQ60*ZDQ < -(ZDQ)**2 ) )
       ZQ6 = 3.0*(ZQL0 - PSRC)
       ZQR = ZQL0 - ZQ6
-      ZQL(:,:,:) = ZQL0
+      ZQL = ZQL0
    END WHERE
    WHERE ( ( ZDMQ /= 0.0 ) .AND. ( ZQ60*ZDQ > (ZDQ)**2 ) )
       ZQ6 = 3.0*(ZQR0 - PSRC)
-      ZQL(:,:,:) = ZQR0 - ZQ6
+      ZQL = ZQR0 - ZQ6
       ZQR = ZQR0
    END WHERE
 !
 ! recalculate coefficients of the parabolae
 !
-ZDQ = ZQR - ZQL(:,:,:)
+ZDQ = ZQR - ZQL
 !
 ! and finally calculate fluxes for the advection
 !
@@ -1547,15 +1552,15 @@ ZFNEG(:,:,IKE+1) = (ZQR(:,:,IKE)-PSRC(:,:,IKE+1))*PCR(:,:,IKE+1) + &
 !
 
     mzm(ZQL,PRHO)
-    ZQR =  PCR* ZQL(:,:,:)*( ZFPOS(:,:,:)*(0.5+SIGN(0.5,PCR)) + ZFNEG*(0.5-SIGN(0.5,PCR)) ) 
+    ZQR =  PCR* ZQL*( ZFPOS*(0.5+SIGN(0.5,PCR)) + ZFNEG*(0.5-SIGN(0.5,PCR)) ) 
     dzf(PR,ZQR)
 
-!!$PR = DZF( PCR*MZM(PRHO)*( ZFPOS(:,:,:)*(0.5+SIGN(0.5,PCR)) + & 
+!!$PR = DZF( PCR*MZM(PRHO)*( ZFPOS*(0.5+SIGN(0.5,PCR)) + & 
 !!$                          ZFNEG*(0.5-SIGN(0.5,PCR)) ) )
 
 #ifdef JUAN_ACC_01_Z
 !$acc end kernels
-!$acc end data 
+!acc end data 
 #endif
 
 CALL GET_HALO_D(PR)
-- 
GitLab