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

source: branches/2015/dev_r5721_CNRS9_NOC3_LDF/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90 @ 5766

Last change on this file since 5766 was 5766, checked in by cetlod, 9 years ago

LDF: phasing the improvements/simplifications of TOP component

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