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

source: branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90 @ 6060

Last change on this file since 6060 was 6060, checked in by timgraham, 8 years ago

Merged dev_r5836_noc2_VVL_BY_DEFAULT into branch

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