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 NEMO/branches/2020/dev_r13383_HPC-02_Daley_Tiling/src/OCE/TRA – NEMO

source: NEMO/branches/2020/dev_r13383_HPC-02_Daley_Tiling/src/OCE/TRA/traldf.F90 @ 13515

Last change on this file since 13515 was 13515, checked in by hadcv, 4 years ago

Tiling for tra_ldf

  • Property svn:keywords set to Id
File size: 9.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 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   ! TEMP: This change not necessary after trd_tra is tiled
20   USE domain, ONLY : dom_tile
21   USE phycst         ! physical constants
22   USE ldftra         ! lateral diffusion: eddy diffusivity & EIV coeff.
23   USE ldfslp         ! lateral diffusion: iso-neutral slope
24   USE traldf_lap_blp ! lateral diffusion: laplacian iso-level            operator  (tra_ldf_lap/_blp   routines)
25   USE traldf_iso     ! lateral diffusion: laplacian iso-neutral standard operator  (tra_ldf_iso        routine )
26   USE traldf_triad   ! lateral diffusion: laplacian iso-neutral triad    operator  (tra_ldf_triad      routine )
27   USE trd_oce        ! trends: ocean variables
28   USE trdtra         ! ocean active tracers trends
29   !
30   USE prtctl         ! Print control
31   USE in_out_manager ! I/O manager
32   USE lib_mpp        ! distribued memory computing library
33   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
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   !! * Substitutions
43#  include "do_loop_substitute.h90"
44   !!----------------------------------------------------------------------
45   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
46   !! $Id$
47   !! Software governed by the CeCILL license (see ./LICENSE)
48   !!----------------------------------------------------------------------
49CONTAINS
50
51   SUBROUTINE tra_ldf( kt, Kbb, Kmm, pts, Krhs )
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      INTEGER,                                   INTENT(in   ) :: Kbb, Kmm, Krhs  ! ocean time level indices
59      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
60      !!
61      ! TEMP: This change not necessary after trd_tra is tiled
62      INTEGER ::   itile
63      INTEGER ::   ji, jj, jk    ! dummy loop indices
64      ! TEMP: This change not necessary after trd_tra is tiled
65      REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ztrdt, ztrds
66      ! TEMP: This change not necessary after extra haloes development
67      LOGICAL :: lskip
68      !!----------------------------------------------------------------------
69      !
70      IF( ln_timing )   CALL timing_start('tra_ldf')
71      !
72      lskip = .FALSE.
73
74      IF( l_trdtra ) THEN
75         IF( ntile == 0 .OR. ntile == 1 )  THEN                       ! Do only on the first tile
76            ! TEMP: This can be ST_2D(nn_hls) after trd_tra is tiled
77            ALLOCATE( ztrdt(jpi,jpj,jpk), ztrds(jpi,jpj,jpk) )
78         ENDIF
79      ENDIF
80
81      ! TEMP: These changes not necessary after extra haloes development (lbc_lnk removed from tra_ldf_blp, zps_hde*)
82      IF( nldf_tra == np_blp .OR. nldf_tra == np_blp_i .OR. nldf_tra == np_blp_it )  THEN
83         IF( ln_tile ) THEN
84            IF( ntile == 1 ) THEN
85               CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 )
86            ELSE
87               lskip = .TRUE.
88            ENDIF
89         ENDIF
90      ENDIF
91      IF( .NOT. lskip ) THEN
92
93         ! TEMP: This change not necessary after trd_tra is tiled
94         itile = ntile
95
96         IF( l_trdtra )   THEN                    !* Save ta and sa trends
97            DO_3D( 0, 0, 0, 0, 1, jpk )
98               ztrdt(ji,jj,jk) = pts(ji,jj,jk,jp_tem,Krhs)
99               ztrds(ji,jj,jk) = pts(ji,jj,jk,jp_sal,Krhs)
100            END_3D
101         ENDIF
102         !
103         SELECT CASE ( nldf_tra )                 !* compute lateral mixing trend and add it to the general trend
104         CASE ( np_lap   )                                  ! laplacian: iso-level operator
105            CALL tra_ldf_lap  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs),                   jpts,  1 )
106         CASE ( np_lap_i )                                  ! laplacian: standard iso-neutral operator (Madec)
107            CALL tra_ldf_iso  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs), jpts,  1 )
108         CASE ( np_lap_it )                                 ! laplacian: triad iso-neutral operator (griffies)
109            CALL tra_ldf_triad( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs), jpts,  1 )
110         CASE ( np_blp , np_blp_i , np_blp_it )             ! bilaplacian: iso-level & iso-neutral operators
111            CALL tra_ldf_blp  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs),             jpts, nldf_tra )
112         END SELECT
113         !
114         ! TEMP: These changes not necessary after trd_tra is tiled
115         IF( l_trdtra )   THEN                    !* save the horizontal diffusive trends for further diagnostics
116            DO_3D( 0, 0, 0, 0, 1, jpk )
117               ztrdt(ji,jj,jk) = pts(ji,jj,jk,jp_tem,Krhs) - ztrdt(ji,jj,jk)
118               ztrds(ji,jj,jk) = pts(ji,jj,jk,jp_sal,Krhs) - ztrds(ji,jj,jk)
119            END_3D
120
121            IF( ntile == 0 .OR. ntile == nijtile )  THEN                ! Do only for the full domain
122               IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 0 )         ! Use full domain
123
124               ! TODO: TO BE TILED- trd_tra
125               CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_tem, jptra_ldf, ztrdt )
126               CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_sal, jptra_ldf, ztrds )
127               DEALLOCATE( ztrdt, ztrds )
128
129               IF( ln_tile ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = itile )     ! Revert to tile domain
130            ENDIF
131         ENDIF
132
133         ! TEMP: This change not necessary after extra haloes development (lbc_lnk removed from tra_ldf_blp, zps_hde*)
134         IF( ln_tile .AND. ntile == 0 ) CALL dom_tile( ntsi, ntsj, ntei, ntej, ktile = 1 )
135
136      ENDIF
137      !                                        !* print mean trends (used for debugging)
138      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' ldf  - Ta: ', mask1=tmask, &
139         &                                  tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
140      !
141      IF( ln_timing )   CALL timing_stop('tra_ldf')
142      !
143   END SUBROUTINE tra_ldf
144
145
146   SUBROUTINE tra_ldf_init
147      !!----------------------------------------------------------------------
148      !!                  ***  ROUTINE tra_ldf_init  ***
149      !!
150      !! ** Purpose :   Choice of the operator for the lateral tracer diffusion
151      !!
152      !! ** Method  :   set nldf_tra from the namtra_ldf logicals
153      !!----------------------------------------------------------------------
154      INTEGER ::   ioptio, ierr   ! temporary integers
155      !!----------------------------------------------------------------------
156      !
157      IF(lwp) THEN                     !==  Namelist print  ==!
158         WRITE(numout,*)
159         WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator'
160         WRITE(numout,*) '~~~~~~~~~~~~'
161         WRITE(numout,*) '   Namelist namtra_ldf: already read in ldftra module'
162         WRITE(numout,*) '      see ldf_tra_init report for lateral mixing parameters'
163         WRITE(numout,*)
164         !
165         SELECT CASE( nldf_tra )             ! print the choice of operator
166         CASE( np_no_ldf )   ;   WRITE(numout,*) '   ==>>>   NO lateral diffusion'
167         CASE( np_lap    )   ;   WRITE(numout,*) '   ==>>>   laplacian iso-level operator'
168         CASE( np_lap_i  )   ;   WRITE(numout,*) '   ==>>>   Rotated laplacian operator (standard)'
169         CASE( np_lap_it )   ;   WRITE(numout,*) '   ==>>>   Rotated laplacian operator (triad)'
170         CASE( np_blp    )   ;   WRITE(numout,*) '   ==>>>   bilaplacian iso-level operator'
171         CASE( np_blp_i  )   ;   WRITE(numout,*) '   ==>>>   Rotated bilaplacian operator (standard)'
172         CASE( np_blp_it )   ;   WRITE(numout,*) '   ==>>>   Rotated bilaplacian operator (triad)'
173         END SELECT
174      ENDIF
175      !
176   END SUBROUTINE tra_ldf_init
177
178   !!======================================================================
179END MODULE traldf
Note: See TracBrowser for help on using the repository browser.