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

source: tags/nemo_v1_01/NEMO/C1D_SRC/step1d.F90 @ 4294

Last change on this file since 4294 was 253, checked in by opalod, 19 years ago

nemo_v1_update_001 : Add the 1D configuration possibility

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.8 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
35   USE dynzdf_imp      ! vertical diffusion: implicit     (dyn_zdf routine)
36   USE dynzdf_imp_atsk ! vertical diffusion: implicit     (dyn_zdf routine)
37   USE dynzdf_iso      ! vertical diffusion: isopycnal    (dyn_zdf routine)
38   USE dynzdf_exp      ! vertical diffusion: explicit (dyn_zdf_exp routine)
39 
40
41   USE traqsr          ! solar radiation penetration      (tra_qsr routine)
42   USE tranxt          ! time-stepping                    (tra_nxt routine)
43   USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp routine)
44   USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp routine)
45   USE trazdf_iso      ! vertical diffusion           (tra_zdf_exp routine)
46   USE trazdf_iso_vopt ! vertical diffusion           (tra_zdf_exp routine)
47   USE trasbc          ! surface boundary condition       (tra_sbc routine)
48
49   USE eosbn2
50
51   USE zdfbfr          ! bottom friction                  (zdf_bfr routine)
52   USE zdftke          ! TKE vertical mixing              (zdf_tke routine)
53   USE zdfddm          ! double diffusion mixing          (zdf_ddm routine)
54   USE zdfevd          ! enhanced vertical diffusion      (zdf_evd routine)
55   USE zdfric          ! Richardson vertical mixing       (zdf_ric routine)
56   USE zdfmxl          ! Mixed-layer depth                (zdf_mxl routine)
57
58   USE dyncor1d
59   USE dynnxt1d
60   USE diawri1d        ! Standard run outputs             (dia_wri_1d routine)
61
62   USE ice_oce         ! sea-ice variable
63   USE icestp1d        ! sea-ice time-stepping             (ice_stp routine)
64
65   USE diawri          ! Standard run outputs             (dia_wri_state routine)
66
67
68   USE stpctl          ! time stepping control            (stp_ctl routine)
69   USE restart         ! ocean restart                    (rst_wri routine)
70 
71   IMPLICIT NONE
72   PRIVATE
73
74   !! * Routine accessibility
75   PUBLIC stp_1d            ! called by opa.F90
76
77   !! * Substitutions
78#  include "domzgr_substitute.h90"
79#  include "zdfddm_substitute.h90"
80   !!----------------------------------------------------------------------
81   !!   OPA 9.0 , LODYC-IPSL (2003)
82   !!----------------------------------------------------------------------
83
84CONTAINS
85
86   SUBROUTINE stp_1d( kstp )
87      !!----------------------------------------------------------------------
88      !!                     ***  ROUTINE stp1D  ***
89      !!                     
90      !! ** Purpose : - Time stepping of OPA (momentum and active tracer eqs.)
91      !!              - Time stepping of LIM (dynamic and thermodynamic eqs.)
92      !!
93      !! ** Method  : -1- Update forcings and data 
94      !!              -2- Update ocean physics
95      !!              -3- Compute the t and s trends
96      !!              -4- Update t and s
97      !!              -5- Compute the momentum trends
98      !!              -6- Update the horizontal velocity
99      !!              -7- Compute the diagnostics variables (rd,N2, div,cur,w)
100      !!              -8- Outputs and diagnostics
101      !!
102      !! History :
103      !!        !  91-03  ()  Original code
104      !!        !  91-11  (G. Madec)
105      !!        !  92-06  (M. Imbard)  add a first output record
106      !!        !  96-04  (G. Madec)  introduction of dynspg
107      !!        !  96-04  (M.A. Foujols)  introduction of passive tracer
108      !!   8.0  !  97-06  (G. Madec)  new architecture of call
109      !!   8.2  !  97-06  (G. Madec, M. Imbard, G. Roullet)  free surface
110      !!   8.2  !  99-02  (G. Madec, N. Grima)  hpg implicit
111      !!   8.2  !  00-07  (J-M Molines, M. Imbard)  Open Bondary Conditions
112      !!   9.0  !  02-06  (G. Madec)  free form, suppress macro-tasking
113      !!        !  04-10  (C. Ethe) 1D configuration
114      !!----------------------------------------------------------------------
115      !! * Arguments
116      INTEGER, INTENT( in ) ::   kstp   ! ocean time-step index
117
118      !! * local declarations
119      INTEGER ::   indic    ! error indicator if < 0
120!!      INTEGER ::   ii0, ii1, ij0, ij1   ! temporary integers
121      !! ---------------------------------------------------------------------
122
123      indic = 1                    ! reset to no error condition
124      adatrj = adatrj + rdt/86400._wp
125
126      CALL day( kstp )             ! Calendar
127
128      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
129      ! Update data, open boundaries and Forcings
130      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
131
132      IF( lk_dtatem  )   CALL dta_tem( kstp )         ! update 3D temperature data
133
134      IF( lk_dtasal  )   CALL dta_sal( kstp )         ! Salinity data
135
136      IF( lk_dtasst  )   CALL dta_sst( kstp )         ! Sea Surface Temperature data
137
138                         CALL tau( kstp )             ! wind stress
139
140                         CALL flx_rnf( kstp )         ! runoff data
141
142                         CALL flx( kstp )             ! heat and freshwater fluxes
143
144      IF( lk_ice_lim )  THEN
145                        CALL ice_stp_1d( kstp )      ! sea-ice model (Update stress & fluxes)
146      ELSE
147                        CALL oce_sbc( kstp )         ! ocean surface boudaries
148      ENDIF
149
150      IF( ln_fwb     )   CALL flx_fwb( kstp )         ! freshwater budget
151
152
153      IF( kstp == nit000 ) THEN
154         IF( ninist == 1 ) THEN                       ! Output the initial state and forcings
155            CALL dia_wri_state( 'output.init' )
156         ENDIF
157      ENDIF
158
159      IF(l_ctl) THEN         ! print mean trends (used for debugging)
160         WRITE(numout,*) ' emp  -   : ', SUM( emp   (1:nictl+1,1:njctl+1)   * tmask(1:nictl+1,1:njctl+1,1) )
161         WRITE(numout,*) ' emps -   : ', SUM( emps  (1:nictl+1,1:njctl+1)   * tmask(1:nictl+1,1:njctl+1,1) )
162         WRITE(numout,*) ' qt   -   : ', SUM( qt    (1:nictl+1,1:njctl+1)   * tmask(1:nictl+1,1:njctl+1,1) )
163         WRITE(numout,*) ' qsr  -   : ', SUM( qsr   (1:nictl+1,1:njctl+1)   * tmask(1:nictl+1,1:njctl+1,1) )
164         WRITE(numout,*) ' runoff   : ', SUM( runoff(1:nictl+1,1:njctl+1)   * tmask(1:nictl+1,1:njctl+1,1) )
165         WRITE(numout,*) ' tmask    : ', SUM( tmask (1:nictl+1,1:njctl+1,:) )
166         WRITE(numout,*) ' sst  -   : ', SUM( tn    (1:nictl+1,1:njctl+1,1) * tmask(1:nictl+1,1:njctl+1,1) )
167         WRITE(numout,*) ' sss  -   : ', SUM( sn    (1:nictl+1,1:njctl+1,1) * tmask(1:nictl+1,1:njctl+1,1) )
168         WRITE(numout,*) ' tau  - x : ', SUM( taux  (1:nictl+1,1:njctl+1) ), ' - y : ', SUM( tauy(1:nictl+1,1:njctl+1) )
169      ENDIF
170
171
172      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
173      ! Ocean physics update
174      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
175      !-----------------------------------------------------------------------
176      !  VERTICAL PHYSICS
177      !-----------------------------------------------------------------------
178      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
179      !-----------------------------------------------------------------------
180
181                       CALL bn2( tb, sb, rn2 )              ! before Brunt-Vaisala frequency
182     
183      !                                                     ! Vertical eddy viscosity and diffusivity coefficients
184      IF( lk_zdfric )   CALL zdf_ric( kstp )                       ! Richardson number dependent Kz
185      IF( lk_zdftke )   CALL zdf_tke( kstp )                       ! TKE closure scheme for Kz
186      IF( lk_zdfcst )   avt (:,:,:) = avt0 * tmask(:,:,:)          ! Constant Kz (reset avt to the background value)
187
188
189      IF( ln_zdfevd )   CALL zdf_evd( kstp )                 ! enhanced vertical eddy diffusivity
190
191      IF( lk_zdfddm )   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
199
200      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
201      ! Active tracers
202      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
203      ! N.B. ua, va arrays are used as workspace in this section
204      !-----------------------------------------------------------------------
205
206                               ta(:,:,:) = 0.e0               ! set tracer trends to zero
207                               sa(:,:,:) = 0.e0
208
209                               CALL tra_sbc( kstp )           ! surface boundary condition
210
211      IF( ln_traqsr        )   CALL tra_qsr( kstp )           ! penetrative solar radiation qsr
212
213      !                                                       ! vertical diffusion
214      IF( l_trazdf_exp     )   CALL tra_zdf_exp     ( kstp )          ! explicit time stepping (time splitting scheme)
215      IF( l_trazdf_imp     )   CALL tra_zdf_imp     ( kstp )          ! implicit time stepping (euler backward)
216      IF( l_trazdf_iso     )   CALL tra_zdf_iso     ( kstp )          ! isopycnal
217      IF( l_trazdf_iso_vo  )   CALL tra_zdf_iso_vopt( kstp )          ! vector opt. isopycnal
218
219                               CALL tra_nxt( kstp )           ! tracer fields at next time step
220
221                               CALL eos( tb, sb, rhd, rhop )       ! now (swap=before) in situ density for dynhpg module
222
223      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
224      ! Dynamics
225      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
226      ! N.B. ta, sa arrays are used as workspace in this section
227      !-----------------------------------------------------------------------
228
229                               ua(:,:,:) = 0.e0               ! set dynamics trends to zero
230                               va(:,:,:) = 0.e0
231 
232                               CALL dyn_cor_1d     ( kstp )
233      !                                                       ! vertical diffusion
234      IF( l_dynzdf_exp     )   CALL dyn_zdf_exp    ( kstp )         ! explicit time stepping (time splitting scheme)
235      IF( l_dynzdf_imp     )   CALL dyn_zdf_imp    ( kstp )         ! implicit time stepping (euler backward)
236      IF( l_dynzdf_imp_tsk )   CALL dyn_zdf_imp_tsk( kstp )         ! autotask implicit time stepping (euler backward)
237      IF( l_dynzdf_iso     )   CALL dyn_zdf_iso    ( kstp )         ! iso-neutral case
238
239!i bug lbc sur emp
240      CALL lbc_lnk( emp, 'T', 1. )
241!i
242 
243                                CALL dyn_nxt_1d( kstp )          ! lateral velocity at next time step
244
245
246      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
247      ! Computation of diagnostic variables
248      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
249      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
250      !-----------------------------------------------------------------------
251
252                               CALL oc_fz_pt                    ! ocean surface freezing temperature
253
254
255      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
256      ! Control, diagnostics and outputs
257      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
258      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
259      !-----------------------------------------------------------------------
260
261      !                                            ! Time loop: control and print
262                       CALL stp_ctl( kstp, indic )
263                       IF ( indic < 0 )   nstop = nstop + 1
264
265      IF ( nstop == 0 ) THEN
266         !                                         ! Diagnostics:
267         !                                         ! save and outputs
268                           CALL rst_write  ( kstp )              ! ocean model: restart file output
269                           CALL dia_wri_1d ( kstp, indic )       ! ocean model: outputs
270
271      ENDIF
272
273
274   END SUBROUTINE stp_1d
275#else
276   !!----------------------------------------------------------------------
277   !!   Default key                                     NO 1D Config
278   !!----------------------------------------------------------------------
279CONTAINS
280   SUBROUTINE stp_1d ( kt )
281      WRITE(*,*) 'stp_1d: You should not have seen this print! error?', kt
282   END SUBROUTINE stp_1d
283#endif
284   !!======================================================================
285END MODULE step1d
Note: See TracBrowser for help on using the repository browser.