New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
step_c1d.F90 in NEMO/trunk/src/OCE/C1D – NEMO

source: NEMO/trunk/src/OCE/C1D/step_c1d.F90 @ 14227

Last change on this file since 14227 was 14227, checked in by smasson, 3 years ago

trunk: replace remaining OPA by OCE

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