New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 11624 – NEMO

Changeset 11624


Ignore:
Timestamp:
2019-10-01T15:07:45+02:00 (4 years 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.

Location:
NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/ICE/icestp.F90

    r11536 r11624  
    232232      IF(lwp) WRITE(numout,*) '~~~~~~~~' 
    233233      ! 
    234       !                                ! Open the reference and configuration namelist files and namelist output file 
    235       CALL ctl_opn( numnam_ice_ref, 'namelist_ice_ref',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp ) 
    236       CALL ctl_opn( numnam_ice_cfg, 'namelist_ice_cfg',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp ) 
    237       IF(lwm) CALL ctl_opn( numoni, 'output.namelist.ice', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, 1 ) 
     234      !                                ! Load the reference and configuration namelist files and open namelist output file 
     235      CALL load_nml( numnam_ice_ref, 'namelist_ice_ref',    numout, lwp ) 
     236      CALL load_nml( numnam_ice_cfg, 'namelist_ice_cfg',    numout, lwp ) 
     237      IF(lwm) CALL ctl_opn( numoni , 'output.namelist.ice', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, 1 ) 
    238238      ! 
    239239      CALL par_init                ! set some ice run parameters 
     
    301301      !!------------------------------------------------------------------- 
    302302      ! 
    303       REWIND( numnam_ice_ref )      ! Namelist nampar in reference namelist : Parameters for ice 
    304303      READ  ( numnam_ice_ref, nampar, IOSTAT = ios, ERR = 901) 
    305304901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampar in reference namelist' ) 
    306       REWIND( numnam_ice_cfg )      ! Namelist nampar in configuration namelist : Parameters for ice 
    307305      READ  ( numnam_ice_cfg, nampar, IOSTAT = ios, ERR = 902 ) 
    308306902   IF( ios > 0 )   CALL ctl_nam ( ios , 'nampar in configuration namelist' ) 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/OCE/IOM/in_out_manager.F90

    r11536 r11624  
    139139   INTEGER ::   numnul          =   -1      !: logical unit for /dev/null 
    140140      !                                     !  early output can be collected; do not change 
    141    INTEGER ::   numnam_ref      =   -1      !: logical unit for reference namelist 
    142    INTEGER ::   numnam_cfg      =   -1      !: logical unit for configuration specific namelist 
    143141   INTEGER ::   numond          =   -1      !: logical unit for Output Namelist Dynamics 
    144    INTEGER ::   numnam_ice_ref  =   -1      !: logical unit for ice reference namelist 
    145    INTEGER ::   numnam_ice_cfg  =   -1      !: logical unit for ice reference namelist 
    146142   INTEGER ::   numoni          =   -1      !: logical unit for Output Namelist Ice 
    147143   INTEGER ::   numevo_ice      =   -1      !: logical unit for ice variables (temp. evolution) 
    148144   INTEGER ::   numrun          =   -1      !: logical unit for run statistics 
    149145   INTEGER ::   numdct_in       =   -1      !: logical unit for transports computing 
    150    INTEGER ::   numdct_vol      =   -1      !: logical unit for voulume transports output 
    151    INTEGER ::   numdct_heat     =   -1      !: logical unit for heat    transports output 
    152    INTEGER ::   numdct_salt     =   -1      !: logical unit for salt    transports output 
     146   INTEGER ::   numdct_vol      =   -1      !: logical unit for volume transports output 
     147   INTEGER ::   numdct_heat     =   -1      !: logical unit for heat   transports output 
     148   INTEGER ::   numdct_salt     =   -1      !: logical unit for salt   transports output 
    153149   INTEGER ::   numfl           =   -1      !: logical unit for floats ascii output 
    154150   INTEGER ::   numflo          =   -1      !: logical unit for floats ascii output 
     151      ! 
     152   CHARACTER(LEN=:), ALLOCATABLE :: numnam_ref      !: character buffer for reference namelist 
     153   CHARACTER(LEN=:), ALLOCATABLE :: numnam_cfg      !: character buffer for configuration specific namelist 
     154   CHARACTER(LEN=:), ALLOCATABLE :: numnam_ice_ref  !: character buffer for ice reference namelist 
     155   CHARACTER(LEN=:), ALLOCATABLE :: numnam_ice_cfg  !: character buffer for ice configuration specific namelist 
    155156 
    156157   !!---------------------------------------------------------------------- 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/OCE/LBC/lib_mpp.F90

    r11536 r11624  
    3232   !!   ctl_opn       : Open file and check if required file is available. 
    3333   !!   ctl_nam       : Prints informations when an error occurs while reading a namelist 
     34   !!   load_nml      : Read, condense and buffer namelist file into character array for use as an internal file 
    3435   !!---------------------------------------------------------------------- 
    3536   !!---------------------------------------------------------------------- 
     
    5758   PRIVATE 
    5859   ! 
    59    PUBLIC   ctl_stop, ctl_warn, ctl_opn, ctl_nam 
     60   PUBLIC   ctl_stop, ctl_warn, ctl_opn, ctl_nam, load_nml 
    6061   PUBLIC   mpp_start, mppstop, mppsync, mpp_comm_free 
    6162   PUBLIC   mpp_ini_north 
     
    10681069 
    10691070   !!---------------------------------------------------------------------- 
    1070    !!   ctl_stop, ctl_warn, get_unit, ctl_opn, ctl_nam   routines 
     1071   !!   ctl_stop, ctl_warn, get_unit, ctl_opn, ctl_nam, load_nml   routines 
    10711072   !!---------------------------------------------------------------------- 
    10721073 
     
    12791280   END FUNCTION get_unit 
    12801281 
     1282   SUBROUTINE load_nml( cdnambuff , cdnamfile, kout, ldwp) 
     1283      CHARACTER(LEN=:)    , ALLOCATABLE, INTENT(INOUT) :: cdnambuff 
     1284      CHARACTER(LEN=*), INTENT(IN )                :: cdnamfile 
     1285      CHARACTER(LEN=256)                           :: chline 
     1286      INTEGER, INTENT(IN)                          :: kout 
     1287      LOGICAL, INTENT(IN)                          :: ldwp 
     1288      INTEGER                                      :: itot, iun, iltc, inl, ios 
     1289      ! 
     1290      ! Check if the namelist buffer has already been allocated. Return if it has. 
     1291      ! 
     1292      IF ( ALLOCATED( cdnambuff ) ) RETURN 
     1293      ! 
     1294      ! Open namelist file 
     1295      ! 
     1296      CALL ctl_opn( iun, cdnamfile, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, kout, ldwp ) 
     1297      ! 
     1298      ! First pass: count characters excluding comments and trimable white space 
     1299      ! 
     1300      itot=0 
     1301  10  READ(iun,'(A256)',END=20,ERR=20) chline 
     1302      iltc = LEN_TRIM(chline) 
     1303      IF ( iltc.GT.0 ) THEN 
     1304       inl = INDEX(chline, '!')  
     1305       IF( inl.eq.0 ) THEN 
     1306        itot = itot + iltc + 1                                ! +1 for the newline character 
     1307       ELSEIF( inl.GT.0 .AND. LEN_TRIM( chline(1:inl-1) ).GT.0 ) THEN 
     1308        itot = itot + inl                                  !  includes +1 for the newline character 
     1309       ENDIF 
     1310      ENDIF 
     1311      GOTO 10 
     1312  20  CONTINUE 
     1313      ! 
     1314      ! Allocate text cdnambuff for condensed namelist 
     1315      ! 
     1316      ALLOCATE( CHARACTER(LEN=itot) :: cdnambuff ) 
     1317      WRITE(*,*) 'ALLOCATED ', itot 
     1318      ! 
     1319      ! Second pass: read and transfer pruned characters into cdnambuff 
     1320      ! 
     1321      REWIND(iun) 
     1322      itot=1 
     1323  30  READ(iun,'(A256)',END=40,ERR=40) chline 
     1324      iltc = LEN_TRIM(chline) 
     1325      IF ( iltc.GT.0 ) THEN 
     1326       inl = INDEX(chline, '!') 
     1327       IF( inl.eq.0 ) THEN 
     1328        inl = iltc 
     1329       ELSE 
     1330        inl = inl - 1 
     1331       ENDIF 
     1332       IF( inl.GT.0 .AND. LEN_TRIM( chline(1:inl) ).GT.0 ) THEN 
     1333          cdnambuff(itot:itot+inl-1) = chline(1:inl) 
     1334          WRITE( cdnambuff(itot+inl:itot+inl), '(a)' ) NEW_LINE('A') 
     1335          itot = itot + inl + 1 
     1336       ENDIF 
     1337      ENDIF 
     1338      GOTO 30 
     1339  40  CONTINUE 
     1340      WRITE(*,*) 'ASSIGNED ',itot - 1 
     1341      ! 
     1342      ! Close namelist file 
     1343      ! 
     1344      CLOSE(iun) 
     1345      !write(*,'(32A)') cdnambuff 
     1346  END SUBROUTINE load_nml 
     1347 
     1348 
    12811349   !!---------------------------------------------------------------------- 
    12821350END MODULE lib_mpp 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/OCE/nemogcm.F90

    r11536 r11624  
    307307      IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    308308      ! open reference and configuration namelist files 
    309                   CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    310                   CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     309                  CALL load_nml( numnam_ref,        'namelist_ref',                                          -1, .FALSE. ) 
     310                  CALL load_nml( numnam_cfg,        'namelist_cfg',                                          -1, .FALSE. ) 
    311311      IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    312312      ! open /dev/null file to be able to supress output write easily 
     
    317317      !                             !--------------------! 
    318318      ! 
    319       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    320319      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    321320901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
    322       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    323321      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    324322902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     
    375373      !                             !------------------------------------! 
    376374      ! 
    377       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    378375      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    379376903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
    380       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    381377      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    382378904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     
    619615      IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file 
    620616      IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file 
    621       IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist 
    622       IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist 
    623617      IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist 
    624       IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist 
    625       IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist 
    626618      IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist 
    627619      IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution) 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/OFF/nemogcm.F90

    r11536 r11624  
    192192      IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    193193      ! open reference and configuration namelist files 
    194                   CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    195                   CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     194                  CALL load_nml( numnam_ref,        'namelist_ref',                                          -1, .FALSE. ) 
     195                  CALL load_nml( numnam_cfg,        'namelist_cfg',                                          -1, .FALSE. ) 
    196196      IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    197197      ! open /dev/null file to be able to supress output write easily 
     
    202202      !                             !--------------------! 
    203203      ! 
    204       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    205204      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    206205901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
    207       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    208206      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    209207902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     
    260258      !                             !------------------------------------! 
    261259      !      
    262       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    263260      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    264261903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
    265       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    266262      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    267263904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     
    446442      ! 
    447443      IF( numstp     /= -1 )   CLOSE( numstp     )   ! time-step file 
    448       IF( numnam_ref /= -1 )   CLOSE( numnam_ref )   ! oce reference namelist 
    449       IF( numnam_cfg /= -1 )   CLOSE( numnam_cfg )   ! oce configuration namelist 
    450       IF( numout     /=  6 )   CLOSE( numout     )   ! standard model output file 
    451444      IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist 
    452445      ! 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/SAO/nemogcm.F90

    r11536 r11624  
    135135      IF( lwm )   CALL ctl_opn(     numout,        'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    136136      ! open reference and configuration namelist files 
    137                   CALL ctl_opn( numnam_ref,        'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    138                   CALL ctl_opn( numnam_cfg,        'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     137                  CALL load_nml( numnam_ref,        'namelist_ref',                                          -1, .FALSE. ) 
     138                  CALL load_nml( numnam_cfg,        'namelist_cfg',                                          -1, .FALSE. ) 
    139139      IF( lwm )   CALL ctl_opn(     numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    140140      ! open /dev/null file to be able to supress output write easily 
     
    145145      !                             !--------------------! 
    146146      ! 
    147       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    148147      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    149148901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
    150       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    151149      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    152150902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     
    203201      !                             !------------------------------------! 
    204202      ! 
    205       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    206203      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    207204903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
    208       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    209205      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    210206904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     
    363359      IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file 
    364360      IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file 
    365       IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist 
    366       IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist 
    367361      IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist 
    368       IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist 
    369       IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist 
    370362      IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist 
    371363      IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution) 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/SAS/nemogcm.F90

    r11536 r11624  
    230230      ! open ocean.output as soon as possible to get all output prints (including errors messages) 
    231231      IF( lk_oasis ) THEN 
    232          IF( lwm )   CALL ctl_opn(     numout,              'sas.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     232         IF( lwm )   CALL ctl_opn(     numout,               'sas.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    233233         ! open reference and configuration namelist files 
    234                      CALL ctl_opn( numnam_ref,        'namelist_sas_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    235                      CALL ctl_opn( numnam_cfg,        'namelist_sas_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    236          IF( lwm )   CALL ctl_opn(     numond, 'output.namelist_sas.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     234                     CALL load_nml( numnam_ref,        'namelist_sas_ref',                                          -1, .FALSE. ) 
     235                     CALL load_nml( numnam_cfg,        'namelist_sas_cfg',                                          -1, .FALSE. ) 
     236         IF( lwm )   CALL ctl_opn(      numond, 'output.namelist_sas.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    237237      ELSE 
    238          IF( lwm )   CALL ctl_opn(     numout,            'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     238         IF( lwm )   CALL ctl_opn(      numout,            'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    239239         ! open reference and configuration namelist files 
    240                      CALL ctl_opn( numnam_ref,            'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    241                      CALL ctl_opn( numnam_cfg,            'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    242          IF( lwm )   CALL ctl_opn(     numond,     'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     240                     CALL load_nml( numnam_ref,            'namelist_ref',                                          -1, .FALSE. ) 
     241                     CALL load_nml( numnam_cfg,            'namelist_cfg',                                          -1, .FALSE. ) 
     242         IF( lwm )   CALL ctl_opn(      numond,     'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    243243      ENDIF 
    244244      ! open /dev/null file to be able to supress output write easily 
     
    249249      !                             !--------------------! 
    250250      ! 
    251       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    252251      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    253252901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
    254       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    255253      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    256254902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     
    311309      !                             !------------------------------------! 
    312310      ! 
    313       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    314311      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    315312903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
    316       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    317313      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    318314904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     
    489485      IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file       
    490486      IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file 
    491       IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist 
    492       IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist 
    493487      IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist 
    494       IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist 
    495       IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist 
    496488      IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist 
    497489      IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution) 
  • 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 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/TOP/PISCES/sms_pisces.F90

    r10788 r11624  
    1313   PUBLIC 
    1414 
    15    INTEGER ::   numnatp_ref = -1           !! Logical units for namelist pisces 
    16    INTEGER ::   numnatp_cfg = -1           !! Logical units for namelist pisces 
    17    INTEGER ::   numonp      = -1           !! Logical unit for namelist pisces output 
     15   CHARACTER(:), ALLOCATABLE ::   numnatp_ref   !! Character buffer for reference namelist pisces 
     16   CHARACTER(:), ALLOCATABLE ::   numnatp_cfg   !! Character buffer for configuration namelist pisces 
     17   INTEGER ::   numonp      = -1                !! Logical unit for namelist pisces output 
    1818 
    1919   !                                                       !:  PISCES  : silicon dependant half saturation 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/TOP/PISCES/trcnam_pisces.F90

    r11536 r11624  
    5151      IF(lwp) WRITE(numout,*) 'trc_nam_pisces : read PISCES namelist' 
    5252      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~' 
    53       CALL ctl_opn( numnatp_ref, TRIM( clname )//'_ref', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    54       CALL ctl_opn( numnatp_cfg, TRIM( clname )//'_cfg', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
     53      CALL load_nml( numnatp_ref, TRIM( clname )//'_ref', numout, .FALSE. ) 
     54      CALL load_nml( numnatp_cfg, TRIM( clname )//'_cfg', numout, .FALSE. ) 
    5555      IF(lwm) CALL ctl_opn( numonp     , 'output.namelist.pis' , 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    5656      ! 
    57       REWIND( numnatp_ref )              ! Namelist nampisbio in reference namelist : Pisces variables 
    5857      READ  ( numnatp_ref, nampismod, IOSTAT = ios, ERR = 901) 
    5958901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nampismod in reference namelist' ) 
    60       REWIND( numnatp_cfg )              ! Namelist nampisbio in configuration namelist : Pisces variables 
    6159      READ  ( numnatp_cfg, nampismod, IOSTAT = ios, ERR = 902 ) 
    6260902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nampismod in configuration namelist' ) 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/TOP/trc.F90

    r10425 r11624  
    1818 
    1919   !                                     !!- logical units of passive tracers 
    20    INTEGER, PUBLIC ::   numnat_ref = -1   !: reference passive tracer namelist_top_ref 
    21    INTEGER, PUBLIC ::   numnat_cfg = -1   !: reference passive tracer namelist_top_cfg 
    2220   INTEGER, PUBLIC ::   numont     = -1   !: reference passive tracer namelist output output.namelist.top 
    23    INTEGER, PUBLIC ::   numtrc_ref = -1   !: reference passive tracer namelist_top_ref 
    24    INTEGER, PUBLIC ::   numtrc_cfg = -1   !: reference passive tracer namelist_top_cfg 
    2521   INTEGER, PUBLIC ::   numonr     = -1   !: reference passive tracer namelist output output.namelist.top 
    2622   INTEGER, PUBLIC ::   numstr            !: tracer statistics 
    2723   INTEGER, PUBLIC ::   numrtr            !: trc restart (read ) 
    2824   INTEGER, PUBLIC ::   numrtw            !: trc restart ( write ) 
     25   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_ref   !: character buffer for reference passive tracer namelist_top_ref 
     26   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_cfg   !: character buffer for configuration specific passive tracer namelist_top_cfg 
     27   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numtrc_ref   !: character buffer for reference passive tracer namelist_trc_ref 
     28   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numtrc_cfg   !: character buffer for configuration specific passive tracer namelist_trc_cfg 
    2929 
    3030   !! passive tracers fields (before,now,after) 
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/TOP/trcnam.F90

    r11536 r11624  
    108108      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 
    109109      ! 
    110       CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    111       CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
     110      CALL load_nml( numnat_ref, 'namelist_top_ref' , numout, .FALSE. ) 
     111      CALL load_nml( numnat_cfg, 'namelist_top_cfg' , numout, .FALSE. ) 
    112112      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 ) 
    113113      ! 
    114       REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables 
    115114      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901) 
    116115901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc in reference namelist' ) 
    117       REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables 
    118116      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 ) 
    119117902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc in configuration namelist' ) 
     
    158156      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 
    159157 
    160       REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables 
    161158      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901) 
    162159901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc in reference namelist' ) 
    163       REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables 
    164160      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 ) 
    165161902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc in configuration namelist' ) 
     
    228224      IF( ll_cfc .OR. ln_c14 ) THEN 
    229225        !                             ! Open namelist files 
    230         CALL ctl_opn( numtrc_ref, 'namelist_trc_ref'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    231         CALL ctl_opn( numtrc_cfg, 'namelist_trc_cfg'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
     226        CALL load_nml( numtrc_ref, 'namelist_trc_ref' , numout, .FALSE. ) 
     227        CALL load_nml( numtrc_cfg, 'namelist_trc_cfg' , numout, .FALSE. ) 
    232228        IF(lwm) CALL ctl_opn( numonr, 'output.namelist.trc', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    233229        ! 
     
    261257      ALLOCATE( ln_trdtrc(jptra) )  
    262258      ! 
    263       REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends 
    264259      READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905) 
    265260905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_trd in reference namelist' ) 
    266       REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends 
    267261      READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 ) 
    268262906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist' ) 
Note: See TracChangeset for help on using the changeset viewer.