diff --git a/src/MNH/default_desfmn.f90 b/src/MNH/default_desfmn.f90 index 5b09658349b61205885e64be84c94682286f2aaa..8c51e1579498e172c2b636d58afe4ca4ce242c6c 100644 --- a/src/MNH/default_desfmn.f90 +++ b/src/MNH/default_desfmn.f90 @@ -297,8 +297,8 @@ INTEGER :: JM ! loop index !* 1. SET DEFAULT VALUES FOR MODD_LUNIT_n : ! ---------------------------------- ! -CINIFILE='INIFILE' -CINIFILEPGD='' +! CINIFILE='INIFILE' +! CINIFILEPGD='' CCPLFILE(:)=' ' ! !------------------------------------------------------------------------------- diff --git a/src/MNH/diag.f90 b/src/MNH/diag.f90 index 42a04b4aace6afd6e59035a43b90ff403ca3da77..54897c615c8c09c1660dd2b0c097e49a48efcd07 100644 --- a/src/MNH/diag.f90 +++ b/src/MNH/diag.f90 @@ -199,7 +199,6 @@ INTEGER :: IIU, IJU, IKU INTEGER :: IINFO_ll ! return code for _ll routines REAL, DIMENSION(:,:),ALLOCATABLE :: ZSEA,ZTOWN ! -TYPE(TFILEDATA),POINTER :: TZFILE TYPE(TFILEDATA),POINTER :: TZDIACFILE ! NAMELIST/NAM_DIAG/ CISO, LVAR_RS, LVAR_LS, & @@ -234,7 +233,6 @@ NAMELIST/NAM_CONF_DIAG/JPHEXT, NHALO !* 0.0 Initializations ! --------------- ! -TZFILE => NULL() TZDIACFILE => NULL() ! CALL GOTO_MODEL(1) @@ -450,9 +448,9 @@ ENDIF INPRAR = 24 +2*(4+NRR+NSV) COUTFMFILE=TRIM(CINIFILE)//YSUFFIX ! -CALL IO_FILE_ADD2LIST(TZFILE,TRIM(CINIFILE)//YSUFFIX,'DIAG','WRITE',KLFINPRAR=INPRAR,KLFITYPE=1,KLFIVERB=NVERB) +CALL IO_FILE_ADD2LIST(TINIFILE,TRIM(CINIFILE)//YSUFFIX,'DIAG','WRITE',KLFINPRAR=INPRAR,KLFITYPE=1,KLFIVERB=NVERB) ! -CALL IO_FILE_OPEN_ll(TZFILE,CLUOUT,IRESP) +CALL IO_FILE_OPEN_ll(TINIFILE,CLUOUT,IRESP) ! CALL SECOND_MNH2(ZTIME2) ZSTART=ZTIME2-ZTIME1 @@ -500,7 +498,7 @@ ENDIF ! !* 4.0 Stores the fields in MESONH files if necessary ! -CALL WRITE_LFIFM1_FOR_DIAG(TZFILE,CDAD_NAME(1)) +CALL WRITE_LFIFM1_FOR_DIAG(TINIFILE,CDAD_NAME(1)) ! WRITE(ILUOUT0,*) ' ' WRITE(ILUOUT0,*) 'DIAG AFTER WRITE_LFIFM1_FOR_DIAG' @@ -684,7 +682,7 @@ ZCHEM=0. XTIME_LES=0. XTIME_LES_BU_PROCESS=0. XTIME_BU_PROCESS=0. -CALL PHYS_PARAM_n(1,TZFILE,GCLOSE_OUT, & +CALL PHYS_PARAM_n(1,TINIFILE,GCLOSE_OUT, & ZRAD,ZSHADOWS,ZDCONV,ZGROUND,ZMAFL,ZDRAG, & ZTURB,ZTRACER, ZCHEM,ZTIME_BU,GMASKkids) WRITE(ILUOUT0,*) 'DIAG AFTER PHYS_PARAM1' @@ -704,7 +702,7 @@ ZTIME1=ZTIME2 ! IF (CSURF=='EXTE') THEN CALL GOTO_SURFEX(1) - TFILE_SURFEX => TZFILE + TFILE_SURFEX => TINIFILE CALL WRITE_SURF_ATM_n(YSURF_CUR,'MESONH','ALL',.FALSE.) CALL DIAG_SURF_ATM_n(YSURF_CUR%IM%DGEI, YSURF_CUR%FM%DGF, YSURF_CUR%DGL, YSURF_CUR%IM%DGI, & YSURF_CUR%SM%DGS, YSURF_CUR%DGU, YSURF_CUR%TM%DGT, YSURF_CUR%WM%DGW, & @@ -723,7 +721,7 @@ ZTIME1=ZTIME2 ! !* 7.0 Stores other fields in MESONH files if necessary ! -CALL WRITE_LFIFM1_FOR_DIAG_SUPP(TZFILE) +CALL WRITE_LFIFM1_FOR_DIAG_SUPP(TINIFILE) WRITE(ILUOUT0,*) ' ' WRITE(ILUOUT0,*) 'DIAG AFTER WRITE_LFIFM1_FOR_DIAG_SUPP' ! @@ -734,7 +732,7 @@ ZTIME1=ZTIME2 ! !* 8.0 Initial positions computation (back into simulation segments) ! -IF (LTRAJ .AND. JF/=1) CALL COMPUTE_R00(TZFILE) +IF (LTRAJ .AND. JF/=1) CALL COMPUTE_R00(TINIFILE) ! CALL SECOND_MNH2(ZTIME2) ZTRAJ =ZTIME2-ZTIME1 @@ -746,7 +744,7 @@ ZTIME1=ZTIME2 DEALLOCATE(GMASKkids) IF (GCLOSE_OUT) THEN GCLOSE_OUT=.FALSE. - CALL IO_FILE_CLOSE_ll(TZFILE,CLUOUT,IRESP) + CALL IO_FILE_CLOSE_ll(TINIFILE,CLUOUT,IRESP) END IF ! CALL CLOSE_ll (CLUOUT,IOSTAT=IRESP) diff --git a/src/MNH/ini_modeln.f90 b/src/MNH/ini_modeln.f90 index deafa28c7bff89dec5883a9501bb5c2b764430bd..4588c298e379b933140acc98b118b8f18eb76caf 100644 --- a/src/MNH/ini_modeln.f90 +++ b/src/MNH/ini_modeln.f90 @@ -10,24 +10,22 @@ ! INTERFACE ! - SUBROUTINE INI_MODEL_n(KMI,HLUOUT,TPINIFILE,HINIFILEPGD) + SUBROUTINE INI_MODEL_n(KMI,HLUOUT,TPINIFILE) ! - USE MODD_IO_ll, ONLY : TFILEDATA +USE MODD_IO_ll, ONLY : TFILEDATA ! - INTEGER, INTENT(IN) :: KMI ! Model index - CHARACTER (LEN=*), INTENT(IN) :: HLUOUT ! name for output-listing - ! of nested models - TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE !Initial file - CHARACTER (LEN=28), INTENT(IN) :: HINIFILEPGD +INTEGER, INTENT(IN) :: KMI ! Model Index +CHARACTER(LEN=*), INTENT(IN) :: HLUOUT ! name for output-listing of nested models +TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE ! Initial file ! END SUBROUTINE INI_MODEL_n ! END INTERFACE ! END MODULE MODI_INI_MODEL_n -! ###################################################### - SUBROUTINE INI_MODEL_n(KMI,HLUOUT,TPINIFILE,HINIFILEPGD) -! ###################################################### +! ############################################ + SUBROUTINE INI_MODEL_n(KMI,HLUOUT,TPINIFILE) +! ############################################ ! !!**** *INI_MODEL_n* - routine to initialize the nested model _n !! @@ -437,12 +435,9 @@ IMPLICIT NONE !* 0.1 declarations of arguments ! ! -INTEGER, INTENT(IN) :: KMI ! Model Index - -CHARACTER (LEN=*), INTENT(IN) :: HLUOUT ! name for output-listing - ! of nested models -TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE !Initial file -CHARACTER (LEN=28), INTENT(IN) :: HINIFILEPGD +INTEGER, INTENT(IN) :: KMI ! Model Index +CHARACTER(LEN=*), INTENT(IN) :: HLUOUT ! name for output-listing of nested models +TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE ! Initial file ! !* 0.2 declarations of local variables ! @@ -536,9 +531,6 @@ NULLIFY(TZINITHALO3D_ll) ! ---------------------------- ! CALL FMLOOK_ll(HLUOUT,HLUOUT,ILUOUT,IRESP) -CLUOUT = HLUOUT -CINIFILE=TPINIFILE%CNAME -CINIFILEPGD=HINIFILEPGD ! CALL IO_READ_FIELD(TPINIFILE,'MASDEV',IMASDEV) !------------------------------------------------------------------------------- diff --git a/src/MNH/ini_segn.f90 b/src/MNH/ini_segn.f90 index f1978145d18dbb5861e0518d61a5c2d33395e789..0010370cdd04e154ff2b9ebd5e8fa01bca56e855 100644 --- a/src/MNH/ini_segn.f90 +++ b/src/MNH/ini_segn.f90 @@ -176,7 +176,7 @@ USE MODN_CONFZ USE MODD_DYN USE MODD_IO_ll, ONLY : ISP,LIOCDF4,LLFIREAD,NVERB_FATAL,NVERB_WARNING,TFILEDATA USE MODD_LUNIT -USE MODD_LUNIT_n, ONLY : CINIFILE_n=> CINIFILE,CINIFILEPGD_n=> CINIFILEPGD +USE MODD_LUNIT_n, ONLY : CINIFILE_n=> CINIFILE, TINIFILE_n => TINIFILE, CINIFILEPGD_n=> CINIFILEPGD USE MODD_PARAM_n, ONLY : CSURF USE MODD_PARAMETERS USE MODD_REF, ONLY : LBOUSS @@ -292,11 +292,11 @@ ELSE IF (CPROGRAM=='SPAWN ' .OR. CPROGRAM=='REAL '.OR. CPROGRAM=='SPEC ') THEN ! ELSE IF (CPROGRAM=='DIAG ') THEN YINIFILE = CINIFILE_n + HINIFILEPGD = CINIFILEPGD_n YEXSEG=TRIM(ADJUSTL(CINIFILE_n))//'.des' CALL IO_FILE_ADD2LIST(TPINIFILE,TRIM(YINIFILE),'UNKNOWN','READ',KLFINPRAR=0,KLFITYPE=2,KLFIVERB=NVERB) CALL IO_FILE_OPEN_ll(TPINIFILE,CLUOUT0,IRESP) CALL FMLOOK_ll(YEXSEG,CLUOUT0,ILUSEG,IRESP) - HINIFILEPGD=CINIFILEPGD_n ! !* 1.4 Other program cases ! ------------------- @@ -347,9 +347,9 @@ IF (CPROGRAM=='MESONH') THEN HINIFILEPGD=CINIFILEPGD_n YINIFILE=CINIFILE_n - CALL IO_FILE_ADD2LIST(TPINIFILE,TRIM(YINIFILE),'PREPIDEALCASE','READ',KLFINPRAR=0,KLFITYPE=2,KLFIVERB=NVERB) + CALL IO_FILE_ADD2LIST(TINIFILE_n,TRIM(YINIFILE),'PREPIDEALCASE','READ',KLFINPRAR=0,KLFITYPE=2,KLFIVERB=NVERB) - CALL IO_FILE_OPEN_ll(TPINIFILE,HLUOUT,IRESP) + CALL IO_FILE_OPEN_ll(TINIFILE_n,HLUOUT,IRESP) END IF ! !------------------------------------------------------------------------------- diff --git a/src/MNH/ini_size_spawn.f90 b/src/MNH/ini_size_spawn.f90 index 6de91c868b0a41fa180e129a052d2d72da36772d..428835f2d242d828338e3773ec7591f7c0cacb0f 100644 --- a/src/MNH/ini_size_spawn.f90 +++ b/src/MNH/ini_size_spawn.f90 @@ -121,7 +121,6 @@ INTEGER :: ININAR ! Number of articles present in the LFIFM file INTEGER :: IMASDEV CHARACTER(LEN=2) :: YDIR ! Type of the data field in LFIFM file ! -CHARACTER (LEN=28) :: YINIFILE ! Name of the model 1 FM-file CHARACTER (LEN=5) :: YPRESOPT ! Pressure solver option of model 1 INTEGER :: IITR ! Iterations of pressure solver of model 1 CHARACTER (LEN=28) :: YMY_NAME, YDAD_NAME @@ -152,11 +151,9 @@ CALL FMLOOK_ll(CLUOUT,CLUOUT,ILUOUT,IRESP) ! !* 1.1 set default values : ! -YINIFILE = CINIFILE YPRESOPT = HPRESOPT IITR = KITR CALL DEFAULT_DESFM_n(2) -CINIFILE = YINIFILE CPRESOPT = YPRESOPT NITR = IITR ! diff --git a/src/MNH/ini_sizen.f90 b/src/MNH/ini_sizen.f90 index 92d2bed1ef0b28d29824688a026a22c0e5740c37..146b6e7a8e735ceb5374c005f508d035c41378f8 100644 --- a/src/MNH/ini_sizen.f90 +++ b/src/MNH/ini_sizen.f90 @@ -13,14 +13,13 @@ ! INTERFACE ! -SUBROUTINE INI_SIZE_n(KMI,HLUOUT,TPINIFILE,HINIFILEPGD) +SUBROUTINE INI_SIZE_n(KMI,HLUOUT,TPINIFILE) ! USE MODD_IO_ll, ONLY : TFILEDATA ! INTEGER, INTENT(IN) :: KMI !Model Index CHARACTER (LEN=*), INTENT(IN) :: HLUOUT !Name for output-listing of nested models TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE !Initial file -CHARACTER (LEN=*), INTENT(IN) :: HINIFILEPGD ! END SUBROUTINE INI_SIZE_n ! @@ -28,9 +27,9 @@ END INTERFACE ! END MODULE MODI_INI_SIZE_n !----------------------------------------------------------------- -! ####################################################### - SUBROUTINE INI_SIZE_n(KMI,HLUOUT,TPINIFILE,HINIFILEPGD) -! ####################################################### +! ########################################### + SUBROUTINE INI_SIZE_n(KMI,HLUOUT,TPINIFILE) +! ########################################### ! !! !!**** *INI_SIZE_n* - routine to initialize the sizes ratio positions of nested model _n @@ -138,7 +137,6 @@ IMPLICIT NONE INTEGER, INTENT(IN) :: KMI !Model Index CHARACTER (LEN=*), INTENT(IN) :: HLUOUT !Name for output-listing of nested models TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE !Initial file -CHARACTER (LEN=*), INTENT(IN) :: HINIFILEPGD ! !* 0.2 declarations of local variables ! @@ -153,8 +151,6 @@ INTEGER :: IJPHEXT ! CALL FMLOOK_ll(HLUOUT,HLUOUT,ILUOUT,IRESP) CLUOUT = HLUOUT -CINIFILE=TPINIFILE%CNAME -CINIFILEPGD=HINIFILEPGD ! !------------------------------------------------------------------------------- ! diff --git a/src/MNH/ini_spectren.f90 b/src/MNH/ini_spectren.f90 index e299c24c85d90872588c385592fe99a10a1bbb49..34c6e4f932e996062ac9c9dc416cbfaa2fbc0b21 100644 --- a/src/MNH/ini_spectren.f90 +++ b/src/MNH/ini_spectren.f90 @@ -220,8 +220,6 @@ NULLIFY(TZINITHALO3D_ll) ! ---------------------------- ! CALL FMLOOK_ll(HLUOUT,HLUOUT,ILUOUT,IRESP) -CLUOUT = HLUOUT -CINIFILE=TPINIFILE%CNAME ! !------------------------------------------------------------------------------- ! @@ -240,7 +238,7 @@ IF (XALZBOT>=XZHAT(IKU) .AND. LVE_RELAX) THEN WRITE(ILUOUT,FMT=*) " but bottom of layer XALZBOT(",XALZBOT,")" WRITE(ILUOUT,FMT=*) " is upper than model top (",XZHAT(IKU),")" !callabortstop - CALL CLOSE_ll(CLUOUT,IOSTAT=IRESP) + CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP) CALL ABORT STOP END IF @@ -903,7 +901,7 @@ IF ( KMI > 1) THEN DPTR_XLBYRM=>XLBYRM DPTR_XLBXSVM=>XLBXSVM DPTR_XLBYSVM=>XLBYSVM - CALL INI_ONE_WAY_n(NDAD(KMI),CLUOUT,XTSTEP,KMI,1, & + CALL INI_ONE_WAY_n(NDAD(KMI),HLUOUT,XTSTEP,KMI,1, & DPTR_XBMX1,DPTR_XBMX2,DPTR_XBMX3,DPTR_XBMX4,DPTR_XBMY1,DPTR_XBMY2,DPTR_XBMY3,DPTR_XBMY4, & DPTR_XBFX1,DPTR_XBFX2,DPTR_XBFX3,DPTR_XBFX4,DPTR_XBFY1,DPTR_XBFY2,DPTR_XBFY3,DPTR_XBFY4, & NDXRATIO_ALL(KMI),NDYRATIO_ALL(KMI),NDTRATIO(KMI), & diff --git a/src/MNH/init_mnh.f90 b/src/MNH/init_mnh.f90 index 15ac5c8b6d4e0bc77ffbb188bf3f4125ffa459c4..6297e1c78a7aa85337e1eb7174027d277a31dd6a 100644 --- a/src/MNH/init_mnh.f90 +++ b/src/MNH/init_mnh.f90 @@ -85,6 +85,7 @@ USE MODD_DYN_n, ONLY: CPRESOPT,NITR ! only for spawning purpose USE MODD_IO_ll, ONLY: TPTR2FILE USE MODD_LBC_n, ONLY: CLBCX,CLBCY ! only for spawning purpose USE MODD_LUNIT +USE MODD_LUNIT_n USE MODD_PARAMETERS ! USE MODE_IO_ll @@ -115,7 +116,6 @@ IMPLICIT NONE INTEGER :: JMI ! Loop index CHARACTER(LEN=16), DIMENSION(JPMODELMAX) :: YLUOUT ! Name for output-listing ! of nested models -TYPE(TPTR2FILE), DIMENSION(JPMODELMAX) :: TZINIFILE ! Initial files CHARACTER(LEN=28),DIMENSION(JPMODELMAX) :: YINIFILEPGD INTEGER :: ILUOUT0,IRESP ! Logical unit number for ! output-listing common @@ -174,11 +174,11 @@ IF (CPROGRAM=='SPAWN ' .OR. CPROGRAM=='DIAG ' .OR. CPROGRAM=='SPEC ' .OR. CPRO END IF ! CALL GOTO_MODEL(1) -CALL INI_SEG_n(1,YLUOUT(1),TZINIFILE(1)%TZFILE,YINIFILEPGD(1),ZTSTEP_ALL) +CALL INI_SEG_n(1,YLUOUT(1),LUNIT_MODEL(1)%TINIFILE,YINIFILEPGD(1),ZTSTEP_ALL) ! DO JMI=2,NMODEL CALL GOTO_MODEL(JMI) - CALL INI_SEG_n(JMI,YLUOUT(JMI),TZINIFILE(JMI)%TZFILE,YINIFILEPGD(JMI),ZTSTEP_ALL) + CALL INI_SEG_n(JMI,YLUOUT(JMI),LUNIT_MODEL(JMI)%TINIFILE,YINIFILEPGD(JMI),ZTSTEP_ALL) END DO ! IF (CPROGRAM=='SPAWN ') THEN @@ -196,14 +196,14 @@ IF (CPROGRAM=='DIAG') CALL RESET_EXSEG(YLUOUT(1)) ! DO JMI=1,NMODEL CALL GOTO_MODEL(JMI) - CALL INI_SIZE_n(JMI,YLUOUT(JMI),TZINIFILE(JMI)%TZFILE,YINIFILEPGD(JMI)) + CALL INI_SIZE_n(JMI,YLUOUT(JMI),LUNIT_MODEL(JMI)%TINIFILE) END DO ! IF (CPROGRAM=='SPAWN ') THEN DPTR_CLBCX=>CLBCX DPTR_CLBCY=>CLBCY CALL INI_PARAZ_ll(IINFO_ll) - CALL INI_SIZE_SPAWN(DPTR_CLBCX,DPTR_CLBCY,CPRESOPT,NITR,TZINIFILE(1)%TZFILE) + CALL INI_SIZE_SPAWN(DPTR_CLBCX,DPTR_CLBCY,CPRESOPT,NITR,LUNIT_MODEL(1)%TINIFILE) END IF ! ! INITIALIZE data structures of ComLib @@ -237,11 +237,11 @@ DO JMI=1,NMODEL CALL GO_TOMODEL_ll(JMI,IINFO_ll) CALL GOTO_MODEL(JMI) IF (CPROGRAM/='SPEC ') THEN - CALL INI_MODEL_n(JMI,YLUOUT(JMI),TZINIFILE(JMI)%TZFILE,YINIFILEPGD(JMI)) + CALL INI_MODEL_n(JMI,YLUOUT(JMI),LUNIT_MODEL(JMI)%TINIFILE) !Call necessary to update the TFIELDLIST pointers to the data CALL FIELDLIST_GOTO_MODEL(JMI,JMI) ELSE - CALL INI_SPECTRE_n(JMI,YLUOUT(JMI),TZINIFILE(JMI)%TZFILE) + CALL INI_SPECTRE_n(JMI,YLUOUT(JMI),LUNIT_MODEL(JMI)%TINIFILE) END IF END DO ! diff --git a/src/MNH/modd_lunitn.f90 b/src/MNH/modd_lunitn.f90 index aec2234f0deea1e79a06343f1c05c6befb9f0079..1003455809274f4c3b5174c6cb1044cf9393f8b0 100644 --- a/src/MNH/modd_lunitn.f90 +++ b/src/MNH/modd_lunitn.f90 @@ -52,16 +52,16 @@ IMPLICIT NONE TYPE LUNIT_t ! - CHARACTER(LEN=28) :: CINIFILE ! Name of the input FM-file + CHARACTER(LEN=28) :: CINIFILE = 'INIFILE' ! Name of the input FM-file TYPE(TFILEDATA),POINTER :: TINIFILE => NULL() ! input FM-file - CHARACTER(LEN=28) :: CINIFILEPGD ! Name of the PGD associated to input FM-file + CHARACTER(LEN=28) :: CINIFILEPGD = '' ! Name of the PGD associated to input FM-file TYPE(TFILEDATA),POINTER :: TINIFILEPGD => NULL() ! PGD associated to input FM-file - CHARACTER(LEN=24) :: COUTFILE ! Generic name of the output FM-files + CHARACTER(LEN=24) :: COUTFILE = '' ! Generic name of the output FM-files TYPE(TFILEDATA),POINTER :: TDIAFILE => NULL() ! diachronic output file ! - CHARACTER(LEN=16) :: CLUOUT ! Name of output_listing file + CHARACTER(LEN=16) :: CLUOUT = '' ! Name of output_listing file !JUAN - CHARACTER(LEN=28),DIMENSION(:),POINTER :: CCPLFILE =>NULL() ! Names of the + CHARACTER(LEN=28),DIMENSION(:),POINTER :: CCPLFILE =>NULL() ! Names of the ! coupling FM-files TYPE(TPTR2FILE),DIMENSION(:),POINTER :: TCPLFILE => NULL() ! Coupling files !JUAN diff --git a/src/MNH/modeln.f90 b/src/MNH/modeln.f90 index 01d4cd2e3c4bada1362bc89b407429aa512b0347..bed3d79296314a90b289f640a10cba24c90f35e8 100644 --- a/src/MNH/modeln.f90 +++ b/src/MNH/modeln.f90 @@ -1964,7 +1964,7 @@ IF (OEXIT) THEN CALL MENU_DIACHRO(TDIAFILE,CLUOUT,'END') CALL IO_FILE_CLOSE_ll(TDIAFILE,CLUOUT,IRESP) ! - CALL FMCLOS_ll(CINIFILE,'KEEP',CLUOUT,IRESP) + CALL IO_FILE_CLOSE_ll(TINIFILE,CLUOUT,IRESP) IF (CSURF=="EXTE") CALL FMCLOS_ll(CINIFILEPGD,'KEEP',CLUOUT,IRESP,OPARALLELIO=.FALSE.) ! !* 28.1 print statistics! diff --git a/src/MNH/prep_ideal_case.f90 b/src/MNH/prep_ideal_case.f90 index b3b7f1546f7b4d88bd80dbc003ec40cf0ed69e26..e4794abe8c245a3f167f64f874a1a06146836775 100644 --- a/src/MNH/prep_ideal_case.f90 +++ b/src/MNH/prep_ideal_case.f90 @@ -1766,15 +1766,15 @@ NNPRAR = 22 + 2*(NRR+NSV) & ! 22 = number of grid variables + reference NTYPE=1 CDESFM=ADJUSTL(ADJUSTR(CINIFILE)//'.des') ! -CALL IO_FILE_ADD2LIST(TZFILE,TRIM(CINIFILE),'PREPIDEALCASE','WRITE',KLFINPRAR=NNPRAR,KLFITYPE=NTYPE,KLFIVERB=NVERB) +CALL IO_FILE_ADD2LIST(TINIFILE,TRIM(CINIFILE),'PREPIDEALCASE','WRITE',KLFINPRAR=NNPRAR,KLFITYPE=NTYPE,KLFIVERB=NVERB) ! -CALL IO_FILE_OPEN_ll(TZFILE,CLUOUT,NRESP) +CALL IO_FILE_OPEN_ll(TINIFILE,CLUOUT,NRESP) ! -CALL IO_WRITE_HEADER(TZFILE) +CALL IO_WRITE_HEADER(TINIFILE) ! CALL WRITE_DESFM_n(1,CDESFM,CLUOUT) ! -CALL WRITE_LFIFM_n(TZFILE,' ') ! There is no DAD model for PREP_IDEAL_CASE +CALL WRITE_LFIFM_n(TINIFILE,'') ! There is no DAD model for PREP_IDEAL_CASE ! CALL SECOND_MNH2(ZTIME2) ! @@ -1806,9 +1806,9 @@ IF (CSURF =='EXTE') THEN !* definition of physiographic fields ! computed ... IF (LEN_TRIM(CPGD_FILE)==0 .OR. .NOT. LREAD_GROUND_PARAM) THEN - CPGDFILE = CINIFILE - CALL PGD_GRID_SURF_ATM(YSURF_CUR%UG, YSURF_CUR%U,YSURF_CUR%GCP,'MESONH',CINIFILE,'MESONH',.TRUE.) - CALL PGD_SURF_ATM (YSURF_CUR,'MESONH',CINIFILE,'MESONH',.TRUE.) + CPGDFILE = TINIFILE%CNAME + CALL PGD_GRID_SURF_ATM(YSURF_CUR%UG, YSURF_CUR%U,YSURF_CUR%GCP,'MESONH',TINIFILE%CNAME,'MESONH',.TRUE.) + CALL PGD_SURF_ATM (YSURF_CUR,'MESONH',TINIFILE%CNAME,'MESONH',.TRUE.) CPGDFILE = CINIFILEPGD ELSE ! ... or read from file. @@ -1848,8 +1848,8 @@ IF (CSURF =='EXTE') THEN ! !* rereading of physiographic fields and definition of prognostic fields !* writing of all surface fields - COUTFMFILE = CINIFILE - TFILE_SURFEX => TZFILE + COUTFMFILE = TINIFILE%CNAME + TFILE_SURFEX => TINIFILE CALL PREP_SURF_MNH(' ',' ') NULLIFY(TFILE_SURFEX) CALL SURFEX_DEALLO_LIST @@ -1865,7 +1865,7 @@ END IF IF (CSURF =='EXTE' .AND. (LEN_TRIM(CPGD_FILE)==0 .OR. .NOT. LREAD_GROUND_PARAM)) THEN CALL IO_FILE_CLOSE_ll(TZINIFILEPGD,CLUOUT,NRESP) ENDIF -CALL IO_FILE_CLOSE_ll(TZFILE,CLUOUT,NRESP) +CALL IO_FILE_CLOSE_ll(TINIFILE,CLUOUT,NRESP) IF( LEN_TRIM(CPGD_FILE) /= 0 ) THEN CALL IO_FILE_CLOSE_ll(TZPGDFILE,CLUOUT,NRESP) ENDIF diff --git a/src/MNH/prep_real_case.f90 b/src/MNH/prep_real_case.f90 index 0cf14b1cd4d62f4125ead700074a29c288accd19..213d996f89cf33e562e3b79877aefa97b759cd2f 100644 --- a/src/MNH/prep_real_case.f90 +++ b/src/MNH/prep_real_case.f90 @@ -514,7 +514,6 @@ LOGICAL :: LUSECHAQ LOGICAL :: LUSECHIC LOGICAL :: LUSECHEM ! -TYPE(TFILEDATA),POINTER :: TZFILE => NULL() TYPE(TFILEDATA),POINTER :: TZPGDFILE => NULL() ! ! @@ -580,9 +579,9 @@ CALL FMLOOK_ll(CLUOUT0,CLUOUT0,ILUOUT0,IRESP) ! CPGDFILE = YPGDFILE ! -CALL IO_FILE_ADD2LIST(TZFILE,CINIFILE,'PREPREALCASE','WRITE',KLFINPRAR=0,KLFITYPE=1,KLFIVERB=NVERB) +CALL IO_FILE_ADD2LIST(TINIFILE,CINIFILE,'PREPREALCASE','WRITE',KLFINPRAR=0,KLFITYPE=1,KLFIVERB=NVERB) ! -CALL IO_FILE_OPEN_ll(TZFILE,CLUOUT0,IRESP) +CALL IO_FILE_OPEN_ll(TINIFILE,CLUOUT0,IRESP) ! IF (YATMFILETYPE=='MESONH') THEN LSHIFT = .FALSE. @@ -901,10 +900,10 @@ ALLOCATE(XPSURF(SIZE(XXHAT),SIZE(XYHAT))) ! CALL EXTRAPOL('E',XEXNTOP2D) IF (YATMFILETYPE=='GRIBEX') THEN - CALL VER_THERMO(TZFILE,LSHIFT,XTHV_MX,XR_MX,XZS_LS,XZSMT_LS,XZMASS_MX,XZFLUX_MX,XPMHP_MX,ZJ, & + CALL VER_THERMO(TINIFILE,LSHIFT,XTHV_MX,XR_MX,XZS_LS,XZSMT_LS,XZMASS_MX,XZFLUX_MX,XPMHP_MX,ZJ, & XDXX,XDYY,XEXNTOP2D,XPSURF,ZDG ) ELSE IF (YATMFILETYPE=='MESONH') THEN - CALL VER_THERMO(TZFILE,LSHIFT,XTHV_MX,XR_MX,XZS_LS,XZSMT_LS,XZMASS_MX,XZFLUX_MX,XPMHP_MX,ZJ, & + CALL VER_THERMO(TINIFILE,LSHIFT,XTHV_MX,XR_MX,XZS_LS,XZSMT_LS,XZMASS_MX,XZFLUX_MX,XPMHP_MX,ZJ, & XDXX,XDYY,XEXNTOP2D,XPSURF,ZDG, & XLSTH_MX,XLSRV_MX ) END IF @@ -1052,10 +1051,10 @@ IF (YATMFILETYPE=='GRIBEX') THEN END DO END IF ! -YDESFM=ADJUSTL(ADJUSTR(CINIFILE)//'.des') +YDESFM=TRIM(TINIFILE%CNAME)//'.des' CALL WRITE_DESFM_n(1,YDESFM,CLUOUT0) -CALL IO_WRITE_HEADER(TZFILE,HDAD_NAME=YDAD_NAME) -CALL WRITE_LFIFM_n(TZFILE,YDAD_NAME) +CALL IO_WRITE_HEADER(TINIFILE,HDAD_NAME=YDAD_NAME) +CALL WRITE_LFIFM_n(TINIFILE,YDAD_NAME) ! CALL SECOND_MNH(ZTIME2) ZWRITE = ZTIME2 - ZTIME1 @@ -1071,8 +1070,8 @@ CALL MNHREAD_ZS_DUMMY_n(TZPGDFILE) ! !* writing in the output file ! -COUTFMFILE=CINIFILE -CALL MNHWRITE_ZS_DUMMY_n(TZFILE) +COUTFMFILE=TINIFILE%CNAME +CALL MNHWRITE_ZS_DUMMY_n(TINIFILE) ! CALL DEALLOCATE_MODEL1(3) ! @@ -1092,7 +1091,7 @@ IF (.NOT. LCOUPLING ) THEN CALL READ_ALL_NAMELISTS(YSURF_CUR,'MESONH','PRE',.FALSE.) ENDIF CALL GOTO_SURFEX(1) - TFILE_SURFEX => TZFILE + TFILE_SURFEX => TINIFILE CALL PREP_SURF_MNH(YSURFFILE,YSURFFILETYPE) NULLIFY(TFILE_SURFEX) CALL SURFEX_DEALLO_LIST @@ -1182,7 +1181,7 @@ END IF !------------------------------------------------------------------------------- ! CALL CLOSE_ll(CLUOUT0, IOSTAT=IRESP) -CALL IO_FILE_CLOSE_ll(TZFILE,CLUOUT0,IRESP) +CALL IO_FILE_CLOSE_ll(TINIFILE,CLUOUT0,IRESP) ! ! CALL END_PARA_ll(IINFO_ll) diff --git a/src/MNH/read_exspa.f90 b/src/MNH/read_exspa.f90 index 14719eb7f0f5f5a0aa16c2ba16b11b0ba059855f..3dccbc013cd756c0681b4198b0b2858195df6be8 100644 --- a/src/MNH/read_exspa.f90 +++ b/src/MNH/read_exspa.f90 @@ -14,7 +14,7 @@ MODULE MODI_READ_EXSPA ! INTERFACE ! - SUBROUTINE READ_EXSPA(HINIFILE,HINIFILEPGD,& + SUBROUTINE READ_EXSPA(HINIFILE,HINIFILEPGD, & KXOR,KYOR,KXSIZE,KYSIZE,KDXRATIO,KDYRATIO,& OBAL_ONLY,HDOMAIN,HSPAFILE,HSPANBR, & HDADINIFILE,HDADSPAFILE,HSONFILE) @@ -35,9 +35,10 @@ CHARACTER (LEN=28), INTENT(OUT) :: HSPAFILE ! possible name of the output FM-fil CHARACTER (LEN= 2), INTENT(OUT) :: HSPANBR ! NumBeR associated to the SPAwned file CHARACTER (LEN=28), INTENT(OUT) :: HSONFILE ! Name of the SON 1 file CHARACTER (LEN=28), INTENT(OUT) :: HDADINIFILE ! name of the initial dad file - ! of the model 1 only for - ! spawning 1 with GBAL_ONLY -CHARACTER (LEN=28), INTENT(OUT) :: HDADSPAFILE ! name of the dad file of the ! model 2 only for spawning 1 + ! of the model 1 only for + ! spawning 1 with GBAL_ONLY +CHARACTER (LEN=28), INTENT(OUT) :: HDADSPAFILE ! name of the dad file of the + ! model 2 only for spawning 1 ! with GBAL_ONLY LOGICAL, INTENT(OUT) :: OBAL_ONLY ! compute anelastique balance ! without change in the file @@ -50,12 +51,12 @@ END INTERFACE END MODULE MODI_READ_EXSPA ! ! -! ######################################################################### - SUBROUTINE READ_EXSPA(HINIFILE,HINIFILEPGD, & +! ################################################################# + SUBROUTINE READ_EXSPA(HINIFILE,HINIFILEPGD, & KXOR,KYOR,KXSIZE,KYSIZE,KDXRATIO,KDYRATIO,& OBAL_ONLY,HDOMAIN,HSPAFILE,HSPANBR, & HDADINIFILE,HDADSPAFILE,HSONFILE) -! ######################################################################### +! ################################################################# ! !!**** *READ_EXSPA * - subroutine to read spawning namelist !! @@ -104,7 +105,7 @@ END MODULE MODI_READ_EXSPA ! ------------ ! USE MODD_CONF -USE MODD_LUNIT_n, CINIFILE_n=>CINIFILE, CINIFILEPGD_n=>CINIFILEPGD +USE MODD_LUNIT_n, ONLY : LUNIT_MODEL USE MODD_PARAMETERS ! USE MODE_IO_ll @@ -131,9 +132,10 @@ CHARACTER (LEN=28), INTENT(OUT) :: HSPAFILE ! possible name of the output FM-fil CHARACTER (LEN= 2), INTENT(OUT) :: HSPANBR ! NumBeR associated to the SPAwned file CHARACTER (LEN=28), INTENT(OUT) :: HSONFILE ! Name of the SON 1 file CHARACTER (LEN=28), INTENT(OUT) :: HDADINIFILE ! name of the initial dad file - ! of the model 1 only for - ! spawning 1 with GBAL_ONLY -CHARACTER (LEN=28), INTENT(OUT) :: HDADSPAFILE ! name of the dad file of the ! model 2 only for spawning 1 + ! of the model 1 only for + ! spawning 1 with GBAL_ONLY +CHARACTER (LEN=28), INTENT(OUT) :: HDADSPAFILE ! name of the dad file of the + ! model 2 only for spawning 1 ! with GBAL_ONLY LOGICAL, INTENT(OUT) :: OBAL_ONLY ! compute anelastique balance ! without change in the file @@ -157,15 +159,14 @@ INTEGER :: IDYRATIO ! between model 2 and model 1 INTEGER :: IXSIZE,IYSIZE ! number of model 1 grid points in x and y-directions ! in the model 2 physical domain LOGICAL :: GBAL_ONLY ! compute only anelastique balance -CHARACTER (LEN=28) :: YDOMAIN = ' ' ! input fm-file for grid definition -CHARACTER (LEN=28) :: YSPAFILE = ' ' ! possible name of the output FM-file -CHARACTER (LEN= 2) :: YSPANBR = '00' ! NumBeR associated to the SPAwned file -CHARACTER (LEN=28) :: YDADINIFILE = ' ' ! Name of dad model for model 1 -CHARACTER (LEN=28) :: YDADSPAFILE = ' ' ! Name of dad model for model 2 -CHARACTER(LEN=28) :: CINIFILE ! re-declaration because of namelist +CHARACTER(LEN=28) :: YDOMAIN ! input fm-file for grid definition +CHARACTER(LEN=28) :: YSPAFILE ! possible name of the output FM-file +CHARACTER(LEN= 2) :: YSPANBR ! NumBeR associated to the SPAwned file +CHARACTER(LEN=28) :: YDADINIFILE ! Name of dad model for model 1 +CHARACTER(LEN=28) :: YDADSPAFILE ! Name of dad model for model 2 +CHARACTER(LEN=28) :: CINIFILE ! re-declaration because of namelist CHARACTER(LEN=28) :: CINIFILEPGD ! re-declaration because of namelist -INTEGER :: IMI CHARACTER (LEN=28) :: YSONFILE = ' ' ! Name of SON input file ! !* 0.3 Namelist declarations @@ -193,13 +194,17 @@ NAMELIST/NAM_LUNIT2_SPA/ CINIFILE, &! In file name (model 1) ! !* 1. initialize logical unit number of the EXSPA file : ! -IMI = GET_CURRENT_MODEL_INDEX() -CALL GOTO_MODEL(2) +YDOMAIN = ' ' +YSPAFILE = ' ' +YSPANBR = '00' +YDADINIFILE = ' ' +YDADSPAFILE = ' ' ! -CLUOUT = 'OUTPUT_LISTING2' -YEXSPA = 'SPAWN1.nam' -CALL OPEN_ll(UNIT=ILUOUT,FILE=CLUOUT,IOSTAT=IRESP,FORM='FORMATTED',ACTION='WRITE', & +LUNIT_MODEL(2)%CLUOUT = 'OUTPUT_LISTING2' +CALL OPEN_ll(UNIT=ILUOUT,FILE=LUNIT_MODEL(2)%CLUOUT,IOSTAT=IRESP,FORM='FORMATTED',ACTION='WRITE', & MODE=GLOBAL) +! +YEXSPA = 'SPAWN1.nam' CALL OPEN_ll(unit=ILUSPA,FILE=YEXSPA,iostat=IRESP,status="OLD",action='READ', & form='FORMATTED',position="REWIND",mode=GLOBAL) ! @@ -216,23 +221,27 @@ GBAL_ONLY=.FALSE. ! CALL POSNAM(ILUSPA,'NAM_GRID2_SPA',GFOUND,ILUOUT) IF (GFOUND) READ(ILUSPA,NAM_GRID2_SPA) -CINIFILE=CINIFILE_n +! +CINIFILE = LUNIT_MODEL(1)%CINIFILE !To respect default values +CINIFILEPGD = LUNIT_MODEL(1)%CINIFILEPGD !To respect default values +! CALL POSNAM(ILUSPA,'NAM_LUNIT2_SPA',GFOUND,ILUOUT) IF (GFOUND) READ(ILUSPA,NAM_LUNIT2_SPA) -CINIFILE_n=CINIFILE -CINIFILEPGD_n=CINIFILEPGD -!! +LUNIT_MODEL(2)%CINIFILE = CINIFILE +LUNIT_MODEL(2)%CINIFILEPGD = CINIFILEPGD +! CALL POSNAM(ILUSPA,'NAM_CONFIO',GFOUND,ILUOUT) IF (GFOUND) READ(ILUSPA,NAM_CONFIO) +! CALL SET_CONFIO_ll() CALL CLOSE_ll(YEXSPA) ! ! -!* 3. model 1 and SON1 FM file name +!* 3. model 1 and SON1 FM file name (passed as arguments) ! -HINIFILE = CINIFILE_n -HINIFILEPGD = CINIFILEPGD_n -HSONFILE = YSONFILE +HINIFILE = CINIFILE +HINIFILEPGD = CINIFILEPGD +HSONFILE = YSONFILE ! !* 4. CINIFILE value is also used for model 2 (cf SPAWN_MODEL2) ! @@ -256,9 +265,7 @@ KXOR = IXOR KYOR = IYOR ! OBAL_ONLY=GBAL_ONLY -!------------------------------------------------------------------------------- ! -CALL GOTO_MODEL(IMI) +!------------------------------------------------------------------------------- ! END SUBROUTINE READ_EXSPA - diff --git a/src/MNH/reset_exseg.f90 b/src/MNH/reset_exseg.f90 index 8c9aaeee27673f7f9e901922b994afd33158ebbf..65875578b7ea35b142a1fae14020ec4b1abd6b77 100644 --- a/src/MNH/reset_exseg.f90 +++ b/src/MNH/reset_exseg.f90 @@ -69,7 +69,6 @@ USE MODE_IO_ll USE MODE_FMREAD ! USE MODD_DIAG_FLAG -USE MODD_LUNIT_n, ONLY: CINIFILE USE MODD_CH_MNHC_n, ONLY: LUSECHEM USE MODD_CONF_n, ONLY: LUSERV USE MODD_GET_n diff --git a/src/MNH/spawning.f90 b/src/MNH/spawning.f90 index 36dc95211607e38d070df85aecda8dc40dc82dd2..5b8abc7db0f5a7405374fa2ad1fc539a0cdbdbbc 100644 --- a/src/MNH/spawning.f90 +++ b/src/MNH/spawning.f90 @@ -101,6 +101,7 @@ USE MODD_CURVCOR_n USE MODD_DIM_n USE MODD_DYN_n, LRES_n=>LRES, XRES_n=>XRES USE MODD_FIELD_n +USE MODD_IO_ll, ONLY: TFILEDATA USE MODD_LSFIELD_n USE MODD_LBC_n USE MODD_LUNIT_n @@ -112,6 +113,7 @@ USE MODD_CH_MNHC_n USE MODD_GRID_n ! USE MODE_IO_ll +USE MODE_IO_MANAGE_STRUCT, ONLY: IO_FILE_FIND_BYNAME USE MODE_ll USE MODE_POS USE MODE_FM @@ -147,6 +149,7 @@ LOGICAL :: GFOUND ! Return code when searching namelist LOGICAL :: LSPAWN_SURF = .TRUE. ! .TRUE. : surface fields are spawned LOGICAL :: LRES REAL :: XRES +TYPE(TFILEDATA),POINTER :: TZINIFILE => NULL() NAMELIST/NAM_SPAWN_SURF/LSPAWN_SURF, LRES, XRES NAMELIST/NAM_CONF_SPAWN/JPHEXT, NHALO ! @@ -200,7 +203,8 @@ CALL CLOSE_ll(YEXSPA) ! CALL INIT_MNH ! -CALL FMCLOS_ll(CINIFILE,'KEEP',CLUOUT,IRESP) +CALL IO_FILE_FIND_BYNAME(TRIM(CINIFILE),TZINIFILE,IRESP) +CALL IO_FILE_CLOSE_ll(TZINIFILE,CLUOUT,IRESP) CALL IO_FILE_CLOSE_ll(TINIFILEPGD,CLUOUT,IRESP,OPARALLELIO=.FALSE.) !------------------------------------------------------------------------------- ! diff --git a/src/MNH/write_lfifm1_for_diag.f90 b/src/MNH/write_lfifm1_for_diag.f90 index 2db75813fbb0c0023e9ecae4bb83b11d3043b72f..3ab7b03678599f74e4410fda2607bd54a7f1ec1d 100644 --- a/src/MNH/write_lfifm1_for_diag.f90 +++ b/src/MNH/write_lfifm1_for_diag.f90 @@ -252,8 +252,6 @@ CHARACTER(LEN=28), INTENT(IN) :: HDADFILE ! corresponding FM-file name of ! INTEGER :: IRESP ! return-code for the file routines ! -CHARACTER(LEN=28) :: YFMFILE ! Temporary variable to store FM-file name -! CHARACTER(LEN=3) :: YFRC ! to mark the time of the forcing CHARACTER(LEN=31) :: YFGRI ! file name for GPS stations ! @@ -3543,10 +3541,7 @@ IF (LBLTOP) THEN ZGAMREF=3.5E-3 ! K/m ZWORK31(:,:,1:IKU-1)=0.5*(XZZ(:,:,1:IKU-1)+XZZ(:,:,2:IKU)) ZWORK31(:,:,IKU)=2.*ZWORK31(:,:,IKU-1)-ZWORK31(:,:,IKU-2) - YFMFILE=CINIFILE - CINIFILE=TPFILE%CNAME CALL FREE_ATM_PROFILE(TPFILE,ZTHETAV,ZWORK31,XZS,XZSMT,ZGAMREF,ZWORK32,ZWORK33) - CINIFILE=YFMFILE END IF ! IF (ALLOCATED(ZTHETAV)) DEALLOCATE(ZTHETAV) diff --git a/src/MNH/write_lfin.f90 b/src/MNH/write_lfin.f90 index 255960eeb0a636754b279e8eb40f85ce3517e6d1..5382a90461bb2c94aaa5ff2aede9463d4ab8e46c 100644 --- a/src/MNH/write_lfin.f90 +++ b/src/MNH/write_lfin.f90 @@ -20,9 +20,8 @@ USE MODD_IO_ll, ONLY: TFILEDATA ! IMPLICIT NONE ! -CHARACTER(LEN=28), INTENT(IN) :: HDADFILE ! corresponding FM-file name of - ! its DAD model -TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! File characteristics +TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! File characteristics +CHARACTER(LEN=*),INTENT(IN) :: HDADFILE ! Corresponding FM-file name of its DAD model END SUBROUTINE WRITE_LFIFM_n ! END INTERFACE @@ -270,9 +269,8 @@ IMPLICIT NONE ! !* 0.1 Declarations of arguments ! -CHARACTER(LEN=28), INTENT(IN) :: HDADFILE ! corresponding FM-file name of - ! its DAD model -TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! File characteristics +TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! File characteristics +CHARACTER(LEN=*),INTENT(IN) :: HDADFILE ! Corresponding FM-file name of its DAD model ! !* 0.2 Declarations of local variables !