diff --git a/src/ZSOLVER/pressurez.f90 b/src/ZSOLVER/pressurez.f90 index 09c68f1a645addebfca34e9333fcfebbd75a8ad4..38cc006d04519e1be335f0c4c104d751814bdfe1 100644 --- a/src/ZSOLVER/pressurez.f90 +++ b/src/ZSOLVER/pressurez.f90 @@ -404,10 +404,10 @@ INTEGER :: IIU,IJU,IKU ! array sizes in I,J,K INTEGER :: JK ! loop index on the vertical levels INTEGER :: JI,JJ ! -REAL, SAVE , ALLOCATABLE , DIMENSION(:,:) :: ZPABS_S ! local pressure on southern side -REAL, SAVE , ALLOCATABLE , DIMENSION(:,:) :: ZPABS_N ! local pressure on northern side -REAL, SAVE , ALLOCATABLE , DIMENSION(:,:) :: ZPABS_E ! local pressure on eastern side -REAL, SAVE , ALLOCATABLE , DIMENSION(:,:) :: ZPABS_W ! local pressure on western side +REAL, SAVE , POINTER, CONTIGUOUS , DIMENSION(:,:) :: ZPABS_S ! local pressure on southern side +REAL, SAVE , POINTER, CONTIGUOUS , DIMENSION(:,:) :: ZPABS_N ! local pressure on northern side +REAL, SAVE , POINTER, CONTIGUOUS , DIMENSION(:,:) :: ZPABS_E ! local pressure on eastern side +REAL, SAVE , POINTER, CONTIGUOUS , DIMENSION(:,:) :: ZPABS_W ! local pressure on western side INTEGER :: IINFO_ll,KINFO TYPE(LIST_ll), POINTER :: TZFIELDS_ll, TZFIELDS2_ll ! list of fields to exchange ! @@ -448,7 +448,7 @@ IF (MPPDB_INITIALIZED) THEN CALL MPPDB_CHECK(PRVREF,"PRESSUREZ beg:PRVREF") CALL MPPDB_CHECK(PEXNREF,"PRESSUREZ beg:PEXNREF") CALL MPPDB_CHECK(PBFB,"PRESSUREZ beg:PBFB") - CALL MPPDB_CHECK(PBF_SXP2_YP1_Z,"PRESSUREZ beg:PBF_SXP2_YP1_Z") + !/!\ don't work not of size NX/NY/NZ CALL MPPDB_CHECK(PBF_SXP2_YP1_Z,"PRESSUREZ beg:PBF_SXP2_YP1_Z") !Check all INOUT arrays CALL MPPDB_CHECK(PRUS,"PRESSUREZ beg:PRUS") CALL MPPDB_CHECK(PRVS,"PRESSUREZ beg:PRVS") @@ -489,6 +489,7 @@ GPRVREF0 = ( SIZE(PRVREF,1) == 0 ) ALLOCATE( ZDV_SOURCE(IIU, IJU, IKU) ) ALLOCATE( ZTHETAV (IIU, IJU, IKU) ) ALLOCATE( ZPHIT (IIU, IJU, IKU) ) +ALLOCATE( ZPABS_S(IIU,IKU),ZPABS_N(IIU,IKU),ZPABS_E(IJU,IKU),ZPABS_W(IJU,IKU)) #else !Pin positions in the pools of MNH memory CALL MNH_MEM_POSITION_PIN() @@ -496,7 +497,12 @@ CALL MNH_MEM_POSITION_PIN() CALL MNH_MEM_GET( ZDV_SOURCE, IIU, IJU, IKU ) CALL MNH_MEM_GET( ZTHETAV, IIU, IJU, IKU ) CALL MNH_MEM_GET( ZPHIT, IIU, IJU, IKU ) - +! +CALL MNH_MEM_GET( ZPABS_S, IIU,IKU ) +CALL MNH_MEM_GET( ZPABS_N, IIU,IKU ) +CALL MNH_MEM_GET( ZPABS_E, IJU,IKU ) +CALL MNH_MEM_GET( ZPABS_W, IJU,IKU ) +! CALL MNH_MEM_GET( ZPRHODJ, IIU, IJU, IKU ) CALL MNH_MEM_GET( ZMXM_PRHODJ, IIU, IJU, IKU ) CALL MNH_MEM_GET( ZMZM_PRHODJ, IIU, IJU, IKU ) @@ -504,11 +510,7 @@ CALL MNH_MEM_GET( ZGZ_M_W, IIU, IJU, IKU ) CALL MNH_MEM_GET( ZMYM_PRHODJ, IIU, IJU, IKU ) #endif ! -IF (GFIRST_CALL_PRESSUREZ) THEN - GFIRST_CALL_PRESSUREZ = .FALSE. - ALLOCATE ( ZPABS_S(IIU,IKU),ZPABS_N(IIU,IKU),ZPABS_E(IJU,IKU),ZPABS_W(IJU,IKU)) -END IF -!$acc kernels +!$acc kernels ZPABS_S(:,:) = 0. ZPABS_N(:,:) = 0. ZPABS_E(:,:) = 0. @@ -540,9 +542,11 @@ IF (LIBM) THEN WHERE(XIBM_LS(:,:,:,4).GT.-XIBM_EPSI) PRWS(:,:,:) = 0. ENDIF ! -CALL MPPDB_CHECK3D(PRUS,"pressurez 4-before update_halo_ll::PRUS",PRECISION) -CALL MPPDB_CHECK3D(PRVS,"pressurez 4-before update_halo_ll::PRVS",PRECISION) -CALL MPPDB_CHECK3D(PRWS,"pressurez 4-before update_halo_ll::PRWS",PRECISION) +IF (MPPDB_INITIALIZED) THEN + CALL MPPDB_CHECK3D(PRUS,"pressurez 4-before update_halo_ll::PRUS",PRECISION) + CALL MPPDB_CHECK3D(PRVS,"pressurez 4-before update_halo_ll::PRVS",PRECISION) + CALL MPPDB_CHECK3D(PRWS,"pressurez 4-before update_halo_ll::PRWS",PRECISION) +END IF #ifndef MNH_OPENACC NULLIFY(TZFIELDS_ll) CALL ADD3DFIELD_ll( TZFIELDS_ll, PRUS, 'PRESSUREZ::PRUS' ) @@ -555,9 +559,11 @@ CALL GET_HALO_D(PRUS,HNAME='PRESSUREZ::PRUS' ) CALL GET_HALO_D(PRVS,HNAME='PRESSUREZ::PRVS' ) CALL GET_HALO_D(PRWS,HNAME='PRESSUREZ::PRWS' ) #endif -CALL MPPDB_CHECK3D(PRUS,"pressurez 4-after update_halo_ll::PRUS",PRECISION) -CALL MPPDB_CHECK3D(PRVS,"pressurez 4-after update_halo_ll::PRVS",PRECISION) -CALL MPPDB_CHECK3D(PRWS,"pressurez 4-after update_halo_ll::PRWS",PRECISION) +IF (MPPDB_INITIALIZED) THEN + CALL MPPDB_CHECK3D(PRUS,"pressurez 4-after update_halo_ll::PRUS",PRECISION) + CALL MPPDB_CHECK3D(PRVS,"pressurez 4-after update_halo_ll::PRVS",PRECISION) + CALL MPPDB_CHECK3D(PRWS,"pressurez 4-after update_halo_ll::PRWS",PRECISION) +END IF ! CALL GDIV(HLBCX,HLBCY,PDXX,PDYY,PDZX,PDZY,PDZZ,PRUS,PRVS,PRWS,ZDV_SOURCE) ! @@ -726,6 +732,10 @@ END IF !* 6. ADD THE PRESSURE GRADIENT TO THE SOURCES ! ---------------------------------------- ! +IF (MPPDB_INITIALIZED) THEN + CALL MPPDB_CHECK(ZPHIT,"PRESSUREZ after zsolv :ZPHIT") +END IF +! IF ( GWEST ) THEN !$acc kernels async ZPHIT(IIB-1,:,IKB-1) = ZPHIT(IIB,:,IKB-1) @@ -831,7 +841,9 @@ IF( GEAST ) THEN END IF !$acc wait ! -CALL MPPDB_CHECK3DM("before MXM PRESSUREZ :PRU/V/WS",PRECISION,PRUS,PRVS,PRWS) +IF (MPPDB_INITIALIZED) THEN + CALL MPPDB_CHECK3DM("before MXM PRESSUREZ :PRU/V/WS",PRECISION,PRUS,PRVS,PRWS) +END IF IF(CEQNSYS=='MAE' .OR. CEQNSYS=='DUR') THEN #ifndef MNH_OPENACC PRUS = PRUS - MXM(PRHODJ * XCPD * ZTHETAV) * ZDV_SOURCE @@ -902,7 +914,9 @@ IF(.NOT. L2D) THEN END IF !$acc wait ! - CALL MPPDB_CHECK3DM("before MYM PRESSUREZ :PRU/V/WS",PRECISION,PRUS,PRVS,PRWS) +IF (MPPDB_INITIALIZED) THEN + CALL MPPDB_CHECK3DM("before MYM PRESSUREZ :PRU/V/WS",PRECISION,PRUS,PRVS,PRWS) +END IF IF(CEQNSYS=='MAE' .OR. CEQNSYS=='DUR') THEN #ifndef MNH_OPENACC PRVS = PRVS - MYM(PRHODJ * XCPD * ZTHETAV) * ZDV_SOURCE @@ -961,6 +975,7 @@ ELSEIF( CEQNSYS=='MAE' .OR. CEQNSYS=='LHE' ) THEN ZDV_SOURCE=ZDV_SOURCE/PRHODJ*PRHODREF END IF ! +!$acc update host(ZDV_SOURCE) ZMAXVAL=MAX_ll(ABS(ZDV_SOURCE),IINFO_ll) !JUANZ IF (PRESENT(PRESIDUAL)) PRESIDUAL = ZMAXVAL @@ -1075,7 +1090,9 @@ IF ((ZMAX_ll > 1.E-12) .AND. KTCOUNT >0 ) THEN #else CALL GET_HALO_D( PPABST,HNAME='PRESSUREZ::PPABST' ) #endif - +IF (MPPDB_INITIALIZED) THEN + CALL MPPDB_CHECK(PPABST,"PRESSUREZ after get halo_d :PPABST") +END IF ! IF( GWEST ) THEN !$acc kernels async @@ -1117,6 +1134,7 @@ END IF deallocate( ZDV_SOURCE ) deallocate( ZTHETAV ) deallocate( ZPHIT ) +deallocate( ZPABS_S,ZPABS_N,ZPABS_E,ZPABS_W ) #else !Release all memory allocated with MNH_MEM_GET calls since last call to MNH_MEM_POSITION_PIN CALL MNH_MEM_RELEASE()