- Timestamp:
- 2015-08-12T17:46:45+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/NEMO/OPA_SRC/step.F90
r5012 r5682 50 50 51 51 #if defined key_agrif 52 SUBROUTINE stp( )52 RECURSIVE SUBROUTINE stp( ) 53 53 INTEGER :: kstp ! ocean time-step index 54 54 #else … … 79 79 #if defined key_agrif 80 80 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 83 86 IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE. 87 84 88 # if defined key_iomput 85 IF( Agrif_Nbstepint() == 0 ) CALL iom_swap( "nemo")89 IF( Agrif_Nbstepint() == 0 ) CALL iom_swap( cxios_context ) 86 90 # endif 87 91 #endif 88 92 indic = 0 ! reset to no error condition 89 93 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 92 97 ENDIF 93 98 94 99 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 thatwe are at time step kstp96 IF( ln_crs ) CALL iom_setkt( kstp - nit000 + 1, "nemo_crs" ) ! say to iom thatwe are at time step kstp100 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 97 102 98 103 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> … … 100 105 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 101 106 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 104 111 CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) 105 112 ! 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 106 117 107 118 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> … … 122 133 IF( lk_zdfkpp ) CALL zdf_kpp( kstp ) ! KPP closure scheme for Kz 123 134 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(:,:,:) 127 138 ENDIF 128 139 IF( ln_rnf_mouth ) THEN ! increase diffusivity at rivers mouths … … 145 156 ! 146 157 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 151 167 IF( ln_traldf_grif ) THEN ! before slope for Griffies operator 152 168 CALL ldf_slp_grif( kstp ) … … 158 174 IF( lk_traldf_eiv ) CALL ldf_eiv( kstp ) ! eddy induced velocity coefficient 159 175 #endif 160 #if defined key_traldf_c3d && key_traldf_smag176 #if defined key_traldf_c3d && defined key_traldf_smag 161 177 CALL ldf_tra_smag( kstp ) ! eddy induced velocity coefficient 162 178 # endif 163 #if defined key_dynldf_c3d && key_dynldf_smag179 #if defined key_dynldf_c3d && defined key_dynldf_smag 164 180 CALL ldf_dyn_smag( kstp ) ! eddy induced velocity coefficient 165 181 # endif … … 176 192 ! Note that the computation of vertical velocity above, hence "after" sea level 177 193 ! 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 178 195 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 182 203 183 204 ua(:,:,:) = 0.e0 ! set dynamics trends to zero 184 205 va(:,:,:) = 0.e0 185 IF( l n_asmiau .AND. &206 IF( lk_asminc .AND. ln_asmiau .AND. & 186 207 & ln_dyninc ) CALL dyn_asm_inc ( kstp ) ! apply dynamics assimilation increment 187 208 IF( ln_neptsimp ) CALL dyn_nept_cor ( kstp ) ! subtract Neptune velocities (simplified) … … 208 229 ! diagnostics and outputs (ua, va, tsa used as workspace) 209 230 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 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 221 240 222 241 #if defined key_top … … 233 252 tsa(:,:,:,:) = 0.e0 ! set tracer trends to zero 234 253 235 IF( l n_asmiau .AND. &254 IF( lk_asminc .AND. ln_asmiau .AND. & 236 255 & ln_trainc ) CALL tra_asm_inc( kstp ) ! apply tracer assimilation increment 237 256 CALL tra_sbc ( kstp ) ! surface boundary condition … … 244 263 IF( lk_zdfkpp ) CALL tra_kpp ( kstp ) ! KPP non-local tracer fluxes 245 264 CALL tra_ldf ( kstp ) ! lateral mixing 265 266 IF( ln_diaptr ) CALL dia_ptr ! Poleward adv/ldf TRansports diagnostics 267 246 268 #if defined key_agrif 247 269 IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_tra ! tracers sponge … … 252 274 IF( ln_zdfnpc ) CALL tra_npc( kstp ) ! update after fields by non-penetrative convection 253 275 CALL tra_nxt( kstp ) ! tracer fields at next time step 276 IF( ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations 254 277 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 258 285 ELSE ! centered hpg (eos then time stepping) 259 286 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 260 288 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 264 296 ENDIF 265 297 IF( ln_zdfnpc ) CALL tra_npc( kstp ) ! update after fields by non-penetrative convection … … 286 318 va(:,:,:) = 0.e0 287 319 288 IF( l n_asmiau .AND. &320 IF( lk_asminc .AND. ln_asmiau .AND. & 289 321 & ln_dyninc ) CALL dyn_asm_inc( kstp ) ! apply dynamics assimilation increment 290 322 IF( ln_bkgwri ) CALL asm_bkg_wri( kstp ) ! output background fields … … 307 339 CALL ssh_swp( kstp ) ! swap of sea surface height 308 340 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 310 355 IF( ln_diahsb ) CALL dia_hsb( kstp ) ! - ML - global conservation diagnostics 311 IF( l k_diaobs ) CALL dia_obs( kstp ) ! obs-minus-model (assimilation) diagnostics (call after dynamics update)312 313 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 314 ! Control and restarts356 IF( ln_diaobs ) CALL dia_obs( kstp ) ! obs-minus-model (assimilation) diagnostics (call after dynamics update) 357 358 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 359 ! Control 315 360 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 316 361 CALL stp_ctl( kstp, indic ) … … 322 367 CALL iom_close( numror ) ! close input ocean restart file 323 368 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 327 371 328 372 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 329 373 ! Coupled mode 330 374 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 331 IF( lk_ cpl) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges375 IF( lk_oasis ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges 332 376 ! 333 377 #if defined key_iomput 334 378 IF( kstp == nitend .OR. indic < 0 ) THEN 335 CALL iom_context_finalize( "nemo") ! needed for XIOS+AGRIF336 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" ) ! 337 381 ENDIF 338 382 #endif 339 383 ! 340 384 IF( nn_timing == 1 .AND. kstp == nit000 ) CALL timing_reset 385 ! 341 386 ! 342 387 END SUBROUTINE stp
Note: See TracChangeset
for help on using the changeset viewer.