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.
traldf.F90 in branches/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90 @ 5845

Last change on this file since 5845 was 5845, checked in by gm, 9 years ago

#1613: vvl by default: suppression of domzgr_substitute.h90

  • Property svn:keywords set to Id
File size: 11.5 KB
Line 
1MODULE traldf
2   !!======================================================================
3   !!                       ***  MODULE  traldf  ***
4   !! Ocean Active 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   !!            3.7  ! 2013-12  (G. Madec) remove the optional computation from T & S anomaly profiles and traldf_bilapg
9   !!             -   ! 2013-12  (F. Lemarie, G. Madec)  triad operator (Griffies) + Method of Stabilizing Correction
10   !!             -   ! 2014-01  (G. Madec, S. Masson)  restructuration/simplification of lateral diffusive operators
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   tra_ldf      : update the tracer trend with the lateral diffusion
15   !!   tra_ldf_init : initialization, namelist read, and parameters control
16   !!----------------------------------------------------------------------
17   USE oce           ! ocean dynamics and tracers
18   USE dom_oce       ! ocean space and time domain
19   USE phycst        ! physical constants
20   USE ldftra        ! lateral diffusion: eddy diffusivity & EIV coeff.
21   USE ldfslp        ! lateral diffusion: iso-neutral slope
22   USE traldf_lap    ! lateral diffusion: laplacian iso-level            operator  (tra_ldf_lap   routine)
23   USE traldf_iso    ! lateral diffusion: laplacian iso-neutral standard operator  (tra_ldf_iso   routine)
24   USE traldf_triad  ! lateral diffusion: laplacian iso-neutral triad    operator  (tra_ldf_triad routine)
25   USE traldf_blp    ! lateral diffusion (iso-level lap/blp)                       (tra_ldf_lap   routine)
26   USE trd_oce       ! trends: ocean variables
27   USE trdtra        ! ocean active tracers trends
28   !
29   USE prtctl         ! Print control
30   USE in_out_manager ! I/O manager
31   USE lib_mpp        ! distribued memory computing library
32   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
33   USE wrk_nemo       ! Memory allocation
34   USE timing         ! Timing
35
36   IMPLICIT NONE
37   PRIVATE
38
39   PUBLIC   tra_ldf        ! called by step.F90
40   PUBLIC   tra_ldf_init   ! called by nemogcm.F90
41   !
42   INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_traldf_... (namlist logicals)
43   
44   !! * Substitutions
45#  include "vectopt_loop_substitute.h90"
46   !!----------------------------------------------------------------------
47   !! NEMO/OPA 3.7 , NEMO Consortium (2015)
48   !! $Id$
49   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
50   !!----------------------------------------------------------------------
51CONTAINS
52
53   SUBROUTINE tra_ldf( kt )
54      !!----------------------------------------------------------------------
55      !!                  ***  ROUTINE tra_ldf  ***
56      !!
57      !! ** Purpose :   compute the lateral ocean tracer physics.
58      !!----------------------------------------------------------------------
59      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
60      !!
61      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdt, ztrds
62      !!----------------------------------------------------------------------
63      !
64      IF( nn_timing == 1 )   CALL timing_start('tra_ldf')
65      !
66      IF( l_trdtra )   THEN                    !* Save ta and sa trends
67         CALL wrk_alloc( jpi,jpj,jpk,   ztrdt, ztrds ) 
68         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
69         ztrds(:,:,:) = tsa(:,:,:,jp_sal)
70      ENDIF
71      !
72      SELECT CASE ( nldf )                     !* compute lateral mixing trend and add it to the general trend
73      !
74      CASE ( np_lap   )                                  ! laplacian: iso-level operator
75         CALL tra_ldf_lap  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb,      tsa, jpts,  1   )
76      CASE ( np_lap_i )                                  ! laplacian: standard iso-neutral operator (Madec)
77         CALL tra_ldf_iso  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts,  1   )
78      CASE ( np_lap_it )                                 ! laplacian: triad iso-neutral operator (griffies)
79         CALL tra_ldf_triad( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts,  1   )
80      CASE ( np_blp , np_blp_i , np_blp_it )             ! bilaplacian: iso-level & iso-neutral operators
81         CALL tra_ldf_blp  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb      , tsa, jpts, nldf )
82      END SELECT
83
84      IF( l_trdtra )   THEN                    !* save the horizontal diffusive trends for further diagnostics
85         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
86         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:)
87         CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt )
88         CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds )
89         CALL wrk_dealloc( jpi,jpj,jpk,   ztrdt, ztrds ) 
90      ENDIF
91      !                                        !* print mean trends (used for debugging)
92      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf  - Ta: ', mask1=tmask,               &
93         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
94      !
95      IF( nn_timing == 1 )   CALL timing_stop('tra_ldf')
96      !
97   END SUBROUTINE tra_ldf
98
99
100   SUBROUTINE tra_ldf_init
101      !!----------------------------------------------------------------------
102      !!                  ***  ROUTINE tra_ldf_init  ***
103      !!
104      !! ** Purpose :   Choice of the operator for the lateral tracer diffusion
105      !!
106      !! ** Method  :   set nldf from the namtra_ldf logicals
107      !!----------------------------------------------------------------------
108      INTEGER ::   ioptio, ierr   ! temporary integers
109      !!----------------------------------------------------------------------
110      !
111      IF(lwp) THEN                     ! Namelist print
112         WRITE(numout,*)
113         WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator'
114         WRITE(numout,*) '~~~~~~~~~~~'
115         WRITE(numout,*) '   Namelist namtra_ldf already read in ldftra module'
116         WRITE(numout,*) '   see ldf_tra_init report for lateral mixing parameters'
117         WRITE(numout,*)
118      ENDIF
119      !                                   ! use of lateral operator or not
120      nldf   = np_ERROR
121      ioptio = 0
122      IF( ln_traldf_lap )   ioptio = ioptio + 1
123      IF( ln_traldf_blp )   ioptio = ioptio + 1
124      IF( ioptio >  1   )   CALL ctl_stop( 'tra_ldf_init: use ONE or NONE of the 2 lap/bilap operator type on tracer' )
125      IF( ioptio == 0   )   nldf = np_no_ldf     ! No lateral diffusion
126      !
127      IF( nldf /= np_no_ldf ) THEN        ! direction ==>> type of operator 
128         ioptio = 0
129         IF( ln_traldf_lev )   ioptio = ioptio + 1
130         IF( ln_traldf_hor )   ioptio = ioptio + 1
131         IF( ln_traldf_iso )   ioptio = ioptio + 1
132         IF( ioptio >  1 )   CALL ctl_stop( 'tra_ldf_init: use only ONE direction (level/hor/iso)' )
133         !
134         !                                ! defined the type of lateral diffusion from ln_traldf_... logicals
135         ierr = 0
136         IF( ln_traldf_lap ) THEN         ! laplacian operator
137            IF ( ln_zco ) THEN               ! z-coordinate
138               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level = horizontal (no rotation)
139               IF ( ln_traldf_hor   )   nldf = np_lap     ! iso-level = horizontal (no rotation)
140               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation)
141               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation)
142            ENDIF
143            IF ( ln_zps ) THEN               ! z-coordinate with partial step
144               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed
145               IF ( ln_traldf_hor   )   nldf = np_lap     ! horizontal             (no rotation)
146               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard     (rotation)
147               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad        (rotation)
148            ENDIF
149            IF ( ln_sco ) THEN               ! s-coordinate
150               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level              (no rotation)
151               IF ( ln_traldf_hor   )   nldf = np_lap_i   ! horizontal             (   rotation)
152               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation)
153               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation)
154            ENDIF
155         ENDIF
156         !
157         IF( ln_traldf_blp ) THEN         ! bilaplacian operator
158            IF ( ln_zco ) THEN               ! z-coordinate
159               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level = horizontal (no rotation)
160               IF ( ln_traldf_hor   )   nldf = np_blp     ! iso-level = horizontal (no rotation)
161               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation)
162               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation)
163            ENDIF
164            IF ( ln_zps ) THEN               ! z-coordinate with partial step
165               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed
166               IF ( ln_traldf_hor   )   nldf = np_blp     ! horizontal             (no rotation)
167               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation)
168               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation)
169            ENDIF
170            IF ( ln_sco ) THEN               ! s-coordinate
171               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level              (no rotation)
172               IF ( ln_traldf_hor   )   nldf = np_blp_it  ! horizontal             (   rotation)
173               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation)
174               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation)
175            ENDIF
176         ENDIF
177      ENDIF
178      !
179      IF( ierr == 1 )   CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' )
180      IF( ln_ldfeiv .AND. .NOT.( ln_traldf_iso .OR. ln_traldf_triad ) )                                    &
181           &            CALL ctl_stop( '          eddy induced velocity on tracers requires isopycnal',    &
182           &                                                                    ' laplacian diffusion' )
183      IF(  nldf == np_lap_i .OR. nldf == np_lap_it .OR. &
184         & nldf == np_blp_i .OR. nldf == np_blp_it  )   l_ldfslp = .TRUE.    ! slope of neutral surfaces required
185      !
186      IF(lwp) THEN
187         WRITE(numout,*)
188         IF( nldf == np_no_ldf )   WRITE(numout,*) '          NO lateral diffusion'
189         IF( nldf == np_lap    )   WRITE(numout,*) '          laplacian iso-level operator'
190         IF( nldf == np_lap_i  )   WRITE(numout,*) '          Rotated laplacian operator (standard)'
191         IF( nldf == np_lap_it )   WRITE(numout,*) '          Rotated laplacian operator (triad)'
192         IF( nldf == np_blp    )   WRITE(numout,*) '          bilaplacian iso-level operator'
193         IF( nldf == np_blp_i  )   WRITE(numout,*) '          Rotated bilaplacian operator (standard)'
194         IF( nldf == np_blp_it )   WRITE(numout,*) '          Rotated bilaplacian operator (triad)'
195      ENDIF
196      !
197   END SUBROUTINE tra_ldf_init
198
199   !!======================================================================
200END MODULE traldf
Note: See TracBrowser for help on using the repository browser.