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.
2021WP/KNL-01_Sibylle_RK3_stage1 – NEMO
wiki:2021WP/KNL-01_Sibylle_RK3_stage1

Name and subject of the action

Last edition: Wikinfo(changed_ts)? by Wikinfo(changed_by)?

The PI is responsible to closely follow the progress of the action, and especially to contact NEMO project manager if the delay on preview (or review) are longer than the 2 weeks expected.

  1. Summary

Summary

Action RK3 stage 1
PI(S) Gurvan et Sibylle
Digest Run a GYRE configuration with new RK3 scheme
Dependencies If any
Branch source:/NEMO/branches/2021/dev_r14318_RK3_stage1
Previewer(s) Gurvan
Reviewer(s) Names
Ticket #2605 #2715

Description

Error: Failed to load processor box
No macro or processor named 'box' found

RK3 time stepping implementation for NEMO includes at this stage dynamic and active tracers implementation, time spitting single first with 2D mode integration.

...

Implementation

Error: Failed to load processor box
No macro or processor named 'box' found

RK3 implementation is splitted up into :

  • code preparation
  • dynamic and active tracers (barocline)
  • vertical physics (TKE) ?
  • barotropic mode (barotrope)
  • mass forcing
  • passive tracers

Code preparation In order to preserve constancy property velocity for momentum and active tracers must be the same. Advection routines in flux form are modified to take (u,v,w) as an input argument. In order to use advection routines for the barotropic mode we need the possibility to de-activate vertical advection computation. Advection routines in flux and vector form are modified to take an optional argument (no_zad) to do so.

Barocline part For sake of simplicity we started to implement RK3 regarding a GYRE configuration validation with no barotrope mode (ssh, uu_b, un_adv are set to zero at each time step). Forcing have been removed except winds and heat flux. key_qco is active and vertical physics is modeled as constant with high viscosity coefficients.

  • Prepare routines
    • Change eos divhor and sshwzv interface.
  • Add RK3 time stepping routines
    • rk3stg deals with time integration at N+1/3, N+1/2 and N+1
    • stprk3 orchestrates

Barotrope part In order to validate 2D mode implementation we remove above zero forcing for barotropic variables mass forcing remains to zero.

  • Prepare routines
    • Change dynadv, dynvor, dynspg_ts
  • Add RK3 2D mode time stepping routines
    • rk3ssh prepare 2D forcing, get dynamics 2D RHS from 3D trends, integrate 2D mode

...

Implementation details : Code preparation

r14418 Allow an advective velocity to be passed as an argument.
3D velocity can be a pointer.

OCE
 |-- oce.F90
     REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:), TARGET   ::   uu   ,  vv     !: horizontal velocities        [m/s] 
     REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  , TARGET   ::   ww             !: vertical velocity            [m/s]

3D velocity added as an input argument of advective routines passed through dyn_adv

OCE
 |--DYN
     |-- dynadv.F90
         SUBROUTINE dyn_adv( kt, Kbb, Kmm, puu, pvv, Krhs, pau, pav, paw )
         ...
         CALL dyn_adv_cen2( kt                , Kmm, puu, pvv, Krhs, pau, pav, paw )   ! 2nd order centered scheme 
         CALL dyn_adv_ubs ( kt           , Kbb, Kmm, puu, pvv, Krhs, pau, pav, paw )   ! 3rd order UBS      scheme (UP3) 
     |-- dynadv_cen2.F90
         SUBROUTINE dyn_adv_cen2( kt, Kmm, puu, pvv, Krhs, pau, pav, paw )  
         ...       
         IF( PRESENT( pau ) ) THEN     ! RK3: advective velocity (pau,pav,paw) /= advected velocity (puu,pvv,ww) 
            zptu => pau(:,:,:) 
            ...
         zfu(:,:,jk) = 0.25_wp * e2u(:,:) * e3u(:,:,jk,Kmm) * zptu(:,:,jk) 
     |-- dynadv_ubs.F90
         SUBROUTINE dyn_adv_ubs( kt, Kbb, Kmm, puu, pvv, Krhs, pau, pav, paw ) 
         ...
         IF( PRESENT( pau ) ) THEN     ! RK3: advective velocity (pau,pav,paw) /= advected velocity (puu,pvv,ww) 
            zptu => pau(:,:,:) 
            ...
         zfu(:,:,jk) = e2u(:,:) * e3u(:,:,jk,Kmm) * zptu(:,:,jk) 
 |--TRA  
     |-- traadv.F90
         SUBROUTINE tra_adv( kt, Kbb, Kmm, pts, Krhs, pau, pav, paw ) 
         ...
         IF( PRESENT( pau ) ) THEN     ! RK3: advective velocity (pau,pav,paw) /= advected velocity (puu,pvv,ww) 
            zptu => pau(:,:,:) 
            ...
         zuu(ji,jj,jk) = e2u  (ji,jj) * e3u(ji,jj,jk,Kmm) * ( zptu(ji,jj,jk) + usd(ji,jj,jk) ) 

Finally this new structure is used in step and tested with usual velocities

OCE
 |-- stpmlf.F90
     REAL(wp), TARGET     , DIMENSION(jpi,jpj,jpk) ::   zau, zav, zaw   ! advective velocity 
     ...
     zau(:,:,:) = uu(:,:,:,Nnn)        !!st   patch for MLF will be computed in RK3
     ...
     CALL dyn_adv( kstp, Nbb, Nnn      , uu, vv, Nrhs, zau, zav, zaw )  ! advection (VF or FF)   ==> RHS
     ...
     CALL tra_adv    ( kstp, Nbb, Nnn, ts, Nrhs, zau, zav, zaw )  ! hor. + vert. advection ==> RHS 

Results should be exactly the same as the ones from from the trunk. It was not the case for an OVERFLOW. The use of ln_wAimp=T changes ww at the truncature in diawri.F90, and that produces a small error. This has been corrected.

r14428 Allow vertical advection to be de-activated with an optionnal input argument : no_zad.

3D velocity added as an input argument of advective routines passed through dyn_adv

OCE
 |--DYN
     |-- dynadv.F90
         SUBROUTINE dyn_adv( kt, Kbb, Kmm, puu, pvv, Krhs, pau, pav, paw, no_zad )
         ...
         CALL dyn_adv_cen2( kt                , Kmm, puu, pvv, Krhs, pau, pav, paw, no_zad )   ! 2nd order centered scheme 
         CALL dyn_adv_ubs ( kt           , Kbb, Kmm, puu, pvv, Krhs, pau, pav, paw, no_zad )   ! 3rd order UBS      scheme (UP3) 
     |-- dynadv_cen2.F90
         SUBROUTINE dyn_adv_cen2( kt, Kmm, puu, pvv, Krhs, pau, pav, paw, no_zad )  
         ...       
         IF( PRESENT( no_zad ) ) THEN  !==  No vertical advection  ==!   (except if linear free surface) 
            IF( ln_linssh ) THEN                ! linear free surface: advection through the surface z=0 
               DO_2D( 0, 0, 0, 0 ) 
                  zzu = 0.5_wp * ( e1e2t(ji,jj) * zpt_w(ji,jj,1) + e1e2t(ji+1,jj) * zpt_w(ji+1,jj,1) ) * puu(ji,jj,1,Kmm) 
                  zzv = 0.5_wp * ( e1e2t(ji,jj) * zpt_w(ji,jj,1) + e1e2t(ji,jj+1) * zpt_w(ji,jj+1,1) ) * pvv(ji,jj,1,Kmm) 
                  puu(ji,jj,1,Krhs) = puu(ji,jj,1,Krhs) - zzu * r1_e1e2u(ji,jj)   & 
                     &                                        / e3u(ji,jj,1,Kmm) 
                  pvv(ji,jj,1,Krhs) = pvv(ji,jj,1,Krhs) - zzv * r1_e1e2v(ji,jj)   & 
                     &                                        / e3v(ji,jj,1,Kmm) 
               END_2D 
            ENDIF 
         ! 
         ELSE                          !==  Vertical advection  ==! 
            ...
     |-- dynadv_ubs.F90
         SUBROUTINE dyn_adv_ubs( kt, Kbb, Kmm, puu, pvv, Krhs, pau, pav, paw, no_zad ) 
         ...
         IF( PRESENT( no_zad ) ) THEN  !==  No vertical advection  ==!   (except if linear free surface) 
            IF( ln_linssh ) THEN                ! linear free surface: advection through the surface z=0 
               DO_2D( 0, 0, 0, 0 ) 
                  zzu = 0.5_wp * ( e1e2t(ji,jj) * zpt_w(ji,jj,1) + e1e2t(ji+1,jj) * zpt_w(ji+1,jj,1) ) * puu(ji,jj,1,Kmm)
                  zzv = 0.5_wp * ( e1e2t(ji,jj) * zpt_w(ji,jj,1) + e1e2t(ji,jj+1) * zpt_w(ji,jj+1,1) ) * pvv(ji,jj,1,Kmm) 
                  puu(ji,jj,1,Krhs) = puu(ji,jj,1,Krhs) - zzu * r1_e1e2u(ji,jj)   & 
                     &                                        / e3u(ji,jj,1,Kmm) 
                  pvv(ji,jj,1,Krhs) = pvv(ji,jj,1,Krhs) - zzv * r1_e1e2v(ji,jj)   & 
                     &                                        / e3v(ji,jj,1,Kmm) 
               END_2D 
            ENDIF 
         ! 
         ELSE                          !==  Vertical advection  ==! 

Gurvan added a loop optimisation for dynzad.F90

OCE
 |--DYN
     |-- dynzad.F90
All the loops are now gather in a single one.  

Implementation details : barocline processing

r14547 Allow RK3 time-stepping with 2D mode damped.
div_hor interface and sshwzv interface have been changed accordingly for RK3. eos also changed in order to avoid gdep to be used as an input argument in the key_qco framework.

OCE
 |--DYN
     |-- divhor.F90
         SUBROUTINE div_hor_RK3( kt, Kbb, Kmm, puu, pvv, pe3divUh ) 
     |-- sshwzv.F90
         SUBROUTINE wzv_RK3( kt, Kbb, Kmm, Kaa, puu, pvv, pww )
 |--TRA
     |-- eosbn2.F90
         SUBROUTINE eos_insitu_New( pts, Knn, prd ) 

Time step no longer need to be doubled. rk3 routines are added to the code and stprk3 is called through nemogcm when key_RK3 is active.

OCE
 |--DOM
     |-- domain.F90
         #if defined key_RK3 
              rDt   =         rn_Dt 
 	      r1_Dt = 1._wp / rDt
          ...
 |-- nemogcm.F90
     # if defined key_RK3 
             USE stprk3 
     ...
 |-- stprk3.F90
 |-- stprk3-stg.F90

Has been tested and validated against an modified leap frog GYRE in the same configuration with the same namelist.

r14549 Allow RK3 time-stepping with 2D mode.
Prepare forcings and barotropic 2D fields. dynspg_ts remains for 2D mode integration. dyn_vor_RK3 only computes 2D relative vorticity and metric term from 3D to 2D. stp_2D is called by stprk3 in single first.

OCE
 |--DYN
     |-- dynspg_ts.F90
         #remove k_only_ADV
         PUBLIC dyn_drg_init      ! called by rk3ssh
         !  Phase 1 : Coupling between general trend and barotropic estimates (1st step)
         IF( kt == nit000 ) THEN 
 	    IF( .NOT.ln_bt_fw  .OR. ln_bt_av )   CALL ctl_stop( 'dyn_spg_ts: RK3 requires ln_bt_fw=T AND ln_bt_av=F') 
 	 ENDIF
         !                          ! set values computed in RK3_ssh 
 	 zssh_frc(:,:) = sshe_rhs(:,:) 
 	 zu_frc(:,:) =   Ue_rhs(:,:) 
 	 zv_frc(:,:) =   Ve_rhs(:,:) 
 	 zCdU_u  (:,:) = CdU_u   (:,:) 
 	 zCdU_v  (:,:) = CdU_v   (:,:)
         !
 	 IF( kt == nit000 .OR. .NOT. ln_linssh )   CALL dyn_cor_2D_init( Kmm )   ! Set zwz, the barotropic Coriolis force coefficient
         ! Phase 3. update the general trend with the barotropic trend 
         IF(.NOT.ln_bt_av ) THEN                          !* Update Kaa barotropic external mode  
            uu_b(:,:,Kaa) = ua_e  (:,:) 
  	    pvv_b(:,:,Kaa) = va_e  (:,:) 
  	    pssh (:,:,Kaa) = ssha_e(:,:) 
  	 ENDIF
         un_adv...
         ubar...
     |-- dynspg.F90
         #remove k_only_ADV
     |-- dynvor.F90
         SUBROUTINE dyn_vor_3D( kt, Kmm, puu, pvv, Krhs ) 
     |-- dynzdf.F90
         zDt_2 = rDt * 0.5_wp # small cosmetic optim
 |-- stprk3_stg.F90
 |-- stp2d.F90
 |-- stprk3.F90
179	      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
180	      !  RK3 : single first external mode computation
181	      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
182	
183	      CALL stp_2D( kstp, Nbb, Nbb, Naa, Nrhs )   ! out: ssh, (uu_b,vv_b) and (un_adv,vn_adv) at Naa
184	
185	
186	      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
187	      !  RK3 time integration
188	      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
189	
190	      ! Stage 1 :
191	      CALL stp_RK3_stg( 1, kstp, Nbb, Nbb, Nrhs, Naa )
192	      !
193	      Nrhs = Nnn   ;   Nnn  = Naa   ;   Naa  = Nrhs    ! Swap: Nbb unchanged, Nnn <==> Naa
194	      !
195	      ! Stage 2 :
196	      CALL stp_RK3_stg( 2, kstp, Nbb, Nnn, Nrhs, Naa )
197	      !
198	      Nrhs = Nnn   ;   Nnn  = Naa   ;   Naa  = Nrhs    ! Swap: Nbb unchanged, Nnn <==> Naa
199	      !
200	      ! Stage 3 :
201	      CALL stp_RK3_stg( 3, kstp, Nbb, Nnn, Nrhs, Naa )
202	      !
203	      Nrhs = Nbb   ;   Nbb  = Naa   ;   Naa  = Nrhs    ! Swap: Nnn unchanged, Nbb <==> Naa

Implementation of AGRIF with RK3

r14800 introduces the major changes to activate AGRIF with RK3

  • Add provision of ssh data for setting bcs during barotropic loop in agrif_dta_ts subroutine. Indeed, MLF makes use of sshwzv where a first guess of ssh was done and corrected at AGRIF bdys. This routine is not called anymore with RK3.
NST
 |-- agrif_oce_interp.F90
     SUBROUTINE Agrif_dta_ts( kt )
     #if defined key_RK3
        Agrif_SpecialValue    = 0._wp
        Agrif_UseSpecialValue = .TRUE.
        CALL Agrif_Bc_variable(sshn_id, procname=interpsshn )
        Agrif_UseSpecialValue = .FALSE.
     #endif
  • Important change of time indexes on Parent grid in stprk3.F90: "Now" arrays on parent refers to "Nbb" index for RK3 instead of "Nnn" with MLF:
    OCE
     |-- stprk3.F90
         Kbb_a = Nbb; Kmm_a = Nbb; Krhs_a = Nrhs      ! agrif_oce module copies of time level indices
    
  • Added (optional) time interpolation at intermediate stages in Agrif_dyn and Agrif_tra:
    NST
     |-- agrif_oce_interp.F90
          SUBROUTINE Agrif_tra( kt, kstg )
          !!----------------------------------------------------------------------
          !!                  ***  ROUTINE Agrif_tra  ***
          !!----------------------------------------------------------------------
          INTEGER, INTENT(in) ::   kt
          INTEGER, OPTIONAL, INTENT(in) :: kstg
          REAL(wp) :: ztindex
          !
          IF( Agrif_Root() )   RETURN
          !
          ! Set time index depending on stage in case of RK3 time stepping:
          IF ( PRESENT( kstg ) ) THEN
             ztindex = REAL(Agrif_Nbstepint(), wp)
             IF     ( kstg == 1 ) THEN
                ztindex = ztindex + 1._wp / 3._wp
             ELSEIF ( kstg == 2 ) THEN
                ztindex = ztindex + 1._wp / 2._wp
             ELSEIF ( kstg == 3 ) THEN
                ztindex = ztindex + 1._wp
             ENDIF
             ztindex = ztindex / Agrif_Rhot()
          ELSE
             ztindex = REAL(Agrif_Nbstepint()+1, wp) / Agrif_Rhot()
          ENDIF
          !
          Agrif_SpecialValue    = 0._wp
          Agrif_UseSpecialValue = .TRUE.
          l_vremap              = ln_vert_remap
          !
          CALL Agrif_Bc_variable( ts_interp_id, calledweight=ztindex, procname=interptsn )
          !
          Agrif_UseSpecialValue = .FALSE.
          l_vremap              = .FALSE.
          !
       END SUBROUTINE Agrif_tra
    

Functionnality activated in stprk3_stg.F90

OCE
 |-- stprk3_stg.F90
         !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
         ! Set boundary conditions
         !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         !
     # if defined key_agrif
            CALL Agrif_tra( kstp, kstg )             !* AGRIF zoom boundaries
            CALL Agrif_dyn( kstp, kstg )
     # endif
  • Removed updates of Parent "before" fields coming from asselin filtering. cpp directives "#if ! defined key_RK3" have been used in agrif_oce_update.F90 module.
  • Added Agrif sponge trend in barotropic mode (stp2d.F90). It is taken as constant over the barotropic loop, but that's the only source of damping near grid boundaries... Should add time dependent nudging during barotropic loop which could help damping instabilities as reported below without time averaging of barotropic variables.
  • The changes above have also been made for agrif routines related to TOP. At that stage, TOP was nevertheless not functional with RK3.
  • Changes validated (qualitavely) in VORTEX test case. Successful doubling of time step. However results are substantiallly different in term of VORTEX amplitude around grid interface => impact of unchanged adimensionnalized sponge/nudging coefficients ?
  • NB1: I noticed instabilities preventing runs to finish when switching off barotropic time averaging (and using Demange's dissipative time stepping). This occurs also with MLF. Is the periodic data exchange between grids (at baroclinic time step) suitable with such an approach ?
  • NB2: Restartability not checked yet but it is likely that some changes on Agrif time indexes (such as the one reported above) will be needed at initialization.

Solar flux penetration optimization (r14990 start r15083 fully debugged rxxxxx optimized)

Tracer surface boundary condition optimization (r14993)

Ice Shelve now compatible with qco (r15083)

Adapt TOP for RK3

Merge with trunk r15557

Trunk has new management of the halos, RK3 additionnal routines have to be updated accordingly.

  • lbc_lnk_multi routines no longer exist : they have been integrated into lbc_lnk generic routines, then they have to be replaced in :

=> src/OCE/DYN/dynspg_ts.F90
=> src/OCE/stprk3_stg.F90

  • loop have changed and optimized for limiting communications : when relevant RK3 routines will mimic MLF ones

=> src/OCE/DYN/divhor.F90 : div_hor_RK3
=> src/OCE/DYN/sshwzv.F90 : wzv_RK3
=> src/OCE/TRA/trasbc.F90 : tra_sbc_RK3

  • we have optimized tra_qsr routine by limiting intermidiate storing array, computations are now done only in the interior it works for all variables except fraqsr_1lev. Indeed it needs to be defined over the whole domain for the ICE. When not np_BIO fraqsr_1lev depends on qsr_hc, to minimize the code changed I decided to keep qsr_hc defined in the interior and to make a communication on fraqsr_1lev but it may not be the best solution. see with GM !

=> src/OCE/TRA/traqsr.F90 (fraqsr_1lev)

  • src/OCE/stprk3_stg.F90 also has to be updated.

=> A communication is required on r3. Indeed r3. at Kbb and Kmm can be used over the whole domain. In MLF case r3. at Kbb and Kmm are lbc-ised when starting a time step, while in RK3 case because of the stages within a step and r3. at Kmm is never lbc-ised. That is why this communication is required !
=> Advective speeds at Kmm are computed on the whole domain and also required r3u to be defined over the whole domain.
=> As far as I understand ts, tr @ Kaa are not only computed in the interior in order to limit the number of loops, and sometime (ex pt update in src/OCE/TRA/traadv_fct.F90) values are computed but not used. In traadv case pt value outside the interior in erased with a lbc_lnk at the end of the time step. That is why ts/tr have to be initialised over the whole domain. Maybe it should be done at the init only as we discussed with GM !
=> As what has been done for MLF "IF( nn_hls == 2 .AND. l_zdfsh2 ) CALL lbc_lnk( 'stp_RK3_stg', avm_k, 'W', 1.0_wp )" needs to be externalised from the tke routine.

  • rhop removal needs to be adressed properly. For now it has been quickly removed from RK3 but it is required for some DIA routines and over all for tra_mle (activated in ORCA2_ICE_PISCES configuration). The initial target was to compute rhop locally when needed on order to avoid to store a useless rhop array. But is means about 6 times. see with GM !!!

=> src/OCE/TRD/trdglo.F90 : glo_dyn_wri changes maye useless since glo_dyn_wri never called !
=> src/OCE/stprk3.F90 rhop@Nbb now computed with rhd at each time step
=> src/OCE/IOM/restart.F90 : remove rhop from restart

  • initialisation with restart sometimes requires Kmm field with are not intialised in RK3, as a matter of simplicity we just copy Kbb into Kmm for ssh, ts, uu, vv fields.

=> src/OCE/IOM/restart.F90 : rst_read
=> src/OCE/IOM/restart.F90 : rst_read_ssh

  • finally we wrote additionnal comments and did some cleaning !
  • DEC_dbg_RK3/src/OCE/stprk3.F90

     
    156156!!st                         CALL zdf_phy( kstp, Nbb, Nnn, Nrhs )   ! vertical physics update (top/bot drag, avt, avs, avm + MLD) 
    157157                         CALL zdf_phy( kstp, Nbb, Nbb, Nrhs )   ! vertical physics update (top/bot drag, avt, avs, avm + MLD) 
    158158!!gm 
     159!!st check with gm !!!!! 
     160                         CALL eos( ts(:,:,:,:,Nbb), rhd, rhop, gdept_0(:,:,:) ) ! now in situ density for tramle slope computation 
    159161      !  LATERAL  PHYSICS 
    160162      ! 
    161163      IF( l_ldfslp ) THEN                             ! slope of lateral mixing 
    162164!!gm gdep 
    163                          CALL eos( ts(:,:,:,:,Nbb), rhd, gdept_0(:,:,:) )               ! before in situ density 
     165!!st         CALL eos( ts(:,:,:,:,Nbb), rhd, gdept_0(:,:,:) )               ! before in situ density 
    164166 
    165167         IF( ln_zps .AND. .NOT. ln_isfcav)                                    & 
    166168            &            CALL zps_hde    ( kstp, Nbb, jpts, ts(:,:,:,:,Nbb), gtsu, gtsv,  &  ! Partial steps: before horizontal gradient 
  • DEC_dbg_RK3/src/OCE/IOM/restart.F90

     
    176176         CALL iom_rstput( kt, nitrst, numrow, 'vn'  , vv(:,:,:       ,Kmm) ) 
    177177         CALL iom_rstput( kt, nitrst, numrow, 'tn'  , ts(:,:,:,jp_tem,Kmm) ) 
    178178         CALL iom_rstput( kt, nitrst, numrow, 'sn'  , ts(:,:,:,jp_sal,Kmm) ) 
    179          IF( .NOT.lk_SWE )   CALL iom_rstput( kt, nitrst, numrow, 'rhop', rhop ) 
     179!!$         IF( .NOT.lk_SWE )   CALL iom_rstput( kt, nitrst, numrow, 'rhop', rhop ) 
    180180#endif 
    181181      ENDIF 
    182182 
     
    290290      CALL iom_get( numror, jpdom_auto, 'sb'   , ts(:,:,:,jp_sal,Kbb) ) 
    291291      CALL iom_get( numror, jpdom_auto, 'uu_b' , uu_b(:,:       ,Kbb), cd_type = 'U', psgn = -1._wp ) 
    292292      CALL iom_get( numror, jpdom_auto, 'vv_b' , vv_b(:,:       ,Kbb), cd_type = 'V', psgn = -1._wp ) 
     293      uu(:,:,:  ,Kmm) = uu(:,:,:  ,Kbb)         ! all now value set to before for initialisation (sbc_ssm_init) 
     294      vv(:,:,:  ,Kmm) = vv(:,:,:  ,Kbb) 
     295      ts(:,:,:,:,Kmm) = ts(:,:,:,:,Kbb) 
    293296#else 
    294297      !                             !*  Read Kmm fields   (MLF only) 
    295298      IF(lwp) WRITE(numout,*)    '           Kmm u, v and T-S fields read in the restart file' 
     
    313316      ENDIF 
    314317#endif 
    315318      ! 
    316       IF( .NOT.lk_SWE ) THEN 
    317          IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN 
    318             CALL iom_get( numror, jpdom_auto, 'rhop'   , rhop )   ! now    potential density 
    319          ELSE 
    320 #if defined key_RK3 
    321             CALL eos( ts, Kbb, rhop ) 
    322 #else 
    323             CALL eos( ts, Kmm, rhop ) 
    324 #endif 
    325 !!#if defined key_qco 
    326 !!            ALLOCATE( zgdept(jpi,jpj,jpk) ) 
    327 !!            DO jk = 1, jpk 
    328 !!               zgdept(:,:,jk) = gdept(:,:,jk,Kmm) 
    329 !!            END DO 
    330 !!            CALL eos( ts(:,:,:,:,Kmm), rhd, rhop, zgdept ) 
    331 !!            DEALLOCATE( zgdept ) 
    332 !!#else 
    333 !!            CALL eos( ts(:,:,:,:,Kmm), rhd, rhop, gdept(:,:,:,Kmm) ) 
    334 !!#endif 
    335          ENDIF 
    336       ENDIF 
     319!!$      IF( .NOT.lk_SWE ) THEN 
     320!!$         IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN 
     321!!$            CALL iom_get( numror, jpdom_auto, 'rhop'   , rhop )   ! now    potential density 
     322!!$         ELSE 
     323!!$#if defined key_RK3 
     324!!$            CALL eos( ts, Kbb, rhop ) ! not rhop but rhd  
     325!!$#else 
     326!!$            CALL eos( ts, Kmm, rhop ) 
     327!!$#endif 
     328!!$         ENDIF 
     329!!$      ENDIF 
    337330      ! 
    338331   END SUBROUTINE rst_read 
    339332 
     
    377370         CALL iom_get( numror, jpdom_auto, 'sshb'   , ssh(:,:,Kbb) ) 
    378371         ! 
    379372         !                                     !*  RK3: Set ssh at Kmm for AGRIF 
    380          ssh(:,:,Kmm) = 0._wp 
     373         ssh(:,:,Kmm) = ssh(:,:,Kbb) 
    381374#else 
    382375         !                                     !*  MLF: Read ssh at Kmm 
    383376         IF(lwp) WRITE(numout,*) 
  • DEC_dbg_RK3/src/OCE/DYN/divhor.F90

     
    8383      !  
    8484      pe3divUh(:,:,:) = 0._wp    !!gm to be applied to the halos only 
    8585      ! 
    86       DO_3D( 0, 0, 0, 0, 1, jpkm1 )                                                   
     86      DO_3D_OVR( nn_hls-1, nn_hls, nn_hls-1, nn_hls, 1, jpkm1 ) 
    8787         hdiv(ji,jj,jk) = (   e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm) * puu(ji  ,jj,jk)      & 
    8888            &               - e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm) * puu(ji-1,jj,jk)      & 
    8989            &               + e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm) * pvv(ji,jj  ,jk)      & 
     
    100100      ! 
    101101      IF( ln_isf )   CALL isf_hdiv( kt, Kmm, hdiv )            !==  + ice-shelf mass exchange ==! 
    102102      ! 
    103       CALL lbc_lnk( 'divhor', hdiv, 'T', 1._wp )   !   (no sign change) 
     103      IF( nn_hls==1 )   CALL lbc_lnk( 'divhor', hdiv, 'T', 1._wp )   !   (no sign change) 
    104104      ! 
    105105!!gm Patch before suppression of hdiv from all modules that use it 
    106106!      DO_3D( 0, 0, 0, 0, 1, jpkm1 )                            !==  e3t * Horizontal divergence  ==! 
     
    107107!         pe3divUh(ji,jj,jk) = hdiv(ji,jj,jk) * e3t(ji,jj,jk,Kmm) 
    108108!      END_3D 
    109109!JC: over whole domain, and after lbclnk on hdiv to prevent from reproducibility issues 
    110       DO jk=1, jpkm1 
    111          pe3divUh(:,:,jk) = hdiv(:,:,jk) * e3t(:,:,jk,Kmm) 
    112       END DO 
     110      DO_3D_OVR( nn_hls-1, nn_hls, nn_hls-1, nn_hls, 1, jpkm1 ) 
     111         pe3divUh(ji,jj,jk) = hdiv(ji,jj,jk) * e3t(ji,jj,jk,Kmm) 
     112      END_3D 
    113113!!gm end 
    114114      ! 
    115115      ! 
  • DEC_dbg_RK3/src/OCE/DYN/sshwzv.F90

     
    328328         DO jk = 1, jpkm1 
    329329            ! horizontal divergence of thickness diffusion transport ( velocity multiplied by e3t) 
    330330            ! - ML - note: computation already done in dom_vvl_sf_nxt. Could be optimized (not critical and clearer this way) 
    331             DO_2D( 0, 0, 0, 0 ) 
     331            DO_2D( nn_hls-1, nn_hls, nn_hls-1, nn_hls )  
    332332               zhdiv(ji,jj,jk) = r1_e1e2t(ji,jj) * ( un_td(ji,jj,jk) - un_td(ji-1,jj,jk) + vn_td(ji,jj,jk) - vn_td(ji,jj-1,jk) ) 
    333333            END_2D 
    334334         END DO 
    335          CALL lbc_lnk('sshwzv', zhdiv, 'T', 1.0_wp)  ! - ML - Perhaps not necessary: not used for horizontal "connexions" 
     335         IF( nn_hls == 1)   CALL lbc_lnk('sshwzv', zhdiv, 'T', 1.0_wp)  ! - ML - Perhaps not necessary: not used for horizontal "connexions" 
    336336         !                             ! Is it problematic to have a wrong vertical velocity in boundary cells? 
    337337         !                             ! Same question holds for hdiv. Perhaps just for security 
    338          DO jk = jpkm1, 1, -1                       ! integrate from the bottom the hor. divergence 
    339             ! computation of w 
    340             pww(:,:,jk) = pww(:,:,jk+1) - (   ze3div(:,:,jk) + zhdiv(:,:,jk)   & 
    341                &                            + r1_Dt * (  e3t(:,:,jk,Kaa)       & 
    342                &                                       - e3t(:,:,jk,Kbb) )   ) * tmask(:,:,jk) 
    343          END DO 
    344          !          IF( ln_vvl_layer ) pww(:,:,:) = 0.e0 
     338         DO_3DS( nn_hls-1, nn_hls, nn_hls-1, nn_hls, jpkm1, 1, -1 )     ! integrate from the bottom the hor. divergence 
     339            pww(ji,jj,jk) = pww(ji,jj,jk+1) - (   ze3div(ji,jj,jk) + zhdiv(ji,jj,jk)   & 
     340                 &                            + r1_Dt * (  e3t(ji,jj,jk,Kaa)       & 
     341                 &                                       - e3t(ji,jj,jk,Kbb) )   ) * tmask(ji,jj,jk) 
     342         END_3D 
     343         ! 
    345344         DEALLOCATE( zhdiv )  
    346345         !                                            !=================================! 
    347346      ELSEIF( ln_linssh )   THEN                      !==  linear free surface cases  ==! 
    348347         !                                            !=================================! 
    349          DO jk = jpkm1, 1, -1                               ! integrate from the bottom the hor. divergence 
    350             pww(:,:,jk) = pww(:,:,jk+1) - ze3div(:,:,jk) 
    351          END DO 
     348         DO_3DS( nn_hls-1, nn_hls, nn_hls-1, nn_hls, jpkm1, 1, -1 )     ! integrate from the bottom the hor. divergence 
     349            pww(ji,jj,jk) = pww(ji,jj,jk+1) - ze3div(ji,jj,jk)  
     350         END_3D 
    352351         !                                            !==========================================! 
    353352      ELSE                                            !==  Quasi-Eulerian vertical coordinate  ==!   ('key_qco') 
    354353         !                                            !==========================================! 
    355          DO jk = jpkm1, 1, -1                               ! integrate from the bottom the hor. divergence 
    356             !                                               ! NB: [e3t[a] -e3t[b] ]=e3t_0*[r3t[a]-r3t[b]] 
    357             pww(:,:,jk) = pww(:,:,jk+1) - (  ze3div(:,:,jk)                            & 
    358                &                            + r1_Dt * e3t_0(:,:,jk) * ( r3t(:,:,Kaa) - r3t(:,:,Kbb) )  ) * tmask(:,:,jk) 
    359          END DO 
     354         DO_3DS( nn_hls-1, nn_hls, nn_hls-1, nn_hls, jpkm1, 1, -1 )     ! integrate from the bottom the hor. divergence 
     355         !                                                              ! NB: [e3t[a] -e3t[b] ]=e3t_0*[r3t[a]-r3t[b]] 
     356            pww(ji,jj,jk) = pww(ji,jj,jk+1) - (  ze3div(ji,jj,jk)                            & 
     357               &                               + r1_Dt * e3t_0(ji,jj,jk) * ( r3t(ji,jj,Kaa) - r3t(ji,jj,Kbb) )  ) * tmask(ji,jj,jk) 
     358         END_3D 
    360359      ENDIF 
    361360 
    362361      IF( ln_bdy ) THEN 
    363362         DO jk = 1, jpkm1 
    364             pww(:,:,jk) = pww(:,:,jk) * bdytmask(:,:) 
     363            DO_2D( nn_hls-1, nn_hls, nn_hls-1, nn_hls ) 
     364               pww(ji,jj,jk) = pww(ji,jj,jk) * bdytmask(ji,jj) 
     365            END_2D 
    365366         END DO 
    366367      ENDIF 
    367368      ! 
  • DEC_dbg_RK3/src/OCE/DYN/dynspg_ts.F90

     
    802802         END_2D 
    803803# endif    
    804804         ! 
    805          CALL lbc_lnk_multi( 'dynspg_ts', puu_b, 'U', -1._wp, pvv_b, 'V', -1._wp ) ! Boundary conditions 
     805         CALL lbc_lnk( 'dynspg_ts', puu_b, 'U', -1._wp, pvv_b, 'V', -1._wp ) ! Boundary conditions 
    806806         ! 
    807807      ENDIF 
    808808      ! 
  • DEC_dbg_RK3/src/OCE/stprk3_stg.F90

     
    3333# if defined key_agrif 
    3434   USE agrif_oce_interp 
    3535# endif 
     36!!st -dbg stp2d (r3u) 
     37   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
    3638    
    3739   ! 
    3840   USE prtctl         ! print control 
     
    147149      !                     !==  ssh/h0 ratio at Kaa  ==!  
    148150      ! 
    149151      IF( .NOT.lk_linssh )   CALL dom_qco_r3c( ssh(:,:,Kaa), r3t(:,:,Kaa), r3u(:,:,Kaa), r3v(:,:,Kaa), r3f(:,:) )   ! "after" ssh/h_0 ratio at t,u,v-column 
     152!!      SELECT CASE( kstg ) 
     153         ! 
     154!!      CASE ( 3 ) 
     155         !!st required at each stage for div hor loops 
     156         CALL lbc_lnk( 'stprk3_stg', r3u(:,:,Kaa), 'U', 1._wp, r3v(:,:,Kaa), 'V', 1._wp, r3f(:,:), 'F', 1._wp ) 
     157         ! 
     158!!      END SELECT 
    150159      ! 
    151160      ! 
    152161      !                     !==  advective velocity at Kmm  ==! 
    153162      ! 
    154163      !                                            !- horizontal components -!   (zaU,zaV)  
    155       zub(:,:) = un_adv(:,:)*r1_hu(:,:,Kmm) - uu_b(:,:,Kmm)    ! barotropic velocity correction 
    156       zvb(:,:) = vn_adv(:,:)*r1_hv(:,:,Kmm) - vv_b(:,:,Kmm) 
    157       DO jk = 1, jpkm1                                         ! horizontal advective velocity 
    158          zaU(:,:,jk) = uu(:,:,jk,Kmm) + zub(:,:)*umask(:,:,jk) 
    159          zaV(:,:,jk) = vv(:,:,jk,Kmm) + zvb(:,:)*vmask(:,:,jk) 
    160       END DO 
     164      DO_2D_OVR( nn_hls, nn_hls, nn_hls, nn_hls ) 
     165         zub(ji,jj) = un_adv(ji,jj)*r1_hu(ji,jj,Kmm) - uu_b(ji,jj,Kmm)    ! barotropic velocity correction 
     166         zvb(ji,jj) = vn_adv(ji,jj)*r1_hv(ji,jj,Kmm) - vv_b(ji,jj,Kmm) 
     167      END_2D 
     168      DO_3D_OVR( nn_hls, nn_hls, nn_hls, nn_hls, 1, jpkm1 )           ! horizontal advective velocity 
     169         zaU(ji,jj,jk) = uu(ji,jj,jk,Kmm) + zub(ji,jj)*umask(ji,jj,jk) 
     170         zaV(ji,jj,jk) = vv(ji,jj,jk,Kmm) + zvb(ji,jj)*vmask(ji,jj,jk) 
     171      END_3D 
     172 
    161173      !                                            !- vertical components -!   ww 
    162174                         CALL wzv  ( kstp, Kbb, Kmm, Kaa, zaU, zaV, ww )     ! ww cross-level velocity 
    163175 
     
    223235         IF(.NOT. ln_trcadv_mus ) THEN 
    224236            ! 
    225237            DO jn = 1, jptra 
    226                DO_3D( 0, 0, 0, 0, 1, jpkm1 ) 
    227                tr(ji,jj,jk,jn,Krhs) = 0._wp                              ! set tracer trends to zero 
    228                END_3D 
     238               tr(:,:,:,jn,Krhs) = 0._wp                              ! set tracer trends to zero !!st ::: required because of tra_adv new loops 
    229239            END DO 
    230240            !                                      !==  advection of passive tracers  ==! 
    231241            rDt_trc = rDt 
     
    253263         !                 !---------------! 
    254264         ! 
    255265         DO jn = 1, jptra 
    256             DO_3D( 0, 0, 0, 0, 1, jpkm1 ) 
    257             tr(ji,jj,jk,jn,Krhs) = 0._wp                              ! set tracer trends to zero 
    258             END_3D 
     266            tr(:,:,:,jn,Krhs) = 0._wp                              ! set tracer trends to zero !!st ::: required because of tra_adv new loops 
    259267         END DO 
    260268         !                                         !==  advection of passive tracers  ==! 
    261269         rDt_trc = rDt 
     
    393401      zvb(A2D(0)) = vv_b(A2D(0),Kaa) - SUM( e3v_0(A2D(0),:)*vv(A2D(0),:,Kaa), 3 ) * r1_hv_0(A2D(0)) 
    394402      ! 
    395403      DO jk = 1, jpkm1                                            ! corrected horizontal velocity 
    396          uu(:,:,jk,Kaa) = uu(:,:,jk,Kaa) + zub(:,:)*umask(:,:,jk) 
    397          vv(:,:,jk,Kaa) = vv(:,:,jk,Kaa) + zvb(:,:)*vmask(:,:,jk) 
     404         uu(A2D(0),jk,Kaa) = uu(A2D(0),jk,Kaa) + zub(A2D(0))*umask(A2D(0),jk) 
     405         vv(A2D(0),jk,Kaa) = vv(A2D(0),jk,Kaa) + zvb(A2D(0))*vmask(A2D(0),jk) 
    398406      END DO 
    399 !!st pourquoi ne pas mettre A2D(0) ici ?  
    400           
    401407 
     408 
    402409      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    403410      ! Set boundary conditions 
    404411      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     
    408415            CALL Agrif_dyn( kstp, kstg ) 
    409416# endif 
    410417      !                                              !* local domain boundaries  (T-point, unchanged sign) 
    411       CALL lbc_lnk_multi( 'stp_RK3_stg', uu(:,:,:,       Kaa), 'U', -1., vv(:,:,:       ,Kaa), 'V', -1.   & 
    412          &                             , ts(:,:,:,jp_tem,Kaa), 'T',  1., ts(:,:,:,jp_sal,Kaa), 'T',  1. ) 
     418      CALL lbc_lnk( 'stp_RK3_stg', uu(:,:,:,       Kaa), 'U', -1., vv(:,:,:       ,Kaa), 'V', -1.   & 
     419         &                       , ts(:,:,:,jp_tem,Kaa), 'T',  1., ts(:,:,:,jp_sal,Kaa), 'T',  1. ) 
     420      ! lbc_lnk needed for zdf_sh2 when using nn_hls = 2, moved here to allow tiling in zdf_phy 
     421      IF( nn_hls == 2 .AND. l_zdfsh2 ) CALL lbc_lnk( 'stp_RK3_stg', avm_k, 'W', 1.0_wp ) 
    413422      ! 
     423      ! 
    414424      !                                              !* BDY open boundaries 
    415425      IF( ln_bdy )   THEN 
    416426                               CALL bdy_tra( kstp, Kbb, ts,     Kaa ) 
  • DEC_dbg_RK3/src/OCE/ZDF/zdfphy.F90

     
    209209      ioptio = 0 
    210210      IF( ln_zdfcst ) THEN   ;   ioptio = ioptio + 1   ;    nzdf_phy = np_CST   ;   ENDIF 
    211211      IF( ln_zdfric ) THEN   ;   ioptio = ioptio + 1   ;    nzdf_phy = np_RIC   ;   CALL zdf_ric_init          ;   ENDIF 
    212       IF( ln_zdftke ) THEN   ;   ioptio = ioptio + 1   ;    nzdf_phy = np_TKE   ;   CALL zdf_tke_init( Kmm )   ;   ENDIF 
     212      IF( ln_zdftke ) THEN   ;   ioptio = ioptio + 1   ;    nzdf_phy = np_TKE   ;   CALL zdf_tke_init          ;   ENDIF 
    213213      IF( ln_zdfgls ) THEN   ;   ioptio = ioptio + 1   ;    nzdf_phy = np_GLS   ;   CALL zdf_gls_init          ;   ENDIF 
    214214      IF( ln_zdfosm ) THEN   ;   ioptio = ioptio + 1   ;    nzdf_phy = np_OSM   ;   CALL zdf_osm_init( Kmm )   ;   ENDIF 
    215215      ! 
     
    350350      IF( ln_zdfiwm )   CALL zdf_iwm( kt, Kmm, avm, avt, avs )   ! internal wave (de Lavergne et al 2017) 
    351351 
    352352      !                                         !* Lateral boundary conditions (sign unchanged) 
    353       IF(nn_hls==1) THEN 
     353      IF(nn_hls==1) THEN                                         ! if nn_hls==2 lbc_lnk done in stpxxx routines 
    354354         IF( l_zdfsh2 ) THEN 
    355355            CALL lbc_lnk( 'zdfphy', avm_k, 'W', 1.0_wp , avt_k, 'W', 1.0_wp,   & 
    356356                  &                 avm  , 'W', 1.0_wp , avt  , 'W', 1.0_wp , avs , 'W', 1.0_wp ) 
  • DEC_dbg_RK3/src/OCE/ZDF/zdftke.F90

     
    698698   END SUBROUTINE tke_avn 
    699699 
    700700 
    701    SUBROUTINE zdf_tke_init( Kmm ) 
     701   SUBROUTINE zdf_tke_init 
    702702      !!---------------------------------------------------------------------- 
    703703      !!                  ***  ROUTINE zdf_tke_init  *** 
    704704      !! 
     
    714714      !!---------------------------------------------------------------------- 
    715715      USE zdf_oce , ONLY : ln_zdfiwm   ! Internal Wave Mixing flag 
    716716      !! 
    717       INTEGER, INTENT(in) ::   Kmm          ! time level index 
    718717      INTEGER             ::   ji, jj, jk   ! dummy loop indices 
    719718      INTEGER             ::   ios 
    720719      !! 
  • DEC_dbg_RK3/src/OCE/TRA/traqsr.F90

     
    179179#endif 
    180180         END_3D 
    181181         !                                                     !- sea-ice : store the 1st level attenuation coefficient 
    182          WHERE( etot3(A2D(0),1) /= 0._wp )   ;   fraqsr_1lev(A2D(0)) = 1._wp - etot3(A2D(0),2) / etot3(A2D(0),1) 
    183          ELSEWHERE                           ;   fraqsr_1lev(A2D(0)) = 1._wp 
     182         WHERE( etot3(A2D(nn_hls),1) /= 0._wp )   ;   fraqsr_1lev(A2D(nn_hls)) = 1._wp - etot3(A2D(nn_hls),2) / etot3(A2D(nn_hls),1) 
     183         ELSEWHERE                                ;   fraqsr_1lev(A2D(nn_hls)) = 1._wp 
    184184         END WHERE 
    185185         ! 
    186186      END SELECT 
     
    207207            &                             / e3t(ji,jj,jk,Kmm) 
    208208      END_3D 
    209209      ! 
    210 !!st7-2 
    211210      ! sea-ice: store the 1st ocean level attenuation coefficient 
    212       DO_2D_OVR( nn_hls, nn_hls, nn_hls, nn_hls ) 
     211      DO_2D( 0, 0, 0, 0 ) 
    213212         IF( qsr(ji,jj) /= 0._wp ) THEN   ;   fraqsr_1lev(ji,jj) = qsr_hc(ji,jj,1) / ( r1_rho0_rcp * qsr(ji,jj) ) 
    214213         ELSE                             ;   fraqsr_1lev(ji,jj) = 1._wp 
    215214         ENDIF 
     
    217216      !                                       !===>>> CAUTION: lbc_lnk is required on fraqsr_lev since sea ice computes on the full domain 
    218217      !                                       !                otherwise restartability and reproducibility are broken  
    219218      CALL lbc_lnk( 'tra_qsr', fraqsr_1lev(:,:), 'T', 1._wp ) 
    220 !!st      CALL lbc_lnk( 'tra_qsr', qsr_hc(:,:,:), 'T', 1._wp ) 
    221219      ! 
    222220      IF( iom_use('qsr3d') ) THEN      ! output the shortwave Radiation distribution 
    223221         ALLOCATE( zetot(A2D(nn_hls),jpk) ) 
  • DEC_dbg_RK3/src/OCE/TRA/traadv_fct.F90

     
    186186               &      + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  )   & 
    187187               &      + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1) ) * r1_e1e2t(ji,jj) 
    188188            !                               ! update and guess with monotonic sheme 
     189!!st pt should be updated with a DO_3D( 0,0,0,0, 1, jpkm1 ) values outside the interior are wrong but unused. 
    189190            pt(ji,jj,jk,jn,Krhs) =                   pt(ji,jj,jk,jn,Krhs) +       ztra   & 
    190191               &                                  / e3t(ji,jj,jk,Kmm ) * tmask(ji,jj,jk) 
    191192            zwi(ji,jj,jk)    = ( e3t(ji,jj,jk,Kbb) * pt(ji,jj,jk,jn,Kbb) + p2dt * ztra ) & 
  • DEC_dbg_RK3/src/OCE/TRA/trasbc.F90

     
    275275             
    276276!!gm  This should be moved into sbcmod.F90 module ? (especially now that ln_traqsr is read in namsbc namelist) 
    277277      IF( .NOT.ln_traqsr  .AND. kstg == 1) THEN     ! no solar radiation penetration 
    278          DO_2D( 0, 0, 0, 0 ) 
     278         DO_2D_OVR( nn_hls, nn_hls, nn_hls, nn_hls ) 
    279279            qns(ji,jj) = qns(ji,jj) + qsr(ji,jj)         ! total heat flux in qns 
    280280            qsr(ji,jj) = 0._wp                           ! qsr set to zero 
    281281         END_2D 
  • DEC_dbg_RK3/src/OCE/TRD/trdglo.F90

     
    201201         zkz  (:,:,:) = 0._wp 
    202202         zkepe(:,:,:) = 0._wp 
    203203    
    204          CALL eos( ts(:,:,:,:,Kmm), rhd, rhop )       ! now potential density 
     204!!clem st dbg         CALL eos( ts(:,:,:,:,Kmm), rhd, rhop )       ! now potential density 
    205205 
    206206         zcof = 0.5_wp / rho0             ! Density flux at w-point 
    207207         zkz(:,:,1) = 0._wp 
  • DEC_dbg_RK3/src/TOP/trcini.F90

     
    246246      ! 
    247247      tr(:,:,:,:,Kaa) = 0._wp 
    248248      ! 
    249       IF( ln_trcbc .AND. lltrcbc )  THEN  
    250         CALL trc_bc_ini ( jptra, Kmm  )            ! set tracers Boundary Conditions 
    251         CALL trc_bc     ( nit000, Kmm, tr, Kaa )   ! tracers: surface and lateral Boundary Conditions 
    252       ENDIF 
    253       ! 
    254       IF( ln_trcais ) CALL trc_ais_ini   ! set tracers from Antarctic Ice Sheet 
    255       ! 
    256249      IF( ln_rsttr ) THEN              ! restart from a file 
    257250        ! 
    258251        CALL trc_rst_read( Kbb, Kmm ) 
  • DEC_dbg_RK3/src/TOP/trcrst.F90

     
    159159      ! prognostic variables  
    160160      ! -------------------- 
    161161#if defined key_RK3 
    162       DO jn = 1, jptra      ! MLF : After time step (before the swap) put in TRN 
    163          CALL iom_rstput( kt, nitrst, numrtw, 'TRN'//ctrcnm(jn), tr(:,:,:,jn,Kaa) ) 
    164       END DO 
    165162      DO jn = 1, jptra      ! RK3 : After time step (before the swap) put in TRB 
    166163         CALL iom_rstput( kt, nitrst, numrtw, 'TRB'//ctrcnm(jn), tr(:,:,:,jn,Kaa) ) 
    167164      END DO 
  • sette.sh

    === Documentation updates
    
    {{{#!box width=55em help
    Using previous parts, define the main changes to be done in the NEMO literature 
    (manuals, guide, web pages, …).
    }}}
    
    ''...''
    
    == Preview 
    
    {{{#!box width=50em info
    [[Include(wiki:Developers/DevProcess#preview_)]]
    }}}
    
    ''...''
    
    == Tests
    
    {{{#!box width=50em info
    [[Include(wiki:Developers/DevProcess#tests)]]
    }}}
    === Early SETTE tests
    Some preliminary SETTE tests have been carried out on branch `2021/dev_r14318_RK3_stage1` at revision 14244. The implementation is not complete at this stage and, in particular, RK3 time-stepping has not yet been implemented for passive tracers. Nevertheless, the tests that are possible will inform on the general status of the branch.
    
    The first step is to enable `key_qco` and `key_RK3` with SETTE. To allow easy selection, the following `-Q` option was added via changes to `sette.sh` `sette_reference-configurations.sh` and `sette_test-cases.sh`:
    
    {{{#!diff
     
    44MAIN_DIR=$(dirname $SETTE_DIR) 
    55export SETTE_TIMING='no' 
    66export NOT_USING_QCO='no' 
     7export USING_RK3='no' 
    78 
    89# Parse command-line arguments 
    910if [ $# -gt 0 ]; then 
    10   while getopts t:x:cshTq option; do 
     11  while getopts t:x:cshTqQ option; do 
    1112     case $option in 
    1213        c) export SETTE_CLEAN_CONFIGS='yes' 
    1314           export SETTE_SYNC_CONFIGS='yes' 
     
    3637           echo "" 
    3738           echo "key_qco and key_linssh will NOT be activated" 
    3839           echo "";; 
     40       Q) export USING_RK3='yes' 
     41           echo "" 
     42           echo "key_qco and key_RK3 will be activated" 
     43           echo "";; 
    3944        h | *) echo 'sette.sh with no arguments (in this case all configuration will be tested)' 
    4045               echo '-t "CFG1_to_test CFG2_to_test ..." to test some specific configurations' 
    4146               echo '-x "TEST_type TEST_type ..." to specify particular types of test (RESTART is mandatory)' 
  • sette_reference-configurations.sh

    }}}
    {{{#!diff
     
    143143   export DEL_KEYS="${DEL_KEYS} key_qco key_linssh" 
    144144fi 
    145145# 
     146if [ ${USING_RK3} == "yes" ] 
     147 then 
     148   export ADD_KEYS="${ADD_KEYS} key_qco key_RK3" 
     149fi 
     150# 
    146151# Settings which control the use of stand alone servers (only relevant if using xios) 
    147152# 
    148153export NUM_XIOSERVERS=4 
  • sette_test-cases.sh

    }}}
    {{{#!diff
     
    140140   export DEL_KEYS="${DEL_KEYS} key_qco key_linssh" 
    141141fi 
    142142# 
     143if [ ${USING_RK3} == "yes" ] 
     144 then 
     145   export ADD_KEYS="${ADD_KEYS} key_qco key_RK3" 
     146fi 
     147# 
    143148# Settings which control the use of stand alone servers (only relevant if using xios) 
    144149# 
    145150export NUM_XIOSERVERS=4 
  • OCE/stp2d.F90

    }}}
    With these changes and an, otherwise normal, SETTE setup the following tests have been attempted:
    
    {{{
    sette.sh -Q -t "AMM12 WED025 ICE_AGRIF OVERFLOW LOCK_EXCHANGE VORTEX ISOMIP+"
    }}}
    With the following outcomes:
    
    * No tests were successful but compilation succeeded and runs started for the following:
    {{{
    AMM12          -failed both restartability and reproducibility
    OVERFLOW       -failed restartability (no reproducibility: single proc)
    LOCK_EXCHANGE  -failed restartability (last digit differences in Umax)
    }}}
    * Generally there are a few compilation warnings to chase down:
    {{{
    ftn-7212 crayftn: WARNING STP_2D, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/OVERFLOW_ST/BLD/ppsrc/nemo/stp2d.f90, Line = 175
      Variable "r1_2" is used before it is defined.
    
    ftn-7212 crayftn: WARNING SUB_LOOP_DIA_HSB, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/VORTEX_ST/BLD/ppsrc/nemo/diahsb.f90, Line = 283
      Variable "z_frc_trd_t" is used before it is defined.
    
    ftn-7212 crayftn: WARNING SUB_LOOP_DIA_HSB, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/VORTEX_ST/BLD/ppsrc/nemo/diahsb.f90, Line = 284
      Variable "z_frc_trd_s" is used before it is defined.
    
    ftn-7212 crayftn: WARNING OBS_GRID_SETUP, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/obs_grid.f90, Line = 1275
      Variable "histx1" is used before it is defined.
    
    ftn-7212 crayftn: WARNING OBS_GRID_SETUP, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/obs_grid.f90, Line = 1281
      Variable "histx2" is used before it is defined.
    
    ftn-7212 crayftn: WARNING OBS_GRID_SETUP, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/obs_grid.f90, Line = 1287
    
    ftn-7212 crayftn: WARNING FLO_4RK, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/flo4rk.f90, Line = 85
      Variable "ierror" is used before it is defined.
    
    ftn-7212 crayftn: WARNING ICB_THM, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/icbthm.f90, Line = 218
      Variable "zdvo" is used before it is defined.
    
    ftn-7212 crayftn: WARNING TRA_NPC, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/tranpc.f90, Line = 194
      Variable "klc1" is used before it is defined.
    }}}
    None of which appear to be fatal (but the first may be serious)
    
    * WED025 compiled but failed to run with:
    {{{
      ===>>> : E R R O R
    
              ===========
    
     dyn_hpg_init : key_qco and ln_hpg_isf not yet compatible
    }}}
    * ICE_AGRIF compiled but failed to run with:
    {{{
      ===>>> : E R R O R
    
              ===========
    
     STOP
     domain: key_qco and ln_linssh=T or key_linssh are incompatible
    }}}
    * ISOMIP+ failed to compile with:
    {{{
    ftn-855 crayftn: ERROR STPRK3_STG, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/stprk3_stg.f90, Line = 14, Column = 8
      The compiler has detected errors in module "STPRK3_STG".  No module information file will be created for this module.
    
    
    ftn-389 crayftn: ERROR STP_RK3_STG, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/ISOMIP+_ST/BLD/ppsrc/nemo/stprk3_stg.f90, Line = 203, Column = 12
      No specific match can be found for the generic subprogram call "EOS".
    }}}
    * VORTEX failed to compile with:
    {{{
    ftn-855 crayftn: ERROR STPRK3_STG, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/VORTEX_ST/BLD/ppsrc/nemo/stprk3_stg.f90, Line = 27, Column = 8
      The compiler has detected errors in module "STPRK3_STG".  No module information file will be created for this module.
    
    
    ftn-297 crayftn: ERROR SUB_LOOP_STP_RK3_STG, File = ../../../lus/cls01095/work/n01/n01/acc/NEMO/2021/dev_r14318_RK3_stage1/tests/VORTEX_ST/BLD/ppsrc/nemo/stprk3_stg.f90, Line = 538, Column = 29
      IMPLICIT NONE is specified in the host scope, therefore an explicit type must be specified for data object "KT".
    }}}
    which is associated with the line: `CALL Agrif_dyn( kt )`
    
    Vortex can be compiled and run with the following (uncommitted) changes:
    {{{#!diff
     
    2626   USE sbc_ice , ONLY : snwice_mass, snwice_mass_b 
    2727   USE sbcapr         ! surface boundary condition: atmospheric pressure 
    2828   USE sbcwave,  ONLY : bhd_wave 
     29#if defined key_agrif 
     30   USE agrif_oce_interp 
     31#endif 
    2932 
    3033   PRIVATE 
    3134 
  • OCE/stprk3_stg.F90

     
    354354      ! 
    355355# if defined key_agrif 
    356356            CALL Agrif_tra                     !* AGRIF zoom boundaries 
    357             CALL Agrif_dyn( kt ) 
     357            CALL Agrif_dyn( kstp ) 
    358358# endif 
    359359      !                                        ! local domain boundaries  (T-point, unchanged sign) 
    360360      CALL lbc_lnk_multi( 'stp_RK3_stg', uu(:,:,:,       Kaa), 'U', -1., vv(:,:,:       ,Kaa), 'V', -1.   & 
Last modified 2 years ago Last modified on 2022-01-03T18:32:34+01:00