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.
step1d.F90 in tags/nemo_v1_13_dev6/NEMO/C1D_SRC – NEMO

source: tags/nemo_v1_13_dev6/NEMO/C1D_SRC/step1d.F90 @ 3050

Last change on this file since 3050 was 474, checked in by opalod, 18 years ago

nemo_v1_update_061: SM: end of ctl_stop + mpi optimization in _bilap

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.4 KB
Line 
1MODULE step1d
2   !!======================================================================
3   !!                       ***  MODULE step1D  ***
4   !! Time-stepping    : manager of the ocean, tracer and ice time stepping
5   !!======================================================================
6#if defined key_cfg_1d
7   !!----------------------------------------------------------------------
8   !!   'key_cfg_1d'               1D Configuration
9   !!---------------------------------------------------------------------- 
10   !!----------------------------------------------------------------------
11   !!   stp_1d           : OPA system time-stepping on 1 direction
12   !!----------------------------------------------------------------------
13   !! * Modules used
14   USE oce             ! ocean dynamics and tracers variables
15   USE dom_oce         ! ocean space and time domain variables
16   USE zdf_oce         ! ocean vertical physics variables
17   USE ldftra_oce
18   USE ldfdyn_oce
19   USE in_out_manager  ! I/O manager
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 dtasst          ! ocean sea surface temerature     (dta_sst routine)
27   USE taumod          ! surface stress                   (tau     routine)
28   USE flxmod          ! thermohaline fluxes              (flx     routine)
29   USE ocesbc          ! thermohaline fluxes              (oce_sbc routine)
30   USE flxrnf          ! runoffs                          (flx_rnf routine)
31   USE flxfwb          ! freshwater budget correction     (flx_fwb routine)
32   USE ocfzpt          ! surface ocean freezing point    (oc_fz_pt routine)
33
34   USE trcstp          ! passive tracer time-stepping     (trc_stp routine)
35
36   USE dynzdf          ! vertical diffusion               (dyn_zdf routine)
37
38   USE traqsr          ! solar radiation penetration      (tra_qsr routine)
39   USE tranxt          ! time-stepping                    (tra_nxt routine)
40   USE trazdf          ! vertical diffusion               (tra_zdf routine)
41   USE trasbc          ! surface boundary condition       (tra_sbc routine)
42
43   USE eosbn2
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 dyncor1d
54   USE dynnxt1d
55   USE diawri1d        ! Standard run outputs             (dia_wri_1d routine)
56
57   USE ice_oce         ! sea-ice variable
58   USE icestp1d        ! sea-ice time-stepping             (ice_stp routine)
59
60   USE diawri          ! Standard run outputs             (dia_wri_state routine)
61
62
63   USE stpctl          ! time stepping control            (stp_ctl routine)
64   USE restart         ! ocean restart                    (rst_wri routine)
65   USE prtctl          ! Print control                    (prt_ctl routine)
66   IMPLICIT NONE
67   PRIVATE
68
69   !! * Routine accessibility
70   PUBLIC stp_1d            ! called by opa.F90
71
72   !! * Substitutions
73#  include "domzgr_substitute.h90"
74#  include "zdfddm_substitute.h90"
75   !!----------------------------------------------------------------------
76   !!   OPA 9.0 , LOCEAN-IPSL (2005)
77   !! $Header$
78   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
79   !!----------------------------------------------------------------------
80
81CONTAINS
82
83   SUBROUTINE stp_1d( kstp )
84      !!----------------------------------------------------------------------
85      !!                     ***  ROUTINE stp1D  ***
86      !!                     
87      !! ** Purpose : - Time stepping of OPA (momentum and active tracer eqs.)
88      !!              - Time stepping of LIM (dynamic and thermodynamic eqs.)
89      !!
90      !! ** Method  : -1- Update forcings and data 
91      !!              -2- Update ocean physics
92      !!              -3- Compute the t and s trends
93      !!              -4- Update t and s
94      !!              -5- Compute the momentum trends
95      !!              -6- Update the horizontal velocity
96      !!              -7- Compute the diagnostics variables (rd,N2, div,cur,w)
97      !!              -8- Outputs and diagnostics
98      !!
99      !! History :
100      !!        !  91-03  ()  Original code
101      !!        !  91-11  (G. Madec)
102      !!        !  92-06  (M. Imbard)  add a first output record
103      !!        !  96-04  (G. Madec)  introduction of dynspg
104      !!        !  96-04  (M.A. Foujols)  introduction of passive tracer
105      !!   8.0  !  97-06  (G. Madec)  new architecture of call
106      !!   8.2  !  97-06  (G. Madec, M. Imbard, G. Roullet)  free surface
107      !!   8.2  !  99-02  (G. Madec, N. Grima)  hpg implicit
108      !!   8.2  !  00-07  (J-M Molines, M. Imbard)  Open Bondary Conditions
109      !!   9.0  !  02-06  (G. Madec)  free form, suppress macro-tasking
110      !!        !  04-10  (C. Ethe) 1D configuration
111      !!----------------------------------------------------------------------
112      !! * Arguments
113      INTEGER, INTENT( in ) ::   kstp   ! ocean time-step index
114
115      !! * local declarations
116      INTEGER ::   indic    ! error indicator if < 0
117!!      INTEGER ::   ii0, ii1, ij0, ij1   ! temporary integers
118      !! ---------------------------------------------------------------------
119
120      indic = 1                    ! reset to no error condition
121      adatrj = adatrj + rdt/86400._wp
122
123      CALL day( kstp )             ! Calendar
124
125      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
126      ! Update data, open boundaries and Forcings
127      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
128
129      IF( lk_dtatem  )   CALL dta_tem( kstp )         ! update 3D temperature data
130
131      IF( lk_dtasal  )   CALL dta_sal( kstp )         ! Salinity data
132
133      IF( lk_dtasst  )   CALL dta_sst( kstp )         ! Sea Surface Temperature data
134
135                         CALL tau( kstp )             ! wind stress
136
137                         CALL flx_rnf( kstp )         ! runoff data
138
139                         CALL flx( kstp )             ! heat and freshwater fluxes
140
141      IF( lk_ice_lim )  THEN
142                        CALL ice_stp_1d( kstp )      ! sea-ice model (Update stress & fluxes)
143      ELSE
144                        CALL oce_sbc( kstp )         ! ocean surface boudaries
145      ENDIF
146
147      IF( ln_fwb     )   CALL flx_fwb( kstp )         ! freshwater budget
148
149
150      IF( kstp == nit000 ) THEN
151         IF( ninist == 1 ) THEN                       ! Output the initial state and forcings
152            CALL dia_wri_state( 'output.init' )
153         ENDIF
154      ENDIF
155
156      IF(ln_ctl) THEN         ! print mean trends (used for debugging)
157         CALL prt_ctl(tab2d_1=emp    , clinfo1=' emp  -   : ', mask1=tmask, ovlap=1)
158         CALL prt_ctl(tab2d_1=emps   , clinfo1=' emps -   : ', mask1=tmask, ovlap=1)
159         CALL prt_ctl(tab2d_1=qt     , clinfo1=' qt   -   : ', mask1=tmask, ovlap=1)
160         CALL prt_ctl(tab2d_1=qsr    , clinfo1=' qsr  -   : ', mask1=tmask, ovlap=1)
161         CALL prt_ctl(tab2d_1=runoff , clinfo1=' runoff   : ', mask1=tmask, ovlap=1)
162         CALL prt_ctl(tab3d_1=tmask  , clinfo1=' tmask    : ', mask1=tmask, ovlap=1, kdim=jpk)
163         CALL prt_ctl(tab3d_1=tn     , clinfo1=' sst  -   : ', mask1=tmask, ovlap=1, kdim=1)
164         CALL prt_ctl(tab3d_1=sn     , clinfo1=' sss  -   : ', mask1=tmask, ovlap=1, kdim=1)
165         CALL prt_ctl(tab2d_1=taux   , clinfo1=' tau  - x : ', tab2d_2=tauy, clinfo2='      - y : ', ovlap=1)
166      ENDIF
167
168
169
170      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
171      ! Ocean physics update
172      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
173      !-----------------------------------------------------------------------
174      !  VERTICAL PHYSICS
175      !-----------------------------------------------------------------------
176      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
177      !-----------------------------------------------------------------------
178
179                       CALL bn2( tb, sb, rn2 )              ! before Brunt-Vaisala frequency
180     
181      !                                                     ! Vertical eddy viscosity and diffusivity coefficients
182      IF( lk_zdfric )   CALL zdf_ric( kstp )                       ! Richardson number dependent Kz
183      IF( lk_zdftke )   CALL zdf_tke( kstp )                       ! TKE closure scheme for Kz
184      IF( lk_zdfkpp )   CALL zdf_kpp( kstp )                       ! KPP scheme for Kz
185      IF( lk_zdfcst )   avt (:,:,:) = avt0 * tmask(:,:,:)          ! Constant Kz (reset avt to the background value)
186
187
188      IF( ln_zdfevd )   CALL zdf_evd( kstp )                 ! enhanced vertical eddy diffusivity
189
190      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp)   &
191         &              CALL zdf_ddm( kstp )                 ! double diffusive mixing
192
193                        CALL zdf_bfr( kstp )                 ! bottom friction
194
195                        CALL zdf_mxl( kstp )                 ! mixed layer depth
196
197
198#if defined key_passivetrc
199      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
200      ! Passive Tracer Model
201      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
202      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
203      !-----------------------------------------------------------------------
204
205                               CALL trc_stp( kstp, indic )            ! time-stepping
206
207#endif
208
209
210      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
211      ! Active tracers
212      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
213      ! N.B. ua, va arrays are used as workspace in this section
214      !-----------------------------------------------------------------------
215
216                               ta(:,:,:) = 0.e0               ! set tracer trends to zero
217                               sa(:,:,:) = 0.e0
218
219                               CALL tra_sbc( kstp )           ! surface boundary condition
220
221      IF( ln_traqsr        )   CALL tra_qsr( kstp )           ! penetrative solar radiation qsr
222
223      IF( lk_zdfkpp        )   CALL tra_kpp( kstp )           ! KPP non-local tracer fluxes
224
225                               CALL tra_zdf( kstp )           ! vertical mixing
226
227                               CALL tra_nxt( kstp )           ! tracer fields at next time step
228
229                               CALL eos( tb, sb, rhd, rhop )       ! now (swap=before) in situ density for dynhpg module
230
231      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
232      ! Dynamics
233      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
234      ! N.B. ta, sa arrays are used as workspace in this section
235      !-----------------------------------------------------------------------
236
237                               ua(:,:,:) = 0.e0               ! set dynamics trends to zero
238                               va(:,:,:) = 0.e0
239 
240                               CALL dyn_cor_1d     ( kstp )
241      !                                                       ! vertical diffusion
242                               CALL dyn_zdf( kstp )     
243
244!i bug lbc sur emp
245      CALL lbc_lnk( emp, 'T', 1. )
246!i
247 
248                                CALL dyn_nxt_1d( kstp )          ! lateral velocity at next time step
249
250
251      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
252      ! Computation of diagnostic variables
253      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
254      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
255      !-----------------------------------------------------------------------
256
257                               CALL oc_fz_pt                    ! ocean surface freezing temperature
258
259
260      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
261      ! Control, diagnostics and outputs
262      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
263      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
264      !-----------------------------------------------------------------------
265
266      !                                            ! Time loop: control and print
267                       CALL stp_ctl( kstp, indic )
268                       IF ( indic < 0 ) CALL ctl_stop( 'step1d: indic < 0' )
269
270      IF ( nstop == 0 ) THEN
271         !                                         ! Diagnostics:
272         !                                         ! save and outputs
273                           CALL rst_write  ( kstp )              ! ocean model: restart file output
274                           CALL dia_wri_1d ( kstp, indic )       ! ocean model: outputs
275
276      ENDIF
277
278
279   END SUBROUTINE stp_1d
280#else
281   !!----------------------------------------------------------------------
282   !!   Default key                                     NO 1D Config
283   !!----------------------------------------------------------------------
284CONTAINS
285   SUBROUTINE stp_1d ( kt )
286      WRITE(*,*) 'stp_1d: You should not have seen this print! error?', kt
287   END SUBROUTINE stp_1d
288#endif
289   !!======================================================================
290END MODULE step1d
Note: See TracBrowser for help on using the repository browser.