From f37206394880f4e4e1c2dcdd27e5a66cd9daab95 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@cnrs.fr> Date: Mon, 16 Sep 2024 11:09:58 +0200 Subject: [PATCH] Philippe 16/09/2024: IO: remove unnecessary .des files --- src/LIB/SURCOUCHE/src/mode_io_file.f90 | 11 +++++++---- src/MNH/mnhget_desfmn.f90 | 8 ++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/LIB/SURCOUCHE/src/mode_io_file.f90 b/src/LIB/SURCOUCHE/src/mode_io_file.f90 index d3a539dff..3841a5ceb 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_file.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_file.f90 @@ -40,6 +40,7 @@ ! P. Wautelet 01/10/2020: bugfix: add missing initializations for IRESP ! P. Wautelet 19/08/2022: bugfix: IO_File_check_format_exist: broadcast cformat if changed ! P. Wautelet 13/01/2023: IO_File_close: add optional dummy argument TPDTMODELN to force written model time +! P. Wautelet 16/09/2024: remove unnecessary .des files !----------------------------------------------------------------- module mode_io_file @@ -161,8 +162,9 @@ SELECT CASE(TPFILE%CTYPE) CASE ('MNH', 'MNHBACKUP', 'MNHDIACHRONIC', 'MNHDIAG', 'MNHOUTPUT', 'PGD') if (.not.GCONFIO) CALL PRINT_MSG(NVERB_FATAL,'IO','IO_File_open','IO_Config_set must be called before IO_File_open') - !Do not open '.des' file if OUTPUT or if is a "subfile" (tmainfile is associated) - IF(TPFILE%CTYPE/='MNHOUTPUT' .AND. CPROGRAM/='LFICDF' .and. .not.associated(tpfile%tmainfile) ) THEN + !Associate a '.des' file if useful and not if is a "subfile" (tmainfile is associated) + IF ( ( TPFILE%CTYPE=='MNH' .OR. TPFILE%CTYPE=='MNHBACKUP' .OR. TPFILE%CTYPE=='MNHDIACHRONIC' ) & + .and. .not.associated(tpfile%tmainfile) ) THEN !OOLD=T because the file may already be in the list CALL IO_File_add2list(TZFILE_DES,TRIM(TPFILE%CNAME)//'.des','DES',TPFILE%CMODE,TPDATAFILE=TPFILE,OOLD=.TRUE.) CALL IO_File_open(TZFILE_DES,HPROGRAM_ORIG=HPROGRAM_ORIG) @@ -557,8 +559,9 @@ SELECT CASE(TPFILE%CTYPE) !MesoNH files !Remark: 'MNH' is more general than MNHBACKUP and could be in fact a MNHBACKUP file CASE ('MNH', 'MNHBACKUP', 'MNHDIACHRONIC', 'MNHDIAG', 'MNHOUTPUT', 'PGD') - !Do not close (non-existing) '.des' file if OUTPUT - IF(TPFILE%CTYPE/='MNHOUTPUT' .AND. CPROGRAM/='LFICDF') THEN + !Try to close '.des' file only if it should exist + IF ( ( TPFILE%CTYPE=='MNH' .OR. TPFILE%CTYPE=='MNHBACKUP' .OR. TPFILE%CTYPE=='MNHDIACHRONIC' ) & + .and. .not.associated(tpfile%tmainfile) ) THEN IF ( .NOT.ASSOCIATED(TPFILE%TDESFILE) ) THEN CALL PRINT_MSG( NVERB_ERROR, 'IO', 'IO_File_close','DES file for '//TRIM(TPFILE%CNAME)//' not associated' ) ELSE diff --git a/src/MNH/mnhget_desfmn.f90 b/src/MNH/mnhget_desfmn.f90 index f4afb7796..d49a77ab8 100644 --- a/src/MNH/mnhget_desfmn.f90 +++ b/src/MNH/mnhget_desfmn.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 1994-2018 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 2003-2024 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. @@ -81,7 +81,11 @@ IF (HACTION=='READ ') THEN CASE('MESONH','DIAG ') KLUDES = TINIFILE%TDESFILE%NLU CASE('REAL ') - KLUDES = TPGDFILE%TDESFILE%NLU + IF ( ASSOCIATED(TPGDFILE%TDESFILE) ) THEN + KLUDES = TPGDFILE%TDESFILE%NLU + ELSE + KLUDES = 0 + END IF CASE('IDEAL ') KLUDES = 0 END SELECT -- GitLab