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 14644 for NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/step.F90 – NEMO

Ignore:
Timestamp:
2021-03-26T15:33:49+01:00 (3 years ago)
Author:
sparonuz
Message:

Merge trunk -r14642:HEAD

Location:
NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final

    • Property svn:externals
      •  

        old new  
        99 
        1010# SETTE 
        11 ^/utils/CI/sette_wave@13990         sette 
         11^/utils/CI/sette@14244        sette 
  • NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/step.F90

    r14219 r14644  
    3333   !!            4.1  !  2019-08  (A. Coward, D. Storkey) rewrite in preparation for new timestepping scheme 
    3434   !!---------------------------------------------------------------------- 
     35 
    3536#if defined key_qco   ||   defined key_linssh 
    3637   !!---------------------------------------------------------------------- 
     
    4142#else 
    4243   !!---------------------------------------------------------------------- 
    43    !!   stp             : OPA system time-stepping 
     44   !!   stp             : OCE system time-stepping 
    4445   !!---------------------------------------------------------------------- 
    4546   USE step_oce         ! time stepping definition modules 
     
    5051   PUBLIC   stp   ! called by nemogcm.F90 
    5152 
    52    !!---------------------------------------------------------------------- 
    53    !! time level indices 
    54    !!---------------------------------------------------------------------- 
    55    INTEGER, PUBLIC :: Nbb, Nnn, Naa, Nrhs          !! used by nemo_init 
     53   !                                          !**  time level indices  **! 
     54   INTEGER, PUBLIC ::   Nbb, Nnn, Naa, Nrhs   !: used by nemo_init 
    5655 
    5756   !! * Substitutions 
    5857#  include "do_loop_substitute.h90" 
    5958#  include "single_precision_substitute.h90" 
    60  
    6159   !!---------------------------------------------------------------------- 
    6260   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    7674      !!                     ***  ROUTINE stp  *** 
    7775      !! 
    78       !! ** Purpose : - Time stepping of OPA  (momentum and active tracer eqs.) 
     76      !! ** Purpose : - Time stepping of OCE  (momentum and active tracer eqs.) 
    7977      !!              - Time stepping of SI3 (dynamic and thermodynamic eqs.) 
    8078      !!              - Time stepping of TRC  (passive tracer eqs.) 
     
    9088      !!---------------------------------------------------------------------- 
    9189      INTEGER ::   ji, jj, jk, jtile   ! dummy loop indice 
    92 !!gm kcall can be removed, I guess 
    93       INTEGER ::   kcall        ! optional integer argument (dom_vvl_sf_nxt) 
    9490      !! --------------------------------------------------------------------- 
    9591#if defined key_agrif 
     
    10298      ENDIF 
    10399      IF( kstp == nit000 + 1 )   lk_agrif_fstep = .FALSE. 
    104 # if defined key_iomput 
     100# if defined key_xios 
    105101      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context ) 
    106102# endif 
     
    113109      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    114110      ! 
    115       IF( l_1st_euler ) THEN 
    116          ! start or restart with Euler 1st time-step 
    117          rDt =  rn_Dt 
     111      IF( l_1st_euler ) THEN     ! start or restart with Euler 1st time-step 
     112         rDt   = rn_Dt    
    118113         r1_Dt = 1._wp / rDt 
    119114      ENDIF 
     
    122117      ! update I/O and calendar 
    123118      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     119      ! 
    124120      IF( kstp == nit000 ) THEN                       ! initialize IOM context (must be done after nemo_init for AGRIF+XIOS+OASIS) 
    125121                             CALL iom_init( cxios_context, ld_closedef=.FALSE. )   ! for model grid (including possible AGRIF zoom) 
     
    128124         IF( ln_crs      )   CALL iom_init( TRIM(cxios_context)//"_crs" )  ! for coarse grid 
    129125      ENDIF 
    130       IF((kstp == nitrst) .AND. lwxios) THEN 
    131          CALL iom_swap(      cw_ocerst_cxt          ) 
    132          CALL iom_init_closedef(cw_ocerst_cxt) 
    133          CALL iom_setkt( kstp - nit000 + 1,      cw_ocerst_cxt          ) 
     126      IF( kstp == nitrst .AND. lwxios ) THEN 
     127                             CALL iom_swap(                     cw_ocerst_cxt ) 
     128                             CALL iom_init_closedef(            cw_ocerst_cxt ) 
     129                             CALL iom_setkt( kstp - nit000 + 1, cw_ocerst_cxt ) 
    134130#if defined key_top 
    135          CALL iom_swap(      cw_toprst_cxt          ) 
    136          CALL iom_init_closedef(cw_toprst_cxt) 
    137          CALL iom_setkt( kstp - nit000 + 1,      cw_toprst_cxt          ) 
    138 #endif 
    139       ENDIF 
     131                             CALL iom_swap(                     cw_toprst_cxt ) 
     132                             CALL iom_init_closedef(            cw_toprst_cxt ) 
     133                             CALL iom_setkt( kstp - nit000 + 1, cw_toprst_cxt ) 
     134#endif 
     135      ENDIF 
     136      IF( kstp + nn_fsbc - 1 == nitrst .AND. lwxios ) THEN 
    140137#if defined key_si3 
    141       IF(((kstp + nn_fsbc - 1) == nitrst) .AND. lwxios) THEN 
    142          CALL iom_swap(      cw_icerst_cxt          ) 
    143          CALL iom_init_closedef(cw_icerst_cxt) 
    144          CALL iom_setkt( kstp - nit000 + 1,      cw_icerst_cxt          ) 
    145       ENDIF 
    146 #endif 
     138                             CALL iom_swap(                     cw_icerst_cxt ) 
     139                             CALL iom_init_closedef(            cw_icerst_cxt ) 
     140                             CALL iom_setkt( kstp - nit000 + 1, cw_icerst_cxt ) 
     141#endif 
     142         IF( ln_abl      ) THEN 
     143                             CALL iom_swap(                     cw_ablrst_cxt ) 
     144                             CALL iom_init_closedef(            cw_ablrst_cxt ) 
     145                             CALL iom_setkt( kstp - nit000 + 1, cw_ablrst_cxt ) 
     146         ENDIF 
     147      ENDIF 
    147148      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
    148149                             CALL iom_setkt( kstp - nit000 + 1,      cxios_context          )   ! tell IOM we are at time step kstp 
     
    161162      ! Update stochastic parameters and random T/S fluctuations 
    162163      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    163       IF( ln_sto_eos ) CALL sto_par( kstp )          ! Stochastic parameters 
    164       IF( ln_sto_eos ) CALL sto_pts( ts(:,:,:,:,Nnn)  )          ! Random T/S fluctuations 
     164      IF( ln_sto_eos )   CALL sto_par( kstp )                         ! Stochastic parameters 
     165      IF( ln_sto_eos )   CALL sto_pts( ts(:,:,:,:,Nnn)  )             ! Random T/S fluctuations 
    165166 
    166167      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    202203      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    203204 
    204                             CALL ssh_nxt       ( kstp, Nbb, Nnn, ssh, Naa )    ! after ssh (includes call to div_hor) 
    205       IF( .NOT.ln_linssh )  CALL dom_vvl_sf_nxt( kstp, Nbb, Nnn,      Naa )    ! after vertical scale factors 
    206                             CALL wzv           ( kstp, Nbb, Nnn, Naa, ww  )    ! now cross-level velocity 
    207       IF( ln_zad_Aimp )     CALL wAimp         ( kstp,      Nnn           )  ! Adaptive-implicit vertical advection partitioning 
    208                             CALL eos    ( CASTWP(ts(:,:,:,:,Nnn)), rhd, rhop, CASTWP(gdept(:,:,:,Nnn)) )  ! now in situ density for hpg computation 
     205                         CALL ssh_nxt       ( kstp, Nbb, Nnn, ssh, Naa )   ! after ssh (includes call to div_hor) 
     206      IF( .NOT.ln_linssh )   & 
     207                       & CALL dom_vvl_sf_nxt( kstp, Nbb, Nnn,      Naa )   ! after vertical scale factors 
     208                         CALL wzv           ( kstp, Nbb, Nnn, Naa, ww  )   ! now cross-level velocity 
     209      IF( ln_zad_Aimp )  CALL wAimp         ( kstp,      Nnn           )   ! Adaptive-implicit vertical advection partitioning 
     210                         CALL eos    ( ts(:,:,:,:,Nnn), rhd, rhop, gdept(:,:,:,Nnn) )  ! now in situ density for hpg computation 
    209211 
    210212 
     
    233235                            CALL dyn_zdf    ( kstp, Nbb, Nnn, Nrhs, uu, vv, Naa  )  ! vertical diffusion 
    234236      IF( ln_dynspg_ts ) THEN                                                       ! vertical scale factors and vertical velocity need to be updated 
    235                             CALL wzv        ( kstp, Nbb, Nnn, Naa, ww )             ! now cross-level velocity 
     237                            CALL wzv        ( kstp, Nbb, Nnn, Naa, ww )             ! Nnn cross-level velocity 
    236238         IF( ln_zad_Aimp )  CALL wAimp      ( kstp,      Nnn )                      ! Adaptive-implicit vertical advection partitioning 
    237239      ENDIF 
     
    261263      ! Passive Tracer Model 
    262264      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    263                          CALL trc_stp       ( kstp, Nbb, Nnn, Nrhs, Naa )  ! time-stepping 
     265                         CALL trc_stp    ( kstp, Nbb, Nnn, Nrhs, Naa )           ! time-stepping 
    264266#endif 
    265267 
     
    269271      ! Loop over tile domains 
    270272      DO jtile = 1, nijtile 
    271          IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
     273         IF( ln_tile    )  CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
    272274 
    273275         DO_3D( 0, 0, 0, 0, 1, jpk ) 
    274             ts(ji,jj,jk,:,Nrhs) = 0._wp                                         ! set tracer trends to zero 
     276            ts(ji,jj,jk,:,Nrhs) = 0._wp                                   ! set tracer trends to zero 
    275277         END_3D 
    276278 
     
    287289 
    288290#if defined key_agrif 
    289          IF(.NOT. Agrif_Root()) THEN 
    290             IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) 
    291             CALL Agrif_Sponge_tra        ! tracers sponge 
    292          ENDIF 
     291      IF(.NOT. Agrif_Root() )  THEN 
     292         IF( ln_tile    )  CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 ) 
     293                            CALL Agrif_Sponge_tra        ! tracers sponge 
     294      ENDIF 
    293295#endif 
    294296 
    295297      ! TEMP: [tiling] Separate loop over tile domains (due to tra_adv workarounds for tiling) 
    296298      DO jtile = 1, nijtile 
    297          IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
     299         IF( ln_tile    )  CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = jtile ) 
    298300 
    299301                            CALL tra_adv    ( kstp, Nbb, Nnn, ts, Nrhs )  ! hor. + vert. advection ==> RHS 
    300302         IF( ln_zdfmfc  )   CALL tra_mfc    ( kstp, Nbb,      ts, Nrhs )  ! Mass Flux Convection 
    301          IF( ln_zdfosm  )   CALL tra_osm    ( kstp,      Nnn, ts, Nrhs )  ! OSMOSIS non-local tracer fluxes ==> RHS 
    302          IF( lrst_oce .AND. ln_zdfosm ) & 
    303               &             CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts 
     303         IF( ln_zdfosm  ) THEN 
     304                            CALL tra_osm    ( kstp,      Nnn, ts, Nrhs )  ! OSMOSIS non-local tracer fluxes ==> RHS 
     305            IF( lrst_oce )  CALL osm_rst    ( kstp,      Nnn, 'WRITE'  )  ! write OSMOSIS outputs + ww (so must do here) to restarts 
     306         ENDIF 
    304307                            CALL tra_ldf    ( kstp, Nbb, Nnn, ts, Nrhs )  ! lateral mixing 
    305308 
     
    365368      ! AGRIF update 
    366369      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    367       IF( Agrif_NbStepint() == 0 .AND. nstop == 0 ) THEN 
    368                          CALL Agrif_update_all( )                  ! Update all components 
    369       ENDIF 
    370  
    371 #endif 
    372       IF( ln_diaobs .AND. nstop == 0 )  CALL dia_obs( kstp, Nnn )  ! obs-minus-model (assimilation) diags (after dynamics update) 
     370      IF( Agrif_NbStepint() == 0 .AND. nstop == 0 )   & 
     371         &               CALL Agrif_update_all( )                  ! Update all components 
     372 
     373#endif 
     374      IF( ln_diaobs .AND. nstop == 0 )   & 
     375         &               CALL dia_obs( kstp, Nnn )  ! obs-minus-model (assimilation) diags (after dynamics update) 
    373376 
    374377      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    377380      IF( kstp == nit000 ) THEN                          ! 1st time step only 
    378381                                        CALL iom_close( numror )   ! close input  ocean restart file 
    379          IF( lrxios )                   CALL iom_context_finalize(      cr_ocerst_cxt        ) 
     382         IF( lrxios )                   CALL iom_context_finalize( cr_ocerst_cxt ) 
    380383         IF(lwm)                        CALL FLUSH    ( numond )   ! flush output namelist oce 
    381384         IF(lwm .AND. numoni /= -1 )    CALL FLUSH    ( numoni )   ! flush output namelist ice (if exist) 
     
    387390      IF( lk_oasis .AND. nstop == 0 )   CALL sbc_cpl_snd( kstp, Nbb, Nnn )     ! coupled mode : field exchanges 
    388391      ! 
    389 #if defined key_iomput 
     392#if defined key_xios 
    390393      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    391394      ! Finalize contextes if end of simulation or error detected 
     
    398401      ! 
    399402      IF( l_1st_euler ) THEN         ! recover Leap-frog timestep 
    400          rDt = 2._wp * rn_Dt 
     403         rDt   = 2._wp * rn_Dt 
    401404         r1_Dt = 1._wp / rDt 
    402405         l_1st_euler = .FALSE. 
Note: See TracChangeset for help on using the changeset viewer.