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 11641 for NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles/src/OCE/BDY/bdytides.F90 – NEMO

Ignore:
Timestamp:
2019-10-02T15:12:32+02:00 (5 years 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/bdytides.F90

    r11536 r11641  
    7171      INTEGER, DIMENSION(3)                     ::   ilen0       !: length of boundary data (from OBC arrays) 
    7272      INTEGER                                   ::   ios                 ! Local integer output status for namelist read 
     73      INTEGER                                   ::   nbdy_rdstart, nbdy_loc 
     74      CHARACTER(LEN=50)                         ::   cerrmsg             !: error string 
    7375      CHARACTER(len=80)                         ::   clfile              !: full file name for tidal input file  
    7476      REAL(wp),ALLOCATABLE, DIMENSION(:,:,:)    ::   dta_read            !: work space to read in tidal harmonics data 
     
    8486      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' 
    8587 
    86       REWIND(numnam_cfg) 
    87  
     88 
     89      nbdy_rdstart = 1 
    8890      DO ib_bdy = 1, nb_bdy 
    8991         IF( nn_dyn2d_dta(ib_bdy) >= 2 ) THEN 
     
    9496            filtide(:) = '' 
    9597 
    96             REWIND( numnam_ref ) 
    9798            READ  ( numnam_ref, nambdy_tide, IOSTAT = ios, ERR = 901) 
    9899901         IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_tide in reference namelist' ) 
    99             ! Don't REWIND here - may need to read more than one of these namelists.  
    100             READ  ( numnam_cfg, nambdy_tide, IOSTAT = ios, ERR = 902 ) 
     100            ! 
     101            ! Need to support possibility of reading more than one 
     102            ! nambdy_tide from the namelist_cfg internal file. 
     103            ! Do this by finding the ib_bdy'th occurence of nambdy_tide in the 
     104            ! character buffer as the starting point. 
     105            ! 
     106            nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_tide' ) 
     107            IF( nbdy_loc .GT. 0 ) THEN 
     108               nbdy_rdstart = nbdy_rdstart + nbdy_loc 
     109            ELSE 
     110               WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',ib_bdy,' of nambdy_tide not found' 
     111               ios = -1 
     112               CALL ctl_nam ( ios , cerrmsg ) 
     113            ENDIF 
     114            nbdy_rdstart = MAX( 1, nbdy_rdstart - 2 ) 
     115            READ  ( numnam_cfg( nbdy_rdstart: ), nambdy_tide, IOSTAT = ios, ERR = 902) 
    101116902         IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy_tide in configuration namelist' ) 
    102117            IF(lwm) WRITE ( numond, nambdy_tide ) 
Note: See TracChangeset for help on using the changeset viewer.