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