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 10322 for NEMO/branches/UKMO/dev_r9950_GO8_package/src/OCE/ICB/icbrst.F90 – NEMO

Ignore:
Timestamp:
2018-11-16T16:06:47+01:00 (5 years ago)
Author:
davestorkey
Message:

UKMO/dev_r9950_GO8_package: Update to be relative to rev 10321 of NEMO4_beta_mirror branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/dev_r9950_GO8_package/src/OCE/ICB/icbrst.F90

    r9953 r10322  
    4747   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
    4848   !! $Id$ 
    49    !! Software governed by the CeCILL licence     (./LICENSE) 
     49   !! Software governed by the CeCILL license (see ./LICENSE) 
    5050   !!---------------------------------------------------------------------- 
    5151CONTAINS 
     
    6161      INTEGER                      ::   idim, ivar, iatt 
    6262      INTEGER                      ::   jn, iunlim_dim, ibergs_in_file 
    63       INTEGER                      ::   ii,ij,iclass 
     63      INTEGER                      ::   ii, ij, iclass, ibase_err, imax_icb 
    6464      REAL(wp), DIMENSION(nkounts) ::   zdata       
    6565      LOGICAL                      ::   ll_found_restart 
     
    7878      CALL iom_open( TRIM(cl_path)//cl_filename, ncid ) 
    7979 
     80      imax_icb = 0 
    8081      IF( iom_file(ncid)%iduld .GE. 0) THEN 
    8182 
     
    9798               CALL iom_get( ncid, jpdom_unknown, 'number'       , zdata(:) , ktime=jn, kstart=(/1/), kcount=(/nkounts/) ) 
    9899               localberg%number(:) = INT(zdata(:)) 
     100               imax_icb = MAX( imax_icb, INT(zdata(1)) ) 
    99101               CALL iom_get( ncid, 'mass_scaling' , localberg%mass_scaling, ktime=jn ) 
    100102               CALL iom_get( ncid, 'lon'          , localpt%lon           , ktime=jn ) 
     
    130132      CALL iom_get( ncid, jpdom_unknown, 'kount' , zdata(:) ) 
    131133      num_bergs(:) = INT(zdata(:)) 
    132  
    133       ! Sanity check 
     134      ! Close file 
     135      CALL iom_close( ncid ) 
     136      ! 
     137 
     138      ! Sanity checks 
    134139      jn = icb_utl_count() 
    135140      IF ( lwp .AND. nn_verbose_level >= 0 )   & 
     
    143148         &                                    ' bergs in the restart file and', jn,' bergs have been read' 
    144149      ! 
    145       ! Finish up 
    146       CALL iom_close( ncid ) 
     150      ! Confirm that all areas have a suitable base for assigning new iceberg 
     151      ! numbers. This will not be the case if restarting from a collated dataset 
     152      ! (even if using the same processor decomposition) 
     153      ! 
     154      ibase_err = 0 
     155      IF( num_bergs(1) < 0 .AND. num_bergs(1) /= narea - jpnij ) THEN 
     156         ! If this area has never calved a new berg then the base should be 
     157         ! set to narea - jpnij. If it is negative but something else then 
     158         ! a new base will be needed to guarantee unique, future iceberg numbers 
     159         ibase_err = 1 
     160      ELSEIF( MOD( num_bergs(1) - narea , jpnij ) /= 0 ) THEN 
     161         ! If this area has a base which is not in the set {narea + N*jpnij} 
     162         ! for positive integers N then a new base will be needed to guarantee  
     163         ! unique, future iceberg numbers 
     164         ibase_err = 1 
     165      ENDIF 
     166      IF( lk_mpp ) THEN 
     167         CALL mpp_sum(ibase_err) 
     168      ENDIF 
     169      IF( ibase_err > 0 ) THEN 
     170         !  
     171         ! A new base is needed. The only secure solution is to set bases such that 
     172         ! all future icebergs numbers will be greater than the current global maximum 
     173         IF( lk_mpp ) THEN 
     174            CALL mpp_max(imax_icb) 
     175         ENDIF 
     176         num_bergs(1) = imax_icb - jpnij + narea 
     177      ENDIF 
    147178      ! 
    148179      IF( lwp .AND. nn_verbose_level >= 0 )  WRITE(numout,'(a)') 'icebergs, icb_rst_read: completed' 
Note: See TracChangeset for help on using the changeset viewer.