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/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90 @ 8568

Last change on this file since 8568 was 8568, checked in by gm, 7 years ago

#1911 (ENHANCE-09): PART I.2 - _NONE option + remove zts + see associated wiki page

  • Property svn:keywords set to Id
File size: 11.6 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 trend
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_blp ! lateral diffusion: laplacian iso-level            operator  (tra_ldf_lap/_blp   routines)
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 trd_oce        ! trends: ocean variables
26   USE trdtra         ! ocean active tracers trends
27   !
28   USE prtctl         ! 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   USE timing         ! Timing
33
34   IMPLICIT NONE
35   PRIVATE
36
37   PUBLIC   tra_ldf        ! called by step.F90
38   PUBLIC   tra_ldf_init   ! called by nemogcm.F90
39   !
40   INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_traldf_... (namlist logicals)
41   
42   !! * Substitutions
43#  include "vectopt_loop_substitute.h90"
44   !!----------------------------------------------------------------------
45   !! NEMO/OPA 3.7 , NEMO Consortium (2015)
46   !! $Id$
47   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
48   !!----------------------------------------------------------------------
49CONTAINS
50
51   SUBROUTINE tra_ldf( kt )
52      !!----------------------------------------------------------------------
53      !!                  ***  ROUTINE tra_ldf  ***
54      !!
55      !! ** Purpose :   compute the lateral ocean tracer physics.
56      !!----------------------------------------------------------------------
57      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
58      !!
59      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdt, ztrds
60      !!----------------------------------------------------------------------
61      !
62      IF( ln_timing )   CALL timing_start('tra_ldf')
63      !
64      IF( l_trdtra )   THEN                    !* Save ta and sa trends
65         ALLOCATE( ztrdt(jpi,jpj,jpk) , ztrds(jpi,jpj,jpk) ) 
66         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
67         ztrds(:,:,:) = tsa(:,:,:,jp_sal)
68      ENDIF
69      !
70      SELECT CASE ( nldf )                     !* compute lateral mixing trend and add it to the general trend
71      CASE ( np_lap   )                                  ! laplacian: iso-level operator
72         CALL tra_ldf_lap  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb,      tsa, jpts,  1   )
73      CASE ( np_lap_i )                                  ! laplacian: standard iso-neutral operator (Madec)
74         CALL tra_ldf_iso  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts,  1   )
75      CASE ( np_lap_it )                                 ! laplacian: triad iso-neutral operator (griffies)
76         CALL tra_ldf_triad( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts,  1   )
77      CASE ( np_blp , np_blp_i , np_blp_it )             ! bilaplacian: iso-level & iso-neutral operators
78         CALL tra_ldf_blp  ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb      , tsa, jpts, nldf )
79      END SELECT
80      !
81      IF( l_trdtra )   THEN                    !* save the horizontal diffusive trends for further diagnostics
82         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
83         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:)
84         CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt )
85         CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds )
86         DEALLOCATE( ztrdt, ztrds ) 
87      ENDIF
88      !                                        !* print mean trends (used for debugging)
89      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf  - Ta: ', mask1=tmask,               &
90         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
91      !
92      IF( ln_timing )   CALL timing_stop('tra_ldf')
93      !
94   END SUBROUTINE tra_ldf
95
96
97   SUBROUTINE tra_ldf_init
98      !!----------------------------------------------------------------------
99      !!                  ***  ROUTINE tra_ldf_init  ***
100      !!
101      !! ** Purpose :   Choice of the operator for the lateral tracer diffusion
102      !!
103      !! ** Method  :   set nldf from the namtra_ldf logicals
104      !!----------------------------------------------------------------------
105      INTEGER ::   ioptio, ierr   ! temporary integers
106      !!----------------------------------------------------------------------
107      !
108      IF(lwp) THEN                     !==  Namelist print  ==!
109         WRITE(numout,*)
110         WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator'
111         WRITE(numout,*) '~~~~~~~~~~~~'
112         WRITE(numout,*) '   Namelist namtra_ldf: already read in ldftra module'
113         WRITE(numout,*) '      see ldf_tra_init report for lateral mixing parameters'
114      ENDIF
115      !                                !==  use of lateral operator or not  ==!
116      nldf   = np_ERROR
117      ioptio = 0
118      IF( ln_traldf_NONE ) THEN   ;   nldf = np_no_ldf   ;   ioptio = ioptio + 1   ;   ENDIF
119      IF( ln_traldf_lap  ) THEN   ;                          ioptio = ioptio + 1   ;   ENDIF
120      IF( ln_traldf_blp  ) THEN   ;                          ioptio = ioptio + 1   ;   ENDIF
121      IF( ioptio /=  1   )   CALL ctl_stop( 'tra_ldf_init: use ONE of the 3 operator options (NONE/lap/blp)' )
122      !
123      IF( .NOT.ln_traldf_NONE ) THEN   !==  direction ==>> type of operator  ==!
124         ioptio = 0
125         IF( ln_traldf_lev )   ioptio = ioptio + 1
126         IF( ln_traldf_hor )   ioptio = ioptio + 1
127         IF( ln_traldf_iso )   ioptio = ioptio + 1
128         IF( ioptio /=  1  )   CALL ctl_stop( 'tra_ldf_init: use ONE direction (level/hor/iso)' )
129         !
130         !                                ! defined the type of lateral diffusion from ln_traldf_... logicals
131         ierr = 0
132         IF( ln_traldf_lap ) THEN         ! laplacian operator
133            IF ( ln_zco ) THEN               ! z-coordinate
134               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level = horizontal (no rotation)
135               IF ( ln_traldf_hor   )   nldf = np_lap     ! iso-level = horizontal (no rotation)
136               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation)
137               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation)
138            ENDIF
139            IF ( ln_zps ) THEN               ! z-coordinate with partial step
140               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed
141               IF ( ln_traldf_hor   )   nldf = np_lap     ! horizontal             (no rotation)
142               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard     (rotation)
143               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad        (rotation)
144            ENDIF
145            IF ( ln_sco ) THEN               ! s-coordinate
146               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level              (no rotation)
147               IF ( ln_traldf_hor   )   nldf = np_lap_i   ! horizontal             (   rotation)
148               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation)
149               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation)
150            ENDIF
151         ENDIF
152         !
153         IF( ln_traldf_blp ) THEN         ! bilaplacian operator
154            IF ( ln_zco ) THEN               ! z-coordinate
155               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level = horizontal (no rotation)
156               IF ( ln_traldf_hor   )   nldf = np_blp     ! iso-level = horizontal (no rotation)
157               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation)
158               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation)
159            ENDIF
160            IF ( ln_zps ) THEN               ! z-coordinate with partial step
161               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed
162               IF ( ln_traldf_hor   )   nldf = np_blp     ! horizontal             (no rotation)
163               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation)
164               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation)
165            ENDIF
166            IF ( ln_sco ) THEN               ! s-coordinate
167               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level              (no rotation)
168               IF ( ln_traldf_hor   )   nldf = np_blp_it  ! horizontal             (   rotation)
169               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation)
170               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation)
171            ENDIF
172         ENDIF
173         IF( ierr == 1 )   CALL ctl_stop( 'iso-level in z-partial step, not allowed' )
174      ENDIF
175      !
176      IF( ln_ldfeiv .AND. .NOT.( ln_traldf_iso .OR. ln_traldf_triad ) )                                    &
177           &            CALL ctl_stop( 'eddy induced velocity on tracers requires iso-neutral laplacian diffusion' )
178      IF( ln_isfcav .AND. ln_traldf_triad ) &
179           &            CALL ctl_stop( ' ice shelf cavity and traldf_triad not tested' )
180           !
181      IF(  nldf == np_lap_i .OR. nldf == np_lap_it .OR. &
182         & nldf == np_blp_i .OR. nldf == np_blp_it  )   l_ldfslp = .TRUE.    ! slope of neutral surfaces required
183      !
184      IF(lwp) THEN
185         WRITE(numout,*)
186         SELECT CASE( nldf )
187         CASE( np_no_ldf )   ;   WRITE(numout,*) '      ===>>   NO lateral diffusion'
188         CASE( np_lap    )   ;   WRITE(numout,*) '      ===>>   laplacian iso-level operator'
189         CASE( np_lap_i  )   ;   WRITE(numout,*) '      ===>>   Rotated laplacian operator (standard)'
190         CASE( np_lap_it )   ;   WRITE(numout,*) '      ===>>   Rotated laplacian operator (triad)'
191         CASE( np_blp    )   ;   WRITE(numout,*) '      ===>>   bilaplacian iso-level operator'
192         CASE( np_blp_i  )   ;   WRITE(numout,*) '      ===>>   Rotated bilaplacian operator (standard)'
193         CASE( np_blp_it )   ;   WRITE(numout,*) '      ===>>   Rotated bilaplacian operator (triad)'
194         END SELECT
195      ENDIF
196      !
197   END SUBROUTINE tra_ldf_init
198
199   !!======================================================================
200END MODULE traldf
Note: See TracBrowser for help on using the repository browser.