[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 |
---|
[12377] | 8 | !! 4.1 ! 2019-08 (A. Coward, D. Storkey) rewrite in preparation for new timestepping scheme |
---|
[2409] | 9 | !!---------------------------------------------------------------------- |
---|
| 10 | #if defined key_c1d |
---|
| 11 | !!---------------------------------------------------------------------- |
---|
| 12 | !! 'key_c1d' 1D Configuration |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | !! stp_c1d : NEMO system time-stepping in c1d case |
---|
| 15 | !!---------------------------------------------------------------------- |
---|
[4245] | 16 | USE step_oce ! time stepping definition modules |
---|
[12377] | 17 | USE step, ONLY : Nbb, Nnn, Naa, Nrhs ! time level indices |
---|
[2409] | 18 | #if defined key_top |
---|
[4245] | 19 | USE trcstp ! passive tracer time-stepping (trc_stp routine) |
---|
[2409] | 20 | #endif |
---|
| 21 | USE dyncor_c1d ! Coriolis term (c1d case) (dyn_cor_1d ) |
---|
[12377] | 22 | USE dynatf ! time filtering (dyn_atf routine) |
---|
[4245] | 23 | USE dyndmp ! U & V momentum damping (dyn_dmp routine) |
---|
[3680] | 24 | USE restart ! restart |
---|
[2409] | 25 | |
---|
| 26 | IMPLICIT NONE |
---|
| 27 | PRIVATE |
---|
| 28 | |
---|
| 29 | PUBLIC stp_c1d ! called by opa.F90 |
---|
| 30 | |
---|
| 31 | !!---------------------------------------------------------------------- |
---|
[10068] | 32 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[5215] | 33 | !! $Id$ |
---|
[10068] | 34 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[2409] | 35 | !!---------------------------------------------------------------------- |
---|
| 36 | CONTAINS |
---|
| 37 | |
---|
| 38 | SUBROUTINE stp_c1d( kstp ) |
---|
| 39 | !!---------------------------------------------------------------------- |
---|
| 40 | !! *** ROUTINE stp_c1d *** |
---|
| 41 | !! |
---|
[9656] | 42 | !! ** Purpose : - Time stepping of SBC including sea ice (dynamic and thermodynamic eqs.) |
---|
[2409] | 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 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[12377] | 69 | CALL sbc ( kstp, Nbb, Nnn ) ! Sea Boundary Condition (including sea-ice) |
---|
[2409] | 70 | |
---|
| 71 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[12377] | 72 | ! Ocean physics update |
---|
[2409] | 73 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[12377] | 74 | CALL eos_rab( ts(:,:,:,:,Nbb), rab_b, Nnn ) ! before local thermal/haline expension ratio at T-points |
---|
| 75 | CALL eos_rab( ts(:,:,:,:,Nnn), rab_n, Nnn ) ! now local thermal/haline expension ratio at T-points |
---|
| 76 | CALL bn2( ts(:,:,:,:,Nbb), rab_b, rn2b, Nnn ) ! before Brunt-Vaisala frequency |
---|
| 77 | CALL bn2( ts(:,:,:,:,Nnn), rab_n, rn2 , Nnn ) ! now Brunt-Vaisala frequency |
---|
[9019] | 78 | |
---|
| 79 | ! VERTICAL PHYSICS |
---|
[12377] | 80 | CALL zdf_phy( kstp, Nbb, Nnn, Nrhs ) ! vertical physics update (bfr, avt, avs, avm + MLD) |
---|
[2409] | 81 | |
---|
[12377] | 82 | IF(.NOT.ln_linssh ) CALL ssh_nxt ( kstp, Nbb, Nnn, ssh, Naa ) ! after ssh (includes call to div_hor) |
---|
| 83 | IF(.NOT.ln_linssh ) CALL dom_vvl_sf_nxt( kstp, Nbb, Nnn, Naa ) ! after vertical scale factors |
---|
[2409] | 84 | |
---|
[12377] | 85 | IF(.NOT.ln_linssh ) CALL wzv ( kstp, Nbb, Nnn, ww, Naa ) ! now cross-level velocity |
---|
[2409] | 86 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[12377] | 87 | ! diagnostics and outputs |
---|
[2409] | 88 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[12377] | 89 | CALL dia_wri( kstp, Nnn ) ! ocean model: outputs |
---|
| 90 | IF( lk_diahth ) CALL dia_hth( kstp, Nnn ) ! Thermocline depth (20°C) |
---|
[2409] | 91 | |
---|
[4153] | 92 | |
---|
[2409] | 93 | #if defined key_top |
---|
| 94 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 95 | ! Passive Tracer Model |
---|
| 96 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[12377] | 97 | CALL trc_stp( kstp, Nbb, Nnn, Nrhs, Naa ) ! time-stepping |
---|
[2409] | 98 | #endif |
---|
| 99 | |
---|
| 100 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
[12377] | 101 | ! Active tracers (uu(:,:,:,Nrhs), vv(:,:,:,Nrhs) used as workspace) |
---|
[2409] | 102 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[12377] | 103 | ts(:,:,:,:,Nrhs) = 0._wp ! set tracer trends to zero |
---|
[2409] | 104 | |
---|
[12377] | 105 | CALL tra_sbc( kstp, Nnn, ts, Nrhs ) ! surface boundary condition |
---|
| 106 | IF( ln_traqsr ) CALL tra_qsr( kstp, Nnn, ts, Nrhs ) ! penetrative solar radiation qsr |
---|
| 107 | IF( ln_tradmp ) CALL tra_dmp( kstp, Nbb, Nnn, ts, Nrhs ) ! internal damping trends- tracers |
---|
| 108 | IF(.NOT.ln_linssh)CALL tra_adv( kstp, Nbb, Nnn, ts, Nrhs ) ! horizontal & vertical advection |
---|
| 109 | IF( ln_zdfosm ) CALL tra_osm( kstp, Nnn , ts, Nrhs ) ! OSMOSIS non-local tracer fluxes |
---|
| 110 | CALL tra_zdf( kstp, Nbb, Nnn, Nrhs, ts, Naa ) ! vertical mixing |
---|
| 111 | CALL eos( ts(:,:,:,:,Nnn), rhd, rhop, gdept_0(:,:,:) ) ! now potential density for zdfmxl |
---|
| 112 | IF( ln_zdfnpc ) CALL tra_npc( kstp, Nnn, Nrhs, ts, Naa ) ! applied non penetrative convective adjustment on (t,s) |
---|
| 113 | CALL tra_atf( kstp, Nbb, Nnn, Nrhs, Naa, ts ) ! time filtering of "now" tracer fields |
---|
[2409] | 114 | |
---|
[5108] | 115 | |
---|
| 116 | |
---|
[2409] | 117 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 118 | ! Dynamics (ta, sa used as workspace) |
---|
| 119 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[12377] | 120 | uu(:,:,:,Nrhs) = 0._wp ! set dynamics trends to zero |
---|
| 121 | vv(:,:,:,Nrhs) = 0._wp |
---|
[2409] | 122 | |
---|
[12377] | 123 | IF( ln_dyndmp ) CALL dyn_dmp ( kstp, Nbb, Nnn , uu, vv, Nrhs ) ! internal damping trends- momentum |
---|
| 124 | CALL dyn_cor_c1d( kstp, Nnn , uu, vv, Nrhs ) ! vorticity term including Coriolis |
---|
| 125 | IF( ln_zdfosm ) CALL dyn_osm ( kstp, Nnn , uu, vv, Nrhs ) ! OSMOSIS non-local velocity fluxes |
---|
| 126 | CALL dyn_zdf ( kstp, Nbb, Nnn, Nrhs, uu, vv, Naa ) ! vertical diffusion |
---|
| 127 | CALL dyn_atf ( kstp, Nbb, Nnn, Naa , uu, vv, e3t, e3u, e3v ) ! time filtering of "now" fields |
---|
| 128 | IF(.NOT.ln_linssh)CALL ssh_atf ( kstp, Nbb, Nnn, Naa , ssh ) ! time filtering of "now" sea surface height |
---|
| 129 | ! |
---|
| 130 | ! Swap time levels |
---|
| 131 | Nrhs = Nbb |
---|
| 132 | Nbb = Nnn |
---|
| 133 | Nnn = Naa |
---|
| 134 | Naa = Nrhs |
---|
| 135 | ! |
---|
| 136 | IF(.NOT.ln_linssh)CALL dom_vvl_sf_update( kstp, Nbb, Nnn, Naa ) ! update of vertical scale factors |
---|
[2409] | 137 | |
---|
| 138 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 139 | ! Control and restarts |
---|
| 140 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[12377] | 141 | CALL stp_ctl( kstp, Nnn, indic ) |
---|
| 142 | IF( kstp == nit000 ) CALL iom_close( numror ) ! close input ocean restart file |
---|
| 143 | IF( lrst_oce ) CALL rst_write( kstp, Nbb, Nnn ) ! write output ocean restart file |
---|
[2409] | 144 | ! |
---|
[5412] | 145 | #if defined key_iomput |
---|
| 146 | IF( kstp == nitend .OR. indic < 0 ) CALL xios_context_finalize() ! needed for XIOS |
---|
| 147 | ! |
---|
| 148 | #endif |
---|
[2409] | 149 | END SUBROUTINE stp_c1d |
---|
| 150 | |
---|
| 151 | #else |
---|
| 152 | !!---------------------------------------------------------------------- |
---|
| 153 | !! Default key NO 1D Config |
---|
| 154 | !!---------------------------------------------------------------------- |
---|
| 155 | CONTAINS |
---|
| 156 | SUBROUTINE stp_c1d ( kt ) ! dummy routine |
---|
[9927] | 157 | IMPLICIT NONE |
---|
| 158 | INTEGER, INTENT( in ) :: kt |
---|
[2409] | 159 | WRITE(*,*) 'stp_c1d: You should not have seen this print! error?', kt |
---|
| 160 | END SUBROUTINE stp_c1d |
---|
| 161 | #endif |
---|
| 162 | |
---|
| 163 | !!====================================================================== |
---|
| 164 | END MODULE step_c1d |
---|