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 9374 for branches/NERC/dev_r5518_GO6_CO2_cmip/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90 – NEMO

Ignore:
Timestamp:
2018-03-06T13:35:36+01:00 (5 years ago)
Author:
jpalmier
Message:

JPALM -- 06-03-2018 -- corrections after review suggestions ; see GMED 380 - comment 22

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/NERC/dev_r5518_GO6_CO2_cmip/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90

    r8280 r9374  
    4444      !! ** Method  : - Read the namcfc namelist and check the parameter values 
    4545      !!---------------------------------------------------------------------- 
    46       INTEGER  ::  ji, jj, jn, jl, jm, js, io, ierr 
     46      INTEGER  ::  ji, jj, jn, jl, jm, js, io, iostatus, ierr 
    4747      INTEGER  ::  iskip = 7   ! number of 1st descriptor lines 
    4848      REAL(wp) ::  zyy, zyd 
     
    5757       
    5858      CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    59       REWIND(inum) 
    6059       
    6160      ! compute the number of year in the file 
    6261      ! file starts in 1931 do jn represent the year in the century 
     62      iostatus = 0 
    6363      jn = 31  
    64       DO  
    65         READ(inum,'(1x)',END=100)  
     64      DO WHILE ( iostatus == 0 ) 
     65        READ(inum,'(1x)', IOSTAT=iostatus, END=100) 
    6666        jn = jn + 1 
    67       END DO 
     67      ENDDO 
     68      IF( iostatus .NE. 0 ) THEN 
     69        !! Error while reading CFC input file  
     70        CALL ctl_stop('trc_ini_cfc:  & 
     71                      & Error on the 1st reading of cfc1112sf6.atm') 
     72        RETURN 
     73      ENDIF 
    6874 100  jpyear = jn - 1 - iskip 
    6975      IF ( lwp) WRITE(numout,*) '    ', jpyear ,' years read' 
     
    7278      ALLOCATE( p_cfc(jpyear,jphem,3), STAT=ierr ) 
    7379      IF( ierr > 0 ) THEN 
    74          CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' )   ;   RETURN 
     80         CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' )    
     81         RETURN 
    7582      ENDIF 
    7683      IF( trc_sms_cfc_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trc_ini_cfc: unable to allocate CFC arrays' ) 
     
    101108      ! file starts in 1931 do jn represent the year in the century.jhh 
    102109      ! Read file till the end 
    103       jn = 31 
    104       DO  
    105         READ(inum,*, IOSTAT=io) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), & 
     110      DO jn = 31, jpyear  
     111        READ(inum, '( F6.1, 6F7.2)', IOSTAT=io) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), & 
    106112             & p_cfc(jn,1,3), p_cfc(jn,2,1),  & 
    107113             & p_cfc(jn,2,2), p_cfc(jn,2,3) 
    108         IF( io < 0 ) exit 
    109         jn = jn + 1 
     114        IF( io .NE.0 )  THEN 
     115          !! Error while reading CFC input file  
     116          CALL ctl_stop('trc_ini_cfc:   & 
     117                        & Error on the 2nd reading of cfc1112sf6.atm') 
     118          RETURN 
     119        ENDIF 
    110120      END DO 
    111121 
Note: See TracChangeset for help on using the changeset viewer.