Ignore:
Timestamp:
2019-10-01T15:07:45+02:00 (16 months ago)
Author:
acc
Message:

Branch 2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles. Substantive changes required to replace all namelists with internal files. These are the key changes only; to compile and run tests all REWIND and CLOSE operations on the (no longer) units have to be removed. These changes affect many more files but can be scripted so are not included here in order to make a later merge easier. The scripts used to prepare code for testing are included on: wiki:2019WP/ENHANCE-04_AndrewC-reporting/Internal_Namelists. With these additional changes this code passes most SETTE tests but the AGRIF preprocessor does not currently accept the new allocatable character strings. To be investigated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/TOP/PISCES/SED/sedini.F90

    r11536 r11624  
    406406      !!---------------------------------------------------------------------- 
    407407 
    408       INTEGER ::   numnamsed_ref = -1           !! Logical units for namelist sediment 
    409       INTEGER ::   numnamsed_cfg = -1           !! Logical units for namelist sediment 
     408      CHARACTER(:), ALLOCATABLE ::   numnamsed_ref           !! Character buffer for reference namelist sediment 
     409      CHARACTER(:), ALLOCATABLE ::   numnamsed_cfg           !! Character buffer for configuration namelist sediment 
    410410      INTEGER :: ios                 ! Local integer output status for namelist read 
    411411      CHARACTER(LEN=20)   ::   clname 
     
    452452      IF(lwp) WRITE(numsed,*) ' sed_init_nam : read SEDIMENT namelist' 
    453453      IF(lwp) WRITE(numsed,*) ' ~~~~~~~~~~~~~~' 
    454       CALL ctl_opn( numnamsed_ref, TRIM( clname )//'_ref', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    455       CALL ctl_opn( numnamsed_cfg, TRIM( clname )//'_cfg', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
     454      CALL load_nml( numnamsed_ref, TRIM( clname )//'_ref', numout, .FALSE. ) 
     455      CALL load_nml( numnamsed_cfg, TRIM( clname )//'_cfg', numout, .FALSE. ) 
    456456 
    457457      nitsed000 = nittrc000 
    458458      nitsedend = nitend 
    459459      ! Namelist nam_run 
    460       REWIND( numnamsed_ref )              ! Namelist nam_run in reference namelist : Pisces variables 
    461460      READ  ( numnamsed_ref, nam_run, IOSTAT = ios, ERR = 901) 
    462461901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_run in reference namelist' ) 
    463462 
    464       REWIND( numnamsed_cfg )              ! Namelist nam_run in reference namelist : Pisces variables 
    465463      READ  ( numnamsed_cfg, nam_run, IOSTAT = ios, ERR = 902) 
    466464902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_run in configuration namelist' ) 
     
    474472      IF ( ln_p5z .AND. ln_sed_2way ) CALL ctl_stop( '2 ways coupling with sediment cannot be activated with PISCES-QUOTA' ) 
    475473 
    476       REWIND( numnamsed_ref )              ! Namelist nam_geom in reference namelist : Pisces variables 
    477474      READ  ( numnamsed_ref, nam_geom, IOSTAT = ios, ERR = 903) 
    478475903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_geom in reference namelist' ) 
    479476 
    480       REWIND( numnamsed_cfg )              ! Namelist nam_geom in reference namelist : Pisces variables 
    481477      READ  ( numnamsed_cfg, nam_geom, IOSTAT = ios, ERR = 904) 
    482478904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_geom in configuration namelist' ) 
     
    497493      dtsed = r2dttrc 
    498494 
    499       REWIND( numnamsed_ref )              ! Namelist nam_trased in reference namelist : Pisces variables 
    500495      READ  ( numnamsed_ref, nam_trased, IOSTAT = ios, ERR = 905) 
    501496905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_trased in reference namelist' ) 
    502497 
    503       REWIND( numnamsed_cfg )              ! Namelist nam_trased in reference namelist : Pisces variables 
    504498      READ  ( numnamsed_cfg, nam_trased, IOSTAT = ios, ERR = 906) 
    505499906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_trased in configuration namelist' ) 
     
    530524      ENDIF 
    531525 
    532       REWIND( numnamsed_ref )              ! Namelist nam_diased in reference namelist : Pisces variables 
    533526      READ  ( numnamsed_ref, nam_diased, IOSTAT = ios, ERR = 907) 
    534527907   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diased in reference namelist' ) 
    535528 
    536       REWIND( numnamsed_cfg )              ! Namelist nam_diased in reference namelist : Pisces variables 
    537529      READ  ( numnamsed_cfg, nam_diased, IOSTAT = ios, ERR = 908) 
    538530908   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diased in configuration namelist' ) 
     
    572564      ! Inorganic chemistry parameters 
    573565      !---------------------------------- 
    574       REWIND( numnamsed_ref )              ! Namelist nam_inorg in reference namelist : Pisces variables 
    575566      READ  ( numnamsed_ref, nam_inorg, IOSTAT = ios, ERR = 909) 
    576567909   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_inorg in reference namelist' ) 
    577568 
    578       REWIND( numnamsed_cfg )              ! Namelist nam_inorg in reference namelist : Pisces variables 
    579569      READ  ( numnamsed_cfg, nam_inorg, IOSTAT = ios, ERR = 910) 
    580570910   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_inorg in configuration namelist' ) 
     
    598588      ! Additional parameter linked to POC/O2/No3/Po4 
    599589      !---------------------------------------------- 
    600       REWIND( numnamsed_ref )              ! Namelist nam_poc in reference namelist : Pisces variables 
    601590      READ  ( numnamsed_ref, nam_poc, IOSTAT = ios, ERR = 911) 
    602591911   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_poc in reference namelist' ) 
    603592 
    604       REWIND( numnamsed_cfg )              ! Namelist nam_poc in reference namelist : Pisces variables 
    605593      READ  ( numnamsed_cfg, nam_poc, IOSTAT = ios, ERR = 912) 
    606594912   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_poc in configuration namelist' ) 
     
    650638      ! Bioturbation parameter 
    651639      !------------------------ 
    652       REWIND( numnamsed_ref )              ! Namelist nam_btb in reference namelist : Pisces variables 
    653640      READ  ( numnamsed_ref, nam_btb, IOSTAT = ios, ERR = 913) 
    654641913   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_btb in reference namelist' ) 
    655642 
    656       REWIND( numnamsed_cfg )              ! Namelist nam_btb in reference namelist : Pisces variables 
    657643      READ  ( numnamsed_cfg, nam_btb, IOSTAT = ios, ERR = 914) 
    658644914   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_btb in configuration namelist' ) 
     
    671657      ! Initial value (t=0) for sediment pore water and solid components 
    672658      !---------------------------------------------------------------- 
    673       REWIND( numnamsed_ref )              ! Namelist nam_rst in reference namelist : Pisces variables 
    674659      READ  ( numnamsed_ref, nam_rst, IOSTAT = ios, ERR = 915) 
    675660915   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_rst in reference namelist' ) 
    676661 
    677       REWIND( numnamsed_cfg )              ! Namelist nam_rst in reference namelist : Pisces variables 
    678662      READ  ( numnamsed_cfg, nam_rst, IOSTAT = ios, ERR = 916) 
    679663916   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_rst in configuration namelist' ) 
     
    686670      nn_dtsed = nn_dttrc 
    687671 
    688       CLOSE( numnamsed_cfg ) 
    689       CLOSE( numnamsed_ref ) 
    690672 
    691673   END SUBROUTINE sed_init_nam 
Note: See TracChangeset for help on using the changeset viewer.