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