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

source: branches/UKMO/dev_r5518_GO6_package_FOAMv14/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90 @ 11442

Last change on this file since 11442 was 11442, checked in by mattmartin, 5 years ago

Introduction of stochastic physics in NEMO, based on Andrea Storto's code.
For details, see ticket https://code.metoffice.gov.uk/trac/utils/ticket/251.

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