Juan 26/09/2017:for MPPDB_CHECK in SFX correct array dimension
authorESCOBAR Juan <escj@nuwa>
Tue, 26 Sep 2017 08:42:15 +0000 (10:42 +0200)
committerESCOBAR Juan <escj@nuwa>
Tue, 26 Sep 2017 08:42:15 +0000 (10:42 +0200)
src/LIB/SURCOUCHE/src/mode_mppdb.f90
src/SURFEX/init_tebn.F90
src/SURFEX/pgd_cover.F90
src/SURFEX/pgd_flake.F90
src/SURFEX/pgd_teb.F90
src/SURFEX/read_pgd_isban.F90
src/SURFEX/read_pgd_tebn.F90
src/SURFEX/zoom_pgd_cover.F90
src/SURFEX/zoom_pgd_isba.F90
src/SURFEX/zoom_pgd_seaflux.F90
src/SURFEX/zoom_pgd_teb.F90

index 42bff6b..d47454c 100644 (file)
@@ -229,6 +229,8 @@ CONTAINS
        END IF
     END IF !  IF (MPPDB_INTER_COMM == MPI_COMM_NULL)
 
+    CALL MPI_BARRIER  ( MPPDB_INTRA_COMM , ierr )
+
 #endif
   END SUBROUTINE MPPDB_INIT
 
@@ -839,8 +841,8 @@ CONTAINS
       IJU = KYEND-KYOR+1+2*JPHEXT
       KSIZE_FULL = (KXEND-KXOR+1)*(KYEND-KYOR+1)
       IF ( PRESENT(HTYPE) .AND. KSIZE_FULL /= SIZE(YSURF_CUR%U%XCOVER,1) .AND. NHALO /= JPHEXT ) THEN
-        IIU = KXEND-KXOR+1+2*JPHEXT+2*NHALO
-        IJU = KYEND-KYOR+1+2*JPHEXT+2*NHALO
+        !IIU = KXEND-KXOR+1+2*JPHEXT+2*NHALO
+        !IJU = KYEND-KYOR+1+2*JPHEXT+2*NHALO
         KSIZE_FULL = (KXEND-KXOR+1+2*NHALO) * (KYEND-KYOR+1+2*NHALO)
       ENDIF
     ENDIF
@@ -865,7 +867,11 @@ CONTAINS
     ZFIELD2D = 0.
     DO IJ=1+JPHEXT,IJU-JPHEXT
       DO II=1+JPHEXT,IIU-JPHEXT
-        ZFIELD2D(II,IJ) = PTAB_UNPACKED((IJ-JPHEXT-1)*(KXEND-KXOR+1)+II-JPHEXT)
+         IF(PRESENT(HTYPE)) THEN
+            ZFIELD2D(II,IJ) = PTAB_UNPACKED((IJ-JPHEXT-1+NHALO)*(KXEND-KXOR+1+2*NHALO)+II-JPHEXT+NHALO)
+         ELSE
+            ZFIELD2D(II,IJ) = PTAB_UNPACKED((IJ-JPHEXT-1)*(KXEND-KXOR+1)+II-JPHEXT)
+         END IF
       ENDDO
     ENDDO
     !
@@ -967,7 +973,8 @@ CONTAINS
       ZFIELD3D = 0.
       DO IJ=1+JPHEXT,IJU-JPHEXT
         DO II=1+JPHEXT,IIU-JPHEXT
-          ZFIELD3D(II,IJ,:) = PTAB_UNPACKED((IJ-JPHEXT-1)*(KXEND-KXOR+1)+II-JPHEXT,:)
+          !ZFIELD3D(II,IJ,:) = PTAB_UNPACKED((IJ-JPHEXT-1)*(KXEND-KXOR+1)+II-JPHEXT,:)
+         ZFIELD3D(II,IJ,:) = PTAB_UNPACKED((IJ-JPHEXT-1+NHALO)*(KXEND-KXOR+1+2*NHALO)+II-JPHEXT+NHALO,:)
         ENDDO
       ENDDO
     ENDIF
index bf1f94a..4e4481c 100644 (file)
@@ -311,7 +311,7 @@ END SELECT
  CALL READ_PGD_TEB_n(DTCO, U, TM,GCP, &
                      HPROGRAM)
 #ifdef MNH_PARALLEL
- CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"INIT_TEB_n after READ_PGD_TEB_n:XCOVER",PRECISION,ILUOUT, 'TOWN  ',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"INIT_TEB_n after READ_PGD_TEB_n:XCOVER",PRECISION,ILUOUT, 'TOWN  ',SIZE(TM%TOP%XCOVER,2))
 #endif
 !
  CALL END_IO_SURF_n(HPROGRAM)
@@ -324,7 +324,7 @@ ALLOCATE(TM%TOP%XTEB_PATCH(ILU,TM%TOP%NTEB_PATCH))
  CALL CONVERT_TEB(TM%TOP, &
                   TM%TOP%XCOVER,TM%TOP%XTEB_PATCH)
 #ifdef MNH_PARALLEL
- CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"INIT_TEB_n after CONVERT_TEB:XCOVER",PRECISION,ILUOUT, 'TOWN  ',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"INIT_TEB_n after CONVERT_TEB:XCOVER",PRECISION,ILUOUT, 'TOWN  ',SIZE(TM%TOP%XCOVER,2))
 #endif
 !
  CALL SET_SURFEX_FILEIN(HPROGRAM,'PREP') ! restore input file name
@@ -693,7 +693,7 @@ DO JPATCH=1,TM%TOP%NTEB_PATCH
                             HPROGRAM,ILU,ISWB)
 END DO ! end of loop on patches
 #ifdef MNH_PARALLEL
- CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"INIT_TEB_n end:XCOVER",PRECISION,ILUOUT, 'TOWN  ',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"INIT_TEB_n end:XCOVER",PRECISION,ILUOUT, 'TOWN  ',SIZE(TM%TOP%XCOVER,2))
 #endif
 !
 !-------------------------------------------------------------------------------
index 5f76908..3aa1069 100644 (file)
@@ -91,6 +91,10 @@ USE MODD_IO_SURF_LFI, ONLY : CFILEIN_LFI
 !
 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
 USE PARKIND1  ,ONLY : JPRB
+#ifdef MNH_PARALLEL
+USE MODE_MPPDB
+!
+#endif
 !
 IMPLICIT NONE
 !
@@ -286,6 +290,9 @@ ELSE
   WRITE(YFIELD,FMT='(A)') 'covers'
   CALL INTERPOL_FIELD2D(UG, U, &
                         HPROGRAM,ILUOUT,NSIZE,U%XCOVER(:,:),YFIELD)
+#ifdef MNH_PARALLEL
+  CALL MPPDB_CHECK_SURFEX3D(U%XCOVER,"PGD_COVER:XCOVER",PRECISION,ILUOUT,'FULL',SIZE(U%XCOVER,2))
+#endif
 !
 !-------------------------------------------------------------------------------
 !
index 01cb2fb..464b352 100644 (file)
@@ -206,7 +206,7 @@ ALLOCATE(FG%XMESH_SIZE (FG%NDIM))
                 F%LCOVER, F%XCOVER, F%XZS,                   &
                 FG%XLAT, FG%XLON, FG%XMESH_SIZE                 )  
 #ifdef MNH_PARALLEL
- CALL MPPDB_CHECK_SURFEX3D(F%XCOVER,"PGD_FLAKE after PACK_PGD:XCOVER",PRECISION,ILUOUT,'WATER',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(F%XCOVER,"PGD_FLAKE after PACK_PGD:XCOVER",PRECISION,ILUOUT,'WATER',SIZE(F%XCOVER,2))
  CALL MPPDB_CHECK_SURFEX2D(FG%XLAT,"PGD_FLAKE after PACK_PGD:XLAT",PRECISION,ILUOUT,'WATER')
  CALL MPPDB_CHECK_SURFEX2D(FG%XLON,"PGD_FLAKE after PACK_PGD:XLON",PRECISION,ILUOUT,'WATER')
  CALL MPPDB_CHECK_SURFEX2D(FG%XMESH_SIZE,"PGD_FLAKE after PACK_PGD:XMESH_SIZE",PRECISION,ILUOUT,'WATER')
index bcfe371..e3d1e3e 100644 (file)
@@ -163,7 +163,7 @@ ALLOCATE(TM%TG%XMESH_SIZE (TM%TG%NDIM))
                 TM%TOP%LCOVER, TM%TOP%XCOVER, TM%TOP%XZS,  &
                 TM%TG%XLAT, TM%TG%XLON, TM%TG%XMESH_SIZE      )
 #ifdef MNH_PARALLEL  
- CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"PGD_TEB after PACK_PGD:XCOVER",PRECISION,ILUOUT, 'TOWN  ',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"PGD_TEB after PACK_PGD:XCOVER",PRECISION,ILUOUT, 'TOWN  ',SIZE(TM%TOP%XCOVER,2))
  CALL MPPDB_CHECK_SURFEX2D(TM%TG%XLAT,"PGD_TEB after PACK_PGD:XLAT",PRECISION,ILUOUT, 'TOWN  ')
  CALL MPPDB_CHECK_SURFEX2D(TM%TG%XLON,"PGD_TEB after PACK_PGD:XLON",PRECISION,ILUOUT, 'TOWN  ')
  CALL MPPDB_CHECK_SURFEX2D(TM%TG%XMESH_SIZE,"PGD_TEB after PACK_PGD:XMESH_SIZE",PRECISION,ILUOUT, 'TOWN  ')
index 2a0f017..3efc709 100644 (file)
@@ -306,7 +306,7 @@ ALLOCATE(I%XCOVER(IG%NDIM,COUNT(I%LCOVER)))
 #ifdef MNH_PARALLEL
  CALL READ_SURF_COV(&
                     HPROGRAM,'COVER',I%XCOVER(:,:),I%LCOVER,IRESP,HDIR='H')
- CALL MPPDB_CHECK_SURFEX3D(I%XCOVER,"READ_PGD_ISBA_n after READ_SURF:XCOVER",PRECISION,ILUOUT,'NATURE',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(I%XCOVER,"READ_PGD_ISBA_n after READ_SURF:XCOVER",PRECISION,ILUOUT,'NATURE',SIZE(I%XCOVER,2))
 #else
  CALL READ_SURF_COV(&
                     HPROGRAM,'COVER',I%XCOVER(:,:),I%LCOVER,IRESP)
index 665fb41..4cd313d 100644 (file)
@@ -219,7 +219,7 @@ ALLOCATE(TM%TOP%XCOVER(TM%TG%NDIM,COUNT(TM%TOP%LCOVER)))
 #ifdef MNH_PARALLEL
  CALL READ_SURF_COV(&
                     HPROGRAM,'COVER',TM%TOP%XCOVER(:,:),TM%TOP%LCOVER,IRESP,HDIR='H')
- CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"READ_PGD_TEB_n after READ_SURF:XCOVER",PRECISION,ILUOUT, 'TOWN  ',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(TM%TOP%XCOVER,"READ_PGD_TEB_n after READ_SURF:XCOVER",PRECISION,ILUOUT, 'TOWN  ',SIZE(TM%TOP%XCOVER,2))
 #else
  CALL READ_SURF_COV(&
                     HPROGRAM,'COVER',TM%TOP%XCOVER(:,:),TM%TOP%LCOVER,IRESP)
index a32fab0..87b9320 100644 (file)
@@ -229,10 +229,11 @@ IF ( HPROGRAM == 'MESONH' ) THEN
       ICPT1 = ICPT1 + 1
       CALL READ_SURFX2COV_1COV_MNH(YRECFM,INI,JCOVER,ZCOVER1D(:),IRESP,YCOMMENT,'A')
       CALL HOR_INTERPOL_1COV(DTCO, U,GCP,ILUOUT,ZCOVER1D,U%XCOVER(:,ICPT1))
-    CALL MPPDB_CHECK_SURFEX3D(U%XCOVER,"ZOOM_PGD_COVER:XCOVER",PRECISION,ILUOUT,'FULL',JPCOVER)
+
     ENDIF
     !
   ENDDO 
+  CALL MPPDB_CHECK_SURFEX3D(U%XCOVER,"ZOOM_PGD_COVER:XCOVER",PRECISION,ILUOUT,'FULL',SIZE(U%XCOVER,2))
 ENDIF
 DEALLOCATE(ZCOVER1D)
 #else
index 83c6c0a..190416e 100644 (file)
@@ -245,7 +245,7 @@ ALLOCATE(I%XZ0EFFJPDIR(ILU))
                 I%LCOVER, I%XCOVER, I%XZS,                   &
                 IG%XLAT, IG%XLON, IG%XMESH_SIZE, I%XZ0EFFJPDIR    ) 
 #ifdef MNH_PARALLEL
- CALL MPPDB_CHECK_SURFEX3D(I%XCOVER,"ZOOM_PGD_ISBA:XCOVER",PRECISION,ILUOUT,'NATURE',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(I%XCOVER,"ZOOM_PGD_ISBA:XCOVER",PRECISION,ILUOUT,'NATURE',SIZE(I%XCOVER,2))
  CALL MPPDB_CHECK_SURFEX2D(IG%XLAT,"ZOOM_PGD_ISBA:XLAT",PRECISION,ILUOUT,'NATURE')
  CALL MPPDB_CHECK_SURFEX2D(IG%XLON,"ZOOM_PGD_ISBA:XLON",PRECISION,ILUOUT,'NATURE')
  CALL MPPDB_CHECK_SURFEX2D(IG%XMESH_SIZE,"ZOOM_PGD_ISBA:XMESH_SIZE",PRECISION,ILUOUT,'NATURE')
index 11c7219..4333401 100644 (file)
@@ -149,7 +149,7 @@ ALLOCATE(SG%XMESH_SIZE (SG%NDIM))
                 S%XCOVER, S%XZS,                           &
                 SG%XLAT, SG%XLON, SG%XMESH_SIZE                 ) 
 #ifdef MNH_PARALLEL 
- CALL MPPDB_CHECK_SURFEX3D(S%XCOVER,"ZOOM_PGD_SEAFLUX:XCOVER",PRECISION,ILUOUT, 'SEA',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(S%XCOVER,"ZOOM_PGD_SEAFLUX:XCOVER",PRECISION,ILUOUT, 'SEA',SIZE(S%XCOVER,2))
  CALL MPPDB_CHECK_SURFEX2D(SG%XMESH_SIZE,"ZOOM_PGD_SEAFLUX:XMESH_SIZE",PRECISION,ILUOUT, 'SEA')
  CALL MPPDB_CHECK_SURFEX2D(S%XZS,"ZOOM_PGD_SEAFLUX:XZS",PRECISION,ILUOUT, 'SEA')
 #endif
index 0902485..b7ba4f7 100644 (file)
@@ -187,7 +187,7 @@ ALLOCATE(TG%XMESH_SIZE (ILU))
                 TOP%LCOVER, TOP%XCOVER, TOP%XZS,                   &
                 TG%XLAT, TG%XLON, TG%XMESH_SIZE                 )
 #ifdef MNH_PARALLEL
- CALL MPPDB_CHECK_SURFEX3D(TOP%XCOVER,"ZOOM_PGD_TEB:XCOVER",PRECISION,ILUOUT, 'TOWN  ',JPCOVER)
+ CALL MPPDB_CHECK_SURFEX3D(TOP%XCOVER,"ZOOM_PGD_TEB:XCOVER",PRECISION,ILUOUT, 'TOWN  ',SIZE(TOP%XCOVER,2))
  CALL MPPDB_CHECK_SURFEX2D(TG%XLAT,"ZOOM_PGD_TEB:XLAT",PRECISION,ILUOUT, 'TOWN  ')
  CALL MPPDB_CHECK_SURFEX2D(TG%XLON,"ZOOM_PGD_TEB:XLON",PRECISION,ILUOUT, 'TOWN  ')
  CALL MPPDB_CHECK_SURFEX2D(TG%XMESH_SIZE,"ZOOM_PGD_TEB:XMESH_SIZE",PRECISION,ILUOUT, 'TOWN  ')