From 38f28d3f7b7e6c3c1e29112620110dce09c61f7e Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 28 Aug 2020 09:53:37 +0200
Subject: [PATCH] Philippe 28/08/2020: budgets: bugfix: allocate ZWORK6 at the
 correct dimension (3rd one)

(cherry picked from commit 7259278fe7f81754d0a20bb3986896895a822790)
(cherry picked from commit f79456a78150a44a29441e5cfd38c9862f5c251e)
---
 src/MNH/mode_les_diachro.f90 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/MNH/mode_les_diachro.f90 b/src/MNH/mode_les_diachro.f90
index 536ab8fc2..e681a460c 100644
--- a/src/MNH/mode_les_diachro.f90
+++ b/src/MNH/mode_les_diachro.f90
@@ -412,7 +412,8 @@ SUBROUTINE LES_TIME_AVG(PWORK6,tpdates,KRESP)
 ! this routine computes time averaging
 !
 ! Modifications:
-!  03/2018     (P.Wautelet)   replace ADD_FORECAST_TO_DATE by DATETIME_CORRECTDATE
+!  P. Wautelet    03/2018: replace ADD_FORECAST_TO_DATE by DATETIME_CORRECTDATE
+!  P. Wautelet 28/08/2020: bugfix: allocate ZWORK6 at the correct dimension (3rd one)
 !
 use modd_time,      only: tdtseg
 USE MODD_LES
@@ -456,7 +457,7 @@ END IF
 deallocate( tpdates )
 !
 allocate( tpdates( iavg ) )
-ALLOCATE (ZWORK6(SIZE(PWORK6,1),SIZE(PWORK6,2),NLES_K,IAVG,SIZE(PWORK6,5),SIZE(PWORK6,6)))
+ALLOCATE (ZWORK6(SIZE(PWORK6,1),SIZE(PWORK6,2),SIZE(PWORK6,3),IAVG,SIZE(PWORK6,5),SIZE(PWORK6,6)))
 !
 ZWORK6(:,:,:,:,:,:) = 0.
 !
@@ -501,7 +502,7 @@ DO JAVG=1,IAVG
 END DO
 !
 DEALLOCATE(PWORK6)
-ALLOCATE(PWORK6(SIZE(ZWORK6,1),SIZE(ZWORK6,2),NLES_K,IAVG,SIZE(ZWORK6,5),SIZE(ZWORK6,6)))
+ALLOCATE(PWORK6(SIZE(ZWORK6,1),SIZE(ZWORK6,2),SIZE(ZWORK6,3),IAVG,SIZE(ZWORK6,5),SIZE(ZWORK6,6)))
 PWORK6 = ZWORK6
 DEALLOCATE(ZWORK6)
 
-- 
GitLab