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 14941 for NEMO/branches/2021/dev_r14318_RK3_stage1/src/OCE/DOM/istate.F90 – NEMO

Ignore:
Timestamp:
2021-06-03T13:42:27+02:00 (3 years ago)
Author:
acc
Message:

#2605 : restartability and reproducibility fixes (at least for AMM12 with key_qco and key_RK3). Including: Sibylles corrected indexing of ssh in stprk3.F90; inclusion of before barotropic velocities in restarts (restart.F90 and istate.F90) and (as yet, unreviewed) changes to stprk3_stg.F90/trasbc.F90 to ensure correct stage calculations. A couple of other minor changes in module_example.F90 and mppini.F90 that the compiler flagged.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r14318_RK3_stage1/src/OCE/DOM/istate.F90

    r14139 r14941  
    131131         ! 
    132132!!gm ==>>>  to be moved in usrdef_istate of C1D case  
    133          IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
    134             ALLOCATE( zuvd(jpi,jpj,jpk,2) ) 
    135             CALL dta_uvd( nit000, Kbb, zuvd ) 
    136             uu(:,:,:,Kbb) = zuvd(:,:,:,1)  ;  uu(:,:,:,Kmm) = uu(:,:,:,Kbb) 
    137             vv(:,:,:,Kbb) = zuvd(:,:,:,2)  ;  vv(:,:,:,Kmm) = vv(:,:,:,Kbb) 
    138             DEALLOCATE( zuvd ) 
    139          ENDIF 
    140          ! 
    141          !  
     133            IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
     134               ALLOCATE( zuvd(jpi,jpj,jpk,2) ) 
     135               CALL dta_uvd( nit000, Kbb, zuvd ) 
     136               uu(:,:,:,Kbb) = zuvd(:,:,:,1)  ;  uu(:,:,:,Kmm) = uu(:,:,:,Kbb) 
     137               vv(:,:,:,Kbb) = zuvd(:,:,:,2)  ;  vv(:,:,:,Kmm) = vv(:,:,:,Kbb) 
     138               DEALLOCATE( zuvd ) 
     139            ENDIF 
     140            ! 
    142141         ENDIF  
    143142#if defined key_agrif 
     
    145144#endif 
    146145      !  
    147       ! Initialize "now" and "before" barotropic velocities: 
    148       ! Do it whatever the free surface method, these arrays being eventually used 
     146      ! Initialize "now" barotropic velocities: 
     147      ! Do it whatever the free surface method, these arrays being used eventually  
    149148      ! 
    150149      uu_b(:,:,Kmm) = 0._wp   ;   vv_b(:,:,Kmm) = 0._wp 
    151       uu_b(:,:,Kbb) = 0._wp   ;   vv_b(:,:,Kbb) = 0._wp 
    152150      ! 
    153 !!gm  the use of umsak & vmask is not necessary below as uu(:,:,:,Kmm), vv(:,:,:,Kmm), uu(:,:,:,Kbb), vv(:,:,:,Kbb) are always masked 
     151!!gm  the use of umask & vmask is not necessary below as uu(:,:,:,Kmm), vv(:,:,:,Kmm), uu(:,:,:,Kbb), vv(:,:,:,Kbb) are always masked 
    154152      DO_3D( 1, 1, 1, 1, 1, jpkm1 ) 
    155153         uu_b(ji,jj,Kmm) = uu_b(ji,jj,Kmm) + e3u(ji,jj,jk,Kmm) * uu(ji,jj,jk,Kmm) * umask(ji,jj,jk) 
    156154         vv_b(ji,jj,Kmm) = vv_b(ji,jj,Kmm) + e3v(ji,jj,jk,Kmm) * vv(ji,jj,jk,Kmm) * vmask(ji,jj,jk) 
    157          ! 
    158          uu_b(ji,jj,Kbb) = uu_b(ji,jj,Kbb) + e3u(ji,jj,jk,Kbb) * uu(ji,jj,jk,Kbb) * umask(ji,jj,jk) 
    159          vv_b(ji,jj,Kbb) = vv_b(ji,jj,Kbb) + e3v(ji,jj,jk,Kbb) * vv(ji,jj,jk,Kbb) * vmask(ji,jj,jk) 
    160155      END_3D 
    161156      ! 
     
    163158      vv_b(:,:,Kmm) = vv_b(:,:,Kmm) * r1_hv(:,:,Kmm) 
    164159      ! 
    165       uu_b(:,:,Kbb) = uu_b(:,:,Kbb) * r1_hu(:,:,Kbb) 
    166       vv_b(:,:,Kbb) = vv_b(:,:,Kbb) * r1_hv(:,:,Kbb) 
     160      IF( .NOT. ln_rstart ) THEN 
     161         ! Initialize "before" barotropic velocities. "now" values are always set but  
     162         ! "before" values may have been read from a restart to ensure restartability. 
     163         ! In the non-restart case they need to be initialised here: 
     164         uu_b(:,:,Kbb) = 0._wp   ;   vv_b(:,:,Kbb) = 0._wp 
     165         DO_3D( 1, 1, 1, 1, 1, jpkm1 ) 
     166            uu_b(ji,jj,Kbb) = uu_b(ji,jj,Kbb) + e3u(ji,jj,jk,Kbb) * uu(ji,jj,jk,Kbb) * umask(ji,jj,jk) 
     167            vv_b(ji,jj,Kbb) = vv_b(ji,jj,Kbb) + e3v(ji,jj,jk,Kbb) * vv(ji,jj,jk,Kbb) * vmask(ji,jj,jk) 
     168         END_3D 
     169         uu_b(:,:,Kbb) = uu_b(:,:,Kbb) * r1_hu(:,:,Kbb) 
     170         vv_b(:,:,Kbb) = vv_b(:,:,Kbb) * r1_hv(:,:,Kbb) 
     171         !  
     172      ENDIF 
    167173      ! 
    168174   END SUBROUTINE istate_init 
Note: See TracChangeset for help on using the changeset viewer.