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 5682 for branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/OPA_SRC/step.F90 – NEMO

Ignore:
Timestamp:
2015-08-12T17:46:45+02:00 (9 years ago)
Author:
mattmartin
Message:

OBS simplification changes committed to branch after running SETTE tests to make sure we get the same results as the trunk for ORCA2_LIM_OBS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/OPA_SRC/step.F90

    r5012 r5682  
    5050 
    5151#if defined key_agrif 
    52    SUBROUTINE stp( ) 
     52   RECURSIVE SUBROUTINE stp( ) 
    5353      INTEGER             ::   kstp   ! ocean time-step index 
    5454#else 
     
    7979#if defined key_agrif 
    8080      kstp = nit000 + Agrif_Nb_Step() 
    81 !      IF ( Agrif_Root() .and. lwp) Write(*,*) '---' 
    82 !      IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp 
     81      IF ( lk_agrif_debug ) THEN 
     82         IF ( Agrif_Root() .and. lwp) Write(*,*) '---' 
     83         IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint() 
     84      ENDIF 
     85 
    8386      IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE. 
     87 
    8488# if defined key_iomput 
    85       IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( "nemo" ) 
     89      IF( Agrif_Nbstepint() == 0 )   CALL iom_swap( cxios_context ) 
    8690# endif 
    8791#endif 
    8892                             indic = 0           ! reset to no error condition 
    8993      IF( kstp == nit000 ) THEN 
    90                       CALL iom_init( "nemo" )      ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS) 
    91          IF( ln_crs ) CALL iom_init( "nemo_crs" )  ! initialize context for coarse grid 
     94         ! must be done after nemo_init for AGRIF+XIOS+OASIS 
     95                      CALL iom_init(      cxios_context          )  ! iom_put initialization 
     96         IF( ln_crs ) CALL iom_init( TRIM(cxios_context)//"_crs" )  ! initialize context for coarse grid 
    9297      ENDIF 
    9398 
    9499      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
    95                              CALL iom_setkt( kstp - nit000 + 1, "nemo"     )   ! say to iom that we are at time step kstp 
    96       IF( ln_crs     )       CALL iom_setkt( kstp - nit000 + 1, "nemo_crs" )   ! say to iom that we are at time step kstp 
     100                             CALL iom_setkt( kstp - nit000 + 1,      cxios_context          )   ! tell iom we are at time step kstp 
     101      IF( ln_crs     )       CALL iom_setkt( kstp - nit000 + 1, TRIM(cxios_context)//"_crs" )   ! tell iom we are at time step kstp 
    97102 
    98103      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    100105      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    101106      IF( lk_tide    )   CALL sbc_tide( kstp ) 
    102       IF( lk_bdy     )   CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries 
    103  
     107      IF( lk_bdy     )  THEN 
     108         IF( ln_apr_dyn) CALL sbc_apr( kstp )   ! bdy_dta needs ssh_ib  
     109                         CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries 
     110      ENDIF 
    104111                         CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice) 
    105112                                                      ! clem: moved here for bdy ice purpose 
     113      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     114      ! Update stochastic parameters and random T/S fluctuations 
     115      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     116                        CALL sto_par( kstp )          ! Stochastic parameters 
    106117 
    107118      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    122133      IF( lk_zdfkpp  )   CALL zdf_kpp( kstp )            ! KPP closure scheme for Kz 
    123134      IF( lk_zdfcst  ) THEN                              ! Constant Kz (reset avt, avm[uv] to the background value) 
    124          avt (:,:,:) = rn_avt0 * tmask(:,:,:) 
    125          avmu(:,:,:) = rn_avm0 * umask(:,:,:) 
    126          avmv(:,:,:) = rn_avm0 * vmask(:,:,:) 
     135         avt (:,:,:) = rn_avt0 * wmask (:,:,:) 
     136         avmu(:,:,:) = rn_avm0 * wumask(:,:,:) 
     137         avmv(:,:,:) = rn_avm0 * wvmask(:,:,:) 
    127138      ENDIF 
    128139      IF( ln_rnf_mouth ) THEN                         ! increase diffusivity at rivers mouths 
     
    145156      ! 
    146157      IF( lk_ldfslp ) THEN                            ! slope of lateral mixing 
    147                          CALL eos( tsb, rhd, gdept_0(:,:,:) )             ! before in situ density 
    148          IF( ln_zps )    CALL zps_hde( kstp, jpts, tsb, gtsu, gtsv,  &        ! Partial steps: before horizontal gradient 
    149             &                                      rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   &             ! 
    150             &                               gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi  )  ! of t, s, rd at the last ocean level 
     158         IF(ln_sto_eos ) CALL sto_pts( tsn )          ! Random T/S fluctuations 
     159                         CALL eos( tsb, rhd, gdept_0(:,:,:) )               ! before in situ density 
     160         IF( ln_zps .AND. .NOT. ln_isfcav)                               & 
     161            &            CALL zps_hde    ( kstp, jpts, tsb, gtsu, gtsv,  &  ! Partial steps: before horizontal gradient 
     162            &                                          rhd, gru , grv    )  ! of t, s, rd at the last ocean level 
     163         IF( ln_zps .AND.       ln_isfcav)                               & 
     164            &            CALL zps_hde_isf( kstp, jpts, tsb, gtsu, gtsv,  &    ! Partial steps for top cell (ISF) 
     165            &                                          rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   & 
     166            &                                   gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the first ocean level 
    151167         IF( ln_traldf_grif ) THEN                           ! before slope for Griffies operator 
    152168                         CALL ldf_slp_grif( kstp ) 
     
    158174      IF( lk_traldf_eiv )   CALL ldf_eiv( kstp )      ! eddy induced velocity coefficient 
    159175#endif 
    160 #if defined key_traldf_c3d && key_traldf_smag 
     176#if defined key_traldf_c3d && defined key_traldf_smag 
    161177                          CALL ldf_tra_smag( kstp )      ! eddy induced velocity coefficient 
    162178#  endif 
    163 #if defined key_dynldf_c3d && key_dynldf_smag 
     179#if defined key_dynldf_c3d && defined key_dynldf_smag 
    164180                          CALL ldf_dyn_smag( kstp )      ! eddy induced velocity coefficient 
    165181#  endif 
     
    176192          ! Note that the computation of vertical velocity above, hence "after" sea level 
    177193          ! is necessary to compute momentum advection for the rhs of barotropic loop: 
     194            IF(ln_sto_eos ) CALL sto_pts( tsn )                             ! Random T/S fluctuations 
    178195                            CALL eos    ( tsn, rhd, rhop, fsdept_n(:,:,:) ) ! now in situ density for hpg computation 
    179             IF( ln_zps )    CALL zps_hde( kstp, jpts, tsn, gtsu, gtsv,  &        ! Partial steps: before horizontal gradient 
    180                &                                      rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   &             ! 
    181                &                               gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi  )  ! of t, s, rd at the last ocean level 
     196            IF( ln_zps .AND. .NOT. ln_isfcav)                               & 
     197               &            CALL zps_hde    ( kstp, jpts, tsn, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient 
     198               &                                          rhd, gru , grv    )  ! of t, s, rd at the last ocean level 
     199            IF( ln_zps .AND.       ln_isfcav)                               & 
     200               &            CALL zps_hde_isf( kstp, jpts, tsn, gtsu, gtsv,  &    ! Partial steps for top cell (ISF) 
     201               &                                          rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   & 
     202               &                                   gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the last ocean level 
    182203 
    183204                                  ua(:,:,:) = 0.e0             ! set dynamics trends to zero 
    184205                                  va(:,:,:) = 0.e0 
    185           IF(  ln_asmiau .AND. & 
     206          IF(  lk_asminc .AND. ln_asmiau .AND. & 
    186207             & ln_dyninc       )  CALL dyn_asm_inc  ( kstp )   ! apply dynamics assimilation increment 
    187208          IF( ln_neptsimp )       CALL dyn_nept_cor ( kstp )   ! subtract Neptune velocities (simplified) 
     
    208229      ! diagnostics and outputs             (ua, va, tsa used as workspace) 
    209230      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    210       IF( lk_floats  )   CALL flo_stp( kstp )         ! drifting Floats 
    211       IF( lk_diahth  )   CALL dia_hth( kstp )         ! Thermocline depth (20 degres isotherm depth) 
    212       IF( .NOT. lk_cpl ) CALL dia_fwb( kstp )         ! Fresh water budget diagnostics 
    213       IF( ln_diaptr  )   CALL dia_ptr( kstp )         ! Poleward TRansports diagnostics 
    214       IF( lk_diadct  )   CALL dia_dct( kstp )         ! Transports 
    215       IF( lk_diaar5  )   CALL dia_ar5( kstp )         ! ar5 diag 
    216       IF( lk_diaharm )   CALL dia_harm( kstp )        ! Tidal harmonic analysis 
    217                          CALL dia_wri( kstp )         ! ocean model: outputs 
    218       ! 
    219       IF( ln_crs     )   CALL crs_fld( kstp )         ! ocean model: online field coarsening & output 
    220  
     231      IF( lk_floats  )      CALL flo_stp( kstp )         ! drifting Floats 
     232      IF( lk_diahth  )      CALL dia_hth( kstp )         ! Thermocline depth (20 degres isotherm depth) 
     233      IF( .NOT. ln_cpl )    CALL dia_fwb( kstp )         ! Fresh water budget diagnostics 
     234      IF( lk_diadct  )      CALL dia_dct( kstp )         ! Transports 
     235      IF( lk_diaar5  )      CALL dia_ar5( kstp )         ! ar5 diag 
     236      IF( lk_diaharm )      CALL dia_harm( kstp )        ! Tidal harmonic analysis 
     237                            CALL dia_wri( kstp )         ! ocean model: outputs 
     238      ! 
     239      IF( ln_crs     )      CALL crs_fld( kstp )         ! ocean model: online field coarsening & output 
    221240 
    222241#if defined key_top 
     
    233252                             tsa(:,:,:,:) = 0.e0            ! set tracer trends to zero 
    234253 
    235       IF(  ln_asmiau .AND. & 
     254      IF(  lk_asminc .AND. ln_asmiau .AND. & 
    236255         & ln_trainc     )   CALL tra_asm_inc( kstp )       ! apply tracer assimilation increment 
    237256                             CALL tra_sbc    ( kstp )       ! surface boundary condition 
     
    244263      IF( lk_zdfkpp      )   CALL tra_kpp    ( kstp )       ! KPP non-local tracer fluxes 
    245264                             CALL tra_ldf    ( kstp )       ! lateral mixing 
     265 
     266      IF( ln_diaptr      )   CALL dia_ptr                   ! Poleward adv/ldf TRansports diagnostics 
     267 
    246268#if defined key_agrif 
    247269      IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_tra          ! tracers sponge 
     
    252274         IF( ln_zdfnpc   )   CALL tra_npc( kstp )                ! update after fields by non-penetrative convection 
    253275                             CALL tra_nxt( kstp )                ! tracer fields at next time step 
     276            IF( ln_sto_eos ) CALL sto_pts( tsn )                 ! Random T/S fluctuations 
    254277                             CALL eos    ( tsa, rhd, rhop, fsdept_n(:,:,:) )  ! Time-filtered in situ density for hpg computation 
    255          IF( ln_zps      )   CALL zps_hde( kstp, jpts, tsa, gtsu, gtsv,  &        ! Partial steps: before horizontal gradient 
    256             &                                      rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   &             ! 
    257             &                               gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi  )  ! of t, s, rd at the last ocean level 
     278            IF( ln_zps .AND. .NOT. ln_isfcav)                                & 
     279               &             CALL zps_hde    ( kstp, jpts, tsa, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient 
     280               &                                           rhd, gru , grv    )  ! of t, s, rd at the last ocean level 
     281            IF( ln_zps .AND.       ln_isfcav)                                & 
     282               &             CALL zps_hde_isf( kstp, jpts, tsa, gtsu, gtsv,  &    ! Partial steps for top cell (ISF) 
     283               &                                           rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   & 
     284               &                                    gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the last ocean level 
    258285      ELSE                                                  ! centered hpg  (eos then time stepping) 
    259286         IF ( .NOT. lk_dynspg_ts ) THEN                     ! eos already called in time-split case 
     287            IF( ln_sto_eos ) CALL sto_pts( tsn )    ! Random T/S fluctuations 
    260288                             CALL eos    ( tsn, rhd, rhop, fsdept_n(:,:,:) )  ! now in situ density for hpg computation 
    261          IF( ln_zps      )   CALL zps_hde( kstp, jpts, tsn, gtsu, gtsv,  &        ! Partial steps: before horizontal gradient 
    262          &                                      rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   &             ! 
    263          &                               gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi  )  ! of t, s, rd at the last ocean level 
     289         IF( ln_zps .AND. .NOT. ln_isfcav)                                   & 
     290               &             CALL zps_hde    ( kstp, jpts, tsn, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient 
     291               &                                           rhd, gru , grv    )  ! of t, s, rd at the last ocean level 
     292         IF( ln_zps .AND.       ln_isfcav)                                   &  
     293               &             CALL zps_hde_isf( kstp, jpts, tsn, gtsu, gtsv,  &    ! Partial steps for top cell (ISF) 
     294               &                                           rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   & 
     295               &                                    gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the last ocean level 
    264296         ENDIF 
    265297         IF( ln_zdfnpc   )   CALL tra_npc( kstp )                ! update after fields by non-penetrative convection 
     
    286318                               va(:,:,:) = 0.e0 
    287319 
    288         IF(  ln_asmiau .AND. & 
     320        IF(  lk_asminc .AND. ln_asmiau .AND. & 
    289321           & ln_dyninc      )  CALL dyn_asm_inc( kstp )     ! apply dynamics assimilation increment 
    290322        IF( ln_bkgwri )        CALL asm_bkg_wri( kstp )     ! output background fields 
     
    307339                               CALL ssh_swp( kstp )         ! swap of sea surface height 
    308340      IF( lk_vvl           )   CALL dom_vvl_sf_swp( kstp )  ! swap of vertical scale factors 
    309  
     341      ! 
     342      IF( lrst_oce         )   CALL rst_write( kstp )       ! write output ocean restart file 
     343 
     344#if defined key_agrif 
     345      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     346      ! AGRIF 
     347      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<       
     348                               CALL Agrif_Integrate_ChildGrids( stp )   
     349 
     350      IF ( Agrif_NbStepint().EQ.0 ) THEN 
     351                               CALL Agrif_Update_Tra()      ! Update active tracers 
     352                               CALL Agrif_Update_Dyn()      ! Update momentum 
     353      ENDIF 
     354#endif 
    310355      IF( ln_diahsb        )   CALL dia_hsb( kstp )         ! - ML - global conservation diagnostics 
    311       IF( lk_diaobs  )         CALL dia_obs( kstp )         ! obs-minus-model (assimilation) diagnostics (call after dynamics update) 
    312  
    313       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    314       ! Control and restarts 
     356      IF( ln_diaobs  )         CALL dia_obs( kstp )         ! obs-minus-model (assimilation) diagnostics (call after dynamics update) 
     357 
     358      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     359      ! Control 
    315360      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    316361                               CALL stp_ctl( kstp, indic ) 
     
    322367                 CALL iom_close( numror )     ! close input  ocean restart file 
    323368         IF(lwm) CALL FLUSH    ( numond )     ! flush output namelist oce 
    324          IF( lwm.AND.numoni /= -1 ) CALL FLUSH    ( numoni )     ! flush output namelist ice     
    325       ENDIF 
    326       IF( lrst_oce         )   CALL rst_write    ( kstp )   ! write output ocean restart file 
     369         IF( lwm.AND.numoni /= -1 ) CALL FLUSH    ( numoni )     ! flush output namelist ice 
     370      ENDIF 
    327371 
    328372      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    329373      ! Coupled mode 
    330374      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    331       IF( lk_cpl           )   CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges 
     375      IF( lk_oasis         )   CALL sbc_cpl_snd( kstp )     ! coupled mode : field exchanges 
    332376      ! 
    333377#if defined key_iomput 
    334378      IF( kstp == nitend .OR. indic < 0 ) THEN  
    335                       CALL iom_context_finalize( "nemo"     ) ! needed for XIOS+AGRIF 
    336          IF( ln_crs ) CALL iom_context_finalize( "nemo_crs" ) !  
     379                      CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF 
     380         IF( ln_crs ) CALL iom_context_finalize( trim(cxios_context)//"_crs" ) !  
    337381      ENDIF 
    338382#endif 
    339383      ! 
    340384      IF( nn_timing == 1 .AND.  kstp == nit000  )   CALL timing_reset 
     385      !      
    341386      ! 
    342387   END SUBROUTINE stp 
Note: See TracChangeset for help on using the changeset viewer.