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.
trazdf.F90 in branches/dev_001_GM/NEMO/OPA_SRC/TRA – NEMO

source: branches/dev_001_GM/NEMO/OPA_SRC/TRA/trazdf.F90 @ 786

Last change on this file since 786 was 786, checked in by gm, 16 years ago

dev_001_GM - merge TRC-TRA on OPA only, trabbl & zpshde not done and trdmld not OK - compilation OK

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
Line 
1MODULE trazdf
2   !!==============================================================================
3   !!                 ***  MODULE  trazdf  ***
4   !! Ocean active tracers:  vertical component of the tracer mixing trend
5   !!==============================================================================
6   !! History :  9.0  !  05-11  (G. Madec)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   tra_zdf      : Update the tracer trend with the vertical diffusion
11   !!       zdf_ctl  : ???
12   !!----------------------------------------------------------------------
13   USE oce             ! ocean dynamics and tracers variables
14   USE dom_oce         ! ocean space and time domain variables
15   USE zdf_oce         ! ocean vertical physics variables
16   USE zdfddm          ! vertical mixing: double diffusion
17
18   USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine)
19   USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp     routine)
20
21   USE ldftra_oce      ! ocean active tracers: lateral physics
22   USE trdmod          ! ocean active tracers trends
23   USE trdmod_oce      ! ocean variables trends
24   USE in_out_manager  ! I/O manager
25   USE prtctl          ! Print control
26
27   USE phycst
28   USE dynspg_oce
29   USE ocesbc          ! ocean surface boundary condition
30   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
31   USE domvvl          ! variable volume
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC tra_zdf   !  routine called by step.F90
37
38   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used
39      !                                ! defined from ln_zdf...  namlist logicals)
40
41   REAL(wp), DIMENSION(jpk) ::   r2dt  ! vertical profile time-step, = 2 rdttra
42      !                                ! except at nit000 (=rdttra) if neuler=0
43
44   !! * Substitutions
45#  include "domzgr_substitute.h90"
46#  include "zdfddm_substitute.h90"
47#  include "vectopt_loop_substitute.h90"
48   !!----------------------------------------------------------------------
49   !! NEMO/OPA 2.4 , LOCEAN-IPSL (2008)
50   !! $Id:$
51   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
52   !!----------------------------------------------------------------------
53
54CONTAINS
55   
56   SUBROUTINE tra_zdf( kt )
57      !!----------------------------------------------------------------------
58      !!                  ***  ROUTINE tra_zdf  ***
59      !!
60      !! ** Purpose :   compute the vertical ocean tracer physics.
61      !!---------------------------------------------------------------------
62      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
63
64      INTEGER  ::   jk                   ! Dummy loop indices
65      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrdt, ztrds   ! 3D workspace
66      !!---------------------------------------------------------------------
67
68      IF( kt == nit000 )   CALL zdf_ctl          ! initialisation & control of options
69
70      !                                          ! set time step
71      IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000
72         r2dt(:) =  rdttra(:)                          ! = rdtra (restarting with Euler time stepping)
73      ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1
74         r2dt(:) = 2. * rdttra(:)                      ! = 2 rdttra (leapfrog)
75      ENDIF
76
77      IF( l_trdtra )   THEN                      ! temporary save of ta and sa trends
78         ztrdt(:,:,:) = ta(:,:,:)
79         ztrds(:,:,:) = sa(:,:,:)
80      ENDIF
81
82      IF( lk_vvl )   CALL dom_vvl_ssh( kt )      ! compute ssha field
83
84      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
85      CASE ( -1 )                                       ! esopa: test all possibility with control print
86         CALL tra_zdf_exp    ( kt, r2dt,   avt       , tb, ta )   ! temperature
87         CALL tra_zdf_exp    ( kt, r2dt, fsavs(:,:,:), tb, ta )   ! salinity
88         CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf0 - Ta: ', mask1=tmask,               &
89            &          tab3d_2=sa, clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
90         CALL tra_zdf_imp( kt, r2dt, 'TRA' )                      ! T & S zdf trends
91
92      CASE ( 0 )                                       ! explicit scheme
93         CALL tra_zdf_exp    ( kt, r2dt,   avt       , tb, ta )   ! temperature
94         CALL tra_zdf_exp    ( kt, r2dt, fsavs(:,:,:), tb, ta )   ! salinity
95         IF( l_trdtra )   THEN                                    ! zdf trends diagnostics
96            ztrdt(:,:,:) = ta(:,:,:) - ztrdt(:,:,:)
97            ztrds(:,:,:) = sa(:,:,:) - ztrds(:,:,:)
98            CALL trd_tra( kt, jp_tem, jpt_trd_ldf, 'TRA', ptrd3d=ztrdt)
99            CALL trd_tra( kt, jp_sal, jpt_trd_ldf, 'TRA', ptrd3d=ztrds)
100         ENDIF
101
102      CASE ( 1 )                                       ! implicit scheme
103         CALL tra_zdf_imp( kt, r2dt, 'TRA' )                      ! T & S zdf trends
104         IF( l_trdtra )   THEN                                    ! zdf trends diagnostics
105            DO jk = 1, jpkm1
106               ztrdt(:,:,jk) = ( ( ta(:,:,jk) - tb(:,:,jk) ) / r2dt(jk) ) - ztrdt(:,:,jk)
107               ztrds(:,:,jk) = ( ( sa(:,:,jk) - sb(:,:,jk) ) / r2dt(jk) ) - ztrds(:,:,jk)
108            END DO
109            CALL trd_tra( kt, jp_tem, jpt_trd_zdf, 'TRA', ptrd3d=ztrdt)
110            CALL trd_tra( kt, jp_sal, jpt_trd_zdf, 'TRA', ptrd3d=ztrds)
111         ENDIF
112
113      END SELECT
114
115      !                                                ! print mean trends (used for debugging)
116      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf  - Ta: ', mask1=tmask,               &
117         &                       tab3d_2=sa, clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
118      !
119   END SUBROUTINE tra_zdf
120
121
122   SUBROUTINE zdf_ctl
123      !!----------------------------------------------------------------------
124      !!                 ***  ROUTINE zdf_ctl  ***
125      !!
126      !! ** Purpose :   Choose the vertical mixing scheme
127      !!
128      !! ** Method  :   Set nzdf from ln_zdfexp and 'key_mpp_omp'.
129      !!      nzdf = 0   explicit (time-splitting) scheme (ln_zdfexp=T)
130      !!           = 1   implicit (euler backward) scheme (ln_zdfexp=F)
131      !!           = 2   implicit (euler backward) scheme with j-k-i loops
132      !!                 (ln_zdfexp=T and 'key_mpp_omp')
133      !!      NB: rotation of lateral mixing operator or TKE or KPP scheme,
134      !!      the implicit scheme is required.
135      !!----------------------------------------------------------------------
136      USE zdftke
137      USE zdfkpp
138      !!----------------------------------------------------------------------
139
140      !  Define the vertical tracer physics scheme
141      ! ==========================================
142
143      ! Choice from ln_zdfexp already read in namelist in zdfini module
144      IF( ln_zdfexp ) THEN   ;   nzdf = 0              ! use explicit scheme
145      ELSE                   ;   nzdf = 1              ! use implicit scheme
146      ENDIF
147
148      ! Force implicit schemes
149      IF( lk_zdftke .OR. lk_zdfkpp   )   nzdf = 1      ! TKE or KPP physics
150      IF( ln_traldf_iso              )   nzdf = 1      ! iso-neutral lateral physics
151      IF( ln_traldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate
152
153      IF( ln_zdfexp .AND. nzdf == 1 )   THEN
154         CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator or TKE ', &
155            &           '          or KPP scheme, the implicit scheme is required, set ln_zdfexp = .false.' )
156      ENDIF
157
158      ! Test: esopa
159      IF( lk_esopa )    nzdf = -1                      ! All schemes used
160
161      IF(lwp) THEN
162         WRITE(numout,*)
163         WRITE(numout,*) 'tra:zdf_ctl : vertical tracer physics scheme'
164         WRITE(numout,*) '~~~~~~~~~~~'
165         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
166         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
167         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
168      ENDIF
169
170   END SUBROUTINE zdf_ctl
171
172   !!==============================================================================
173END MODULE trazdf
Note: See TracBrowser for help on using the repository browser.