[3] | 1 | MODULE step |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE step *** |
---|
| 4 | !! Time-stepping : manager of the ocean, tracer and ice time stepping |
---|
| 5 | !!====================================================================== |
---|
[1438] | 6 | !! History : OPA ! 1991-03 (G. Madec) Original code |
---|
[1492] | 7 | !! - ! 1991-11 (G. Madec) |
---|
| 8 | !! - ! 1992-06 (M. Imbard) add a first output record |
---|
| 9 | !! - ! 1996-04 (G. Madec) introduction of dynspg |
---|
| 10 | !! - ! 1996-04 (M.A. Foujols) introduction of passive tracer |
---|
[1438] | 11 | !! 8.0 ! 1997-06 (G. Madec) new architecture of call |
---|
| 12 | !! 8.2 ! 1997-06 (G. Madec, M. Imbard, G. Roullet) free surface |
---|
| 13 | !! - ! 1999-02 (G. Madec, N. Grima) hpg implicit |
---|
| 14 | !! - ! 2000-07 (J-M Molines, M. Imbard) Open Bondary Conditions |
---|
| 15 | !! NEMO 1.0 ! 2002-06 (G. Madec) free form, suppress macro-tasking |
---|
| 16 | !! - ! 2004-08 (C. Talandier) New trends organization |
---|
[1492] | 17 | !! - ! 2005-01 (C. Ethe) Add the KPP closure scheme |
---|
| 18 | !! - ! 2005-11 (G. Madec) Reorganisation of tra and dyn calls |
---|
| 19 | !! - ! 2006-01 (L. Debreu, C. Mazauric) Agrif implementation |
---|
| 20 | !! - ! 2006-07 (S. Masson) restart using iom |
---|
[1438] | 21 | !! 3.2 ! 2009-02 (G. Madec, R. Benshila) reintroduicing z*-coordinate |
---|
[1533] | 22 | !! - ! 2009-06 (S. Masson, G. Madec) TKE restart compatible with key_cpl |
---|
[2528] | 23 | !! 3.3 ! 2010-05 (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface |
---|
| 24 | !! - ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase + merge TRC-TRA |
---|
[3294] | 25 | !! 3.4 ! 2011-04 (G. Madec, C. Ethe) Merge of dtatem and dtasal |
---|
[5758] | 26 | !! 3.6 ! 2012-07 (J. Simeon, G. Madec. C. Ethe) Online coarsening of outputs |
---|
| 27 | !! 3.6 ! 2014-04 (F. Roquet, G. Madec) New equations of state |
---|
| 28 | !! 3.7 ! 2014-10 (G. Madec) LDF simplication |
---|
| 29 | !! - ! 2014-12 (G. Madec) remove KPP scheme |
---|
[3] | 30 | !!---------------------------------------------------------------------- |
---|
[888] | 31 | |
---|
| 32 | !!---------------------------------------------------------------------- |
---|
[2528] | 33 | !! stp : OPA system time-stepping |
---|
[3] | 34 | !!---------------------------------------------------------------------- |
---|
[3764] | 35 | USE step_oce ! time stepping definition modules |
---|
[4990] | 36 | USE iom |
---|
[389] | 37 | |
---|
[3] | 38 | IMPLICIT NONE |
---|
| 39 | PRIVATE |
---|
| 40 | |
---|
[5758] | 41 | PUBLIC stp ! called by nemogcm.F90 |
---|
[3] | 42 | |
---|
| 43 | !! * Substitutions |
---|
| 44 | # include "domzgr_substitute.h90" |
---|
[4990] | 45 | !!gm # include "zdfddm_substitute.h90" |
---|
[3] | 46 | !!---------------------------------------------------------------------- |
---|
[5758] | 47 | !! NEMO/OPA 3.7 , NEMO Consortium (2015) |
---|
[888] | 48 | !! $Id$ |
---|
[2528] | 49 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[3] | 50 | !!---------------------------------------------------------------------- |
---|
| 51 | CONTAINS |
---|
| 52 | |
---|
[508] | 53 | #if defined key_agrif |
---|
[5656] | 54 | RECURSIVE SUBROUTINE stp( ) |
---|
[1438] | 55 | INTEGER :: kstp ! ocean time-step index |
---|
[508] | 56 | #else |
---|
[467] | 57 | SUBROUTINE stp( kstp ) |
---|
[1438] | 58 | INTEGER, INTENT(in) :: kstp ! ocean time-step index |
---|
[467] | 59 | #endif |
---|
| 60 | !!---------------------------------------------------------------------- |
---|
[3] | 61 | !! *** ROUTINE stp *** |
---|
[3764] | 62 | !! |
---|
[3] | 63 | !! ** Purpose : - Time stepping of OPA (momentum and active tracer eqs.) |
---|
| 64 | !! - Time stepping of LIM (dynamic and thermodynamic eqs.) |
---|
| 65 | !! - Tme stepping of TRC (passive tracer eqs.) |
---|
[3764] | 66 | !! |
---|
| 67 | !! ** Method : -1- Update forcings and data |
---|
| 68 | !! -2- Update ocean physics |
---|
| 69 | !! -3- Compute the t and s trends |
---|
| 70 | !! -4- Update t and s |
---|
[3] | 71 | !! -5- Compute the momentum trends |
---|
| 72 | !! -6- Update the horizontal velocity |
---|
| 73 | !! -7- Compute the diagnostics variables (rd,N2, div,cur,w) |
---|
| 74 | !! -8- Outputs and diagnostics |
---|
| 75 | !!---------------------------------------------------------------------- |
---|
[888] | 76 | INTEGER :: jk ! dummy loop indice |
---|
[3] | 77 | INTEGER :: indic ! error indicator if < 0 |
---|
[4338] | 78 | INTEGER :: kcall ! optional integer argument (dom_vvl_sf_nxt) |
---|
[3] | 79 | !! --------------------------------------------------------------------- |
---|
[392] | 80 | #if defined key_agrif |
---|
[389] | 81 | kstp = nit000 + Agrif_Nb_Step() |
---|
[5758] | 82 | IF( lk_agrif_debug ) THEN |
---|
| 83 | IF( Agrif_Root() .and. lwp) WRITE(*,*) '---' |
---|
| 84 | IF(lwp) WRITE(*,*) 'Grid Number', Agrif_Fixed(),' time step ', kstp, 'int tstep', Agrif_NbStepint() |
---|
[5656] | 85 | ENDIF |
---|
[5758] | 86 | IF( kstp == nit000 + 1 ) lk_agrif_fstep = .FALSE. |
---|
[1793] | 87 | # if defined key_iomput |
---|
[5407] | 88 | IF( Agrif_Nbstepint() == 0 ) CALL iom_swap( cxios_context ) |
---|
[3764] | 89 | # endif |
---|
| 90 | #endif |
---|
[5758] | 91 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 92 | ! update I/O and calendar |
---|
| 93 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 94 | indic = 0 ! reset to no error condition |
---|
| 95 | |
---|
| 96 | IF( kstp == nit000 ) THEN ! initialize IOM context (must be done after nemo_init for AGRIF+XIOS+OASIS) |
---|
| 97 | CALL iom_init( cxios_context ) ! for model grid (including passible AGRIF zoom) |
---|
| 98 | IF( ln_crs ) CALL iom_init( TRIM(cxios_context)//"_crs" ) ! for coarse grid |
---|
[4152] | 99 | ENDIF |
---|
[1725] | 100 | IF( kstp /= nit000 ) CALL day( kstp ) ! Calendar (day was already called at nit000 in day_init) |
---|
[5758] | 101 | CALL iom_setkt( kstp - nit000 + 1, cxios_context ) ! tell IOM we are at time step kstp |
---|
| 102 | IF( ln_crs ) CALL iom_setkt( kstp - nit000 + 1, TRIM(cxios_context)//"_crs" ) ! tell IOM we are at time step kstp |
---|
[3] | 103 | |
---|
| 104 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[5758] | 105 | ! Update external forcing (tides, open boundaries, and surface boundary condition (including sea-ice) |
---|
[3] | 106 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[5758] | 107 | IF( lk_tide ) CALL sbc_tide( kstp ) ! update tide potential |
---|
| 108 | IF( ln_apr_dyn ) CALL sbc_apr ( kstp ) ! atmospheric pressure (NB: call before bdy_dta which needs ssh_ib) |
---|
| 109 | IF( lk_bdy ) CALL bdy_dta ( kstp, time_offset=+1 ) ! update dynamic & tracer data at open boundaries |
---|
| 110 | CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) |
---|
| 111 | CALL FLUSH ( numout ) |
---|
[3] | 112 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[5329] | 113 | ! Update stochastic parameters and random T/S fluctuations |
---|
| 114 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[5758] | 115 | CALL sto_par( kstp ) ! Stochastic parameters |
---|
| 116 | CALL FLUSH ( numout ) |
---|
[5329] | 117 | |
---|
| 118 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[3294] | 119 | ! Ocean physics update (ua, va, tsa used as workspace) |
---|
[3] | 120 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[4990] | 121 | ! THERMODYNAMICS |
---|
| 122 | CALL eos_rab( tsb, rab_b ) ! before local thermal/haline expension ratio at T-points |
---|
| 123 | CALL eos_rab( tsn, rab_n ) ! now local thermal/haline expension ratio at T-points |
---|
| 124 | CALL bn2 ( tsb, rab_b, rn2b ) ! before Brunt-Vaisala frequency |
---|
| 125 | CALL bn2 ( tsn, rab_n, rn2 ) ! now Brunt-Vaisala frequency |
---|
[5758] | 126 | CALL FLUSH ( numout ) |
---|
[1492] | 127 | ! |
---|
[3764] | 128 | ! VERTICAL PHYSICS |
---|
[4369] | 129 | CALL zdf_bfr( kstp ) ! bottom friction (if quadratic) |
---|
[1492] | 130 | ! ! Vertical eddy viscosity and diffusivity coefficients |
---|
[2528] | 131 | IF( lk_zdfric ) CALL zdf_ric( kstp ) ! Richardson number dependent Kz |
---|
| 132 | IF( lk_zdftke ) CALL zdf_tke( kstp ) ! TKE closure scheme for Kz |
---|
| 133 | IF( lk_zdfgls ) CALL zdf_gls( kstp ) ! GLS closure scheme for Kz |
---|
[4292] | 134 | IF( lk_zdfcst ) THEN ! Constant Kz (reset avt, avm[uv] to the background value) |
---|
[5120] | 135 | avt (:,:,:) = rn_avt0 * wmask (:,:,:) |
---|
| 136 | avmu(:,:,:) = rn_avm0 * wumask(:,:,:) |
---|
| 137 | avmv(:,:,:) = rn_avm0 * wvmask(:,:,:) |
---|
[677] | 138 | ENDIF |
---|
[5758] | 139 | CALL FLUSH ( numout ) |
---|
[1492] | 140 | IF( ln_rnf_mouth ) THEN ! increase diffusivity at rivers mouths |
---|
[5758] | 141 | DO jk = 2, nkrnf ; avt(:,:,jk) = avt(:,:,jk) + 2._wp * rn_avt_rnf * rnfmsk(:,:) * tmask(:,:,jk) ; END DO |
---|
[3] | 142 | ENDIF |
---|
[1492] | 143 | IF( ln_zdfevd ) CALL zdf_evd( kstp ) ! enhanced vertical eddy diffusivity |
---|
[3] | 144 | |
---|
[1492] | 145 | IF( lk_zdftmx ) CALL zdf_tmx( kstp ) ! tidal vertical mixing |
---|
[3] | 146 | |
---|
[5758] | 147 | IF( lk_zdfddm ) CALL zdf_ddm( kstp ) ! double diffusive mixing |
---|
[3764] | 148 | |
---|
[1492] | 149 | CALL zdf_mxl( kstp ) ! mixed layer depth |
---|
[3] | 150 | |
---|
[2528] | 151 | ! write TKE or GLS information in the restart file |
---|
[1531] | 152 | IF( lrst_oce .AND. lk_zdftke ) CALL tke_rst( kstp, 'WRITE' ) |
---|
[2528] | 153 | IF( lrst_oce .AND. lk_zdfgls ) CALL gls_rst( kstp, 'WRITE' ) |
---|
[5758] | 154 | CALL FLUSH ( numout ) |
---|
[1492] | 155 | ! |
---|
[3764] | 156 | ! LATERAL PHYSICS |
---|
[1492] | 157 | ! |
---|
[5758] | 158 | IF( l_ldfslp ) THEN ! slope of lateral mixing |
---|
| 159 | !!gm : why this here ???? |
---|
[5329] | 160 | IF(ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations |
---|
[5758] | 161 | !!gm |
---|
[5120] | 162 | CALL eos( tsb, rhd, gdept_0(:,:,:) ) ! before in situ density |
---|
[5758] | 163 | |
---|
[5120] | 164 | IF( ln_zps .AND. .NOT. ln_isfcav) & |
---|
| 165 | & CALL zps_hde ( kstp, jpts, tsb, gtsu, gtsv, & ! Partial steps: before horizontal gradient |
---|
| 166 | & rhd, gru , grv ) ! of t, s, rd at the last ocean level |
---|
[5758] | 167 | |
---|
[5120] | 168 | IF( ln_zps .AND. ln_isfcav) & |
---|
[5758] | 169 | & CALL zps_hde_isf( kstp, jpts, tsb, gtsu, gtsv, gtui, gtvi, & ! Partial steps for top cell (ISF) |
---|
[5120] | 170 | & rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv , & |
---|
[5758] | 171 | & grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi ) ! of t, s, rd at the first ocean level |
---|
| 172 | |
---|
| 173 | IF( ln_traldf_triad ) THEN |
---|
| 174 | CALL ldf_slp_triad( kstp ) ! before slope for triad operator |
---|
| 175 | ELSE |
---|
| 176 | CALL ldf_slp ( kstp, rhd, rn2b ) ! before slope for standard operator |
---|
[2528] | 177 | ENDIF |
---|
[1481] | 178 | ENDIF |
---|
[5758] | 179 | ! ! eddy diffusivity coeff. and/or eiv coeff. |
---|
| 180 | IF( l_ldftra_time .OR. l_ldfeiv_time ) CALL ldf_tra( kstp ) |
---|
| 181 | write(*,*) 'after ldf_slp' |
---|
| 182 | CALL FLUSH ( numout ) |
---|
[3] | 183 | |
---|
[4369] | 184 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 185 | ! Ocean dynamics : hdiv, rot, ssh, e3, wn |
---|
| 186 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 187 | CALL ssh_nxt ( kstp ) ! after ssh (includes call to div_cur) |
---|
[4387] | 188 | IF( lk_vvl ) CALL dom_vvl_sf_nxt( kstp ) ! after vertical scale factors |
---|
| 189 | CALL wzv ( kstp ) ! now cross-level velocity |
---|
[5758] | 190 | write(*,*) 'after wzv' |
---|
| 191 | CALL FLUSH ( numout ) |
---|
[3634] | 192 | |
---|
[4387] | 193 | IF( lk_dynspg_ts ) THEN |
---|
[4369] | 194 | ! In case the time splitting case, update almost all momentum trends here: |
---|
| 195 | ! Note that the computation of vertical velocity above, hence "after" sea level |
---|
| 196 | ! is necessary to compute momentum advection for the rhs of barotropic loop: |
---|
[5758] | 197 | !!gm : why also here ???? |
---|
[5329] | 198 | IF(ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations |
---|
[5758] | 199 | !!gm |
---|
[4990] | 200 | CALL eos ( tsn, rhd, rhop, fsdept_n(:,:,:) ) ! now in situ density for hpg computation |
---|
[5758] | 201 | |
---|
| 202 | IF( ln_zps .AND. .NOT. ln_isfcav) & ! Partial steps: bottom before horizontal gradient |
---|
| 203 | & CALL zps_hde ( kstp, jpts, tsn, gtsu, gtsv, & ! of t, s, rd at the last ocean level |
---|
| 204 | & rhd, gru , grv ) |
---|
| 205 | IF( ln_zps .AND. ln_isfcav) & ! Partial steps: top & bottom before horizontal gradient |
---|
| 206 | & CALL zps_hde_isf( kstp, jpts, tsn, gtsu, gtsv, gtui, gtvi, & |
---|
[5120] | 207 | & rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv , & |
---|
[5758] | 208 | & grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi ) |
---|
[4369] | 209 | |
---|
[5758] | 210 | ua(:,:,:) = 0._wp ! set dynamics trends to zero |
---|
| 211 | va(:,:,:) = 0._wp |
---|
[5656] | 212 | IF( lk_asminc .AND. ln_asmiau .AND. & |
---|
[4369] | 213 | & ln_dyninc ) CALL dyn_asm_inc ( kstp ) ! apply dynamics assimilation increment |
---|
| 214 | IF( ln_neptsimp ) CALL dyn_nept_cor ( kstp ) ! subtract Neptune velocities (simplified) |
---|
| 215 | IF( lk_bdy ) CALL bdy_dyn3d_dmp( kstp ) ! bdy damping trends |
---|
| 216 | CALL dyn_adv ( kstp ) ! advection (vector or flux form) |
---|
| 217 | CALL dyn_vor ( kstp ) ! vorticity term including Coriolis |
---|
| 218 | CALL dyn_ldf ( kstp ) ! lateral mixing |
---|
| 219 | IF( ln_neptsimp ) CALL dyn_nept_cor ( kstp ) ! add Neptune velocities (simplified) |
---|
| 220 | #if defined key_agrif |
---|
| 221 | IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_dyn ! momentum sponge |
---|
| 222 | #endif |
---|
| 223 | CALL dyn_hpg( kstp ) ! horizontal gradient of Hydrostatic pressure |
---|
| 224 | CALL dyn_spg( kstp, indic ) ! surface pressure gradient |
---|
| 225 | |
---|
| 226 | ua_sv(:,:,:) = ua(:,:,:) ! Save trends (barotropic trend has been fully updated at this stage) |
---|
| 227 | va_sv(:,:,:) = va(:,:,:) |
---|
| 228 | |
---|
| 229 | CALL div_cur( kstp ) ! Horizontal divergence & Relative vorticity (2nd call in time-split case) |
---|
[4387] | 230 | IF( lk_vvl ) CALL dom_vvl_sf_nxt( kstp, kcall=2 ) ! after vertical scale factors (update depth average component) |
---|
| 231 | CALL wzv ( kstp ) ! now cross-level velocity |
---|
[4369] | 232 | ENDIF |
---|
[5758] | 233 | write(*,*) 'after wzv 2' |
---|
| 234 | CALL FLUSH ( numout ) |
---|
[4369] | 235 | |
---|
[1482] | 236 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[3294] | 237 | ! diagnostics and outputs (ua, va, tsa used as workspace) |
---|
[1482] | 238 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[5758] | 239 | IF( lk_floats ) CALL flo_stp( kstp ) ! drifting Floats |
---|
| 240 | IF( lk_diahth ) CALL dia_hth( kstp ) ! Thermocline depth (20 degres isotherm depth) |
---|
| 241 | IF(.NOT.ln_cpl ) CALL dia_fwb( kstp ) ! Fresh water budget diagnostics |
---|
| 242 | IF( lk_diadct ) CALL dia_dct( kstp ) ! Transports |
---|
| 243 | IF( lk_diaar5 ) CALL dia_ar5( kstp ) ! ar5 diag |
---|
| 244 | IF( lk_diaharm ) CALL dia_harm( kstp ) ! Tidal harmonic analysis |
---|
| 245 | CALL dia_wri( kstp ) ! ocean model: outputs |
---|
[4152] | 246 | ! |
---|
[5758] | 247 | IF( ln_crs ) CALL crs_fld( kstp ) ! ocean model: online field coarsening & output |
---|
[1482] | 248 | |
---|
[923] | 249 | #if defined key_top |
---|
[3] | 250 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 251 | ! Passive Tracer Model |
---|
| 252 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 253 | CALL trc_stp( kstp ) ! time-stepping |
---|
[3] | 254 | #endif |
---|
[5758] | 255 | write(*,*) 'end dyn ' |
---|
| 256 | CALL FLUSH ( numout ) |
---|
[3] | 257 | |
---|
| 258 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[1492] | 259 | ! Active tracers (ua, va used as workspace) |
---|
[3] | 260 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[5758] | 261 | tsa(:,:,:,:) = 0._wp ! set tracer trends to zero |
---|
[3] | 262 | |
---|
[5656] | 263 | IF( lk_asminc .AND. ln_asmiau .AND. & |
---|
[2528] | 264 | & ln_trainc ) CALL tra_asm_inc( kstp ) ! apply tracer assimilation increment |
---|
[467] | 265 | CALL tra_sbc ( kstp ) ! surface boundary condition |
---|
| 266 | IF( ln_traqsr ) CALL tra_qsr ( kstp ) ! penetrative solar radiation qsr |
---|
[2528] | 267 | IF( ln_trabbc ) CALL tra_bbc ( kstp ) ! bottom heat flux |
---|
| 268 | IF( lk_trabbl ) CALL tra_bbl ( kstp ) ! advective (and/or diffusive) bottom boundary layer scheme |
---|
[3294] | 269 | IF( ln_tradmp ) CALL tra_dmp ( kstp ) ! internal damping trends |
---|
[3651] | 270 | IF( lk_bdy ) CALL bdy_tra_dmp( kstp ) ! bdy damping trends |
---|
[467] | 271 | CALL tra_adv ( kstp ) ! horizontal & vertical advection |
---|
[5758] | 272 | write(*,*) 'before tra_ldf' |
---|
| 273 | CALL FLUSH ( numout ) |
---|
[467] | 274 | CALL tra_ldf ( kstp ) ! lateral mixing |
---|
[5758] | 275 | write(*,*) 'after tra_ldf' |
---|
| 276 | CALL FLUSH ( numout ) |
---|
[5147] | 277 | |
---|
[5758] | 278 | !!gm : why CALL to dia_ptr has been moved here??? (use trends info?) |
---|
[5147] | 279 | IF( ln_diaptr ) CALL dia_ptr ! Poleward adv/ldf TRansports diagnostics |
---|
[5758] | 280 | !!gm |
---|
[5147] | 281 | |
---|
[392] | 282 | #if defined key_agrif |
---|
[782] | 283 | IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_tra ! tracers sponge |
---|
[389] | 284 | #endif |
---|
[1111] | 285 | CALL tra_zdf ( kstp ) ! vertical mixing and after tracer fields |
---|
[1239] | 286 | |
---|
[1492] | 287 | IF( ln_dynhpg_imp ) THEN ! semi-implicit hpg (time stepping then eos) |
---|
[2528] | 288 | IF( ln_zdfnpc ) CALL tra_npc( kstp ) ! update after fields by non-penetrative convection |
---|
| 289 | CALL tra_nxt( kstp ) ! tracer fields at next time step |
---|
[5758] | 290 | !!gm : why again a call to sto_pts ??? |
---|
[5329] | 291 | IF( ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations |
---|
[5758] | 292 | !!gm |
---|
[4292] | 293 | CALL eos ( tsa, rhd, rhop, fsdept_n(:,:,:) ) ! Time-filtered in situ density for hpg computation |
---|
[5120] | 294 | IF( ln_zps .AND. .NOT. ln_isfcav) & |
---|
| 295 | & CALL zps_hde ( kstp, jpts, tsa, gtsu, gtsv, & ! Partial steps: before horizontal gradient |
---|
| 296 | & rhd, gru , grv ) ! of t, s, rd at the last ocean level |
---|
| 297 | IF( ln_zps .AND. ln_isfcav) & |
---|
[5758] | 298 | & CALL zps_hde_isf( kstp, jpts, tsa, gtsu, gtsv, gtui, gtvi, & ! Partial steps for top/bottom cells |
---|
[5120] | 299 | & rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv , & |
---|
[5758] | 300 | & grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi ) |
---|
[4215] | 301 | ELSE ! centered hpg (eos then time stepping) |
---|
[4292] | 302 | IF ( .NOT. lk_dynspg_ts ) THEN ! eos already called in time-split case |
---|
[5758] | 303 | !!gm : why again a call to sto_pts ??? |
---|
[5329] | 304 | IF( ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations |
---|
[5758] | 305 | !!gm |
---|
[4990] | 306 | CALL eos ( tsn, rhd, rhop, fsdept_n(:,:,:) ) ! now in situ density for hpg computation |
---|
[5120] | 307 | IF( ln_zps .AND. .NOT. ln_isfcav) & |
---|
[5758] | 308 | & CALL zps_hde ( kstp, jpts, tsn, gtsu, gtsv, & ! Partial steps: bottom before horizontal gradient |
---|
| 309 | & rhd, gru , grv ) ! of t, s, rd at the last ocean level |
---|
[5120] | 310 | IF( ln_zps .AND. ln_isfcav) & |
---|
[5758] | 311 | & CALL zps_hde_isf( kstp, jpts, tsn, gtsu, gtsv, gtui, gtvi, & ! Partial steps for top/bottom cells |
---|
[5120] | 312 | & rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv , & |
---|
[5758] | 313 | & grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi ) ! of t, s, rd at the last ocean level |
---|
[4292] | 314 | ENDIF |
---|
[2528] | 315 | IF( ln_zdfnpc ) CALL tra_npc( kstp ) ! update after fields by non-penetrative convection |
---|
| 316 | CALL tra_nxt( kstp ) ! tracer fields at next time step |
---|
[3764] | 317 | ENDIF |
---|
[5758] | 318 | write(*,*) 'after tra_nxt' |
---|
| 319 | CALL FLUSH ( numout ) |
---|
[1481] | 320 | |
---|
[3] | 321 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[3294] | 322 | ! Dynamics (tsa used as workspace) |
---|
[3] | 323 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[4292] | 324 | IF( lk_dynspg_ts ) THEN |
---|
| 325 | ! revert to previously computed momentum tendencies |
---|
| 326 | ! (not using ua, va as temporary arrays during tracers' update could avoid that) |
---|
| 327 | ua(:,:,:) = ua_sv(:,:,:) |
---|
| 328 | va(:,:,:) = va_sv(:,:,:) |
---|
| 329 | ! Revert now divergence and rotational to previously computed ones |
---|
| 330 | !(needed because of the time swap in div_cur, at the beginning of each time step) |
---|
| 331 | hdivn(:,:,:) = hdivb(:,:,:) |
---|
| 332 | rotn(:,:,:) = rotb(:,:,:) |
---|
| 333 | |
---|
| 334 | CALL dyn_bfr( kstp ) ! bottom friction |
---|
| 335 | CALL dyn_zdf( kstp ) ! vertical diffusion |
---|
| 336 | ELSE |
---|
[5758] | 337 | ua(:,:,:) = 0._wp ! set dynamics trends to zero |
---|
| 338 | va(:,:,:) = 0._wp |
---|
[3] | 339 | |
---|
[5656] | 340 | IF( lk_asminc .AND. ln_asmiau .AND. & |
---|
[4292] | 341 | & ln_dyninc ) CALL dyn_asm_inc( kstp ) ! apply dynamics assimilation increment |
---|
| 342 | IF( ln_bkgwri ) CALL asm_bkg_wri( kstp ) ! output background fields |
---|
| 343 | IF( ln_neptsimp ) CALL dyn_nept_cor( kstp ) ! subtract Neptune velocities (simplified) |
---|
| 344 | IF( lk_bdy ) CALL bdy_dyn3d_dmp(kstp ) ! bdy damping trends |
---|
[1492] | 345 | CALL dyn_adv( kstp ) ! advection (vector or flux form) |
---|
| 346 | CALL dyn_vor( kstp ) ! vorticity term including Coriolis |
---|
| 347 | CALL dyn_ldf( kstp ) ! lateral mixing |
---|
[4292] | 348 | IF( ln_neptsimp ) CALL dyn_nept_cor( kstp ) ! add Neptune velocities (simplified) |
---|
[392] | 349 | #if defined key_agrif |
---|
[4292] | 350 | IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_dyn ! momemtum sponge |
---|
[389] | 351 | #endif |
---|
[1492] | 352 | CALL dyn_hpg( kstp ) ! horizontal gradient of Hydrostatic pressure |
---|
[3764] | 353 | CALL dyn_bfr( kstp ) ! bottom friction |
---|
[1492] | 354 | CALL dyn_zdf( kstp ) ! vertical diffusion |
---|
| 355 | CALL dyn_spg( kstp, indic ) ! surface pressure gradient |
---|
[4292] | 356 | ENDIF |
---|
[1492] | 357 | CALL dyn_nxt( kstp ) ! lateral velocity at next time step |
---|
[3] | 358 | |
---|
[4292] | 359 | CALL ssh_swp( kstp ) ! swap of sea surface height |
---|
| 360 | IF( lk_vvl ) CALL dom_vvl_sf_swp( kstp ) ! swap of vertical scale factors |
---|
[5656] | 361 | ! |
---|
[5758] | 362 | write(*,*) 'after dom_vvl' |
---|
| 363 | CALL FLUSH ( numout ) |
---|
| 364 | |
---|
| 365 | |
---|
| 366 | !!gm : This does not only concern the dynamics ==>>> add a new title |
---|
| 367 | !!gm2: why ouput restart before AGRIF update? |
---|
[5656] | 368 | IF( lrst_oce ) CALL rst_write( kstp ) ! write output ocean restart file |
---|
[593] | 369 | |
---|
[5656] | 370 | #if defined key_agrif |
---|
| 371 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 372 | ! AGRIF |
---|
| 373 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 374 | CALL Agrif_Integrate_ChildGrids( stp ) |
---|
| 375 | |
---|
| 376 | IF ( Agrif_NbStepint().EQ.0 ) THEN |
---|
| 377 | CALL Agrif_Update_Tra() ! Update active tracers |
---|
| 378 | CALL Agrif_Update_Dyn() ! Update momentum |
---|
| 379 | ENDIF |
---|
| 380 | #endif |
---|
[2528] | 381 | IF( ln_diahsb ) CALL dia_hsb( kstp ) ! - ML - global conservation diagnostics |
---|
| 382 | IF( lk_diaobs ) CALL dia_obs( kstp ) ! obs-minus-model (assimilation) diagnostics (call after dynamics update) |
---|
| 383 | |
---|
[3] | 384 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[5656] | 385 | ! Control |
---|
[3] | 386 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 387 | CALL stp_ctl( kstp, indic ) |
---|
| 388 | IF( indic < 0 ) THEN |
---|
| 389 | CALL ctl_stop( 'step: indic < 0' ) |
---|
| 390 | CALL dia_wri_state( 'output.abort', kstp ) |
---|
[1482] | 391 | ENDIF |
---|
[4147] | 392 | IF( kstp == nit000 ) THEN |
---|
[4624] | 393 | CALL iom_close( numror ) ! close input ocean restart file |
---|
| 394 | IF(lwm) CALL FLUSH ( numond ) ! flush output namelist oce |
---|
[5758] | 395 | IF(lwm.AND.numoni /= -1 ) & |
---|
| 396 | & CALL FLUSH ( numoni ) ! flush output namelist ice (if exist) |
---|
[4147] | 397 | ENDIF |
---|
[3] | 398 | |
---|
[508] | 399 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[75] | 400 | ! Coupled mode |
---|
| 401 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[5758] | 402 | !!gm why lk_oasis and not lk_cpl ???? |
---|
[5407] | 403 | IF( lk_oasis ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges |
---|
[508] | 404 | ! |
---|
[4153] | 405 | #if defined key_iomput |
---|
| 406 | IF( kstp == nitend .OR. indic < 0 ) THEN |
---|
[5407] | 407 | CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF |
---|
| 408 | IF( ln_crs ) CALL iom_context_finalize( trim(cxios_context)//"_crs" ) ! |
---|
[4152] | 409 | ENDIF |
---|
[4153] | 410 | #endif |
---|
[3769] | 411 | ! |
---|
[3294] | 412 | IF( nn_timing == 1 .AND. kstp == nit000 ) CALL timing_reset |
---|
[1481] | 413 | ! |
---|
[3] | 414 | END SUBROUTINE stp |
---|
| 415 | |
---|
| 416 | !!====================================================================== |
---|
| 417 | END MODULE step |
---|