From a0e4c900b6f60a68b1f8dc9df1b0748d17fcefbb Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 19 Jan 2023 14:45:56 +0100
Subject: [PATCH] Philippe 19/01/2023: backward compatibility fix: set DRYMASSS
 to 0. if not found in restart file (needed to restart with pre 5.5.1 backup
 files)

---
 src/MNH/read_field.f90 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/MNH/read_field.f90 b/src/MNH/read_field.f90
index 1a40d1797..ce75a05f3 100644
--- a/src/MNH/read_field.f90
+++ b/src/MNH/read_field.f90
@@ -1,4 +1,4 @@
-!MNH_LIC Copyright 1994-2022 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 !MNH_LIC for details. version 1.
@@ -1007,7 +1007,13 @@ CALL INI_LB(TPINIFILE,GLSOURCE,ISV,                                   &
 !
 CALL IO_Field_read(TPINIFILE,'DRYMASST',PDRYMASST) ! dry mass
 IF (CCONF=='RESTA') THEN
-  CALL IO_Field_read(TPINIFILE,'DRYMASSS',PDRYMASSS) ! dry mass tendency
+  CALL IO_Field_read(TPINIFILE,'DRYMASSS',PDRYMASSS,IRESP) ! dry mass tendency
+
+  ! DRYMASSS was not written in backup files before MesoNH 5.5.1
+  IF ( IRESP /= 0 ) THEN
+    CALL PRINT_MSG( NVERB_WARNING, 'IO', 'READ_FIELD', 'PDRYMASSS set to 0 for ' // TRIM( TZFIELD%CMNHNAME ) )
+    PDRYMASSS = 0.
+  END IF
 ELSE
   PDRYMASSS=XUNDEF   ! should not be used
 END IF
-- 
GitLab