Ignore:
Timestamp:
2019-10-02T15:12:32+02:00 (19 months ago)
Author:
acc
Message:

Branch 2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles. Further substantive changes to the BDY routines that read multiple copies of some namelists from namelist_cfg. Special treatment is required to replicate the original behaviour with internal files. These changes emulate previous behaviour but removal of the reliance on multiple, same-named namelist blocks would be preferable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/OCE/BDY/bdydta.F90

    r11536 r11641  
    373373      INTEGER ::   ierror, ios     !  
    374374      ! 
     375      INTEGER ::   nbdy_rdstart, nbdy_loc 
     376      CHARACTER(LEN=50)                      ::   cerrmsg       ! error string 
    375377      CHARACTER(len=3)                       ::   cl3           !  
    376378      CHARACTER(len=100)                     ::   cn_dir        ! Root directory for location of data files 
     
    415417      ! Read namelists 
    416418      ! -------------- 
    417       REWIND(numnam_cfg) 
     419      nbdy_rdstart = 1 
    418420      DO jbdy = 1, nb_bdy 
    419421 
     
    421423         WRITE(ctmp2, '(a,i2)') 'block nambdy_dta number ', jbdy 
    422424 
    423          ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we do a rewind  
    424          REWIND(numnam_ref) 
     425         ! There is only one nambdy_dta block in namelist_ref -> use it for each bdy so we read from the beginning 
    425426         READ  ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901) 
    426427901      IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in reference namelist' ) 
     
    431432            & .OR. ( dta_bdy(jbdy)%lneed_tra   .AND.       nn_tra_dta(jbdy)    == 1 )   & 
    432433            & .OR. ( dta_bdy(jbdy)%lneed_ice   .AND.       nn_ice_dta(jbdy)    == 1 )   )   THEN 
    433             ! WARNING: we don't do a rewind here, each bdy reads its own nambdy_dta block one after another 
    434             READ  ( numnam_cfg, nambdy_dta, IOSTAT = ios, ERR = 902 ) 
     434            ! 
     435            ! Need to support possibility of reading more than one 
     436            ! nambdy_dta from the namelist_cfg internal file. 
     437            ! Do this by finding the jbdy'th occurence of nambdy_dta in the 
     438            ! character buffer as the starting point. 
     439            ! 
     440            nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_dta' ) 
     441            IF( nbdy_loc .GT. 0 ) THEN 
     442               nbdy_rdstart = nbdy_rdstart + nbdy_loc 
     443            ELSE 
     444               WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',jbdy,' of nambdy_dta not found' 
     445               ios = -1 
     446               CALL ctl_nam ( ios , cerrmsg ) 
     447            ENDIF 
     448            nbdy_rdstart = MAX( 1, nbdy_rdstart - 2 ) 
     449            READ  ( numnam_cfg( nbdy_rdstart: ), nambdy_dta, IOSTAT = ios, ERR = 902) 
    435450902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist' ) 
    436451            IF(lwm) WRITE( numond, nambdy_dta )            
Note: See TracChangeset for help on using the changeset viewer.