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/bdyini.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/bdyini.F90

    r11536 r11641  
    7575      ! Read namelist parameters 
    7676      ! ------------------------ 
    77       REWIND( numnam_ref )              ! Namelist nambdy in reference namelist :Unstructured open boundaries 
    7877      READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 901) 
    7978901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist' ) 
     
    9392      cn_ice         (2:jp_bdy) = cn_ice         (1) 
    9493      nn_ice_dta     (2:jp_bdy) = nn_ice_dta     (1) 
    95       REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist :Unstructured open boundaries 
    9694      READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 902 ) 
    9795902   IF( ios >  0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist' ) 
     
    364362      ! ------------------------------------------------- 
    365363 
    366       REWIND( numnam_cfg )      
    367364      nblendta(:,:) = 0 
    368365      nbdysege = 0 
     
    10791076      INTEGER          ::   ios                 ! Local integer output status for namelist read 
    10801077      INTEGER          ::   nbdyind, nbdybeg, nbdyend 
     1078      INTEGER          ::   nbdy_count, nbdy_rdstart, nbdy_loc 
    10811079      CHARACTER(LEN=1) ::   ctypebdy   !     -        -  
     1080      CHARACTER(LEN=50)::   cerrmsg    !     -        -  
    10821081      NAMELIST/nambdy_index/ ctypebdy, nbdyind, nbdybeg, nbdyend 
    10831082      !!---------------------------------------------------------------------- 
    1084  
    1085       ! No REWIND here because may need to read more than one nambdy_index namelist. 
    1086       ! Read only namelist_cfg to avoid unseccessfull overwrite  
    1087       ! keep full control of the configuration namelist 
    1088       READ  ( numnam_cfg, nambdy_index, IOSTAT = ios, ERR = 904 ) 
     1083      ! Need to support possibility of reading more than one nambdy_index from 
     1084      ! the namelist_cfg internal file. 
     1085      ! Do this by finding the kb_bdy'th occurence of nambdy_index in the 
     1086      ! character buffer as the starting point. 
     1087      nbdy_rdstart = 1 
     1088      DO nbdy_count = 1, kb_bdy 
     1089       nbdy_loc = INDEX( numnam_cfg( nbdy_rdstart: ), 'nambdy_index' ) 
     1090       IF( nbdy_loc .GT. 0 ) THEN 
     1091          nbdy_rdstart = nbdy_rdstart + nbdy_loc 
     1092       ELSE 
     1093          WRITE(cerrmsg,'(A,I4,A)') 'Error: entry number ',kb_bdy,' of nambdy_index not found' 
     1094          ios = -1 
     1095          CALL ctl_nam ( ios , cerrmsg ) 
     1096       ENDIF 
     1097      END DO 
     1098      nbdy_rdstart = MAX( 1, nbdy_rdstart - 2 ) 
     1099      READ  ( numnam_cfg( nbdy_rdstart: ), nambdy_index, IOSTAT = ios, ERR = 904) 
    10891100904   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_index in configuration namelist' ) 
    10901101      IF(lwm) WRITE ( numond, nambdy_index ) 
Note: See TracChangeset for help on using the changeset viewer.