[2409] | 1 | MODULE step_c1d |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE step_c1d *** |
---|
| 4 | !! Time-stepping : manager of the ocean, tracer and ice time stepping - c1d case |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 2.0 ! 2004-04 (C. Ethe) adapted from step.F90 for C1D |
---|
| 7 | !! 3.0 ! 2008-04 (G. Madec) redo the adaptation to include SBC |
---|
| 8 | !!---------------------------------------------------------------------- |
---|
| 9 | #if defined key_c1d |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! 'key_c1d' 1D Configuration |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! stp_c1d : NEMO system time-stepping in c1d case |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
[4245] | 15 | USE step_oce ! time stepping definition modules |
---|
[2409] | 16 | #if defined key_top |
---|
[4245] | 17 | USE trcstp ! passive tracer time-stepping (trc_stp routine) |
---|
[2409] | 18 | #endif |
---|
| 19 | USE dyncor_c1d ! Coriolis term (c1d case) (dyn_cor_1d ) |
---|
[5930] | 20 | USE dynnxt ! time-stepping (dyn_nxt routine) |
---|
[4245] | 21 | USE dyndmp ! U & V momentum damping (dyn_dmp routine) |
---|
[3680] | 22 | USE restart ! restart |
---|
[2409] | 23 | |
---|
| 24 | IMPLICIT NONE |
---|
| 25 | PRIVATE |
---|
| 26 | |
---|
| 27 | PUBLIC stp_c1d ! called by opa.F90 |
---|
| 28 | |
---|
| 29 | !! * Substitutions |
---|
| 30 | # include "zdfddm_substitute.h90" |
---|
| 31 | !!---------------------------------------------------------------------- |
---|
[6140] | 32 | !! NEMO/C1D 3.7 , NEMO Consortium (2015) |
---|
[5215] | 33 | !! $Id$ |
---|
[2409] | 34 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 35 | !!---------------------------------------------------------------------- |
---|
| 36 | CONTAINS |
---|
| 37 | |
---|
| 38 | SUBROUTINE stp_c1d( kstp ) |
---|
| 39 | !!---------------------------------------------------------------------- |
---|
| 40 | !! *** ROUTINE stp_c1d *** |
---|
| 41 | !! |
---|
| 42 | !! ** Purpose : - Time stepping of SBC including LIM (dynamic and thermodynamic eqs.) |
---|
| 43 | !! - Time stepping of OPA (momentum and active tracer eqs.) |
---|
| 44 | !! - Time stepping of TOP (passive tracer eqs.) |
---|
| 45 | !! |
---|
| 46 | !! ** Method : -1- Update forcings and data |
---|
| 47 | !! -2- Update vertical ocean physics |
---|
| 48 | !! -3- Compute the t and s trends |
---|
| 49 | !! -4- Update t and s |
---|
| 50 | !! -5- Compute the momentum trends |
---|
| 51 | !! -6- Update the horizontal velocity |
---|
| 52 | !! -7- Compute the diagnostics variables (rd,N2, div,cur,w) |
---|
| 53 | !! -8- Outputs and diagnostics |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
| 55 | INTEGER, INTENT(in) :: kstp ! ocean time-step index |
---|
[6140] | 56 | ! |
---|
[2409] | 57 | INTEGER :: jk ! dummy loop indice |
---|
| 58 | INTEGER :: indic ! error indicator if < 0 |
---|
| 59 | !! --------------------------------------------------------------------- |
---|
| 60 | |
---|
| 61 | indic = 0 ! reset to no error condition |
---|
[4247] | 62 | IF( kstp == nit000 ) CALL iom_init( "nemo") ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS) |
---|
[2409] | 63 | IF( kstp /= nit000 ) CALL day( kstp ) ! Calendar (day was already called at nit000 in day_init) |
---|
[4247] | 64 | CALL iom_setkt( kstp - nit000 + 1, "nemo" ) ! say to iom that we are at time step kstp |
---|
[2409] | 65 | |
---|
| 66 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 67 | ! Update data, open boundaries, surface boundary condition (including sea-ice) |
---|
| 68 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 69 | CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) |
---|
| 70 | |
---|
| 71 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 72 | ! Ocean physics update (ua, va, ta, sa used as workspace) |
---|
| 73 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[5108] | 74 | CALL eos_rab( tsb, rab_b ) ! before local thermal/haline expension ratio at T-points |
---|
| 75 | CALL eos_rab( tsn, rab_n ) ! now local thermal/haline expension ratio at T-points |
---|
[4990] | 76 | CALL bn2( tsb, rab_b, rn2b ) ! before Brunt-Vaisala frequency |
---|
| 77 | CALL bn2( tsn, rab_n, rn2 ) ! now Brunt-Vaisala frequency |
---|
[2409] | 78 | ! VERTICAL PHYSICS |
---|
| 79 | CALL zdf_bfr( kstp ) ! bottom friction |
---|
| 80 | ! ! Vertical eddy viscosity and diffusivity coefficients |
---|
| 81 | IF( lk_zdfric ) CALL zdf_ric( kstp ) ! Richardson number dependent Kz |
---|
| 82 | IF( lk_zdftke ) CALL zdf_tke( kstp ) ! TKE closure scheme for Kz |
---|
| 83 | IF( lk_zdfgls ) CALL zdf_gls( kstp ) ! GLS closure scheme for Kz |
---|
| 84 | IF( lk_zdfcst ) THEN ! Constant Kz (reset avt, avm[uv] to the background value) |
---|
| 85 | avt (:,:,:) = rn_avt0 * tmask(:,:,:) |
---|
| 86 | avmu(:,:,:) = rn_avm0 * umask(:,:,:) |
---|
| 87 | avmv(:,:,:) = rn_avm0 * vmask(:,:,:) |
---|
| 88 | ENDIF |
---|
| 89 | |
---|
| 90 | IF( ln_rnf_mouth ) THEN ! increase diffusivity at rivers mouths |
---|
| 91 | DO jk = 2, nkrnf ; avt(:,:,jk) = avt(:,:,jk) + 2.e0 * rn_avt_rnf * rnfmsk(:,:) ; END DO |
---|
| 92 | ENDIF |
---|
| 93 | IF( ln_zdfevd ) CALL zdf_evd( kstp ) ! enhanced vertical eddy diffusivity |
---|
| 94 | IF( lk_zdftmx ) CALL zdf_tmx( kstp ) ! tidal vertical mixing |
---|
[5836] | 95 | IF( lk_zdfddm ) CALL zdf_ddm( kstp ) ! double diffusive mixing |
---|
[2409] | 96 | CALL zdf_mxl( kstp ) ! mixed layer depth |
---|
| 97 | |
---|
| 98 | ! write tke information in the restart file |
---|
| 99 | IF( lrst_oce .AND. lk_zdftke ) CALL tke_rst( kstp, 'WRITE' ) |
---|
| 100 | ! write gls information in the restart file |
---|
| 101 | IF( lrst_oce .AND. lk_zdfgls ) CALL gls_rst( kstp, 'WRITE' ) |
---|
| 102 | |
---|
| 103 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 104 | ! diagnostics and outputs (ua, va, ta, sa used as workspace) |
---|
| 105 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 106 | CALL dia_wri( kstp ) ! ocean model: outputs |
---|
[4153] | 107 | IF( lk_diahth ) CALL dia_hth( kstp ) ! Thermocline depth (20°C) |
---|
[2409] | 108 | |
---|
[4153] | 109 | |
---|
[2409] | 110 | #if defined key_top |
---|
| 111 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 112 | ! Passive Tracer Model |
---|
| 113 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[4990] | 114 | CALL trc_stp( kstp ) ! time-stepping |
---|
[2409] | 115 | #endif |
---|
| 116 | |
---|
| 117 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 118 | ! Active tracers (ua, va used as workspace) |
---|
| 119 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[4990] | 120 | tsa(:,:,:,:) = 0._wp ! set tracer trends to zero |
---|
[2409] | 121 | |
---|
[4990] | 122 | CALL tra_sbc( kstp ) ! surface boundary condition |
---|
| 123 | IF( ln_traqsr ) CALL tra_qsr( kstp ) ! penetrative solar radiation qsr |
---|
| 124 | IF( ln_tradmp ) CALL tra_dmp( kstp ) ! internal damping trends- tracers |
---|
| 125 | CALL tra_zdf( kstp ) ! vertical mixing |
---|
| 126 | CALL eos( tsn, rhd, rhop, gdept_0(:,:,:) ) ! now potential density for zdfmxl |
---|
| 127 | IF( ln_zdfnpc ) CALL tra_npc( kstp ) ! applied non penetrative convective adjustment on (t,s) |
---|
| 128 | CALL tra_nxt( kstp ) ! tracer fields at next time step |
---|
[2409] | 129 | |
---|
[5108] | 130 | |
---|
| 131 | |
---|
[2409] | 132 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 133 | ! Dynamics (ta, sa used as workspace) |
---|
| 134 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[4990] | 135 | ua(:,:,:) = 0._wp ! set dynamics trends to zero |
---|
| 136 | va(:,:,:) = 0._wp |
---|
[2409] | 137 | |
---|
[4990] | 138 | IF( ln_dyndmp ) CALL dyn_dmp ( kstp ) ! internal damping trends- momentum |
---|
| 139 | CALL dyn_cor_c1d( kstp ) ! vorticity term including Coriolis |
---|
| 140 | CALL dyn_zdf ( kstp ) ! vertical diffusion |
---|
[5930] | 141 | CALL dyn_nxt ( kstp ) ! lateral velocity at next time step |
---|
[2409] | 142 | |
---|
| 143 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 144 | ! Control and restarts |
---|
| 145 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[4990] | 146 | CALL stp_ctl( kstp, indic ) |
---|
| 147 | IF( kstp == nit000 ) CALL iom_close( numror ) ! close input ocean restart file |
---|
| 148 | IF( lrst_oce ) CALL rst_write( kstp ) ! write output ocean restart file |
---|
[2409] | 149 | ! |
---|
[5412] | 150 | #if defined key_iomput |
---|
| 151 | IF( kstp == nitend .OR. indic < 0 ) CALL xios_context_finalize() ! needed for XIOS |
---|
| 152 | ! |
---|
| 153 | #endif |
---|
[2409] | 154 | END SUBROUTINE stp_c1d |
---|
| 155 | |
---|
| 156 | #else |
---|
| 157 | !!---------------------------------------------------------------------- |
---|
| 158 | !! Default key NO 1D Config |
---|
| 159 | !!---------------------------------------------------------------------- |
---|
| 160 | CONTAINS |
---|
| 161 | SUBROUTINE stp_c1d ( kt ) ! dummy routine |
---|
| 162 | WRITE(*,*) 'stp_c1d: You should not have seen this print! error?', kt |
---|
| 163 | END SUBROUTINE stp_c1d |
---|
| 164 | #endif |
---|
| 165 | |
---|
| 166 | !!====================================================================== |
---|
| 167 | END MODULE step_c1d |
---|