From c270415f713d56561c6ca0df7cca9993b69b2e50 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Tue, 13 Sep 2016 16:17:08 +0200 Subject: [PATCH] Philippe 13/09/2016: added TFILEDATA datatype to describe the characteristics of the files and begins to use it Plus : do not write NAM_FMOUT (due to some fields not allocated anymore) --- src/LIB/SURCOUCHE/src/modd_io.f90 | 11 +++++++++++ src/MNH/modeln.f90 | 2 +- src/MNH/set_grid.f90 | 12 +++++++++++- src/MNH/write_desfmn.f90 | 4 ++-- src/MNH/write_lfin.f90 | 21 +++++++++++++++++++-- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/LIB/SURCOUCHE/src/modd_io.f90 b/src/LIB/SURCOUCHE/src/modd_io.f90 index 156bba9a5..80860dcca 100644 --- a/src/LIB/SURCOUCHE/src/modd_io.f90 +++ b/src/LIB/SURCOUCHE/src/modd_io.f90 @@ -45,6 +45,17 @@ TYPE TOUTBAK CHARACTER(LEN=28) :: CFILENAME !Filename INTEGER :: NOUTDAD = -1 !Index of the corresponding dad file (file with same time) CHARACTER(LEN=28) :: CDADFILENAME !Filename of dad + TYPE(TFILEDATA),POINTER :: TFILE => NULL() !Corresponding file END TYPE TOUTBAK +!Structure describing the characteristics of a file +TYPE TFILEDATA + CHARACTER(LEN=7) :: CFILETYPE = "UNKNOWN" !Filetype (backup, output...) + TYPE(TFILEDATA),POINTER :: TFILE_PREV => NULL() + TYPE(TFILEDATA),POINTER :: TFILE_NEXT => NULL() +END TYPE TFILEDATA + +TYPE(TFILEDATA),POINTER,SAVE :: TFILE_FIRST => NULL() +TYPE(TFILEDATA),POINTER,SAVE :: TFILE_LAST => NULL() + END MODULE MODD_IO_ll diff --git a/src/MNH/modeln.f90 b/src/MNH/modeln.f90 index 5d297c5ea..83a552e05 100644 --- a/src/MNH/modeln.f90 +++ b/src/MNH/modeln.f90 @@ -915,7 +915,7 @@ IF (IOUT < NOUT_NUMB ) THEN YDESFM=ADJUSTL(ADJUSTR(YFMFILE)//'.des') ! CALL WRITE_DESFM_n(IMI,YDESFM,CLUOUT) - CALL WRITE_LFIFM_n(YFMFILE,YDADFILE) + CALL WRITE_LFIFM_n(YFMFILE,YDADFILE,TOUTBAKN(IOUT)%TFILE) COUTFMFILE = YFMFILE CALL MNHWRITE_ZS_DUMMY_n(CPROGRAM) IF (CSURF=='EXTE') THEN diff --git a/src/MNH/set_grid.f90 b/src/MNH/set_grid.f90 index db683d82f..9604e0be5 100644 --- a/src/MNH/set_grid.f90 +++ b/src/MNH/set_grid.f90 @@ -255,7 +255,7 @@ USE MODD_OUT_n, ONLY : OUT_MODEL USE MODD_VAR_ll, ONLY : IP,NPROC USE MODD_DYN_n, ONLY : DYN_MODEL USE MODD_IO_SURF_MNH, ONLY : IO_SURF_MNH_MODEL -USE MODD_IO_ll, ONLY : TOUTBAK +USE MODD_IO_ll ! IMPLICIT NONE ! @@ -710,6 +710,16 @@ DO IMI = 1, NMODEL END IF WRITE (YNUMBER,FMT="('.',I3.3)") IPOS OUT_MODEL(IMI)%TOUTBAKN(IPOS)%CFILENAME=ADJUSTL(ADJUSTR(IO_SURF_MNH_MODEL(IMI)%COUTFILE)//YNUMBER) + IF (.NOT.ASSOCIATED(TFILE_FIRST)) THEN + ALLOCATE(TFILE_FIRST) + TFILE_LAST => TFILE_FIRST + ELSE + ALLOCATE(TFILE_LAST%TFILE_NEXT) + TFILE_LAST%TFILE_NEXT%TFILE_PREV => TFILE_LAST + TFILE_LAST => TFILE_LAST%TFILE_NEXT + ENDIF + OUT_MODEL(IMI)%TOUTBAKN(IPOS)%TFILE => TFILE_LAST + OUT_MODEL(IMI)%TOUTBAKN(IPOS)%TFILE%CFILETYPE="BACKUP" END IF END DO ! diff --git a/src/MNH/write_desfmn.f90 b/src/MNH/write_desfmn.f90 index a52794462..396d6c81e 100644 --- a/src/MNH/write_desfmn.f90 +++ b/src/MNH/write_desfmn.f90 @@ -470,8 +470,8 @@ IF (NVERB >= 5) THEN WRITE(UNIT=ILUOUT,FMT="(/,'********** NESTING **************************')") WRITE(UNIT=ILUOUT,NML=NAM_NESTING) ! - WRITE(UNIT=ILUOUT,FMT="(/,'********** FMOUT ****************************')") - WRITE(UNIT=ILUOUT,NML=NAM_FMOUT) +! WRITE(UNIT=ILUOUT,FMT="(/,'********** FMOUT ****************************')") +! WRITE(UNIT=ILUOUT,NML=NAM_FMOUT) ! WRITE(UNIT=ILUOUT,FMT="('************ BUDGET ***************************')") WRITE(UNIT=ILUOUT,NML=NAM_BUDGET) diff --git a/src/MNH/write_lfin.f90 b/src/MNH/write_lfin.f90 index 3c199c84e..ae506e469 100644 --- a/src/MNH/write_lfin.f90 +++ b/src/MNH/write_lfin.f90 @@ -14,10 +14,16 @@ ! INTERFACE ! -SUBROUTINE WRITE_LFIFM_n(HFMFILE,HDADFILE) +SUBROUTINE WRITE_LFIFM_n(HFMFILE,HDADFILE,TPFILE) +! +USE MODD_IO_ll, ONLY: TFILEDATA +! +IMPLICIT NONE +! CHARACTER(LEN=28), INTENT(IN) :: HFMFILE ! Name of FM-file to write CHARACTER(LEN=28), INTENT(IN) :: HDADFILE ! corresponding FM-file name of ! its DAD model +TYPE(TFILEDATA),OPTIONAL,INTENT(IN) :: TPFILE ! File characteristics END SUBROUTINE WRITE_LFIFM_n ! END INTERFACE @@ -26,7 +32,7 @@ END MODULE MODI_WRITE_LFIFM_n ! ! ! ########################################## - SUBROUTINE WRITE_LFIFM_n(HFMFILE,HDADFILE) + SUBROUTINE WRITE_LFIFM_n(HFMFILE,HDADFILE,TPFILE) ! ########################################## ! !!**** *WRITE_LFIFM_n* - routine to write a LFIFM file for model $n @@ -234,6 +240,7 @@ USE MODD_LIMA_PRECIP_SCAVENGING_n ! USE MODE_FMWRIT USE MODE_ll +USE MODD_IO_ll, ONLY: TFILEDATA USE MODE_IO_ll, ONLY: UPCASE,CLOSE_ll USE MODE_GRIDPROJ USE MODE_MODELN_HANDLER @@ -266,6 +273,7 @@ IMPLICIT NONE CHARACTER(LEN=28), INTENT(IN) :: HFMFILE ! Name of FM-file to write CHARACTER(LEN=28), INTENT(IN) :: HDADFILE ! corresponding FM-file name of ! its DAD model +TYPE(TFILEDATA),OPTIONAL,INTENT(IN) :: TPFILE ! File characteristics ! !* 0.2 Declarations of local variables ! @@ -363,6 +371,15 @@ IGRID=0 ILENCH=LEN(YCOMMENT) CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,YDIR,CPROGRAM,IGRID,ILENCH,YCOMMENT,IRESP) ! +YRECFM='FILETYPE' +YCOMMENT=' ' +IGRID=0 +ILENCH=LEN(YCOMMENT) +IF (PRESENT(TPFILE)) THEN + CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,YDIR,TPFILE%CFILETYPE,IGRID,ILENCH,YCOMMENT,IRESP) +ELSE + CALL FMWRIT(HFMFILE,YRECFM,CLUOUT,YDIR,"UNKNOWN",IGRID,ILENCH,YCOMMENT,IRESP) +ENDIF ! YRECFM='MY_NAME' YCOMMENT=' ' -- GitLab