From 8db2792218f0e9b6f69ce6df62965a15da1a7c35 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 18 Nov 2016 11:27:21 +0100
Subject: [PATCH] Philippe 18/11/2016: bug correction: call
 IO_PREPARE_BAKOUT_STRUCT only if program is MESONH + set default values fro
 NBAK/OUT_NUMB to 0

---
 src/MNH/modd_outn.f90 | 2 +-
 src/MNH/set_grid.f90  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/MNH/modd_outn.f90 b/src/MNH/modd_outn.f90
index 531d77413..9f365bfea 100644
--- a/src/MNH/modd_outn.f90
+++ b/src/MNH/modd_outn.f90
@@ -48,7 +48,7 @@ IMPLICIT NONE
 
 TYPE OUT_t
 !
-  INTEGER             :: NBAK_NUMB, NOUT_NUMB ! number of outputs and backups performed by model n
+  INTEGER             :: NBAK_NUMB=0, NOUT_NUMB=0 ! Number of outputs and backups performed by model n
   TYPE(TOUTBAK),DIMENSION(:),POINTER :: TBACKUPN=>NULL(),TOUTPUTN=>NULL()
 ! Lists of the outputs and backups
 !
diff --git a/src/MNH/set_grid.f90 b/src/MNH/set_grid.f90
index 1aca11b48..09476616c 100644
--- a/src/MNH/set_grid.f90
+++ b/src/MNH/set_grid.f90
@@ -516,7 +516,7 @@ KSTOP = NINT(PSEGLEN/PTSTEP)
 !*       2.3    Temporal grid - outputs managment
 !
 ! The output/backups times have been read only by model 1
-IF (KMI == 1) CALL IO_PREPARE_BAKOUT_STRUCT(ISUP,PTSTEP,PSEGLEN)
+IF (CPROGRAM == 'MESONH' .AND. KMI == 1) CALL IO_PREPARE_BAKOUT_STRUCT(ISUP,PTSTEP,PSEGLEN)
 !
 KBAK_NUMB => OUT_MODEL(KMI)%NBAK_NUMB
 KOUT_NUMB => OUT_MODEL(KMI)%NOUT_NUMB
-- 
GitLab