From b0c446107ecf6540cf48965467f9a5fd4e87cd3d Mon Sep 17 00:00:00 2001
From: Juan Escobar <juan.escobar@aero.obs-mip.fr>
Date: Tue, 21 Sep 2021 17:10:45 +0200
Subject: [PATCH] Juan 21/09/2021:pressurez.f90, temp GPU opti, allocate at
 FIRST_CALL 2D tab

---
 src/ZSOLVER/pressurez.f90 | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/ZSOLVER/pressurez.f90 b/src/ZSOLVER/pressurez.f90
index 2d1146b36..b7221fa4a 100644
--- a/src/ZSOLVER/pressurez.f90
+++ b/src/ZSOLVER/pressurez.f90
@@ -394,10 +394,10 @@ INTEGER         :: IIU,IJU,IKU     ! array sizes in I,J,K
 INTEGER         :: JK              ! loop index on the vertical levels
 INTEGER         :: JI,JJ
 !
-REAL, DIMENSION(SIZE(PDXX,1),SIZE(PDXX,3)) :: ZPABS_S ! local pressure on southern side
-REAL, DIMENSION(SIZE(PDXX,1),SIZE(PDXX,3)) :: ZPABS_N ! local pressure on northern side
-REAL, DIMENSION(SIZE(PDYY,2),SIZE(PDXX,3)) :: ZPABS_E ! local pressure on eastern side
-REAL, DIMENSION(SIZE(PDYY,2),SIZE(PDXX,3)) :: ZPABS_W ! local pressure on western side
+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
 INTEGER :: IINFO_ll,KINFO
 TYPE(LIST_ll), POINTER :: TZFIELDS_ll, TZFIELDS2_ll  ! list of fields to exchange
 !
@@ -413,6 +413,8 @@ INTEGER :: IZMYM_PRHODJ
 LOGICAL :: GWEST,GEAST,GSOUTH,GNORTH
 LOGICAL :: GSOUTH2D,GNORTH2D,GPRVREF0
 !
+LOGICAL, SAVE :: GFIRST_CALL_PRESSUREZ = .TRUE.
+!
 !------------------------------------------------------------------------------
 !-------------------------------------------------------------------------------
 !
@@ -454,6 +456,10 @@ IZMZM_PRHODJ = MNH_ALLOCATE_ZT3D( ZMZM_PRHODJ,IIU,IJU,IKU  )
 IZGZ_M_W     = MNH_ALLOCATE_ZT3D( ZGZ_M_W,IIU,IJU,IKU  )
 IZMYM_PRHODJ = MNH_ALLOCATE_ZT3D( ZMYM_PRHODJ,IIU,IJU,IKU  )
 !
+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
 ZPABS_S(:,:) = 0.
 ZPABS_N(:,:) = 0.
-- 
GitLab