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 12397 for NEMO/branches/2020/KERNEL-03_Storkey_Coward_RK3_stage2/src/OCE/DYN – NEMO

Ignore:
Timestamp:
2020-02-18T11:58:37+01:00 (4 years ago)
Author:
davestorkey
Message:

2020/KERNEL-03_Storkey_Coward_RK3_stage2 : Consolidation of code to
handle initial Euler timestep in the context of leapfrog
timestepping. This version passes all SETTE tests but fails to bit
compare with the control for several tests (ORCA2_ICE_PISCES, AMM12,
ISOMIP, AGRIF_DEMO, SPITZ12).

Location:
NEMO/branches/2020/KERNEL-03_Storkey_Coward_RK3_stage2/src/OCE/DYN
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/KERNEL-03_Storkey_Coward_RK3_stage2/src/OCE/DYN/dynatf.F90

    r12377 r12397  
    157157      ! 
    158158      IF( l_trddyn ) THEN             ! prepare the atf trend computation + some diagnostics 
    159          z1_2dt = 1._wp / (2. * rdt)        ! Euler or leap-frog time step  
    160          IF( neuler == 0 .AND. kt == nit000 )   z1_2dt = 1._wp / rdt 
    161159         ! 
    162160         !                                  ! Kinetic energy and Conversion 
     
    164162         ! 
    165163         IF( ln_dyn_trd ) THEN              ! 3D output: total momentum trends 
    166             zua(:,:,:) = ( puu(:,:,:,Kaa) - puu(:,:,:,Kbb) ) * z1_2dt 
    167             zva(:,:,:) = ( pvv(:,:,:,Kaa) - pvv(:,:,:,Kbb) ) * z1_2dt 
     164            zua(:,:,:) = ( puu(:,:,:,Kaa) - puu(:,:,:,Kbb) ) * r1_2dt 
     165            zva(:,:,:) = ( pvv(:,:,:,Kaa) - pvv(:,:,:,Kbb) ) * r1_2dt 
    168166            CALL iom_put( "utrd_tot", zua )        ! total momentum trends, except the asselin time filter 
    169167            CALL iom_put( "vtrd_tot", zva ) 
     
    178176      ! ------------------------------------------ 
    179177          
    180       IF( .NOT.( neuler == 0 .AND. kt == nit000 ) ) THEN    !* Leap-Frog : Asselin time filter  
     178      IF( .NOT. l_1st_euler ) THEN    !* Leap-Frog : Asselin time filter  
    181179         !                                ! =============! 
    182180         IF( ln_linssh ) THEN             ! Fixed volume ! 
     
    263261         ENDIF 
    264262         ! 
    265       ENDIF ! neuler /= 0 
     263      ENDIF ! .NOT. l_1st_euler 
    266264      ! 
    267265      ! Set "now" and "before" barotropic velocities for next time step: 
  • NEMO/branches/2020/KERNEL-03_Storkey_Coward_RK3_stage2/src/OCE/DYN/dynspg_ts.F90

    r12377 r12397  
    180180!     zwdramp = 1._wp / (rn_wdmin2 - rn_wdmin1) ! more general ramp 
    181181      !                                         ! inverse of baroclinic time step  
    182       IF( kt == nit000 .AND. neuler == 0 ) THEN   ;   r1_2dt_b = 1._wp / (         rdt ) 
    183       ELSE                                        ;   r1_2dt_b = 1._wp / ( 2._wp * rdt ) 
    184       ENDIF 
     182      r1_2dt_b = 1._wp / r2dt  
    185183      ! 
    186184      ll_init     = ln_bt_av                    ! if no time averaging, then no specific restart  
     
    198196         IF(lwp) WRITE(numout,*) 
    199197         ! 
    200          IF( neuler == 0 )   ll_init=.TRUE. 
    201          ! 
    202          IF( ln_bt_fw .OR. neuler == 0 ) THEN 
     198         IF( l_1st_euler )   ll_init=.TRUE. 
     199         ! 
     200         IF( ln_bt_fw .OR. l_1st_euler ) THEN 
    203201            ll_fw_start =.TRUE. 
    204202            noffset     = 0 
     
    209207         CALL ts_wgt( ln_bt_av, ll_fw_start, icycle, wgtbtp1, wgtbtp2 ) 
    210208         ! 
    211       ENDIF 
    212       ! 
    213       ! If forward start at previous time step, and centered integration,  
    214       ! then update averaging weights: 
    215       IF (.NOT.ln_bt_fw .AND.( neuler==0 .AND. kt==nit000+1 ) ) THEN 
    216          ll_fw_start=.FALSE. 
    217          CALL ts_wgt( ln_bt_av, ll_fw_start, icycle, wgtbtp1, wgtbtp2 ) 
    218       ENDIF 
    219       ! 
    220                            
     209      ELSEIF( kt == nit000 + 1 ) THEN           !* initialisation 2nd time-step 
     210         ! 
     211         IF( .NOT.ln_bt_fw ) THEN 
     212            ! If we did an Euler timestep on the first timestep we need to reset ll_fw_start 
     213            ! and the averaging weights. We don't have an easy way of telling whether we did 
     214            ! an Euler timestep on the first timestep (because l_1st_euler is reset to .false. 
     215            ! at the end of the first timestep) so just do this in all cases.  
     216            ll_fw_start = .FALSE. 
     217            CALL ts_wgt( ln_bt_av, ll_fw_start, icycle, wgtbtp1, wgtbtp2 ) 
     218         ENDIF 
     219         ! 
     220      ENDIF 
     221      ! 
    221222      ! ----------------------------------------------------------------------------- 
    222223      !  Phase 1 : Coupling between general trend and barotropic estimates (1st step) 
     
    701702      ! Set advection velocity correction: 
    702703      IF (ln_bt_fw) THEN 
    703          IF( .NOT.( kt == nit000 .AND. neuler==0 ) ) THEN 
     704         IF( .NOT.( kt == nit000 .AND. l_1st_euler ) ) THEN 
    704705            DO_2D_11_11 
    705706               zun_save = un_adv(ji,jj) 
     
    889890      IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise  
    890891         !                                   ! --------------- 
    891          IF( ln_rstart .AND. ln_bt_fw .AND. (neuler/=0) ) THEN    !* Read the restart file 
     892         IF( ln_rstart .AND. ln_bt_fw .AND. (.NOT.l_1st_euler) ) THEN    !* Read the restart file 
    892893            CALL iom_get( numror, jpdom_autoglo, 'ub2_b'  , ub2_b  (:,:), ldxios = lrxios )    
    893894            CALL iom_get( numror, jpdom_autoglo, 'vb2_b'  , vb2_b  (:,:), ldxios = lrxios )  
  • NEMO/branches/2020/KERNEL-03_Storkey_Coward_RK3_stage2/src/OCE/DYN/dynzdf.F90

    r12377 r12397  
    9292         ENDIF 
    9393      ENDIF 
    94       !                             !* set time step 
    95       IF( neuler == 0 .AND. kt == nit000     ) THEN   ;   r2dt =      rdt   ! = rdt (restart with Euler time stepping) 
    96       ELSEIF(               kt <= nit000 + 1 ) THEN   ;   r2dt = 2. * rdt   ! = 2 rdt (leapfrog) 
    97       ENDIF 
    98       ! 
    9994      !                             !* explicit top/bottom drag case 
    10095      IF( .NOT.ln_drgimp )   CALL zdf_drg_exp( kt, Kmm, puu(:,:,:,Kbb), pvv(:,:,:,Kbb), puu(:,:,:,Krhs), pvv(:,:,:,Krhs) )  ! add top/bottom friction trend to (puu(Kaa),pvv(Kaa)) 
  • NEMO/branches/2020/KERNEL-03_Storkey_Coward_RK3_stage2/src/OCE/DYN/sshwzv.F90

    r12377 r12397  
    7575      REAL(wp), DIMENSION(jpi,jpj,jpt), INTENT(inout) ::   pssh           ! sea-surface height 
    7676      !  
    77       INTEGER  ::   jk            ! dummy loop indice 
    78       REAL(wp) ::   z2dt, zcoef   ! local scalars 
     77      INTEGER  ::   jk      ! dummy loop index 
     78      REAL(wp) ::   zcoef   ! local scalar 
    7979      REAL(wp), DIMENSION(jpi,jpj) ::   zhdiv   ! 2D workspace 
    8080      !!---------------------------------------------------------------------- 
     
    8888      ENDIF 
    8989      ! 
    90       z2dt = 2._wp * rdt                          ! set time step size (Euler/Leapfrog) 
    91       IF( neuler == 0 .AND. kt == nit000 )   z2dt = rdt 
    9290      zcoef = 0.5_wp * r1_rau0 
    9391 
     
    9694      !                                           !------------------------------! 
    9795      IF(ln_wd_il) THEN 
    98          CALL wad_lmt(pssh(:,:,Kbb), zcoef * (emp_b(:,:) + emp(:,:)), z2dt, Kmm, uu, vv ) 
     96         CALL wad_lmt(pssh(:,:,Kbb), zcoef * (emp_b(:,:) + emp(:,:)), r2dt, Kmm, uu, vv ) 
    9997      ENDIF 
    10098 
     
    109107      ! compute the vertical velocity which can be used to compute the non-linear terms of the momentum equations. 
    110108      !  
    111       pssh(:,:,Kaa) = (  pssh(:,:,Kbb) - z2dt * ( zcoef * ( emp_b(:,:) + emp(:,:) ) + zhdiv(:,:) )  ) * ssmask(:,:) 
     109      pssh(:,:,Kaa) = (  pssh(:,:,Kbb) - r2dt * ( zcoef * ( emp_b(:,:) + emp(:,:) ) + zhdiv(:,:) )  ) * ssmask(:,:) 
    112110      ! 
    113111#if defined key_agrif 
     
    152150      ! 
    153151      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
    154       REAL(wp) ::   z1_2dt       ! local scalars 
    155152      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zhdiv 
    156153      !!---------------------------------------------------------------------- 
     
    168165      !                                           !     Now Vertical Velocity    ! 
    169166      !                                           !------------------------------! 
    170       z1_2dt = 1. / ( 2. * rdt )                         ! set time step size (Euler/Leapfrog) 
    171       IF( neuler == 0 .AND. kt == nit000 )   z1_2dt = 1. / rdt 
    172167      ! 
    173168      IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN      ! z_tilde and layer cases 
     
    187182            ! computation of w 
    188183            pww(:,:,jk) = pww(:,:,jk+1) - (  e3t(:,:,jk,Kmm) * hdiv(:,:,jk) + zhdiv(:,:,jk)    & 
    189                &                         + z1_2dt * ( e3t(:,:,jk,Kaa) - e3t(:,:,jk,Kbb) )     ) * tmask(:,:,jk) 
     184               &                         + r1_2dt * ( e3t(:,:,jk,Kaa) - e3t(:,:,jk,Kbb) )     ) * tmask(:,:,jk) 
    190185         END DO 
    191186         !          IF( ln_vvl_layer ) pww(:,:,:) = 0.e0 
     
    195190            ! computation of w 
    196191            pww(:,:,jk) = pww(:,:,jk+1) - (  e3t(:,:,jk,Kmm) * hdiv(:,:,jk)                 & 
    197                &                         + z1_2dt * ( e3t(:,:,jk,Kaa) - e3t(:,:,jk,Kbb) )  ) * tmask(:,:,jk) 
     192               &                         + r1_2dt * ( e3t(:,:,jk,Kaa) - e3t(:,:,jk,Kbb) )  ) * tmask(:,:,jk) 
    198193         END DO 
    199194      ENDIF 
     
    249244      ENDIF 
    250245      !              !==  Euler time-stepping: no filter, just swap  ==! 
    251       IF ( .NOT.( neuler == 0 .AND. kt == nit000 ) ) THEN   ! Only do time filtering for leapfrog timesteps 
     246      IF ( .NOT.( l_1st_euler ) ) THEN   ! Only do time filtering for leapfrog timesteps 
    252247         !                                                  ! filtered "now" field 
    253248         pssh(:,:,Kmm) = pssh(:,:,Kmm) + atfp * ( pssh(:,:,Kbb) - 2 * pssh(:,:,Kmm) + pssh(:,:,Kaa) ) 
Note: See TracChangeset for help on using the changeset viewer.