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 trunk/NEMO/C1D_SRC – NEMO

source: trunk/NEMO/C1D_SRC/step_c1d.F90 @ 1221

Last change on this file since 1221 was 1221, checked in by ctlod, 15 years ago

correct compilation errors when using key_c1d cpp key, see ticket: #274

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.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   !!----------------------------------------------------------------------
9#if defined key_c1d
10   !!----------------------------------------------------------------------
11   !!   'key_c1d'                                       1D Configuration
12   !!---------------------------------------------------------------------- 
13   !!   stp_c1d        : NEMO system time-stepping in c1d case
14   !!----------------------------------------------------------------------
15   USE oce             ! ocean dynamics and tracers variables
16   USE dom_oce         ! ocean space and time domain variables
17   USE zdf_oce         ! ocean vertical physics variables
18   USE in_out_manager  ! I/O manager
19   USE iom             !
20   USE lbclnk
21
22   USE daymod          ! calendar                         (day     routine)
23
24   USE dtatem          ! ocean temperature data           (dta_tem routine)
25   USE dtasal          ! ocean salinity    data           (dta_sal routine)
26   USE sbcmod          ! surface boundary condition       (sbc     routine)
27   USE sbcrnf          ! surface boundary condition: runoff variables
28
29   USE trcstp          ! passive tracer time-stepping      (trc_stp routine)
30
31   USE traqsr          ! solar radiation penetration      (tra_qsr routine)
32   USE trasbc          ! surface boundary condition       (tra_sbc routine)
33   !   zdfkpp          ! KPP non-local tracer fluxes      (tra_kpp routine)
34   USE trazdf          ! vertical mixing                  (tra_zdf routine)
35   USE tranxt          ! time-stepping                    (tra_nxt routine)
36   USE tranpc          ! non-penetrative convection       (tra_npc routine)
37
38   USE eosbn2          ! equation of state                (eos_bn2 routine)
39
40   USE dyncor_c1d      ! Coriolis term (c1d case)         (dyn_cor_1d     )
41   USE dynzdf          ! vertical diffusion               (dyn_zdf routine)
42   USE dynnxt_c1d      ! time-stepping                    (dyn_nxt routine)
43   USE diawri_c1d      ! write outputs                (dia_wri_c1d routine)
44
45   USE zdfbfr          ! bottom friction                  (zdf_bfr routine)
46   USE zdftke          ! TKE vertical mixing              (zdf_tke routine)
47   USE zdfkpp          ! KPP vertical mixing              (zdf_kpp routine)
48   USE zdfddm          ! double diffusion mixing          (zdf_ddm routine)
49   USE zdfevd          ! enhanced vertical diffusion      (zdf_evd routine)
50   USE zdfric          ! Richardson vertical mixing       (zdf_ric routine)
51   USE zdfmxl          ! Mixed-layer depth                (zdf_mxl routine)
52
53   USE ice_oce         ! sea-ice variable
54
55   USE diawri          ! Standard run outputs             (dia_wri routine)
56
57   USE stpctl          ! time stepping control            (stp_ctl routine)
58   USE restart         ! ocean restart                    (rst_wri routine)
59   USE prtctl          ! Print control                    (prt_ctl routine)
60
61   IMPLICIT NONE
62   PRIVATE
63
64   PUBLIC stp_c1d      ! called by opa.F90
65
66   !! * Substitutions
67#  include "domzgr_substitute.h90"
68#  include "zdfddm_substitute.h90"
69   !!----------------------------------------------------------------------
70   !! NEMO 3.0 , LOCEAN-IPSL (2008)
71   !! $Id$
72   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
73   !!----------------------------------------------------------------------
74
75CONTAINS
76
77   SUBROUTINE stp_c1d( kstp )
78      !!----------------------------------------------------------------------
79      !!                     ***  ROUTINE stp_c1d  ***
80      !!                     
81      !! ** Purpose :  - Time stepping of SBC including LIM (dynamic and thermodynamic eqs.)
82      !!               - Time stepping of OPA (momentum and active tracer eqs.)
83      !!               - Time stepping of TOP (passive tracer eqs.)
84      !!
85      !! ** Method  : -1- Update forcings and data 
86      !!              -2- Update vertical ocean physics
87      !!              -3- Compute the t and s trends
88      !!              -4- Update t and s
89      !!              -5- Compute the momentum trends
90      !!              -6- Update the horizontal velocity
91      !!              -7- Compute the diagnostics variables (rd,N2, div,cur,w)
92      !!              -8- Outputs and diagnostics
93      !!----------------------------------------------------------------------
94      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
95      INTEGER ::   jk       ! dummy loop indice
96      INTEGER ::   indic    ! error indicator if < 0
97      !! ---------------------------------------------------------------------
98
99      indic = 1                    ! reset to no error condition
100
101      CALL day( kstp )             ! Calendar
102
103      CALL rst_opn( kstp )         ! Open the restart file
104
105      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
106      ! Update data, open boundaries, surface boundary condition (including sea-ice)
107      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
108
109      IF( lk_dtatem  )   CALL dta_tem( kstp )         ! update 3D temperature data
110      IF( lk_dtasal  )   CALL dta_sal( kstp )         ! update 3D salinity data
111
112                         CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
113
114      IF( ninist == 1 ) THEN                          ! Output the initial state and forcings
115                        CALL dia_wri_state( 'output.init' )   ;   ninist = 0
116      ENDIF
117
118
119      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
120      ! Ocean physics update
121      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
122      !-----------------------------------------------------------------------
123      !  VERTICAL PHYSICS
124      !-----------------------------------------------------------------------
125      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
126      !-----------------------------------------------------------------------
127
128                        CALL bn2( tb, sb, rn2 )             ! before Brunt-Vaisala frequency
129     
130      !                                                     ! Vertical eddy viscosity and diffusivity coefficients
131      IF( lk_zdfric )   CALL zdf_ric( kstp )                     ! Richardson number dependent Kz
132      IF( lk_zdftke )   CALL zdf_tke( kstp )                     ! TKE closure scheme for Kz
133      IF( lk_zdfkpp )   CALL zdf_kpp( kstp )                     ! KPP closure scheme for Kz
134      IF( lk_zdfcst )   THEN                                     ! Constant Kz (reset avt, avm to the background value)
135         avt (:,:,:) = avt0 * tmask(:,:,:)
136         avmu(:,:,:) = avm0 * umask(:,:,:)
137         avmv(:,:,:) = avm0 * vmask(:,:,:)
138      ENDIF
139
140      IF( ln_rnf_mouth ) THEN                                ! increase diffusivity at rivers mouths
141         DO jk = 2, nkrnf   ;   avt(:,:,jk) = avt(:,:,jk) + 2.e0 * rn_avt_rnf * rnfmsk(:,:)   ;   END DO
142      ENDIF
143      IF( ln_zdfevd )   CALL zdf_evd( kstp )                 ! enhanced vertical eddy diffusivity
144      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   &
145         &              CALL zdf_ddm( kstp )                 ! double diffusive mixing
146                        CALL zdf_bfr( kstp )                 ! bottom friction
147                        CALL zdf_mxl( kstp )                 ! mixed layer depth
148
149#if defined key_top
150      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
151      ! Passive Tracer Model
152      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
153      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
154      !-----------------------------------------------------------------------
155                             CALL trc_stp( kstp, indic )            ! time-stepping
156#endif
157
158      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
159      ! Active tracers
160      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
161      ! N.B. ua, va arrays are used as workspace in this section
162      !-----------------------------------------------------------------------
163                             ta(:,:,:) = 0.e0                ! set tracer trends to zero
164                             sa(:,:,:) = 0.e0
165
166                             CALL tra_sbc    ( kstp )        ! surface boundary condition
167      IF( ln_traqsr      )   CALL tra_qsr    ( kstp )        ! penetrative solar radiation qsr
168      IF( lk_zdfkpp )        CALL tra_kpp    ( kstp )        ! KPP non-local tracer fluxes
169                             CALL tra_zdf    ( kstp )        ! vertical mixing
170                             CALL tra_nxt( kstp )            ! tracer fields at next time step
171      IF( ln_zdfnpc      )   CALL tra_npc( kstp )            ! applied non penetrative convective adjustment on (t,s)
172                             CALL eos( tb, sb, rhd, rhop )   ! now (swap=before) in situ density for dynhpg module
173
174      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
175      ! Dynamics
176      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
177      ! N.B. ta, sa arrays are used as workspace in this section
178      !-----------------------------------------------------------------------
179                               ua(:,:,:) = 0.e0               ! set dynamics trends to zero
180                               va(:,:,:) = 0.e0
181
182                               CALL dyn_cor_c1d( kstp )       ! vorticity term including Coriolis
183                               CALL dyn_zdf    ( kstp )       ! vertical diffusion
184                               CALL dyn_nxt_c1d( kstp )       ! lateral velocity at next time step
185
186      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
187      ! Control and restarts
188      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
189                                 CALL stp_ctl( kstp, indic )
190      IF( kstp == nit000     )   CALL iom_close( numror )             ! close input  ocean restart file
191      IF( lrst_oce           )   CALL rst_write  ( kstp )             ! write output ocean restart file
192
193      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
194      ! diagnostics and outputs
195      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
196      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
197      !-----------------------------------------------------------------------
198
199      IF( nstop == 0 )           CALL dia_wri_c1d( kstp, indic )       ! ocean model: outputs
200      !
201   END SUBROUTINE stp_c1d
202
203#else
204   !!----------------------------------------------------------------------
205   !!   Default key                                            NO 1D Config
206   !!----------------------------------------------------------------------
207CONTAINS
208   SUBROUTINE stp_c1d ( kt )      ! dummy routine
209      WRITE(*,*) 'stp_c1d: You should not have seen this print! error?', kt
210   END SUBROUTINE stp_c1d
211#endif
212
213   !!======================================================================
214END MODULE step_c1d
Note: See TracBrowser for help on using the repository browser.