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.
trdtra.F90 in branches/UKMO/dev_r5518_GO6_package_FOAMv14_bgcupdates/NEMOGCM/NEMO/OPA_SRC/TRD – NEMO

source: branches/UKMO/dev_r5518_GO6_package_FOAMv14_bgcupdates/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90 @ 10232

Last change on this file since 10232 was 10232, checked in by dford, 5 years ago

Merge in revisions 8447:10159 of dev_r5518_GO6_package.

File size: 22.1 KB
Line 
1MODULE trdtra
2   !!======================================================================
3   !!                       ***  MODULE  trdtra  ***
4   !! Ocean diagnostics:  ocean tracers trends pre-processing
5   !!=====================================================================
6   !! History :  3.3  !  2010-06  (C. Ethe) creation for the TRA/TRC merge
7   !!            3.5  !  2012-02  (G. Madec) update the comments
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   trd_tra       : pre-process the tracer trends
12   !!   trd_tra_adv   : transform a div(U.T) trend into a U.grad(T) trend
13   !!   trd_tra_mng   : tracer trend manager: dispatch to the diagnostic modules
14   !!   trd_tra_iom   : output 3D tracer trends using IOM
15   !!----------------------------------------------------------------------
16   USE oce            ! ocean dynamics and tracers variables
17   USE dom_oce        ! ocean domain
18   USE sbc_oce        ! surface boundary condition: ocean
19   USE zdf_oce        ! ocean vertical physics
20   USE trd_oce        ! trends: ocean variables
21   USE trdtrc         ! ocean passive mixed layer tracers trends
22# if defined key_top
23   USE trc,           ONLY: tra    ! tracer definitions (trn, trb, tra, etc.)
24# endif
25   USE trdglo         ! trends: global domain averaged
26   USE trdpen         ! trends: Potential ENergy
27   USE trdmxl         ! ocean active mixed layer tracers trends
28   USE ldftra_oce     ! ocean active tracers lateral physics
29   USE zdfddm         ! vertical physics: double diffusion
30   USE phycst         ! physical constants
31   USE in_out_manager ! I/O manager
32   USE iom            ! I/O manager library
33   USE lib_mpp        ! MPP library
34   USE wrk_nemo       ! Memory allocation
35
36   IMPLICIT NONE
37   PRIVATE
38
39   PUBLIC   trd_tra   ! called by all tra_... modules
40
41   REAL(wp) ::   r2dt   ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0
42
43   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   trdtx, trdty, trdt  ! use to store the temperature trends
44   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   avt_evd  ! store avt_evd to calculate EVD trend
45
46   !! * Substitutions
47#  include "domzgr_substitute.h90"
48#  include "zdfddm_substitute.h90"
49#  include "vectopt_loop_substitute.h90"
50   !!----------------------------------------------------------------------
51   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
52   !! $Id$
53   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
54   !!----------------------------------------------------------------------
55CONTAINS
56
57   INTEGER FUNCTION trd_tra_alloc()
58      !!---------------------------------------------------------------------
59      !!                  ***  FUNCTION trd_tra_alloc  ***
60      !!---------------------------------------------------------------------
61      ALLOCATE( trdtx(jpi,jpj,jpk) , trdty(jpi,jpj,jpk) , trdt(jpi,jpj,jpk) , avt_evd(jpi,jpj,jpk), STAT= trd_tra_alloc )
62      !
63      IF( lk_mpp             )   CALL mpp_sum ( trd_tra_alloc )
64      IF( trd_tra_alloc /= 0 )   CALL ctl_warn('trd_tra_alloc: failed to allocate arrays')
65   END FUNCTION trd_tra_alloc
66
67
68   SUBROUTINE trd_tra( kt, ctype, ktra, ktrd, ptrd, pun, ptra )
69      !!---------------------------------------------------------------------
70      !!                  ***  ROUTINE trd_tra  ***
71      !!
72      !! ** Purpose : pre-process tracer trends
73      !!
74      !! ** Method  : - mask the trend
75      !!              - advection (ptra present) converte the incoming flux (U.T)
76      !!              into trend (U.T => -U.grat(T)=div(U.T)-T.div(U)) through a
77      !!              call to trd_tra_adv
78      !!              - 'TRA' case : regroup T & S trends
79      !!              - send the trends to trd_tra_mng (trdtrc) for further processing
80      !!----------------------------------------------------------------------
81      INTEGER                         , INTENT(in)           ::   kt      ! time step
82      CHARACTER(len=3)                , INTENT(in)           ::   ctype   ! tracers trends type 'TRA'/'TRC'
83      INTEGER                         , INTENT(in)           ::   ktra    ! tracer index
84      INTEGER                         , INTENT(in)           ::   ktrd    ! tracer trend index
85      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in)           ::   ptrd    ! tracer trend  or flux
86      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL ::   pun     ! now velocity
87      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL ::   ptra    ! now tracer variable
88      !
89      INTEGER  ::   jk   ! loop indices
90      REAL(wp), POINTER, DIMENSION(:,:,:)  ::   zwt, zws, ztrdt, ztrds   ! 3D workspace
91      !!----------------------------------------------------------------------
92      !
93      CALL wrk_alloc( jpi, jpj, jpk, ztrds )
94      !     
95      IF( .NOT. ALLOCATED( trdtx ) ) THEN      ! allocate trdtra arrays
96         IF( trd_tra_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trd_tra : unable to allocate arrays' )
97      ENDIF
98
99      IF( ctype == 'TRA' .AND. ktra == jp_tem ) THEN   !==  Temperature trend  ==!
100         !
101         SELECT CASE( ktrd )
102         !                            ! advection: transform the advective flux into a trend
103         CASE( jptra_xad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'X', trdtx ) 
104         CASE( jptra_yad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'Y', trdty ) 
105         CASE( jptra_zad )   ;   CALL trd_tra_adv( ptrd, pun, ptra, 'Z', trdt  ) 
106         CASE( jptra_bbc,    &        ! qsr, bbc: on temperature only, send to trd_tra_mng
107            &  jptra_qsr )   ;   trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)
108                                 ztrds(:,:,:) = 0._wp
109                                 CALL trd_tra_mng( trdt, ztrds, ktrd, kt )
110         CASE( jptra_evd )   ;   avt_evd(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)
111         CASE DEFAULT                 ! other trends: masked trends
112            trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)              ! mask & store
113         END SELECT
114         !
115      ENDIF
116
117      IF( ctype == 'TRA' .AND. ktra == jp_sal ) THEN      !==  Salinity trends  ==!
118         !
119         SELECT CASE( ktrd )
120         !                            ! advection: transform the advective flux into a trend
121         !                            !            and send T & S trends to trd_tra_mng
122         CASE( jptra_xad  )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'X'  , ztrds ) 
123                                  CALL trd_tra_mng( trdtx, ztrds, ktrd, kt   )
124         CASE( jptra_yad  )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'Y'  , ztrds ) 
125                                  CALL trd_tra_mng( trdty, ztrds, ktrd, kt   )
126         CASE( jptra_zad  )   ;   CALL trd_tra_adv( ptrd , pun  , ptra, 'Z'  , ztrds ) 
127                                  CALL trd_tra_mng( trdt , ztrds, ktrd, kt   )
128         CASE( jptra_zdfp )           ! diagnose the "PURE" Kz trend (here: just before the swap)
129            !                         ! iso-neutral diffusion case otherwise jptra_zdf is "PURE"
130            CALL wrk_alloc( jpi, jpj, jpk, zwt, zws, ztrdt )
131            !
132            zwt(:,:, 1 ) = 0._wp   ;   zws(:,:, 1 ) = 0._wp            ! vertical diffusive fluxes
133            zwt(:,:,jpk) = 0._wp   ;   zws(:,:,jpk) = 0._wp
134            DO jk = 2, jpk
135               zwt(:,:,jk) = avt(:,:,jk) * ( tsa(:,:,jk-1,jp_tem) - tsa(:,:,jk,jp_tem) ) / fse3w(:,:,jk) * tmask(:,:,jk)
136               zws(:,:,jk) = fsavs(:,:,jk) * ( tsa(:,:,jk-1,jp_sal) - tsa(:,:,jk,jp_sal) ) / fse3w(:,:,jk) * tmask(:,:,jk)
137            END DO
138            !
139            ztrdt(:,:,jpk) = 0._wp   ;   ztrds(:,:,jpk) = 0._wp
140            DO jk = 1, jpkm1
141               ztrdt(:,:,jk) = ( zwt(:,:,jk) - zwt(:,:,jk+1) ) / fse3t(:,:,jk)
142               ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / fse3t(:,:,jk) 
143            END DO
144            CALL trd_tra_mng( ztrdt, ztrds, jptra_zdfp, kt ) 
145            !
146            !                         ! Also calculate EVD trend at this point.
147            zwt(:,:,:) = 0._wp   ;   zws(:,:,:) = 0._wp            ! vertical diffusive fluxes
148            DO jk = 2, jpk
149               zwt(:,:,jk) = avt_evd(:,:,jk) * ( tsa(:,:,jk-1,jp_tem) - tsa(:,:,jk,jp_tem) ) / fse3w(:,:,jk) * tmask(:,:,jk)
150               zws(:,:,jk) = avt_evd(:,:,jk) * ( tsa(:,:,jk-1,jp_sal) - tsa(:,:,jk,jp_sal) ) / fse3w(:,:,jk) * tmask(:,:,jk)
151            END DO
152            !
153            ztrdt(:,:,jpk) = 0._wp   ;   ztrds(:,:,jpk) = 0._wp
154            DO jk = 1, jpkm1
155               ztrdt(:,:,jk) = ( zwt(:,:,jk) - zwt(:,:,jk+1) ) / fse3t(:,:,jk)
156               ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / fse3t(:,:,jk) 
157            END DO
158            CALL trd_tra_mng( ztrdt, ztrds, jptra_evd, kt ) 
159            !
160            CALL wrk_dealloc( jpi, jpj, jpk, zwt, zws, ztrdt )
161            !
162         CASE DEFAULT                 ! other trends: mask and send T & S trends to trd_tra_mng
163            ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)
164            CALL trd_tra_mng( trdt, ztrds, ktrd, kt ) 
165         END SELECT
166      ENDIF
167
168# if defined key_top
169      IF( ctype == 'TRC' ) THEN                           !==  passive tracer trend  ==!
170         !
171         SELECT CASE( ktrd )
172         !                            ! advection: transform the advective flux into a masked trend
173         CASE( jptra_xad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'X', ztrds ) 
174         CASE( jptra_yad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Y', ztrds ) 
175         CASE( jptra_zad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Z', ztrds ) 
176         CASE( jptra_zdfp )           ! diagnose the "PURE" Kz trend (here: just before the swap)
177            !                         ! iso-neutral diffusion case otherwise
178            !                         jptra_zdf is "PURE"
179            CALL wrk_alloc( jpi, jpj, jpk, zws )
180            !
181            zws(:,:, 1 ) = 0._wp                        ! vertical diffusive fluxes
182            zws(:,:,jpk) = 0._wp 
183            DO jk = 2, jpk
184               zws(:,:,jk) = avt(:,:,jk) * (tra(:,:,jk-1,ktra) - tra(:,:,jk,ktra) ) / fse3w(:,:,jk) * tmask(:,:,jk)
185            END DO
186            !
187            ztrds(:,:,jpk) = 0._wp   
188            DO jk = 1, jpkm1
189               ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / fse3t(:,:,jk)
190            END DO
191            CALL wrk_dealloc( jpi, jpj, jpk, zws )
192            !
193         CASE DEFAULT                 ! other trends: just masked
194                                 ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)
195         END SELECT
196         !                            ! send trend to trd_trc
197         CALL trd_trc( ztrds, ktra, ktrd, kt ) 
198         !
199      ENDIF
200# endif
201      !
202      CALL wrk_dealloc( jpi, jpj, jpk, ztrds )
203      !
204   END SUBROUTINE trd_tra
205
206
207   SUBROUTINE trd_tra_adv( pf, pun, ptn, cdir, ptrd )
208      !!---------------------------------------------------------------------
209      !!                  ***  ROUTINE trd_tra_adv  ***
210      !!
211      !! ** Purpose :   transformed a advective flux into a masked advective trends
212      !!
213      !! ** Method  :   use the following transformation: -div(U.T) = - U grad(T) + T.div(U)
214      !!       i-advective trends = -un. di-1[T] = -( di-1[fi] - tn di-1[un] )
215      !!       j-advective trends = -un. di-1[T] = -( dj-1[fi] - tn dj-1[un] )
216      !!       k-advective trends = -un. di+1[T] = -( dk+1[fi] - tn dk+1[un] )
217      !!                where fi is the incoming advective flux.
218      !!----------------------------------------------------------------------
219      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pf      ! advective flux in one direction
220      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pun     ! now velocity   in one direction
221      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   ptn     ! now or before tracer
222      CHARACTER(len=1)                , INTENT(in   ) ::   cdir    ! X/Y/Z direction
223      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   ptrd    ! advective trend in one direction
224      !
225      INTEGER  ::   ji, jj, jk   ! dummy loop indices
226      INTEGER  ::   ii, ij, ik   ! index shift as function of the direction
227      !!----------------------------------------------------------------------
228      !
229      SELECT CASE( cdir )      ! shift depending on the direction
230      CASE( 'X' )   ;   ii = 1   ;   ij = 0   ;   ik = 0      ! i-trend
231      CASE( 'Y' )   ;   ii = 0   ;   ij = 1   ;   ik = 0      ! j-trend
232      CASE( 'Z' )   ;   ii = 0   ;   ij = 0   ;   ik =-1      ! k-trend
233      END SELECT
234      !
235      !                        ! set to zero uncomputed values
236      ptrd(jpi,:,:) = 0._wp   ;   ptrd(1,:,:) = 0._wp
237      ptrd(:,jpj,:) = 0._wp   ;   ptrd(:,1,:) = 0._wp
238      ptrd(:,:,jpk) = 0._wp
239      !
240      DO jk = 1, jpkm1         ! advective trend
241         DO jj = 2, jpjm1
242            DO ji = fs_2, fs_jpim1   ! vector opt.
243               ptrd(ji,jj,jk) = - (     pf (ji,jj,jk) - pf (ji-ii,jj-ij,jk-ik)                        &
244                 &                  - ( pun(ji,jj,jk) - pun(ji-ii,jj-ij,jk-ik) ) * ptn(ji,jj,jk)  )   &
245                 &              / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )  * tmask(ji,jj,jk)
246            END DO
247         END DO
248      END DO
249      !
250   END SUBROUTINE trd_tra_adv
251
252
253   SUBROUTINE trd_tra_mng( ptrdx, ptrdy, ktrd, kt )
254      !!---------------------------------------------------------------------
255      !!                  ***  ROUTINE trd_tra_mng  ***
256      !!
257      !! ** Purpose :   Dispatch all tracer trends computation, e.g. 3D output,
258      !!                integral constraints, potential energy, and/or
259      !!                mixed layer budget.
260      !!----------------------------------------------------------------------
261      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend
262      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
263      INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index
264      INTEGER                   , INTENT(in   ) ::   kt      ! time step
265      !!----------------------------------------------------------------------
266
267      IF( neuler == 0 .AND. kt == nit000    ) THEN   ;   r2dt =      rdt      ! = rdtra (restart with Euler time stepping)
268      ELSEIF(               kt <= nit000 + 1) THEN   ;   r2dt = 2. * rdt      ! = 2 rdttra (leapfrog)
269      ENDIF
270
271      !                   ! 3D output of tracers trends using IOM interface
272      IF( ln_tra_trd )   CALL trd_tra_iom ( ptrdx, ptrdy, ktrd, kt )
273
274      !                   ! Integral Constraints Properties for tracers trends                                       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
275      IF( ln_glo_trd )   CALL trd_glo( ptrdx, ptrdy, ktrd, 'TRA', kt )
276
277      !                   ! Potential ENergy trends
278      IF( ln_PE_trd  )   CALL trd_pen( ptrdx, ptrdy, ktrd, kt, r2dt )
279
280      !                   ! Mixed layer trends for active tracers
281      IF( ln_tra_mxl )   THEN   
282         !-----------------------------------------------------------------------------------------------
283         ! W.A.R.N.I.N.G :
284         ! jptra_ldf : called by traldf.F90
285         !                 at this stage we store:
286         !                  - the lateral geopotential diffusion (here, lateral = horizontal)
287         !                  - and the iso-neutral diffusion if activated
288         ! jptra_zdf : called by trazdf.F90
289         !                 * in case of iso-neutral diffusion we store the vertical diffusion component in the
290         !                   lateral trend including the K_z contrib, which will be removed later (see trd_mxl)
291         !-----------------------------------------------------------------------------------------------
292
293         SELECT CASE ( ktrd )
294         CASE ( jptra_xad )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_xad, '3D' )   ! zonal    advection
295         CASE ( jptra_yad )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_yad, '3D' )   ! merid.   advection
296         CASE ( jptra_zad )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_zad, '3D' )   ! vertical advection
297         CASE ( jptra_ldf )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_ldf, '3D' )   ! lateral  diffusion
298         CASE ( jptra_bbl )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_bbl, '3D' )   ! bottom boundary layer
299         CASE ( jptra_zdf )
300            IF( ln_traldf_iso ) THEN ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_ldf, '3D' )   ! lateral  diffusion (K_z)
301            ELSE                   ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_zdf, '3D' )   ! vertical diffusion (K_z)
302            ENDIF
303         CASE ( jptra_dmp )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_dmp, '3D' )   ! internal 3D restoring (tradmp)
304         CASE ( jptra_qsr )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_for, '3D' )   ! air-sea : penetrative sol radiat
305         CASE ( jptra_nsr )        ;   ptrdx(:,:,2:jpk) = 0._wp   ;   ptrdy(:,:,2:jpk) = 0._wp
306                                       CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_for, '2D' )   ! air-sea : non penetr sol radiation
307         CASE ( jptra_bbc )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_bbc, '3D' )   ! bottom bound cond (geoth flux)
308         CASE ( jptra_npc )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_npc, '3D' )   ! non penetr convect adjustment
309         CASE ( jptra_atf )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_atf, '3D' )   ! asselin time filter (last trend)
310                                   !
311                                       CALL trd_mxl( kt, r2dt )                             ! trends: Mixed-layer (output)
312         END SELECT
313         !
314      ENDIF
315      !
316   END SUBROUTINE trd_tra_mng
317
318
319   SUBROUTINE trd_tra_iom( ptrdx, ptrdy, ktrd, kt )
320      !!---------------------------------------------------------------------
321      !!                  ***  ROUTINE trd_tra_iom  ***
322      !!
323      !! ** Purpose :   output 3D tracer trends using IOM
324      !!----------------------------------------------------------------------
325     REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend
326     REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
327     INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index
328     INTEGER                   , INTENT(in   ) ::   kt      ! time step
329     !!
330     INTEGER ::   ji, jj, jk   ! dummy loop indices
331     INTEGER ::   ikbu, ikbv   ! local integers
332     REAL(wp), POINTER, DIMENSION(:,:)   ::   z2dx, z2dy   ! 2D workspace
333     !!----------------------------------------------------------------------
334     !
335     !!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added
336     !
337     ! Trends evaluated every time step that could go to the standard T file and can be output every ts into a 1ts file if 1ts output is selected
338     SELECT CASE( ktrd )
339     ! This total trend is done every time step
340     CASE( jptra_tot  )   ;   CALL iom_put( "ttrd_tot" , ptrdx )           ! model total trend
341        CALL iom_put( "strd_tot" , ptrdy )
342     END SELECT
343
344     ! These trends are done every second time step. When 1ts output is selected must go different (2ts) file from standard T-file
345     IF( MOD( kt, 2 ) == 0 ) THEN
346        SELECT CASE( ktrd )
347        CASE( jptra_xad  )   ;   CALL iom_put( "ttrd_xad" , ptrdx )        ! x- horizontal advection
348           CALL iom_put( "strd_xad" , ptrdy )
349        CASE( jptra_yad  )   ;   CALL iom_put( "ttrd_yad" , ptrdx )        ! y- horizontal advection
350           CALL iom_put( "strd_yad" , ptrdy )
351        CASE( jptra_zad  )   ;   CALL iom_put( "ttrd_zad" , ptrdx )        ! z- vertical   advection
352           CALL iom_put( "strd_zad" , ptrdy )
353           IF( .NOT. lk_vvl ) THEN                   ! cst volume : adv flux through z=0 surface
354              CALL wrk_alloc( jpi, jpj, z2dx, z2dy )
355              z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1)
356              z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1)
357              CALL iom_put( "ttrd_sad", z2dx )
358              CALL iom_put( "strd_sad", z2dy )
359              CALL wrk_dealloc( jpi, jpj, z2dx, z2dy )
360           ENDIF
361        CASE( jptra_totad  ) ;   CALL iom_put( "ttrd_totad" , ptrdx )      ! total   advection
362           CALL iom_put( "strd_totad" , ptrdy )
363        CASE( jptra_ldf  )   ;   CALL iom_put( "ttrd_ldf" , ptrdx )        ! lateral diffusion
364           CALL iom_put( "strd_ldf" , ptrdy )
365        CASE( jptra_zdf  )   ;   CALL iom_put( "ttrd_zdf" , ptrdx )        ! vertical diffusion (including Kz contribution)
366           CALL iom_put( "strd_zdf" , ptrdy )
367        CASE( jptra_zdfp )   ;   CALL iom_put( "ttrd_zdfp", ptrdx )        ! PURE vertical diffusion (no isoneutral contribution)
368           CALL iom_put( "strd_zdfp", ptrdy )
369        CASE( jptra_evd )    ;   CALL iom_put( "ttrd_evd", ptrdx )         ! EVD trend (convection)
370           CALL iom_put( "strd_evd", ptrdy )
371        CASE( jptra_dmp  )   ;   CALL iom_put( "ttrd_dmp" , ptrdx )        ! internal restoring (damping)
372           CALL iom_put( "strd_dmp" , ptrdy )
373        CASE( jptra_bbl  )   ;   CALL iom_put( "ttrd_bbl" , ptrdx )        ! bottom boundary layer
374           CALL iom_put( "strd_bbl" , ptrdy )
375        CASE( jptra_npc  )   ;   CALL iom_put( "ttrd_npc" , ptrdx )        ! static instability mixing
376           CALL iom_put( "strd_npc" , ptrdy )
377        CASE( jptra_bbc  )   ;   CALL iom_put( "ttrd_bbc" , ptrdx )        ! geothermal heating   (only on temperature)
378        CASE( jptra_nsr  )   ;   CALL iom_put( "ttrd_qns" , ptrdx(:,:,1) ) ! surface forcing + runoff (ln_rnf=T)
379           CALL iom_put( "strd_cdt" , ptrdy(:,:,1) )        ! output as 2D surface fields
380        CASE( jptra_qsr  )   ;   CALL iom_put( "ttrd_qsr" , ptrdx )        ! penetrative solar radiat. (only on temperature)
381        END SELECT
382        ! the Asselin filter trend  is also every other time step but needs to be lagged one time step
383        ! Even when 1ts output is selected can go to the same (2ts) file as the trends plotted every even time step.
384     ELSE IF( MOD( kt, 2 ) == 1 ) THEN
385        SELECT CASE( ktrd )
386        CASE( jptra_atf  )   ;   CALL iom_put( "ttrd_atf" , ptrdx )        ! asselin time Filter
387           CALL iom_put( "strd_atf" , ptrdy )
388        END SELECT
389     END IF
390     !
391   END SUBROUTINE trd_tra_iom
392
393   !!======================================================================
394END MODULE trdtra
Note: See TracBrowser for help on using the repository browser.