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

source: branches/2016/dev_r6519_HPC_4/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90 @ 6748

Last change on this file since 6748 was 6748, checked in by mocavero, 8 years ago

GYRE hybrid parallelization

  • 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 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!$OMP PARALLEL WORKSHARE
68         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
69         ztrds(:,:,:) = tsa(:,:,:,jp_sal)
70!$OMP END PARALLEL WORKSHARE
71      ENDIF
72      !
73      SELECT CASE ( nldf )                     !* compute lateral mixing trend and add it to the general trend
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!$OMP PARALLEL WORKSHARE
86         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
87         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:)
88!$OMP END PARALLEL WORKSHARE
89         CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt )
90         CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds )
91         CALL wrk_dealloc( jpi,jpj,jpk,   ztrdt, ztrds ) 
92      ENDIF
93      !                                        !* print mean trends (used for debugging)
94      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf  - Ta: ', mask1=tmask,               &
95         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
96      !
97      IF( nn_timing == 1 )   CALL timing_stop('tra_ldf')
98      !
99   END SUBROUTINE tra_ldf
100
101
102   SUBROUTINE tra_ldf_init
103      !!----------------------------------------------------------------------
104      !!                  ***  ROUTINE tra_ldf_init  ***
105      !!
106      !! ** Purpose :   Choice of the operator for the lateral tracer diffusion
107      !!
108      !! ** Method  :   set nldf from the namtra_ldf logicals
109      !!----------------------------------------------------------------------
110      INTEGER ::   ioptio, ierr   ! temporary integers
111      !!----------------------------------------------------------------------
112      !
113      IF(lwp) THEN                     ! Namelist print
114         WRITE(numout,*)
115         WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator'
116         WRITE(numout,*) '~~~~~~~~~~~'
117         WRITE(numout,*) '   Namelist namtra_ldf: already read in ldftra module'
118         WRITE(numout,*) '      see ldf_tra_init report for lateral mixing parameters'
119         WRITE(numout,*)
120      ENDIF
121      !                                   ! use of lateral operator or not
122      nldf   = np_ERROR
123      ioptio = 0
124      IF( ln_traldf_lap )   ioptio = ioptio + 1
125      IF( ln_traldf_blp )   ioptio = ioptio + 1
126      IF( ioptio >  1   )   CALL ctl_stop( 'tra_ldf_init: use ONE or NONE of the 2 lap/bilap operator type on tracer' )
127      IF( ioptio == 0   )   nldf = np_no_ldf     ! No lateral diffusion
128      !
129      IF( nldf /= np_no_ldf ) THEN        ! direction ==>> type of operator 
130         ioptio = 0
131         IF( ln_traldf_lev )   ioptio = ioptio + 1
132         IF( ln_traldf_hor )   ioptio = ioptio + 1
133         IF( ln_traldf_iso )   ioptio = ioptio + 1
134         IF( ioptio >  1 )   CALL ctl_stop( 'tra_ldf_init: use only ONE direction (level/hor/iso)' )
135         !
136         !                                ! defined the type of lateral diffusion from ln_traldf_... logicals
137         ierr = 0
138         IF( ln_traldf_lap ) THEN         ! laplacian operator
139            IF ( ln_zco ) THEN               ! z-coordinate
140               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level = horizontal (no rotation)
141               IF ( ln_traldf_hor   )   nldf = np_lap     ! iso-level = 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_zps ) THEN               ! z-coordinate with partial step
146               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed
147               IF ( ln_traldf_hor   )   nldf = np_lap     ! horizontal             (no 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            IF ( ln_sco ) THEN               ! s-coordinate
152               IF ( ln_traldf_lev   )   nldf = np_lap     ! iso-level              (no rotation)
153               IF ( ln_traldf_hor   )   nldf = np_lap_i   ! horizontal             (   rotation)
154               IF ( ln_traldf_iso   )   nldf = np_lap_i   ! iso-neutral: standard  (   rotation)
155               IF ( ln_traldf_triad )   nldf = np_lap_it  ! iso-neutral: triad     (   rotation)
156            ENDIF
157         ENDIF
158         !
159         IF( ln_traldf_blp ) THEN         ! bilaplacian operator
160            IF ( ln_zco ) THEN               ! z-coordinate
161               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level = horizontal (no rotation)
162               IF ( ln_traldf_hor   )   nldf = np_blp     ! iso-level = 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_zps ) THEN               ! z-coordinate with partial step
167               IF ( ln_traldf_lev   )   ierr = 1          ! iso-level not allowed
168               IF ( ln_traldf_hor   )   nldf = np_blp     ! horizontal             (no 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            IF ( ln_sco ) THEN               ! s-coordinate
173               IF ( ln_traldf_lev   )   nldf = np_blp     ! iso-level              (no rotation)
174               IF ( ln_traldf_hor   )   nldf = np_blp_it  ! horizontal             (   rotation)
175               IF ( ln_traldf_iso   )   nldf = np_blp_i   ! iso-neutral: standard  (   rotation)
176               IF ( ln_traldf_triad )   nldf = np_blp_it  ! iso-neutral: triad     (   rotation)
177            ENDIF
178         ENDIF
179      ENDIF
180      !
181      IF( ierr == 1 )   CALL ctl_stop( 'iso-level in z-partial step, not allowed' )
182      IF( ln_ldfeiv .AND. .NOT.( ln_traldf_iso .OR. ln_traldf_triad ) )                                    &
183           &            CALL ctl_stop( 'eddy induced velocity on tracers requires iso-neutral laplacian diffusion' )
184      IF( ln_isfcav .AND. ln_traldf_triad ) &
185           &            CALL ctl_stop( ' ice shelf cavity and traldf_triad not tested' )
186           !
187      IF(  nldf == np_lap_i .OR. nldf == np_lap_it .OR. &
188         & nldf == np_blp_i .OR. nldf == np_blp_it  )   l_ldfslp = .TRUE.    ! slope of neutral surfaces required
189      !
190      IF(lwp) THEN
191         WRITE(numout,*)
192         SELECT CASE( nldf )
193         CASE( np_no_ldf )   ;   WRITE(numout,*) '   NO lateral diffusion'
194         CASE( np_lap    )   ;   WRITE(numout,*) '   laplacian iso-level operator'
195         CASE( np_lap_i  )   ;   WRITE(numout,*) '   Rotated laplacian operator (standard)'
196         CASE( np_lap_it )   ;   WRITE(numout,*) '   Rotated laplacian operator (triad)'
197         CASE( np_blp    )   ;   WRITE(numout,*) '   bilaplacian iso-level operator'
198         CASE( np_blp_i  )   ;   WRITE(numout,*) '   Rotated bilaplacian operator (standard)'
199         CASE( np_blp_it )   ;   WRITE(numout,*) '   Rotated bilaplacian operator (triad)'
200         END SELECT
201      ENDIF
202      !
203   END SUBROUTINE tra_ldf_init
204
205   !!======================================================================
206END MODULE traldf
Note: See TracBrowser for help on using the repository browser.