[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 |
---|
[2236] | 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 |
---|
[3] | 25 | !!---------------------------------------------------------------------- |
---|
[888] | 26 | |
---|
| 27 | !!---------------------------------------------------------------------- |
---|
[3] | 28 | !! stp : OPA system time-stepping |
---|
| 29 | !!---------------------------------------------------------------------- |
---|
[2027] | 30 | USE step_oce ! time stepping definition modules |
---|
[2104] | 31 | #if defined key_top |
---|
| 32 | USE trcstp ! passive tracer time-stepping (trc_stp routine) |
---|
| 33 | #endif |
---|
[2236] | 34 | USE asminc ! assimilation increments (tra_asm_inc, dyn_asm_inc routines) |
---|
| 35 | USE stpctl ! time stepping control (stp_ctl routine) |
---|
| 36 | USE restart ! ocean restart (rst_wri routine) |
---|
| 37 | USE prtctl ! Print control (prt_ctl routine) |
---|
| 38 | |
---|
| 39 | #if defined key_agrif |
---|
| 40 | USE agrif_opa_sponge ! Momemtum and tracers sponges |
---|
| 41 | #endif |
---|
| 42 | |
---|
[3] | 43 | IMPLICIT NONE |
---|
| 44 | PRIVATE |
---|
| 45 | |
---|
[1492] | 46 | PUBLIC stp ! called by opa.F90 |
---|
[3] | 47 | |
---|
| 48 | !! * Substitutions |
---|
| 49 | # include "domzgr_substitute.h90" |
---|
| 50 | # include "zdfddm_substitute.h90" |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
[2287] | 52 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
[888] | 53 | !! $Id$ |
---|
[2287] | 54 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[3] | 55 | !!---------------------------------------------------------------------- |
---|
| 56 | |
---|
| 57 | CONTAINS |
---|
| 58 | |
---|
[508] | 59 | #if defined key_agrif |
---|
| 60 | SUBROUTINE stp( ) |
---|
[1438] | 61 | INTEGER :: kstp ! ocean time-step index |
---|
[508] | 62 | #else |
---|
[467] | 63 | SUBROUTINE stp( kstp ) |
---|
[1438] | 64 | INTEGER, INTENT(in) :: kstp ! ocean time-step index |
---|
[467] | 65 | #endif |
---|
| 66 | !!---------------------------------------------------------------------- |
---|
[3] | 67 | !! *** ROUTINE stp *** |
---|
| 68 | !! |
---|
| 69 | !! ** Purpose : - Time stepping of OPA (momentum and active tracer eqs.) |
---|
| 70 | !! - Time stepping of LIM (dynamic and thermodynamic eqs.) |
---|
| 71 | !! - Tme stepping of TRC (passive tracer eqs.) |
---|
| 72 | !! |
---|
| 73 | !! ** Method : -1- Update forcings and data |
---|
| 74 | !! -2- Update ocean physics |
---|
| 75 | !! -3- Compute the t and s trends |
---|
| 76 | !! -4- Update t and s |
---|
| 77 | !! -5- Compute the momentum trends |
---|
| 78 | !! -6- Update the horizontal velocity |
---|
| 79 | !! -7- Compute the diagnostics variables (rd,N2, div,cur,w) |
---|
| 80 | !! -8- Outputs and diagnostics |
---|
| 81 | !!---------------------------------------------------------------------- |
---|
[888] | 82 | INTEGER :: jk ! dummy loop indice |
---|
[3] | 83 | INTEGER :: indic ! error indicator if < 0 |
---|
| 84 | !! --------------------------------------------------------------------- |
---|
| 85 | |
---|
[392] | 86 | #if defined key_agrif |
---|
[389] | 87 | kstp = nit000 + Agrif_Nb_Step() |
---|
[1953] | 88 | # if defined key_iomput |
---|
[2104] | 89 | IF( Agrif_Nbstepint() == 0 ) CALL iom_swap |
---|
[1953] | 90 | # endif |
---|
[389] | 91 | #endif |
---|
[2104] | 92 | indic = 0 ! reset to no error condition |
---|
[2200] | 93 | IF( kstp /= nit000 ) CALL day( kstp ) ! Calendar (day was already called at nit000 in day_init) |
---|
[2104] | 94 | CALL iom_setkt( kstp ) ! say to iom that we are at time step kstp |
---|
[508] | 95 | |
---|
[3] | 96 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[888] | 97 | ! Update data, open boundaries, surface boundary condition (including sea-ice) |
---|
[3] | 98 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 99 | IF( lk_dtatem ) CALL dta_tem( kstp ) ! update 3D temperature data |
---|
[888] | 100 | IF( lk_dtasal ) CALL dta_sal( kstp ) ! update 3D salinity data |
---|
| 101 | CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) |
---|
[35] | 102 | IF( lk_obc ) CALL obc_dta( kstp ) ! update dynamic and tracer data at open boundaries |
---|
[3] | 103 | IF( lk_obc ) CALL obc_rad( kstp ) ! compute phase velocities at open boundaries |
---|
[2305] | 104 | IF( lk_bdy ) CALL bdy_dta_frs( kstp ) ! update dynamic and tracer data for FRS conditions (BDY) |
---|
[911] | 105 | |
---|
[1438] | 106 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[1492] | 107 | ! Ocean dynamics : ssh, wn, hdiv, rot ! |
---|
[1438] | 108 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 109 | CALL ssh_wzv( kstp ) ! after ssh & vertical velocity |
---|
[3] | 110 | |
---|
| 111 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[1492] | 112 | ! Ocean physics update (ua, va, ta, sa used as workspace) |
---|
[3] | 113 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[2082] | 114 | CALL bn2( tsb, rn2b ) ! before Brunt-Vaisala frequency |
---|
| 115 | CALL bn2( tsn, rn2 ) ! now Brunt-Vaisala frequency |
---|
[1492] | 116 | ! |
---|
| 117 | ! VERTICAL PHYSICS |
---|
[1662] | 118 | CALL zdf_bfr( kstp ) ! bottom friction |
---|
[1492] | 119 | ! ! Vertical eddy viscosity and diffusivity coefficients |
---|
[1531] | 120 | IF( lk_zdfric ) CALL zdf_ric ( kstp ) ! Richardson number dependent Kz |
---|
| 121 | IF( lk_zdftke ) CALL zdf_tke ( kstp ) ! TKE closure scheme for Kz |
---|
[2236] | 122 | IF( lk_zdfgls ) CALL zdf_gls ( kstp ) ! GLS closure scheme for Kz |
---|
[1531] | 123 | IF( lk_zdfkpp ) CALL zdf_kpp ( kstp ) ! KPP closure scheme for Kz |
---|
| 124 | IF( lk_zdfcst ) THEN ! Constant Kz (reset avt, avm[uv] to the background value) |
---|
[1537] | 125 | avt (:,:,:) = rn_avt0 * tmask(:,:,:) |
---|
| 126 | avmu(:,:,:) = rn_avm0 * umask(:,:,:) |
---|
| 127 | avmv(:,:,:) = rn_avm0 * vmask(:,:,:) |
---|
[677] | 128 | ENDIF |
---|
[1492] | 129 | IF( ln_rnf_mouth ) THEN ! increase diffusivity at rivers mouths |
---|
[1246] | 130 | DO jk = 2, nkrnf ; avt(:,:,jk) = avt(:,:,jk) + 2.e0 * rn_avt_rnf * rnfmsk(:,:) * tmask(:,:,jk) ; END DO |
---|
[3] | 131 | ENDIF |
---|
[1492] | 132 | IF( ln_zdfevd ) CALL zdf_evd( kstp ) ! enhanced vertical eddy diffusivity |
---|
[3] | 133 | |
---|
[1492] | 134 | IF( lk_zdftmx ) CALL zdf_tmx( kstp ) ! tidal vertical mixing |
---|
[3] | 135 | |
---|
[888] | 136 | IF( lk_zdfddm .AND. .NOT. lk_zdfkpp ) & |
---|
[1492] | 137 | & CALL zdf_ddm( kstp ) ! double diffusive mixing |
---|
| 138 | CALL zdf_mxl( kstp ) ! mixed layer depth |
---|
[3] | 139 | |
---|
[1531] | 140 | ! write tke information in the restart file |
---|
| 141 | IF( lrst_oce .AND. lk_zdftke ) CALL tke_rst( kstp, 'WRITE' ) |
---|
[2236] | 142 | ! write gls information in the restart file |
---|
| 143 | IF( lrst_oce .AND. lk_zdfgls ) CALL gls_rst( kstp, 'WRITE' ) |
---|
[1492] | 144 | ! |
---|
| 145 | ! LATERAL PHYSICS |
---|
| 146 | ! |
---|
| 147 | IF( lk_ldfslp ) THEN ! slope of lateral mixing |
---|
[2082] | 148 | CALL eos( tsb, rhd ) ! before in situ density |
---|
| 149 | IF( ln_zps ) CALL zps_hde( kstp, jpts, tsb, gtsu, gtsv, & ! Partial steps: before horizontal gradient |
---|
| 150 | & rhd, gru , grv ) ! of t, s, rd at the last ocean level |
---|
[2236] | 151 | IF ( .NOT. ln_traldf_grif ) THEN |
---|
[1492] | 152 | CALL ldf_slp( kstp, rhd, rn2b ) ! before slope of the lateral mixing |
---|
[2236] | 153 | ELSE |
---|
| 154 | CALL ldf_slp_grif( kstp ) |
---|
| 155 | IF ( ln_dynldf_bilap .OR. ln_dynldf_iso ) CALL ldf_slp( kstp, rhd, rn2b ) |
---|
[1481] | 156 | ENDIF |
---|
[2236] | 157 | ENDIF |
---|
[3] | 158 | #if defined key_traldf_c2d |
---|
[1492] | 159 | IF( lk_traldf_eiv ) CALL ldf_eiv( kstp ) ! eddy induced velocity coefficient |
---|
[1239] | 160 | # endif |
---|
[3] | 161 | |
---|
[1482] | 162 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[1492] | 163 | ! diagnostics and outputs (ua, va, ta, sa used as workspace) |
---|
[1482] | 164 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 165 | IF( lk_floats ) CALL flo_stp( kstp ) ! drifting Floats |
---|
| 166 | IF( lk_diahth ) CALL dia_hth( kstp ) ! Thermocline depth (20 degres isotherm depth) |
---|
| 167 | IF( lk_diafwb ) CALL dia_fwb( kstp ) ! Fresh water budget diagnostics |
---|
[2236] | 168 | IF( lk_diaobs ) CALL dia_obs( kstp ) ! obs-minus-model (assimilation) diagnostics |
---|
[1492] | 169 | IF( ln_diaptr ) CALL dia_ptr( kstp ) ! Poleward TRansports diagnostics |
---|
[1756] | 170 | IF( lk_diaar5 ) CALL dia_ar5( kstp ) ! ar5 diag |
---|
[1635] | 171 | CALL dia_wri( kstp ) ! ocean model: outputs |
---|
[1482] | 172 | |
---|
[923] | 173 | #if defined key_top |
---|
[3] | 174 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 175 | ! Passive Tracer Model |
---|
| 176 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 177 | CALL trc_stp( kstp ) ! time-stepping |
---|
[3] | 178 | #endif |
---|
| 179 | |
---|
| 180 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[1492] | 181 | ! Active tracers (ua, va used as workspace) |
---|
[3] | 182 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[2082] | 183 | tsa(:,:,:,:) = 0.e0 ! set tracer trends to zero |
---|
[3] | 184 | |
---|
[2236] | 185 | IF( ln_asmiau .AND. & |
---|
| 186 | & ln_trainc ) CALL tra_asm_inc( kstp ) ! apply tracer assimilation increment |
---|
[467] | 187 | CALL tra_sbc ( kstp ) ! surface boundary condition |
---|
| 188 | IF( ln_traqsr ) CALL tra_qsr ( kstp ) ! penetrative solar radiation qsr |
---|
[2325] | 189 | IF( ln_trabbc ) CALL tra_bbc ( kstp ) ! bottom heat flux |
---|
[2027] | 190 | IF( lk_trabbl ) CALL tra_bbl ( kstp ) ! advective (and/or diffusive) bottom boundary layer scheme |
---|
[467] | 191 | IF( lk_tradmp ) CALL tra_dmp ( kstp ) ! internal damping trends |
---|
| 192 | CALL tra_adv ( kstp ) ! horizontal & vertical advection |
---|
| 193 | IF( n_cla == 1 ) CALL tra_cla ( kstp ) ! Cross Land Advection (Update Hor. advection) |
---|
| 194 | IF( lk_zdfkpp ) CALL tra_kpp ( kstp ) ! KPP non-local tracer fluxes |
---|
| 195 | CALL tra_ldf ( kstp ) ! lateral mixing |
---|
[392] | 196 | #if defined key_agrif |
---|
[2027] | 197 | CALL tra_unswap |
---|
[782] | 198 | IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_tra ! tracers sponge |
---|
[2027] | 199 | CALL tra_swap |
---|
[389] | 200 | #endif |
---|
[1111] | 201 | CALL tra_zdf ( kstp ) ! vertical mixing and after tracer fields |
---|
[1239] | 202 | |
---|
[1492] | 203 | IF( ln_dynhpg_imp ) THEN ! semi-implicit hpg (time stepping then eos) |
---|
| 204 | IF( ln_zdfnpc ) CALL tra_npc ( kstp ) ! update after fields by non-penetrative convection |
---|
| 205 | CALL tra_nxt ( kstp ) ! tracer fields at next time step |
---|
[2082] | 206 | CALL eos( tsa, rhd, rhop ) ! Time-filtered in situ density for hpg computation |
---|
[2104] | 207 | IF( ln_zps ) CALL zps_hde( kstp, jpts, tsa, gtsu, gtsv, & ! zps: time filtered hor. derivative |
---|
[2082] | 208 | & rhd, gru , grv ) ! of t, s, rd at the last ocean level |
---|
[1492] | 209 | |
---|
| 210 | ELSE ! centered hpg (eos then time stepping) |
---|
[2082] | 211 | CALL eos( tsn, rhd, rhop ) ! now in situ density for hpg computation |
---|
[2104] | 212 | IF( ln_zps ) CALL zps_hde( kstp, jpts, tsn, gtsu, gtsv, & ! zps: now hor. derivative |
---|
[2082] | 213 | & rhd, gru , grv ) ! of t, s, rd at the last ocean level |
---|
[1492] | 214 | IF( ln_zdfnpc ) CALL tra_npc ( kstp ) ! update after fields by non-penetrative convection |
---|
| 215 | CALL tra_nxt ( kstp ) ! tracer fields at next time step |
---|
[2082] | 216 | ENDIF |
---|
[2027] | 217 | CALL tra_unswap |
---|
[1481] | 218 | |
---|
[3] | 219 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[1492] | 220 | ! Dynamics (ta, sa used as workspace) |
---|
[3] | 221 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 222 | ua(:,:,:) = 0.e0 ! set dynamics trends to zero |
---|
[75] | 223 | va(:,:,:) = 0.e0 |
---|
[3] | 224 | |
---|
[2236] | 225 | IF( ln_asmiau .AND. & |
---|
| 226 | & ln_dyninc ) CALL dyn_asm_inc( kstp ) ! apply dynamics assimilation increment |
---|
[1492] | 227 | CALL dyn_adv( kstp ) ! advection (vector or flux form) |
---|
| 228 | CALL dyn_vor( kstp ) ! vorticity term including Coriolis |
---|
| 229 | CALL dyn_ldf( kstp ) ! lateral mixing |
---|
[392] | 230 | #if defined key_agrif |
---|
[1492] | 231 | IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_dyn ! momemtum sponge |
---|
[389] | 232 | #endif |
---|
[1492] | 233 | CALL dyn_hpg( kstp ) ! horizontal gradient of Hydrostatic pressure |
---|
[1662] | 234 | CALL dyn_bfr( kstp ) ! bottom friction |
---|
[1492] | 235 | CALL dyn_zdf( kstp ) ! vertical diffusion |
---|
| 236 | CALL dyn_spg( kstp, indic ) ! surface pressure gradient |
---|
| 237 | CALL dyn_nxt( kstp ) ! lateral velocity at next time step |
---|
[3] | 238 | |
---|
[1492] | 239 | CALL ssh_nxt( kstp ) ! sea surface height at next time step |
---|
[593] | 240 | |
---|
[2148] | 241 | IF( ln_diahsb ) CALL dia_hsb( kstp ) ! - ML - global conservation diagnostics |
---|
| 242 | |
---|
[3] | 243 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[888] | 244 | ! Control and restarts |
---|
[3] | 245 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 246 | CALL stp_ctl( kstp, indic ) |
---|
| 247 | IF( indic < 0 ) THEN |
---|
| 248 | CALL ctl_stop( 'step: indic < 0' ) |
---|
| 249 | CALL dia_wri_state( 'output.abort', kstp ) |
---|
[1482] | 250 | ENDIF |
---|
[1492] | 251 | IF( kstp == nit000 ) CALL iom_close( numror ) ! close input ocean restart file |
---|
| 252 | IF( lrst_oce ) CALL rst_write ( kstp ) ! write output ocean restart file |
---|
| 253 | IF( lk_obc ) CALL obc_rst_write( kstp ) ! write open boundary restart file |
---|
[3] | 254 | |
---|
[508] | 255 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[1492] | 256 | ! Trends (ua, va, ta, sa used as workspace) |
---|
[508] | 257 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 258 | IF( nstop == 0 ) THEN |
---|
| 259 | IF( lk_trddyn ) CALL trd_dwr( kstp ) ! trends: dynamics |
---|
| 260 | IF( lk_trdtra ) CALL trd_twr( kstp ) ! trends: active tracers |
---|
| 261 | IF( lk_trdmld ) CALL trd_mld( kstp ) ! trends: Mixed-layer |
---|
| 262 | IF( lk_trdvor ) CALL trd_vor( kstp ) ! trends: vorticity budget |
---|
[75] | 263 | ENDIF |
---|
[3] | 264 | |
---|
[75] | 265 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 266 | ! Coupled mode |
---|
| 267 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[1492] | 268 | IF( lk_cpl ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges |
---|
[508] | 269 | ! |
---|
[1481] | 270 | ! |
---|
[3] | 271 | END SUBROUTINE stp |
---|
| 272 | |
---|
| 273 | !!====================================================================== |
---|
| 274 | END MODULE step |
---|