trdtra.F90 22 KB

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