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 14201 for NEMO/trunk/src/OCE – NEMO

Changeset 14201 for NEMO/trunk/src/OCE


Ignore:
Timestamp:
2020-12-17T17:14:55+01:00 (3 years ago)
Author:
smasson
Message:

trunk: phase step.F90 and stpmlf.F90...

Location:
NEMO/trunk/src/OCE
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/LDF/ldfdyn.F90

    r14053 r14201  
    9999      !!    nn_ahm_ijk_t  =  0 => = constant 
    100100      !!                  = 10 => = F(z) :     = constant with a reduction of 1/4 with depth  
    101       !!                  =-20 => = F(i,j)     = shape read in 'eddy_viscosity.nc' file 
     101      !!                  =-20 => = F(i,j)     = shape read in 'eddy_viscosity_2D.nc' file 
    102102      !!                  = 20    = F(i,j)     = F(e1,e2) or F(e1^3,e2^3) (lap or bilap case) 
    103       !!                  =-30 => = F(i,j,k)   = shape read in 'eddy_viscosity.nc'  file 
     103      !!                  =-30 => = F(i,j,k)   = shape read in 'eddy_viscosity_3D.nc'  file 
    104104      !!                  = 30    = F(i,j,k)   = 2D (case 20) + decrease with depth (case 10) 
    105105      !!                  = 31    = F(i,j,k,t) = F(local velocity) (  |u|e  /12   laplacian operator 
  • NEMO/trunk/src/OCE/LDF/ldftra.F90

    r14189 r14201  
    118118      !!                  = 10 => = F(z) : constant with a reduction of 1/4 with depth 
    119119      !!                  ! 
    120       !!                  =-20 => = F(i,j)   = shape read in 'eddy_diffusivity.nc' file 
     120      !!                  =-20 => = F(i,j)   = shape read in 'eddy_diffusivity_2D.nc' file 
    121121      !!                  = 20    = F(i,j)   = F(e1,e2) or F(e1^3,e2^3) (lap or bilap case) 
    122122      !!                  = 21    = F(i,j,t) = F(growth rate of baroclinic instability) 
    123123      !!                  ! 
    124       !!                  =-30 => = F(i,j,k)   = shape read in 'eddy_diffusivity.nc' file 
     124      !!                  =-30 => = F(i,j,k)   = shape read in 'eddy_diffusivity_3D.nc' file 
    125125      !!                  = 30    = F(i,j,k)   = 2D (case 20) + decrease with depth (case 10) 
    126126      !!                  = 31    = F(i,j,k,t) = F(local velocity) (  1/2  |u|e     laplacian operator 
     
    481481      !!                  = 10 => = F(z) : constant with a reduction of 1/4 with depth 
    482482      !!                  ! 
    483       !!                  =-20 => = F(i,j)   = shape read in 'eddy_diffusivity.nc' file 
     483      !!                  =-20 => = F(i,j)   = shape read in 'eddy_induced_velocity_2D.nc' file 
    484484      !!                  = 20    = F(i,j)   = F(e1,e2) or F(e1^3,e2^3) (lap or bilap case) 
    485485      !!                  = 21    = F(i,j,t) = F(growth rate of baroclinic instability) 
    486486      !!                  ! 
    487       !!                  =-30 => = F(i,j,k)   = shape read in 'eddy_diffusivity.nc' file 
     487      !!                  =-30 => = F(i,j,k)   = shape read in 'eddy_induced_velocity_3D.nc' file 
    488488      !!                  = 30    = F(i,j,k)   = 2D (case 20) + decrease with depth (case 10) 
    489489      !! 
  • NEMO/trunk/src/OCE/step.F90

    r14143 r14201  
    5050   PUBLIC   stp   ! called by nemogcm.F90 
    5151 
    52    !!---------------------------------------------------------------------- 
    53    !! time level indices 
    54    !!---------------------------------------------------------------------- 
    55    INTEGER, PUBLIC :: Nbb, Nnn, Naa, Nrhs          !! used by nemo_init 
     52   !                                          !**  time level indices  **! 
     53   INTEGER, PUBLIC ::   Nbb, Nnn, Naa, Nrhs   !: used by nemo_init 
    5654 
    5755   !! * Substitutions 
     
    8886      !!---------------------------------------------------------------------- 
    8987      INTEGER ::   ji, jj, jk, jtile   ! dummy loop indice 
    90 !!gm kcall can be removed, I guess 
    91       INTEGER ::   kcall        ! optional integer argument (dom_vvl_sf_nxt) 
    9288      !! --------------------------------------------------------------------- 
    9389#if defined key_agrif 
     
    111107      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    112108      ! 
    113       IF( l_1st_euler ) THEN 
    114          ! start or restart with Euler 1st time-step 
    115          rDt =  rn_Dt 
     109      IF( l_1st_euler ) THEN     ! start or restart with Euler 1st time-step 
     110         rDt   = rn_Dt    
    116111         r1_Dt = 1._wp / rDt 
    117112      ENDIF 
     
    120115      ! update I/O and calendar 
    121116      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     117      ! 
    122118      IF( kstp == nit000 ) THEN                       ! initialize IOM context (must be done after nemo_init for AGRIF+XIOS+OASIS) 
    123119                             CALL iom_init( cxios_context, ld_closedef=.FALSE. )   ! for model grid (including possible AGRIF zoom) 
     
    126122         IF( ln_crs      )   CALL iom_init( TRIM(cxios_context)//"_crs" )  ! for coarse grid 
    127123      ENDIF 
    128       IF((kstp == nitrst) .AND. lwxios) THEN 
    129          CALL iom_swap(      cw_ocerst_cxt          ) 
    130          CALL iom_init_closedef(cw_ocerst_cxt) 
    131          CALL iom_setkt( kstp - nit000 + 1,      cw_ocerst_cxt          ) 
     124      IF( kstp == nitrst .AND. lwxios ) THEN 
     125                             CALL iom_swap(                     cw_ocerst_cxt ) 
     126                             CALL iom_init_closedef(            cw_ocerst_cxt ) 
     127                             CALL iom_setkt( kstp - nit000 + 1, cw_ocerst_cxt ) 
    132128#if defined key_top 
    133          CALL iom_swap(      cw_toprst_cxt          ) 
    134          CALL iom_init_closedef(cw_toprst_cxt) 
    135          CALL iom_setkt( kstp - nit000 + 1,      cw_toprst_cxt          ) 
     129                             CALL iom_swap(                     cw_toprst_cxt ) 
     130                             CALL iom_init_closedef(            cw_toprst_cxt ) 
     131                             CALL iom_setkt( kstp - nit000 + 1, cw_toprst_cxt ) 
    136132#endif 
    137133      ENDIF 
    138134#if defined key_si3 
    139       IF(((kstp + nn_fsbc - 1) == nitrst) .AND. lwxios) THEN 
    140          CALL iom_swap(      cw_icerst_cxt          ) 
    141          CALL iom_init_closedef(cw_icerst_cxt) 
    142          CALL iom_setkt( kstp - nit000 + 1,      cw_icerst_cxt          ) 
     135      IF( kstp + nn_fsbc - 1 == nitrst .AND. lwxios ) THEN 
     136                             CALL iom_swap(                     cw_icerst_cxt ) 
     137                             CALL iom_init_closedef(            cw_icerst_cxt ) 
     138                             CALL iom_setkt( kstp - nit000 + 1, cw_icerst_cxt ) 
    143139      ENDIF 
    144140#endif 
     
    159155      ! Update stochastic parameters and random T/S fluctuations 
    160156      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    161       IF( ln_sto_eos ) CALL sto_par( kstp )          ! Stochastic parameters 
    162       IF( ln_sto_eos ) CALL sto_pts( ts(:,:,:,:,Nnn)  )          ! Random T/S fluctuations 
     157      IF( ln_sto_eos )   CALL sto_par( kstp )                         ! Stochastic parameters 
     158      IF( ln_sto_eos )   CALL sto_pts( ts(:,:,:,:,Nnn)  )             ! Random T/S fluctuations 
    163159 
    164160      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    200196      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    201197 
    202                             CALL ssh_nxt       ( kstp, Nbb, Nnn, ssh, Naa )    ! after ssh (includes call to div_hor) 
    203       IF( .NOT.ln_linssh )  CALL dom_vvl_sf_nxt( kstp, Nbb, Nnn,      Naa )    ! after vertical scale factors 
    204                             CALL wzv           ( kstp, Nbb, Nnn, Naa, ww  )    ! now cross-level velocity 
    205       IF( ln_zad_Aimp )     CALL wAimp         ( kstp,      Nnn           )  ! Adaptive-implicit vertical advection partitioning 
    206                             CALL eos    ( ts(:,:,:,:,Nnn), rhd, rhop, gdept(:,:,:,Nnn) )  ! now in situ density for hpg computation 
     198                         CALL ssh_nxt       ( kstp, Nbb, Nnn, ssh, Naa )   ! after ssh (includes call to div_hor) 
     199      IF( .NOT.ln_linssh )   & 
     200                       & CALL dom_vvl_sf_nxt( kstp, Nbb, Nnn,      Naa )   ! after vertical scale factors 
     201                         CALL wzv           ( kstp, Nbb, Nnn, Naa, ww  )   ! now cross-level velocity 
     202      IF( ln_zad_Aimp )  CALL wAimp         ( kstp,      Nnn           )   ! Adaptive-implicit vertical advection partitioning 
     203                         CALL eos    ( ts(:,:,:,:,Nnn), rhd, rhop, gdept(:,:,:,Nnn) )  ! now in situ density for hpg computation 
    207204 
    208205 
     
    231228                            CALL dyn_zdf    ( kstp, Nbb, Nnn, Nrhs, uu, vv, Naa  )  ! vertical diffusion 
    232229      IF( ln_dynspg_ts ) THEN                                                       ! vertical scale factors and vertical velocity need to be updated 
    233                             CALL wzv        ( kstp, Nbb, Nnn, Naa, ww )             ! now cross-level velocity 
     230                            CALL wzv        ( kstp, Nbb, Nnn, Naa, ww )             ! Nnn cross-level velocity 
    234231         IF( ln_zad_Aimp )  CALL wAimp      ( kstp,      Nnn )                      ! Adaptive-implicit vertical advection partitioning 
    235232      ENDIF 
     
    259256      ! Passive Tracer Model 
    260257      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    261                          CALL trc_stp       ( kstp, Nbb, Nnn, Nrhs, Naa )  ! time-stepping 
     258                         CALL trc_stp    ( kstp, Nbb, Nnn, Nrhs, Naa )           ! time-stepping 
    262259#endif 
    263260 
     
    267264      ! Loop over tile domains 
    268265      DO jtile = 1, nijtile 
    269          IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
     266         IF( ln_tile    )  CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
    270267 
    271268         DO_3D( 0, 0, 0, 0, 1, jpk ) 
    272             ts(ji,jj,jk,:,Nrhs) = 0._wp                                         ! set tracer trends to zero 
     269            ts(ji,jj,jk,:,Nrhs) = 0._wp                                   ! set tracer trends to zero 
    273270         END_3D 
    274271 
     
    285282 
    286283#if defined key_agrif 
    287          IF(.NOT. Agrif_Root()) THEN 
    288             IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) 
    289             CALL Agrif_Sponge_tra        ! tracers sponge 
    290          ENDIF 
     284      IF(.NOT. Agrif_Root()) THEN 
     285         IF( ln_tile    )  CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) 
     286                            CALL Agrif_Sponge_tra        ! tracers sponge 
     287      ENDIF 
    291288#endif 
    292289 
    293290      ! TEMP: [tiling] Separate loop over tile domains (due to tra_adv workarounds for tiling) 
    294291      DO jtile = 1, nijtile 
    295          IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
     292         IF( ln_tile    )  CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
    296293 
    297294                            CALL tra_adv    ( kstp, Nbb, Nnn, ts, Nrhs )  ! hor. + vert. advection ==> RHS 
    298295         IF( ln_zdfmfc  )   CALL tra_mfc    ( kstp, Nbb,      ts, Nrhs )  ! Mass Flux Convection 
    299296         IF( ln_zdfosm  )   CALL tra_osm    ( kstp,      Nnn, ts, Nrhs )  ! OSMOSIS non-local tracer fluxes ==> RHS 
    300          IF( lrst_oce .AND. ln_zdfosm ) & 
    301               &             CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts 
     297         IF( lrst_oce .AND. ln_zdfosm )   & 
     298                         CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts 
    302299                            CALL tra_ldf    ( kstp, Nbb, Nnn, ts, Nrhs )  ! lateral mixing 
    303300 
     
    363360      ! AGRIF update 
    364361      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    365       IF( Agrif_NbStepint() == 0 .AND. nstop == 0 ) THEN 
    366                          CALL Agrif_update_all( )                  ! Update all components 
    367       ENDIF 
    368  
    369 #endif 
    370       IF( ln_diaobs .AND. nstop == 0 )  CALL dia_obs( kstp, Nnn )  ! obs-minus-model (assimilation) diags (after dynamics update) 
     362      IF( Agrif_NbStepint() == 0 .AND. nstop == 0 )   & 
     363         &               CALL Agrif_update_all( )                  ! Update all components 
     364 
     365#endif 
     366      IF( ln_diaobs .AND. nstop == 0 )   & 
     367         &               CALL dia_obs( kstp, Nnn )  ! obs-minus-model (assimilation) diags (after dynamics update) 
    371368 
    372369      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    375372      IF( kstp == nit000 ) THEN                          ! 1st time step only 
    376373                                        CALL iom_close( numror )   ! close input  ocean restart file 
    377          IF( lrxios )                   CALL iom_context_finalize(      cr_ocerst_cxt        ) 
     374         IF( lrxios )                   CALL iom_context_finalize( cr_ocerst_cxt ) 
    378375         IF(lwm)                        CALL FLUSH    ( numond )   ! flush output namelist oce 
    379376         IF(lwm .AND. numoni /= -1 )    CALL FLUSH    ( numoni )   ! flush output namelist ice (if exist) 
     
    396393      ! 
    397394      IF( l_1st_euler ) THEN         ! recover Leap-frog timestep 
    398          rDt = 2._wp * rn_Dt 
     395         rDt   = 2._wp * rn_Dt 
    399396         r1_Dt = 1._wp / rDt 
    400397         l_1st_euler = .FALSE. 
  • NEMO/trunk/src/OCE/stpmlf.F90

    r14143 r14201  
    3535   !!            4.x  !  2020-08  (S. Techene, G. Madec)  quasi eulerian coordinate time stepping 
    3636   !!---------------------------------------------------------------------- 
    37  
    3837#if defined key_qco   ||   defined key_linssh 
    3938   !!---------------------------------------------------------------------- 
     
    4241   !!   'key_linssh                       Fixed in time vertical coordinate 
    4342   !!---------------------------------------------------------------------- 
    44  
     43   !! 
    4544   !!---------------------------------------------------------------------- 
    4645   !!   stp_MLF       : NEMO modified Leap Frog time-stepping with qco or linssh 
     
    4948   ! 
    5049   USE domqco         ! quasi-eulerian coordinate 
    51    USE traatf_qco     ! time filtering                   (tra_atf_qco routine) 
    52    USE dynatf_qco     ! time filtering                   (dyn_atf_qco routine) 
     50   USE traatf_qco     ! time filtering                 (tra_atf_qco routine) 
     51   USE dynatf_qco     ! time filtering                 (dyn_atf_qco routine) 
    5352    
    5453   USE bdydyn         ! ocean open boundary conditions (define bdy_dyn) 
     
    6059   IMPLICIT NONE 
    6160   PRIVATE 
    62     
     61 
    6362   PUBLIC   stp_MLF   ! called by nemogcm.F90 
    6463 
     
    6766 
    6867   !! * Substitutions 
     68#  include "do_loop_substitute.h90" 
    6969#  include "domzgr_substitute.h90" 
    7070   !!---------------------------------------------------------------------- 
     
    9898      !!              -8- Outputs and diagnostics 
    9999      !!---------------------------------------------------------------------- 
    100       INTEGER ::   ji, jj, jk   ! dummy loop indice 
    101       INTEGER ::   indic        ! error indicator if < 0 
     100      INTEGER ::   ji, jj, jk, jtile   ! dummy loop indice 
    102101      REAL(wp),              DIMENSION(jpi,jpj,jpk) ::   zgdept 
    103102      REAL(wp), ALLOCATABLE, DIMENSION(:,:)         ::   zssh_f 
    104103      !! --------------------------------------------------------------------- 
    105104#if defined key_agrif 
     105      IF( nstop > 0 ) RETURN   ! avoid to go further if an error was detected during previous time step (child grid) 
    106106      kstp = nit000 + Agrif_Nb_Step() 
    107107      Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs   ! agrif_oce module copies of time level indices 
     
    130130      ! update I/O and calendar 
    131131      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    132                              indic = 0                ! reset to no error condition 
    133  
     132      ! 
    134133      IF( kstp == nit000 ) THEN                       ! initialize IOM context (must be done after nemo_init for AGRIF+XIOS+OASIS) 
    135                              CALL iom_init( cxios_context, ld_closedef=.FALSE. )   ! for model grid (including passible AGRIF zoom) 
     134                             CALL iom_init( cxios_context, ld_closedef=.FALSE. )   ! for model grid (including possible AGRIF zoom) 
    136135         IF( lk_diamlr   )   CALL dia_mlr_iom_init    ! with additional setup for multiple-linear-regression analysis 
    137136                             CALL iom_init_closedef 
    138137         IF( ln_crs      )   CALL iom_init( TRIM(cxios_context)//"_crs" )  ! for coarse grid 
    139138      ENDIF 
     139      IF( kstp == nitrst .AND. lwxios ) THEN 
     140                             CALL iom_swap(                     cw_ocerst_cxt ) 
     141                             CALL iom_init_closedef(            cw_ocerst_cxt ) 
     142                             CALL iom_setkt( kstp - nit000 + 1, cw_ocerst_cxt ) 
     143#if defined key_top 
     144                             CALL iom_swap(                     cw_toprst_cxt ) 
     145                             CALL iom_init_closedef(            cw_toprst_cxt ) 
     146                             CALL iom_setkt( kstp - nit000 + 1, cw_toprst_cxt ) 
     147#endif 
     148      ENDIF 
     149#if defined key_si3 
     150      IF( kstp + nn_fsbc - 1 == nitrst .AND. lwxios ) THEN 
     151                             CALL iom_swap(                     cw_icerst_cxt ) 
     152                             CALL iom_init_closedef(            cw_icerst_cxt ) 
     153                             CALL iom_setkt( kstp - nit000 + 1, cw_icerst_cxt ) 
     154      ENDIF 
     155#endif 
    140156      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
    141157                             CALL iom_setkt( kstp - nit000 + 1,      cxios_context          )   ! tell IOM we are at time step kstp 
     
    154170      ! Update stochastic parameters and random T/S fluctuations 
    155171      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    156       IF( ln_sto_eos ) CALL sto_par( kstp )          ! Stochastic parameters 
    157       IF( ln_sto_eos ) CALL sto_pts( ts(:,:,:,:,Nnn)  )          ! Random T/S fluctuations 
     172      IF( ln_sto_eos )   CALL sto_par( kstp )                         ! Stochastic parameters 
     173      IF( ln_sto_eos )   CALL sto_pts( ts(:,:,:,:,Nnn)  )             ! Random T/S fluctuations 
    158174 
    159175      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    197213         zgdept(:,:,jk) = gdept(:,:,jk,Nnn) 
    198214      END DO 
    199                             CALL ssh_nxt    ( kstp, Nbb, Nnn, ssh,  Naa )   ! after ssh (includes call to div_hor) 
    200       IF( .NOT.lk_linssh )  THEN 
    201                              CALL dom_qco_r3c( ssh(:,:,Naa), r3t(:,:,Naa), r3u(:,:,Naa), r3v(:,:,Naa)           )   ! "after" ssh/h_0 ratio at t,u,v pts 
    202          IF( ln_dynspg_exp ) CALL dom_qco_r3c( ssh(:,:,Nnn), r3t(:,:,Nnn), r3u(:,:,Nnn), r3v(:,:,Nnn), r3f(:,:) )   ! spg_exp : needed only for "now" ssh/h_0 ratio at f point 
    203       ENDIF 
    204                             CALL wzv        ( kstp, Nbb, Nnn, Naa, ww  )    ! Nnn cross-level velocity 
    205       IF( ln_zad_Aimp )     CALL wAimp      ( kstp,      Nnn           )    ! Adaptive-implicit vertical advection partitioning 
    206                             CALL eos        ( ts(:,:,:,:,Nnn), rhd, rhop, zgdept ) ! now in situ density for hpg computation 
     215                         CALL ssh_nxt    ( kstp, Nbb, Nnn, ssh,  Naa )   ! after ssh (includes call to div_hor) 
     216      IF( .NOT.lk_linssh ) THEN 
     217                         CALL dom_qco_r3c( ssh(:,:,Naa), r3t(:,:,Naa), r3u(:,:,Naa), r3v(:,:,Naa)           )   ! "after" ssh/h_0 ratio at t,u,v pts 
     218         IF( ln_dynspg_exp )   & 
     219            &            CALL dom_qco_r3c( ssh(:,:,Nnn), r3t(:,:,Nnn), r3u(:,:,Nnn), r3v(:,:,Nnn), r3f(:,:) )   ! spg_exp : needed only for "now" ssh/h_0 ratio at f point 
     220      ENDIF 
     221                         CALL wzv        ( kstp, Nbb, Nnn, Naa, ww  )    ! Nnn cross-level velocity 
     222      IF( ln_zad_Aimp )  CALL wAimp      ( kstp,      Nnn           )    ! Adaptive-implicit vertical advection partitioning 
     223                         CALL eos        ( ts(:,:,:,:,Nnn), rhd, rhop, zgdept ) ! now in situ density for hpg computation 
    207224 
    208225 
     
    223240                         CALL dyn_hpg( kstp,      Nnn      , uu, vv, Nrhs )  ! horizontal gradient of Hydrostatic pressure 
    224241                         CALL dyn_spg( kstp, Nbb, Nnn, Nrhs, uu, vv, ssh, uu_b, vv_b, Naa )  ! surface pressure gradient 
     242 
    225243                                                      ! With split-explicit free surface, since now transports have been updated and ssh(:,:,Nrhs) as well 
    226  
    227244      IF( ln_dynspg_ts ) THEN                         ! vertical scale factors and vertical velocity need to be updated 
    228245                            CALL div_hor    ( kstp, Nbb, Nnn )                ! Horizontal divergence  (2nd call in time-split case) 
     
    270287      ! Active tracers 
    271288      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    272                          ts(:,:,:,:,Nrhs) = 0._wp         ! set tracer trends to zero 
    273  
    274       IF(  lk_asminc .AND. ln_asmiau .AND. & 
    275          & ln_trainc )   CALL tra_asm_inc( kstp, Nbb, Nnn, ts, Nrhs )  ! apply tracer assimilation increment 
    276                          CALL tra_sbc    ( kstp,      Nnn, ts, Nrhs )  ! surface boundary condition 
    277       IF( ln_traqsr  )   CALL tra_qsr    ( kstp,      Nnn, ts, Nrhs )  ! penetrative solar radiation qsr 
    278       IF( ln_isf     )   CALL tra_isf    ( kstp,      Nnn, ts, Nrhs )  ! ice shelf heat flux 
    279       IF( ln_trabbc  )   CALL tra_bbc    ( kstp,      Nnn, ts, Nrhs )  ! bottom heat flux 
    280       IF( ln_trabbl  )   CALL tra_bbl    ( kstp, Nbb, Nnn, ts, Nrhs )  ! advective (and/or diffusive) bottom boundary layer scheme 
    281       IF( ln_tradmp  )   CALL tra_dmp    ( kstp, Nbb, Nnn, ts, Nrhs )  ! internal damping trends 
    282       IF( ln_bdy     )   CALL bdy_tra_dmp( kstp, Nbb,      ts, Nrhs )  ! bdy damping trends 
    283 #if defined key_agrif 
    284       IF(.NOT. Agrif_Root())  & 
    285                &         CALL Agrif_Sponge_tra        ! tracers sponge 
    286 #endif 
    287                          CALL tra_adv    ( kstp, Nbb, Nnn, ts, Nrhs )  ! hor. + vert. advection ==> RHS 
    288       IF( ln_zdfosm  )   CALL tra_osm    ( kstp,      Nnn, ts, Nrhs )  ! OSMOSIS non-local tracer fluxes ==> RHS 
    289       IF( lrst_oce .AND. ln_zdfosm ) & 
    290            &             CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts 
    291                          CALL tra_ldf    ( kstp, Nbb, Nnn, ts, Nrhs )  ! lateral mixing 
    292  
    293                          CALL tra_zdf    ( kstp, Nbb, Nnn, Nrhs, ts, Naa  )  ! vertical mixing and after tracer fields 
    294       IF( ln_zdfnpc  )   CALL tra_npc    ( kstp,      Nnn, Nrhs, ts, Naa  )  ! update after fields by non-penetrative convection 
    295  
     289      ! Loop over tile domains 
     290      DO jtile = 1, nijtile 
     291         IF( ln_tile    )   CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
     292 
     293         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     294            ts(ji,jj,jk,:,Nrhs) = 0._wp                                   ! set tracer trends to zero 
     295         END_3D 
     296 
     297         IF(  lk_asminc .AND. ln_asmiau .AND. & 
     298            & ln_trainc )   CALL tra_asm_inc( kstp, Nbb, Nnn, ts, Nrhs )  ! apply tracer assimilation increment 
     299                            CALL tra_sbc    ( kstp,      Nnn, ts, Nrhs )  ! surface boundary condition 
     300         IF( ln_traqsr  )   CALL tra_qsr    ( kstp,      Nnn, ts, Nrhs )  ! penetrative solar radiation qsr 
     301         IF( ln_isf     )   CALL tra_isf    ( kstp,      Nnn, ts, Nrhs )  ! ice shelf heat flux 
     302         IF( ln_trabbc  )   CALL tra_bbc    ( kstp,      Nnn, ts, Nrhs )  ! bottom heat flux 
     303         IF( ln_trabbl  )   CALL tra_bbl    ( kstp, Nbb, Nnn, ts, Nrhs )  ! advective (and/or diffusive) bottom boundary layer scheme 
     304         IF( ln_tradmp  )   CALL tra_dmp    ( kstp, Nbb, Nnn, ts, Nrhs )  ! internal damping trends 
     305         IF( ln_bdy     )   CALL bdy_tra_dmp( kstp, Nbb,      ts, Nrhs )  ! bdy damping trends 
     306      END DO 
     307 
     308#if defined key_agrif 
     309      IF(.NOT. Agrif_Root()) THEN 
     310         IF( ln_tile    )   CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) 
     311                            CALL Agrif_Sponge_tra        ! tracers sponge 
     312      ENDIF 
     313#endif 
     314 
     315      ! TEMP: [tiling] Separate loop over tile domains (due to tra_adv workarounds for tiling) 
     316      DO jtile = 1, nijtile 
     317         IF( ln_tile    )   CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
     318 
     319                            CALL tra_adv    ( kstp, Nbb, Nnn, ts, Nrhs )  ! hor. + vert. advection ==> RHS 
     320         IF( ln_zdfmfc  )   CALL tra_mfc    ( kstp, Nbb,      ts, Nrhs )  ! Mass Flux Convection 
     321         IF( ln_zdfosm  )   CALL tra_osm    ( kstp,      Nnn, ts, Nrhs )  ! OSMOSIS non-local tracer fluxes ==> RHS 
     322         IF( lrst_oce .AND. ln_zdfosm )   & 
     323            &               CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts 
     324                            CALL tra_ldf    ( kstp, Nbb, Nnn, ts, Nrhs )  ! lateral mixing 
     325 
     326                            CALL tra_zdf    ( kstp, Nbb, Nnn, Nrhs, ts, Naa  )  ! vertical mixing and after tracer fields 
     327         IF( ln_zdfnpc  )   CALL tra_npc    ( kstp,      Nnn, Nrhs, ts, Naa  )  ! update after fields by non-penetrative convection 
     328      END DO 
     329 
     330      IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) ! Revert to tile over full domain 
    296331      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    297332      ! Set boundary conditions, time filter and swap time levels 
     
    319354                         r3v(:,:,Nnn) = r3v_f(:,:) 
    320355      ENDIF 
    321  
    322356      ! 
    323357      ! Swap time levels 
     
    340374#if defined key_agrif 
    341375      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    342       ! AGRIF 
     376      ! AGRIF recursive integration 
    343377      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    344378                         Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs      ! agrif_oce module copies of time level indices 
    345379                         CALL Agrif_Integrate_ChildGrids( stp_MLF )       ! allows to finish all the Child Grids before updating 
    346380 
    347                          IF( Agrif_NbStepint() == 0 ) THEN 
    348                             CALL Agrif_update_all( )                  ! Update all components 
    349                          ENDIF 
    350 #endif 
    351       IF( ln_diaobs  )   CALL dia_obs      ( kstp, Nnn )      ! obs-minus-model (assimilation) diagnostics (call after dynamics update) 
    352  
     381#endif 
    353382      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    354383      ! Control 
     
    356385                         CALL stp_ctl      ( kstp, Nnn ) 
    357386 
     387#if defined key_agrif 
     388      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     389      ! AGRIF update 
     390      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     391      IF( Agrif_NbStepint() == 0 .AND. nstop == 0 )   & 
     392         &               CALL Agrif_update_all( )                  ! Update all components 
     393      ENDIF 
     394 
     395#endif 
     396      IF( ln_diaobs .AND. nstop == 0 )   & 
     397         &               CALL dia_obs( kstp, Nnn )  ! obs-minus-model (assimilation) diags (after dynamics update) 
     398 
     399      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     400      ! File manipulation at the end of the first time step 
     401      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    358402      IF( kstp == nit000 ) THEN                          ! 1st time step only 
    359403                                        CALL iom_close( numror )   ! close input  ocean restart file 
     404         IF( lrxios )                   CALL iom_context_finalize( cr_ocerst_cxt ) 
    360405         IF(lwm)                        CALL FLUSH    ( numond )   ! flush output namelist oce 
    361406         IF(lwm .AND. numoni /= -1 )    CALL FLUSH    ( numoni )   ! flush output namelist ice (if exist) 
     
    365410      ! Coupled mode 
    366411      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    367 !!gm why lk_oasis and not lk_cpl ???? 
    368       IF( lk_oasis   )   CALL sbc_cpl_snd( kstp, Nbb, Nnn )        ! coupled mode : field exchanges 
     412      IF( lk_oasis .AND. nstop == 0 )   CALL sbc_cpl_snd( kstp, Nbb, Nnn )     ! coupled mode : field exchanges 
    369413      ! 
    370414#if defined key_iomput 
    371       IF( kstp == nitend .OR. indic < 0 ) THEN 
     415      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     416      ! Finalize contextes if end of simulation or error detected 
     417      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     418      IF( kstp == nitend .OR. nstop > 0 ) THEN 
    372419                      CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF 
    373420         IF( ln_crs ) CALL iom_context_finalize( trim(cxios_context)//"_crs" ) ! 
     
    376423      ! 
    377424      IF( l_1st_euler ) THEN         ! recover Leap-frog timestep 
    378          rDt   = 2._wp * rn_Dt    
     425         rDt   = 2._wp * rn_Dt 
    379426         r1_Dt = 1._wp / rDt 
    380          l_1st_euler = .FALSE.       
     427         l_1st_euler = .FALSE. 
    381428      ENDIF 
    382429      ! 
Note: See TracChangeset for help on using the changeset viewer.