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 12202 for NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/src/OCE/BDY/bdydta.F90 – NEMO

Ignore:
Timestamp:
2019-12-12T09:59:50+01:00 (4 years ago)
Author:
cetlod
Message:

dev_merge_option2 : merge in dev_r11613_ENHANCE-04_namelists_as_internalfiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/src/OCE/BDY/bdydta.F90

    r12184 r12202  
    365365      INTEGER ::   ierror, ios     !  
    366366      ! 
     367      INTEGER ::   nbdy_rdstart, nbdy_loc 
     368      CHARACTER(LEN=50)                      ::   cerrmsg       ! error string 
    367369      CHARACTER(len=3)                       ::   cl3           !  
    368370      CHARACTER(len=100)                     ::   cn_dir        ! Root directory for location of data files 
     
    407409      ! Read namelists 
    408410      ! -------------- 
    409       REWIND(numnam_cfg) 
     411      nbdy_rdstart = 1 
    410412      DO jbdy = 1, nb_bdy 
    411413 
     
    413415         WRITE(ctmp2, '(a,i2)') 'block nambdy_dta number ', jbdy 
    414416 
    415          ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we do a rewind  
    416          REWIND(numnam_ref) 
     417         ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we read from the beginning 
    417418         READ  ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901) 
    418419901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in reference namelist' ) 
     
    423424            & .OR. ( dta_bdy(jbdy)%lneed_tra   .AND.       nn_tra_dta(jbdy)    == 1 )   & 
    424425            & .OR. ( dta_bdy(jbdy)%lneed_ice   .AND.       nn_ice_dta(jbdy)    == 1 )   )   THEN 
    425             ! WARNING: we don't do a rewind here, each bdy reads its own nambdy_dta block one after another 
    426             READ  ( numnam_cfg, nambdy_dta, IOSTAT = ios, ERR = 902 ) 
     426            ! 
     427            ! Need to support possibility of reading more than one 
     428            ! nambdy_dta from the namelist_cfg internal file. 
     429            ! Do this by finding the jbdy'th occurence of nambdy_dta in the 
     430            ! character buffer as the starting point. 
     431            ! 
     432            nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_dta' ) 
     433            IF( nbdy_loc .GT. 0 ) THEN 
     434               nbdy_rdstart = nbdy_rdstart + nbdy_loc 
     435            ELSE 
     436               WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',jbdy,' of nambdy_dta not found' 
     437               ios = -1 
     438               CALL ctl_nam ( ios , cerrmsg ) 
     439            ENDIF 
     440            READ  ( numnam_cfg( MAX( 1, nbdy_rdstart - 2 ): ), nambdy_dta, IOSTAT = ios, ERR = 902) 
    427441902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist' ) 
    428442            IF(lwm) WRITE( numond, nambdy_dta )            
Note: See TracChangeset for help on using the changeset viewer.