From 4fec71f27c3fcb70b33e43d4e374c7ad8c737977 Mon Sep 17 00:00:00 2001
From: ESCOBAR Juan <escj@nuwa>
Date: Sat, 23 Nov 2013 19:02:36 +0100
Subject: [PATCH] Juan 23/11/2013; ZTAB et I,J,K dim in advecuvw_4th

---
 MNH/advecuvw_4th.f90   | 88 +++++++++++++++++++++++++++++++++++-------
 MNH/mode_mnh_zwork.f90 |  2 +-
 2 files changed, 75 insertions(+), 15 deletions(-)

diff --git a/MNH/advecuvw_4th.f90 b/MNH/advecuvw_4th.f90
index 359e6fb28..43e1ab7a5 100644
--- a/MNH/advecuvw_4th.f90
+++ b/MNH/advecuvw_4th.f90
@@ -37,7 +37,62 @@ END MODULE MODI_ADVECUVW_4TH
 !
 !     ######################################################################
       SUBROUTINE ADVECUVW_4TH ( HLBCX, HLBCY, PRUCT, PRVCT, PRWCT,           &
-                                PUT, PVT, PWT, PRUS, PRVS, PRWS, TPHALO2LIST )              
+                                PUT, PVT, PWT, PRUS, PRVS, PRWS, TPHALO2LIST ) 
+
+        USE MODD_ARGSLIST_ll, ONLY : HALO2LIST_ll
+        USE MODE_MNH_ZWORK  , ONLY : ZT3D, MNH_GET_ZT3D , MNH_REL_ZT3D 
+        USE MODE_MNH_ZWORK, ONLY : IIU,IJU,IKU
+
+IMPLICIT NONE
+!
+!*       0.1   Declarations of dummy arguments :
+!
+!
+CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX ! X direction LBC type
+CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCY ! Y direction LBC type
+!
+!
+REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRUCT  ! contravariant
+REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRVCT  !  components
+REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRWCT  ! of momentum
+!$acc declare present(PRUCT,PRVCT,PRWCT)
+!
+REAL, DIMENSION(:,:,:),   INTENT(IN) :: PUT, PVT, PWT        ! Variables at t
+!$acc declare pcopyin(PUT,PVT,PWT)
+!
+REAL, DIMENSION(:,:,:),   INTENT(INOUT) :: PRUS, PRVS, PRWS     ! Source terms
+!$acc declare pcopy(PRUS, PRVS, PRWS)
+!
+TYPE(HALO2LIST_ll), POINTER :: TPHALO2LIST ! list for diffusion
+!
+!*       0.2   Declarations of local variables :
+!
+INTEGER:: IIB,IJB        ! Begining useful area  in x,y,z directions
+INTEGER:: IIE,IJE        ! End useful area in x,y,z directions
+!
+TYPE(HALO2LIST_ll), POINTER :: TZHALO2LIST
+
+INTEGER   :: IZMEANX, IZMEANY, IZTEMP1,IZTEMP2,IZTEMP3,IZTEMP4 
+
+         CALL  MNH_GET_ZT3D(IZMEANX, IZMEANY,IZTEMP1,IZTEMP2,IZTEMP3,IZTEMP4 )
+
+         CALL  ADVECUVW_4TH_D ( IIU,IJU,IKU,HLBCX, HLBCY, &
+                              & PRUCT, PRVCT, PRWCT,        &
+                              & PUT, PVT, PWT, PRUS, PRVS, PRWS, TPHALO2LIST, & 
+                              & ZT3D(:,:,:,IZMEANX),ZT3D(:,:,:,IZMEANY), & 
+                              & ZT3D(:,:,:,IZTEMP1),ZT3D(:,:,:,IZTEMP2), & 
+                              & ZT3D(:,:,:,IZTEMP3),ZT3D(:,:,:,IZTEMP4)  & 
+                              & )
+
+         CALL  MNH_REL_ZT3D(IZMEANX, IZMEANY, IZTEMP1,IZTEMP2,IZTEMP3,IZTEMP4)
+
+CONTAINS
+
+      SUBROUTINE ADVECUVW_4TH_D ( IIU,IJU,IKU,HLBCX, HLBCY, &
+                              & PRUCT, PRVCT, PRWCT,           &
+                              & PUT, PVT, PWT, PRUS, PRVS, PRWS, TPHALO2LIST , &
+                              & ZMEANX, ZMEANY, ZTEMP1,ZTEMP2,ZTEMP3,ZTEMP4 ) 
+         
 !     ######################################################################
 !
 !!****  *ADVECUVW_4TH * - routine to compute the 4th order centered
@@ -164,19 +219,20 @@ IMPLICIT NONE
 !*       0.1   Declarations of dummy arguments :
 !
 !
+INTEGER                        , INTENT(IN) :: IIU,IJU,IKU
 CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX ! X direction LBC type
 CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCY ! Y direction LBC type
 !
 !
-REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRUCT  ! contravariant
-REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRVCT  !  components
-REAL, DIMENSION(:,:,:),   INTENT(IN)    :: PRWCT  ! of momentum
+REAL, DIMENSION(IIU,IJU,IKU),   INTENT(IN)    :: PRUCT  ! contravariant
+REAL, DIMENSION(IIU,IJU,IKU),   INTENT(IN)    :: PRVCT  !  components
+REAL, DIMENSION(IIU,IJU,IKU),   INTENT(IN)    :: PRWCT  ! of momentum
 !$acc declare present(PRUCT,PRVCT,PRWCT)
 !
-REAL, DIMENSION(:,:,:),   INTENT(IN) :: PUT, PVT, PWT        ! Variables at t
+REAL, DIMENSION(IIU,IJU,IKU),   INTENT(IN) :: PUT, PVT, PWT        ! Variables at t
 !$acc declare pcopyin(PUT,PVT,PWT)
 !
-REAL, DIMENSION(:,:,:),   INTENT(INOUT) :: PRUS, PRVS, PRWS     ! Source terms
+REAL, DIMENSION(IIU,IJU,IKU),   INTENT(INOUT) :: PRUS, PRVS, PRWS     ! Source terms
 !$acc declare pcopy(PRUS, PRVS, PRWS)
 !
 TYPE(HALO2LIST_ll), POINTER :: TPHALO2LIST ! list for diffusion
@@ -189,13 +245,13 @@ INTEGER:: IIE,IJE        ! End useful area in x,y,z directions
 TYPE(HALO2LIST_ll), POINTER :: TZHALO2LIST
 !
 INTEGER :: IGRID ! localisation on the model grid
-REAL, DIMENSION(SIZE(PUT,1),SIZE(PUT,2),SIZE(PUT,3)) :: ZMEANX, ZMEANY ! fluxes
-!acc declare create(ZMEANX, ZMEANY)
 !
-REAL, DIMENSION(SIZE(PUT,1),SIZE(PUT,2),SIZE(PUT,3)) :: ZTEMP1,ZTEMP2,ZTEMP3,ZTEMP4
-!$acc declare create(ZTEMP1,ZTEMP2,ZTEMP3,ZTEMP4) 
+REAL, DIMENSION(IIU,IJU,IKU) :: ZMEANX, ZMEANY ! fluxes
+!acc declare present(ZMEANX, ZMEANY)
+!
+REAL, DIMENSION(IIU,IJU,IKU) :: ZTEMP1,ZTEMP2,ZTEMP3,ZTEMP4
+!$acc declare present(ZTEMP1,ZTEMP2,ZTEMP3,ZTEMP4) 
 
-INTEGER                                              :: IIU,IJU,IKU
 INTEGER                                              :: II
 
 !
@@ -221,11 +277,12 @@ INTEGER                                              :: II
 !*       1.     COMPUTES THE DOMAIN DIMENSIONS
 !
 !               ------------------------------
-!$acc data  create(ZMEANX, ZMEANY)
+!$acc data 
+! create(ZMEANX, ZMEANY)
 !
 CALL GET_INDICE_ll(IIB,IJB,IIE,IJE)
-CALL GET_DIM_EXT_ll('B',IIU,IJU)     
-IKU=SIZE(PUT,3)
+!!$CALL GET_DIM_EXT_ll('B',IIU,IJU)     
+!!$IKU=SIZE(PUT,3)
 !
 !-------------------------------------------------------------------------------
 !
@@ -377,4 +434,7 @@ IF (LBUDGET_W)  CALL BUDGET (PRWS,3,'ADVZ_BU_RW')
 !$acc end data 
 !-------------------------------------------------------------------------------
 !
+END SUBROUTINE ADVECUVW_4TH_D
+
 END SUBROUTINE ADVECUVW_4TH
+
diff --git a/MNH/mode_mnh_zwork.f90 b/MNH/mode_mnh_zwork.f90
index 15c959c44..7296556c2 100644
--- a/MNH/mode_mnh_zwork.f90
+++ b/MNH/mode_mnh_zwork.f90
@@ -21,7 +21,7 @@ MODULE MODE_MNH_ZWORK
   REAL, SAVE, ALLOCATABLE , DIMENSION(:,:,:) :: ZUNIT3D
   !$acc declare mirror(ZUNIT3D)
 
-  INTEGER                                   :: JPMAX_T3D = 25
+  INTEGER                                   :: JPMAX_T3D = 35
   INTEGER , ALLOCATABLE, DIMENSION (:)      :: NT3D_POOL
   INTEGER                                   :: NT3D_TOP , NT3D_TOP_MAX = 0  
   REAL    , ALLOCATABLE, DIMENSION(:,:,:,:) , TARGET :: ZT3D_A1,ZT3D_A2,ZT3D_A3,ZT3D_A4
-- 
GitLab