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.
trcldf.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90 @ 2281

Last change on this file since 2281 was 2281, checked in by smasson, 14 years ago

set proper svn properties to all files...

  • Property svn:keywords set to Id
File size: 11.4 KB
Line 
1MODULE trcldf
2   !!======================================================================
3   !!                       ***  MODULE  trcldf  ***
4   !! Ocean Passive tracers : lateral diffusive trends
5   !!=====================================================================
6   !! History :  9.0  ! 2005-11 (G. Madec)  Original code
7   !!       NEMO 3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA
8   !!----------------------------------------------------------------------
9#if defined key_top
10   !!----------------------------------------------------------------------
11   !!   'key_top'                                                TOP models
12   !!----------------------------------------------------------------------
13   !!----------------------------------------------------------------------
14   !!   trc_ldf     : update the tracer trend with the lateral diffusion
15   !!       ldf_ctl : initialization, namelist read, and parameters control
16   !!----------------------------------------------------------------------
17   USE oce_trc         ! ocean dynamics and active tracers
18   USE trc             ! ocean passive tracers variables
19   USE trcnam_trp      ! passive tracers transport namelist variables
20   USE ldftra_oce      ! lateral diffusion coefficient on tracers
21   USE ldfslp          ! ???
22   USE traldf_bilapg   ! lateral mixing            (tra_ldf_bilapg routine)
23   USE traldf_bilap    ! lateral mixing            (tra_ldf_bilap routine)
24   USE traldf_iso      ! lateral mixing            (tra_ldf_iso routine)
25   USE traldf_lap      ! lateral mixing            (tra_ldf_lap routine)
26   USE trdmod_oce
27   USE trdtra
28   USE prtctl_trc      ! Print control
29   USE in_out_manager  ! I/O manager
30   USE lib_mpp         ! distribued memory computing library
31   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   trc_ldf    ! called by step.F90
37   !                                                 !!: ** lateral mixing namelist (nam_trcldf) **
38   INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals)
39   !! * Substitutions
40#  include "domzgr_substitute.h90"
41#  include "vectopt_loop_substitute.h90"
42   !!----------------------------------------------------------------------
43   !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010)
44   !! $Id$
45   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
47
48CONTAINS
49
50   SUBROUTINE trc_ldf( kt )
51      !!----------------------------------------------------------------------
52      !!                  ***  ROUTINE tra_ldf  ***
53      !!
54      !! ** Purpose :   compute the lateral ocean tracer physics.
55      !!
56      !!----------------------------------------------------------------------
57      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
58      !!
59      INTEGER            :: jn
60      CHARACTER (len=22) :: charout
61      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::   ztrtrd
62      !!----------------------------------------------------------------------
63
64      IF( kt == nit000 )   CALL ldf_ctl          ! initialisation & control of options
65
66      IF( l_trdtrc )  THEN
67         ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) )  ! temporary save of trends
68         ztrtrd(:,:,:,:)  = tra(:,:,:,:)
69      ENDIF
70
71      SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend
72      CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level laplacian
73      CASE ( 1 )   ;   CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 )  ! rotated laplacian
74      CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level bilaplacian
75      CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra            )  ! s-coord. horizontal bilaplacian
76         !
77      CASE ( -1 )                                     ! esopa: test all possibility with control print
78         CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )
79         WRITE(charout, FMT="('ldf0 ')") ;  CALL prt_ctl_trc_info(charout)
80                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
81         CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 )
82         WRITE(charout, FMT="('ldf1 ')") ;  CALL prt_ctl_trc_info(charout)
83                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
84         CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )
85         WRITE(charout, FMT="('ldf2 ')") ;  CALL prt_ctl_trc_info(charout)
86                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
87         CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra            )
88         WRITE(charout, FMT="('ldf3 ')") ;  CALL prt_ctl_trc_info(charout)
89                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
90      END SELECT
91      !
92      IF( l_trdtrc )   THEN                      ! save the horizontal diffusive trends for further diagnostics
93        DO jn = 1, jptra
94           ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn)
95           CALL trd_tra( kt, 'TRC', jn, jptra_trd_ldf, ztrtrd(:,:,:,jn) )
96        END DO
97        DEALLOCATE( ztrtrd ) 
98      ENDIF
99      !                                          ! print mean trends (used for debugging)
100      IF( ln_ctl )   THEN
101         WRITE(charout, FMT="('ldf ')") ;  CALL prt_ctl_trc_info(charout)
102                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
103      ENDIF
104      !
105   END SUBROUTINE trc_ldf
106
107
108   SUBROUTINE ldf_ctl
109      !!----------------------------------------------------------------------
110      !!                  ***  ROUTINE ldf_ctl  ***
111      !!
112      !! ** Purpose :   Choice of the operator for the lateral tracer diffusion
113      !!
114      !! ** Method  :   set nldf from the namtra_ldf logicals
115      !!      nldf == -2   No lateral diffusion 
116      !!      nldf == -1   ESOPA test: ALL operators are used
117      !!      nldf ==  0   laplacian operator
118      !!      nldf ==  1   Rotated laplacian operator
119      !!      nldf ==  2   bilaplacian operator
120      !!      nldf ==  3   Rotated bilaplacian
121      !!----------------------------------------------------------------------
122      INTEGER ::   ioptio, ierr         ! temporary integers
123      !!----------------------------------------------------------------------
124
125      !  Define the lateral mixing oparator for tracers
126      ! ===============================================
127   
128      !                               ! control the input
129      ioptio = 0
130      IF( ln_trcldf_lap   )   ioptio = ioptio + 1
131      IF( ln_trcldf_bilap )   ioptio = ioptio + 1
132      IF( ioptio >  1 )   CALL ctl_stop( '          use ONE or NONE of the 2 lap/bilap operator type on tracer' )
133      IF( ioptio == 0 )   nldf = -2   ! No lateral diffusion
134      ioptio = 0
135      IF( ln_trcldf_level )   ioptio = ioptio + 1
136      IF( ln_trcldf_hor   )   ioptio = ioptio + 1
137      IF( ln_trcldf_iso   )   ioptio = ioptio + 1
138      IF( ioptio /= 1 )   CALL ctl_stop( '          use only ONE direction (level/hor/iso)' )
139
140      ! defined the type of lateral diffusion from ln_trcldf_... logicals
141      ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully
142      ierr = 0
143      IF( ln_trcldf_lap ) THEN       ! laplacian operator
144         IF ( ln_zco ) THEN                ! z-coordinate
145            IF ( ln_trcldf_level )   nldf = 0      ! iso-level  (no rotation)
146            IF ( ln_trcldf_hor   )   nldf = 0      ! horizontal (no rotation)
147            IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation)
148         ENDIF
149         IF ( ln_zps ) THEN             ! z-coordinate
150            IF ( ln_trcldf_level )   ierr = 1      ! iso-level not allowed
151            IF ( ln_trcldf_hor   )   nldf = 0      ! horizontal (no rotation)
152            IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation)
153         ENDIF
154         IF ( ln_sco ) THEN             ! z-coordinate
155            IF ( ln_trcldf_level )   nldf = 0      ! iso-level  (no rotation)
156            IF ( ln_trcldf_hor   )   nldf = 1      ! horizontal (   rotation)
157            IF ( ln_trcldf_iso   )   nldf = 1      ! isoneutral (   rotation)
158         ENDIF
159      ENDIF
160
161      IF( ln_trcldf_bilap ) THEN      ! bilaplacian operator
162         IF ( ln_zco ) THEN                ! z-coordinate
163            IF ( ln_trcldf_level )   nldf = 2      ! iso-level  (no rotation)
164            IF ( ln_trcldf_hor   )   nldf = 2      ! horizontal (no rotation)
165            IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation)
166         ENDIF
167         IF ( ln_zps ) THEN             ! z-coordinate
168            IF ( ln_trcldf_level )   ierr = 1      ! iso-level not allowed
169            IF ( ln_trcldf_hor   )   nldf = 2      ! horizontal (no rotation)
170            IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation)
171         ENDIF
172         IF ( ln_sco ) THEN             ! z-coordinate
173            IF ( ln_trcldf_level )   nldf = 2      ! iso-level  (no rotation)
174            IF ( ln_trcldf_hor   )   nldf = 3      ! horizontal (   rotation)
175            IF ( ln_trcldf_iso   )   ierr = 2      ! isoneutral (   rotation)
176         ENDIF
177      ENDIF
178
179      IF( ierr == 1 )   CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' )
180      IF( ierr == 2 )   CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' )
181      IF( lk_traldf_eiv .AND. .NOT.ln_trcldf_iso )   &
182           CALL ctl_stop( '          eddy induced velocity on tracers',   &
183           &              ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' )
184      IF( nldf == 1 .OR. nldf == 3 ) THEN      ! rotation
185         IF( .NOT.lk_ldfslp )   CALL ctl_stop( '          the rotation of the diffusive tensor require key_ldfslp' )
186#if defined key_offline
187         l_traldf_rot = .TRUE.                 ! needed for trazdf_imp
188#endif
189      ENDIF
190
191      IF( lk_esopa ) THEN
192         IF(lwp) WRITE(numout,*) '          esopa control: use all lateral physics options'
193         nldf = -1
194      ENDIF
195
196      IF( .NOT. ln_trcldf_diff ) THEN
197         IF(lwp) WRITE(numout,*) '          No lateral diffusion on passive tracers'
198         nldf = -2
199      ENDIF
200
201      IF(lwp) THEN
202         WRITE(numout,*)
203         IF( nldf == -2 )   WRITE(numout,*) '          NO lateral diffusion'
204         IF( nldf == -1 )   WRITE(numout,*) '          ESOPA test All scheme used'
205         IF( nldf ==  0 )   WRITE(numout,*) '          laplacian operator'
206         IF( nldf ==  1 )   WRITE(numout,*) '          Rotated laplacian operator'
207         IF( nldf ==  2 )   WRITE(numout,*) '          bilaplacian operator'
208         IF( nldf ==  3 )   WRITE(numout,*) '          Rotated bilaplacian'
209      ENDIF
210
211      !
212   END SUBROUTINE ldf_ctl
213#else
214   !!----------------------------------------------------------------------
215   !!   Default option                                         Empty module
216   !!----------------------------------------------------------------------
217CONTAINS
218   SUBROUTINE trc_ldf( kt )
219      INTEGER, INTENT(in) :: kt
220      WRITE(*,*) 'trc_ldf: You should not have seen this print! error?', kt
221   END SUBROUTINE trc_ldf
222#endif
223   !!======================================================================
224END MODULE trcldf
Note: See TracBrowser for help on using the repository browser.