trdglo.F90 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. MODULE trdglo
  2. !!======================================================================
  3. !! *** MODULE trdglo ***
  4. !! Ocean diagnostics: global domain averaged tracer and momentum trends
  5. !!=====================================================================
  6. !! History : 1.0 ! 2004-08 (C. Talandier) New trends organization
  7. !! 3.5 ! 2012-02 (G. Madec) add 3D tracer zdf trend output using iom
  8. !!----------------------------------------------------------------------
  9. !!----------------------------------------------------------------------
  10. !! trd_glo : domain averaged budget of trends (including kinetic energy and T^2 trends)
  11. !! glo_dyn_wri : print dynamic trends in ocean.output file
  12. !! glo_tra_wri : print global T & T^2 trends in ocean.output file
  13. !! trd_glo_init : initialization step
  14. !!----------------------------------------------------------------------
  15. USE oce ! ocean dynamics and tracers variables
  16. USE dom_oce ! ocean space and time domain variables
  17. USE sbc_oce ! surface boundary condition: ocean
  18. USE trd_oce ! trends: ocean variables
  19. USE phycst ! physical constants
  20. USE ldftra_oce ! ocean active tracers: lateral physics
  21. USE ldfdyn_oce ! ocean dynamics: lateral physics
  22. USE zdf_oce ! ocean vertical physics
  23. USE zdfbfr ! bottom friction
  24. USE zdfddm ! ocean vertical physics: double diffusion
  25. USE eosbn2 ! equation of state
  26. USE phycst ! physical constants
  27. USE lib_mpp ! distibuted memory computing library
  28. USE in_out_manager ! I/O manager
  29. USE iom ! I/O manager library
  30. USE wrk_nemo ! Memory allocation
  31. IMPLICIT NONE
  32. PRIVATE
  33. PUBLIC trd_glo ! called by trdtra and trddyn modules
  34. PUBLIC trd_glo_init ! called by trdini module
  35. ! !!! Variables used for diagnostics
  36. REAL(wp) :: tvolt ! volume of the whole ocean computed at t-points
  37. REAL(wp) :: tvolu ! volume of the whole ocean computed at u-points
  38. REAL(wp) :: tvolv ! volume of the whole ocean computed at v-points
  39. REAL(wp) :: rpktrd ! potential to kinetic energy conversion
  40. REAL(wp) :: peke ! conversion potential energy - kinetic energy trend
  41. ! !!! domain averaged trends
  42. REAL(wp), DIMENSION(jptot_tra) :: tmo, smo ! temperature and salinity trends
  43. REAL(wp), DIMENSION(jptot_tra) :: t2 , s2 ! T^2 and S^2 trends
  44. REAL(wp), DIMENSION(jptot_dyn) :: umo, vmo ! momentum trends
  45. REAL(wp), DIMENSION(jptot_dyn) :: hke ! kinetic energy trends (u^2+v^2)
  46. !! * Substitutions
  47. # include "domzgr_substitute.h90"
  48. # include "vectopt_loop_substitute.h90"
  49. # include "zdfddm_substitute.h90"
  50. !!----------------------------------------------------------------------
  51. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  52. !! $Id: trdglo.F90 2355 2015-05-20 07:11:50Z ufla $
  53. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  54. !!----------------------------------------------------------------------
  55. CONTAINS
  56. SUBROUTINE trd_glo( ptrdx, ptrdy, ktrd, ctype, kt )
  57. !!---------------------------------------------------------------------
  58. !! *** ROUTINE trd_glo ***
  59. !!
  60. !! ** Purpose : compute and print global domain averaged trends for
  61. !! T, T^2, momentum, KE, and KE<->PE
  62. !!
  63. !!----------------------------------------------------------------------
  64. REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend
  65. REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend
  66. INTEGER , INTENT(in ) :: ktrd ! tracer trend index
  67. CHARACTER(len=3) , INTENT(in ) :: ctype ! momentum or tracers trends type (='DYN'/'TRA')
  68. INTEGER , INTENT(in ) :: kt ! time step
  69. !!
  70. INTEGER :: ji, jj, jk ! dummy loop indices
  71. INTEGER :: ikbu, ikbv ! local integers
  72. REAL(wp):: zvm, zvt, zvs, z1_2rau0 ! local scalars
  73. REAL(wp), POINTER, DIMENSION(:,:) :: ztswu, ztswv, z2dx, z2dy ! 2D workspace
  74. !!----------------------------------------------------------------------
  75. CALL wrk_alloc( jpi, jpj, ztswu, ztswv, z2dx, z2dy )
  76. IF( MOD(kt,nn_trd) == 0 .OR. kt == nit000 .OR. kt == nitend ) THEN
  77. !
  78. SELECT CASE( ctype )
  79. !
  80. CASE( 'TRA' ) !== Tracers (T & S) ==!
  81. DO jk = 1, jpkm1 ! global sum of mask volume trend and trend*T (including interior mask)
  82. DO jj = 1, jpj
  83. DO ji = 1, jpi
  84. zvm = e1e2t(ji,jj) * fse3t(ji,jj,jk) * tmask(ji,jj,jk) * tmask_i(ji,jj)
  85. zvt = ptrdx(ji,jj,jk) * zvm
  86. zvs = ptrdy(ji,jj,jk) * zvm
  87. tmo(ktrd) = tmo(ktrd) + zvt
  88. smo(ktrd) = smo(ktrd) + zvs
  89. t2 (ktrd) = t2(ktrd) + zvt * tsn(ji,jj,jk,jp_tem)
  90. s2 (ktrd) = s2(ktrd) + zvs * tsn(ji,jj,jk,jp_sal)
  91. END DO
  92. END DO
  93. END DO
  94. ! ! linear free surface: diagnose advective flux trough the fixed k=1 w-surface
  95. IF( .NOT.lk_vvl .AND. ktrd == jptra_zad ) THEN
  96. tmo(jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_tem) * e1e2t(:,:) )
  97. smo(jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_sal) * e1e2t(:,:) )
  98. t2 (jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_tem) * tsn(:,:,1,jp_tem) * e1e2t(:,:) )
  99. s2 (jptra_sad) = SUM( wn(:,:,1) * tsn(:,:,1,jp_sal) * tsn(:,:,1,jp_sal) * e1e2t(:,:) )
  100. ENDIF
  101. !
  102. IF( ktrd == jptra_atf ) THEN ! last trend (asselin time filter)
  103. !
  104. CALL glo_tra_wri( kt ) ! print the results in ocean.output
  105. !
  106. tmo(:) = 0._wp ! prepare the next time step (domain averaged array reset to zero)
  107. smo(:) = 0._wp
  108. t2 (:) = 0._wp
  109. s2 (:) = 0._wp
  110. !
  111. ENDIF
  112. !
  113. CASE( 'DYN' ) !== Momentum and KE ==!
  114. DO jk = 1, jpkm1
  115. DO jj = 1, jpjm1
  116. DO ji = 1, jpim1
  117. zvt = ptrdx(ji,jj,jk) * tmask_i(ji+1,jj ) * tmask_i(ji,jj) * umask(ji,jj,jk) &
  118. & * e1u (ji ,jj ) * e2u (ji,jj) * fse3u(ji,jj,jk)
  119. zvs = ptrdy(ji,jj,jk) * tmask_i(ji ,jj+1) * tmask_i(ji,jj) * vmask(ji,jj,jk) &
  120. & * e1v (ji ,jj ) * e2v (ji,jj) * fse3u(ji,jj,jk)
  121. umo(ktrd) = umo(ktrd) + zvt
  122. vmo(ktrd) = vmo(ktrd) + zvs
  123. hke(ktrd) = hke(ktrd) + un(ji,jj,jk) * zvt + vn(ji,jj,jk) * zvs
  124. END DO
  125. END DO
  126. END DO
  127. !
  128. IF( ktrd == jpdyn_zdf ) THEN ! zdf trend: compute separately the surface forcing trend
  129. z1_2rau0 = 0.5_wp / rau0
  130. DO jj = 1, jpjm1
  131. DO ji = 1, jpim1
  132. zvt = ( utau_b(ji,jj) + utau(ji,jj) ) * tmask_i(ji+1,jj ) * tmask_i(ji,jj) * umask(ji,jj,jk) &
  133. & * z1_2rau0 * e1u (ji ,jj ) * e2u (ji,jj)
  134. zvs = ( vtau_b(ji,jj) + vtau(ji,jj) ) * tmask_i(ji ,jj+1) * tmask_i(ji,jj) * vmask(ji,jj,jk) &
  135. & * z1_2rau0 * e1v (ji ,jj ) * e2v (ji,jj) * fse3u(ji,jj,jk)
  136. umo(jpdyn_tau) = umo(jpdyn_tau) + zvt
  137. vmo(jpdyn_tau) = vmo(jpdyn_tau) + zvs
  138. hke(jpdyn_tau) = hke(jpdyn_tau) + un(ji,jj,1) * zvt + vn(ji,jj,1) * zvs
  139. END DO
  140. END DO
  141. ENDIF
  142. !
  143. IF( ktrd == jpdyn_atf ) THEN ! last trend (asselin time filter)
  144. !
  145. IF( ln_bfrimp ) THEN ! implicit bfr case: compute separately the bottom friction
  146. z1_2rau0 = 0.5_wp / rau0
  147. DO jj = 1, jpjm1
  148. DO ji = 1, jpim1
  149. ikbu = mbku(ji,jj) ! deepest ocean u- & v-levels
  150. ikbv = mbkv(ji,jj)
  151. zvt = bfrua(ji,jj) * un(ji,jj,ikbu) * e1u(ji,jj) * e2v(ji,jj)
  152. zvs = bfrva(ji,jj) * vn(ji,jj,ikbv) * e1v(ji,jj) * e2v(ji,jj)
  153. umo(jpdyn_bfri) = umo(jpdyn_bfri) + zvt
  154. vmo(jpdyn_bfri) = vmo(jpdyn_bfri) + zvs
  155. hke(jpdyn_bfri) = hke(jpdyn_bfri) + un(ji,jj,ikbu) * zvt + vn(ji,jj,ikbv) * zvs
  156. END DO
  157. END DO
  158. ENDIF
  159. !
  160. CALL glo_dyn_wri( kt ) ! print the results in ocean.output
  161. !
  162. umo(:) = 0._wp ! reset for the next time step
  163. vmo(:) = 0._wp
  164. hke(:) = 0._wp
  165. !
  166. ENDIF
  167. !
  168. END SELECT
  169. !
  170. ENDIF
  171. !
  172. CALL wrk_dealloc( jpi, jpj, ztswu, ztswv, z2dx, z2dy )
  173. !
  174. END SUBROUTINE trd_glo
  175. SUBROUTINE glo_dyn_wri( kt )
  176. !!---------------------------------------------------------------------
  177. !! *** ROUTINE glo_dyn_wri ***
  178. !!
  179. !! ** Purpose : write global averaged U, KE, PE<->KE trends in ocean.output
  180. !!----------------------------------------------------------------------
  181. INTEGER, INTENT(in) :: kt ! ocean time-step index
  182. !
  183. INTEGER :: ji, jj, jk ! dummy loop indices
  184. REAL(wp) :: zcof ! local scalar
  185. REAL(wp), POINTER, DIMENSION(:,:,:) :: zkx, zky, zkz, zkepe
  186. !!----------------------------------------------------------------------
  187. CALL wrk_alloc( jpi, jpj, jpk, zkx, zky, zkz, zkepe )
  188. ! I. Momentum trends
  189. ! -------------------
  190. IF( MOD( kt, nn_trd ) == 0 .OR. kt == nit000 .OR. kt == nitend ) THEN
  191. ! I.1 Conversion potential energy - kinetic energy
  192. ! --------------------------------------------------
  193. ! c a u t i o n here, trends are computed at kt+1 (now , but after the swap)
  194. zkx (:,:,:) = 0._wp
  195. zky (:,:,:) = 0._wp
  196. zkz (:,:,:) = 0._wp
  197. zkepe(:,:,:) = 0._wp
  198. CALL eos( tsn, rhd, rhop ) ! now potential density
  199. zcof = 0.5_wp / rau0 ! Density flux at w-point
  200. zkz(:,:,1) = 0._wp
  201. DO jk = 2, jpk
  202. zkz(:,:,jk) = zcof * e1e2t(:,:) * wn(:,:,jk) * ( rhop(:,:,jk) + rhop(:,:,jk-1) ) * tmask_i(:,:)
  203. END DO
  204. zcof = 0.5_wp / rau0 ! Density flux at u and v-points
  205. DO jk = 1, jpkm1
  206. DO jj = 1, jpjm1
  207. DO ji = 1, jpim1
  208. zkx(ji,jj,jk) = zcof * e2u(ji,jj) * fse3u(ji,jj,jk) * un(ji,jj,jk) * ( rhop(ji,jj,jk) + rhop(ji+1,jj,jk) )
  209. zky(ji,jj,jk) = zcof * e1v(ji,jj) * fse3v(ji,jj,jk) * vn(ji,jj,jk) * ( rhop(ji,jj,jk) + rhop(ji,jj+1,jk) )
  210. END DO
  211. END DO
  212. END DO
  213. DO jk = 1, jpkm1 ! Density flux divergence at t-point
  214. DO jj = 2, jpjm1
  215. DO ji = 2, jpim1
  216. zkepe(ji,jj,jk) = - ( zkz(ji,jj,jk) - zkz(ji ,jj ,jk+1) &
  217. & + zkx(ji,jj,jk) - zkx(ji-1,jj ,jk ) &
  218. & + zky(ji,jj,jk) - zky(ji ,jj-1,jk ) ) &
  219. & / ( e1e2t(ji,jj) * fse3t(ji,jj,jk) ) * tmask(ji,jj,jk) * tmask_i(ji,jj)
  220. END DO
  221. END DO
  222. END DO
  223. ! I.2 Basin averaged kinetic energy trend
  224. ! ----------------------------------------
  225. peke = 0._wp
  226. DO jk = 1, jpkm1
  227. peke = peke + SUM( zkepe(:,:,jk) * fsdept(:,:,jk) * e1e2t(:,:) * fse3t(:,:,jk) )
  228. END DO
  229. peke = grav * peke
  230. ! I.3 Sums over the global domain
  231. ! ---------------------------------
  232. IF( lk_mpp ) THEN
  233. CALL mpp_sum( peke )
  234. CALL mpp_sum( umo , jptot_dyn )
  235. CALL mpp_sum( vmo , jptot_dyn )
  236. CALL mpp_sum( hke , jptot_dyn )
  237. ENDIF
  238. ! I.2 Print dynamic trends in the ocean.output file
  239. ! --------------------------------------------------
  240. IF(lwp) THEN
  241. WRITE (numout,*)
  242. WRITE (numout,*)
  243. WRITE (numout,9500) kt
  244. WRITE (numout,9501) umo(jpdyn_hpg) / tvolu, vmo(jpdyn_hpg) / tvolv
  245. WRITE (numout,9502) umo(jpdyn_keg) / tvolu, vmo(jpdyn_keg) / tvolv
  246. WRITE (numout,9503) umo(jpdyn_rvo) / tvolu, vmo(jpdyn_rvo) / tvolv
  247. WRITE (numout,9504) umo(jpdyn_pvo) / tvolu, vmo(jpdyn_pvo) / tvolv
  248. WRITE (numout,9505) umo(jpdyn_zad) / tvolu, vmo(jpdyn_zad) / tvolv
  249. WRITE (numout,9506) umo(jpdyn_ldf) / tvolu, vmo(jpdyn_ldf) / tvolv
  250. WRITE (numout,9507) umo(jpdyn_zdf) / tvolu, vmo(jpdyn_zdf) / tvolv
  251. WRITE (numout,9508) umo(jpdyn_spg) / tvolu, vmo(jpdyn_spg) / tvolv
  252. WRITE (numout,9509) umo(jpdyn_bfr) / tvolu, vmo(jpdyn_bfr) / tvolv
  253. WRITE (numout,9510) umo(jpdyn_atf) / tvolu, vmo(jpdyn_atf) / tvolv
  254. WRITE (numout,9511)
  255. WRITE (numout,9512) &
  256. & ( umo(jpdyn_hpg) + umo(jpdyn_keg) + umo(jpdyn_rvo) + umo(jpdyn_pvo) &
  257. & + umo(jpdyn_zad) + umo(jpdyn_ldf) + umo(jpdyn_zdf) + umo(jpdyn_spg) &
  258. & + umo(jpdyn_bfr) + umo(jpdyn_atf) ) / tvolu, &
  259. & ( vmo(jpdyn_hpg) + vmo(jpdyn_keg) + vmo(jpdyn_rvo) + vmo(jpdyn_pvo) &
  260. & + vmo(jpdyn_zad) + vmo(jpdyn_ldf) + vmo(jpdyn_zdf) + vmo(jpdyn_spg) &
  261. & + vmo(jpdyn_bfr) + vmo(jpdyn_atf) ) / tvolv
  262. WRITE (numout,9513) umo(jpdyn_tau) / tvolu, vmo(jpdyn_tau) / tvolv
  263. IF( ln_bfrimp ) WRITE (numout,9514) umo(jpdyn_bfri) / tvolu, vmo(jpdyn_bfri) / tvolv
  264. ENDIF
  265. 9500 FORMAT(' momentum trend at it= ', i6, ' :', /' ==============================')
  266. 9501 FORMAT(' hydro pressure gradient u= ', e20.13, ' v= ', e20.13)
  267. 9502 FORMAT(' ke gradient u= ', e20.13, ' v= ', e20.13)
  268. 9503 FORMAT(' relative vorticity term u= ', e20.13, ' v= ', e20.13)
  269. 9504 FORMAT(' planetary vorticity term u= ', e20.13, ' v= ', e20.13)
  270. 9505 FORMAT(' vertical advection u= ', e20.13, ' v= ', e20.13)
  271. 9506 FORMAT(' horizontal diffusion u= ', e20.13, ' v= ', e20.13)
  272. 9507 FORMAT(' vertical diffusion u= ', e20.13, ' v= ', e20.13)
  273. 9508 FORMAT(' surface pressure gradient u= ', e20.13, ' v= ', e20.13)
  274. 9509 FORMAT(' explicit bottom friction u= ', e20.13, ' v= ', e20.13)
  275. 9510 FORMAT(' Asselin time filter u= ', e20.13, ' v= ', e20.13)
  276. 9511 FORMAT(' -----------------------------------------------------------------------------')
  277. 9512 FORMAT(' total trend u= ', e20.13, ' v= ', e20.13)
  278. 9513 FORMAT(' incl. surface wind stress u= ', e20.13, ' v= ', e20.13)
  279. 9514 FORMAT(' bottom stress u= ', e20.13, ' v= ', e20.13)
  280. IF(lwp) THEN
  281. WRITE (numout,*)
  282. WRITE (numout,*)
  283. WRITE (numout,9520) kt
  284. WRITE (numout,9521) hke(jpdyn_hpg) / tvolt
  285. WRITE (numout,9522) hke(jpdyn_keg) / tvolt
  286. WRITE (numout,9523) hke(jpdyn_rvo) / tvolt
  287. WRITE (numout,9524) hke(jpdyn_pvo) / tvolt
  288. WRITE (numout,9525) hke(jpdyn_zad) / tvolt
  289. WRITE (numout,9526) hke(jpdyn_ldf) / tvolt
  290. WRITE (numout,9527) hke(jpdyn_zdf) / tvolt
  291. WRITE (numout,9528) hke(jpdyn_spg) / tvolt
  292. WRITE (numout,9529) hke(jpdyn_bfr) / tvolt
  293. WRITE (numout,9530) hke(jpdyn_atf) / tvolt
  294. WRITE (numout,9531)
  295. WRITE (numout,9532) &
  296. & ( hke(jpdyn_hpg) + hke(jpdyn_keg) + hke(jpdyn_rvo) + hke(jpdyn_pvo) &
  297. & + hke(jpdyn_zad) + hke(jpdyn_ldf) + hke(jpdyn_zdf) + hke(jpdyn_spg) &
  298. & + hke(jpdyn_bfr) + hke(jpdyn_atf) ) / tvolt
  299. WRITE (numout,9533) hke(jpdyn_tau) / tvolt
  300. IF( ln_bfrimp ) WRITE (numout,9534) hke(jpdyn_bfri) / tvolt
  301. ENDIF
  302. 9520 FORMAT(' kinetic energy trend at it= ', i6, ' :', /' ====================================')
  303. 9521 FORMAT(' hydro pressure gradient u2= ', e20.13)
  304. 9522 FORMAT(' ke gradient u2= ', e20.13)
  305. 9523 FORMAT(' relative vorticity term u2= ', e20.13)
  306. 9524 FORMAT(' planetary vorticity term u2= ', e20.13)
  307. 9525 FORMAT(' vertical advection u2= ', e20.13)
  308. 9526 FORMAT(' horizontal diffusion u2= ', e20.13)
  309. 9527 FORMAT(' vertical diffusion u2= ', e20.13)
  310. 9528 FORMAT(' surface pressure gradient u2= ', e20.13)
  311. 9529 FORMAT(' explicit bottom friction u2= ', e20.13)
  312. 9530 FORMAT(' Asselin time filter u2= ', e20.13)
  313. 9531 FORMAT(' --------------------------------------------------')
  314. 9532 FORMAT(' total trend u2= ', e20.13)
  315. 9533 FORMAT(' incl. surface wind stress u2= ', e20.13)
  316. 9534 FORMAT(' bottom stress u2= ', e20.13)
  317. IF(lwp) THEN
  318. WRITE (numout,*)
  319. WRITE (numout,*)
  320. WRITE (numout,9540) kt
  321. WRITE (numout,9541) ( hke(jpdyn_keg) + hke(jpdyn_rvo) + hke(jpdyn_zad) ) / tvolt
  322. WRITE (numout,9542) ( hke(jpdyn_keg) + hke(jpdyn_zad) ) / tvolt
  323. WRITE (numout,9543) ( hke(jpdyn_pvo) ) / tvolt
  324. WRITE (numout,9544) ( hke(jpdyn_rvo) ) / tvolt
  325. WRITE (numout,9545) ( hke(jpdyn_spg) ) / tvolt
  326. WRITE (numout,9546) ( hke(jpdyn_ldf) ) / tvolt
  327. WRITE (numout,9547) ( hke(jpdyn_zdf) ) / tvolt
  328. WRITE (numout,9548) ( hke(jpdyn_hpg) ) / tvolt, rpktrd / tvolt
  329. WRITE (numout,*)
  330. WRITE (numout,*)
  331. ENDIF
  332. 9540 FORMAT(' energetic consistency at it= ', i6, ' :', /' =========================================')
  333. 9541 FORMAT(' 0 = non linear term (true if KE conserved) : ', e20.13)
  334. 9542 FORMAT(' 0 = ke gradient + vertical advection : ', e20.13)
  335. 9543 FORMAT(' 0 = coriolis term (true if KE conserving scheme) : ', e20.13)
  336. 9544 FORMAT(' 0 = vorticity term (true if KE conserving scheme) : ', e20.13)
  337. 9545 FORMAT(' 0 = surface pressure gradient ??? : ', e20.13)
  338. 9546 FORMAT(' 0 < horizontal diffusion : ', e20.13)
  339. 9547 FORMAT(' 0 < vertical diffusion : ', e20.13)
  340. 9548 FORMAT(' pressure gradient u2 = - 1/rau0 u.dz(rhop) : ', e20.13, ' u.dz(rhop) =', e20.13)
  341. !
  342. ! Save potential to kinetic energy conversion for next time step
  343. rpktrd = peke
  344. !
  345. ENDIF
  346. !
  347. CALL wrk_dealloc( jpi, jpj, jpk, zkx, zky, zkz, zkepe )
  348. !
  349. END SUBROUTINE glo_dyn_wri
  350. SUBROUTINE glo_tra_wri( kt )
  351. !!---------------------------------------------------------------------
  352. !! *** ROUTINE glo_tra_wri ***
  353. !!
  354. !! ** Purpose : write global domain averaged of T and T^2 trends in ocean.output
  355. !!----------------------------------------------------------------------
  356. INTEGER, INTENT(in) :: kt ! ocean time-step index
  357. !
  358. INTEGER :: jk ! loop indices
  359. !!----------------------------------------------------------------------
  360. ! I. Tracers trends
  361. ! -----------------
  362. IF( MOD(kt,nn_trd) == 0 .OR. kt == nit000 .OR. kt == nitend ) THEN
  363. ! I.1 Sums over the global domain
  364. ! -------------------------------
  365. IF( lk_mpp ) THEN
  366. CALL mpp_sum( tmo, jptot_tra )
  367. CALL mpp_sum( smo, jptot_tra )
  368. CALL mpp_sum( t2 , jptot_tra )
  369. CALL mpp_sum( s2 , jptot_tra )
  370. ENDIF
  371. ! I.2 Print tracers trends in the ocean.output file
  372. ! --------------------------------------------------
  373. IF(lwp) THEN
  374. WRITE (numout,*)
  375. WRITE (numout,*)
  376. WRITE (numout,9400) kt
  377. WRITE (numout,9401) tmo(jptra_xad) / tvolt, smo(jptra_xad) / tvolt
  378. WRITE (numout,9411) tmo(jptra_yad) / tvolt, smo(jptra_yad) / tvolt
  379. WRITE (numout,9402) tmo(jptra_zad) / tvolt, smo(jptra_zad) / tvolt
  380. WRITE (numout,9403) tmo(jptra_ldf) / tvolt, smo(jptra_ldf) / tvolt
  381. WRITE (numout,9404) tmo(jptra_zdf) / tvolt, smo(jptra_zdf) / tvolt
  382. WRITE (numout,9405) tmo(jptra_npc) / tvolt, smo(jptra_npc) / tvolt
  383. WRITE (numout,9406) tmo(jptra_dmp) / tvolt, smo(jptra_dmp) / tvolt
  384. WRITE (numout,9407) tmo(jptra_qsr) / tvolt
  385. WRITE (numout,9408) tmo(jptra_nsr) / tvolt, smo(jptra_nsr) / tvolt
  386. WRITE (numout,9409)
  387. WRITE (numout,9410) ( tmo(jptra_xad) + tmo(jptra_yad) + tmo(jptra_zad) + tmo(jptra_ldf) + tmo(jptra_zdf) &
  388. & + tmo(jptra_npc) + tmo(jptra_dmp) + tmo(jptra_qsr) + tmo(jptra_nsr) ) / tvolt, &
  389. & ( smo(jptra_xad) + smo(jptra_yad) + smo(jptra_zad) + smo(jptra_ldf) + smo(jptra_zdf) &
  390. & + smo(jptra_npc) + smo(jptra_dmp) + smo(jptra_nsr) ) / tvolt
  391. ENDIF
  392. 9400 FORMAT(' tracer trend at it= ',i6,' : temperature', &
  393. ' salinity',/' ============================')
  394. 9401 FORMAT(' zonal advection ',e20.13,' ',e20.13)
  395. 9411 FORMAT(' meridional advection ',e20.13,' ',e20.13)
  396. 9402 FORMAT(' vertical advection ',e20.13,' ',e20.13)
  397. 9403 FORMAT(' horizontal diffusion ',e20.13,' ',e20.13)
  398. 9404 FORMAT(' vertical diffusion ',e20.13,' ',e20.13)
  399. 9405 FORMAT(' static instability mixing ',e20.13,' ',e20.13)
  400. 9406 FORMAT(' damping term ',e20.13,' ',e20.13)
  401. 9407 FORMAT(' penetrative qsr ',e20.13)
  402. 9408 FORMAT(' non solar radiation ',e20.13,' ',e20.13)
  403. 9409 FORMAT(' -------------------------------------------------------------------------')
  404. 9410 FORMAT(' total trend ',e20.13,' ',e20.13)
  405. IF(lwp) THEN
  406. WRITE (numout,*)
  407. WRITE (numout,*)
  408. WRITE (numout,9420) kt
  409. WRITE (numout,9421) t2(jptra_xad) / tvolt, s2(jptra_xad) / tvolt
  410. WRITE (numout,9431) t2(jptra_yad) / tvolt, s2(jptra_yad) / tvolt
  411. WRITE (numout,9422) t2(jptra_zad) / tvolt, s2(jptra_zad) / tvolt
  412. WRITE (numout,9423) t2(jptra_ldf) / tvolt, s2(jptra_ldf) / tvolt
  413. WRITE (numout,9424) t2(jptra_zdf) / tvolt, s2(jptra_zdf) / tvolt
  414. WRITE (numout,9425) t2(jptra_npc) / tvolt, s2(jptra_npc) / tvolt
  415. WRITE (numout,9426) t2(jptra_dmp) / tvolt, s2(jptra_dmp) / tvolt
  416. WRITE (numout,9427) t2(jptra_qsr) / tvolt
  417. WRITE (numout,9428) t2(jptra_nsr) / tvolt, s2(jptra_nsr) / tvolt
  418. WRITE (numout,9429)
  419. WRITE (numout,9430) ( t2(jptra_xad) + t2(jptra_yad) + t2(jptra_zad) + t2(jptra_ldf) + t2(jptra_zdf) &
  420. & + t2(jptra_npc) + t2(jptra_dmp) + t2(jptra_qsr) + t2(jptra_nsr) ) / tvolt, &
  421. & ( s2(jptra_xad) + s2(jptra_yad) + s2(jptra_zad) + s2(jptra_ldf) + s2(jptra_zdf) &
  422. & + s2(jptra_npc) + s2(jptra_dmp) + s2(jptra_nsr) ) / tvolt
  423. ENDIF
  424. 9420 FORMAT(' tracer**2 trend at it= ', i6, ' : temperature', &
  425. ' salinity', /, ' ===============================')
  426. 9421 FORMAT(' zonal advection * t ', e20.13, ' ', e20.13)
  427. 9431 FORMAT(' meridional advection * t ', e20.13, ' ', e20.13)
  428. 9422 FORMAT(' vertical advection * t ', e20.13, ' ', e20.13)
  429. 9423 FORMAT(' horizontal diffusion * t ', e20.13, ' ', e20.13)
  430. 9424 FORMAT(' vertical diffusion * t ', e20.13, ' ', e20.13)
  431. 9425 FORMAT(' static instability mixing * t ', e20.13, ' ', e20.13)
  432. 9426 FORMAT(' damping term * t ', e20.13, ' ', e20.13)
  433. 9427 FORMAT(' penetrative qsr * t ', e20.13)
  434. 9428 FORMAT(' non solar radiation * t ', e20.13, ' ', e20.13)
  435. 9429 FORMAT(' -----------------------------------------------------------------------------')
  436. 9430 FORMAT(' total trend *t = ', e20.13, ' *s = ', e20.13)
  437. IF(lwp) THEN
  438. WRITE (numout,*)
  439. WRITE (numout,*)
  440. WRITE (numout,9440) kt
  441. WRITE (numout,9441) ( tmo(jptra_xad)+tmo(jptra_yad)+tmo(jptra_zad) )/tvolt, &
  442. & ( smo(jptra_xad)+smo(jptra_yad)+smo(jptra_zad) )/tvolt
  443. WRITE (numout,9442) tmo(jptra_sad)/tvolt, smo(jptra_sad)/tvolt
  444. WRITE (numout,9443) tmo(jptra_ldf)/tvolt, smo(jptra_ldf)/tvolt
  445. WRITE (numout,9444) tmo(jptra_zdf)/tvolt, smo(jptra_zdf)/tvolt
  446. WRITE (numout,9445) tmo(jptra_npc)/tvolt, smo(jptra_npc)/tvolt
  447. WRITE (numout,9446) ( t2(jptra_xad)+t2(jptra_yad)+t2(jptra_zad) )/tvolt, &
  448. & ( s2(jptra_xad)+s2(jptra_yad)+s2(jptra_zad) )/tvolt
  449. WRITE (numout,9447) t2(jptra_ldf)/tvolt, s2(jptra_ldf)/tvolt
  450. WRITE (numout,9448) t2(jptra_zdf)/tvolt, s2(jptra_zdf)/tvolt
  451. WRITE (numout,9449) t2(jptra_npc)/tvolt, s2(jptra_npc)/tvolt
  452. ENDIF
  453. 9440 FORMAT(' tracer consistency at it= ',i6, &
  454. ' : temperature',' salinity',/, &
  455. ' ==================================')
  456. 9441 FORMAT(' 0 = horizontal+vertical advection + ',e20.13,' ',e20.13)
  457. 9442 FORMAT(' 1st lev vertical advection ',e20.13,' ',e20.13)
  458. 9443 FORMAT(' 0 = horizontal diffusion ',e20.13,' ',e20.13)
  459. 9444 FORMAT(' 0 = vertical diffusion ',e20.13,' ',e20.13)
  460. 9445 FORMAT(' 0 = static instability mixing ',e20.13,' ',e20.13)
  461. 9446 FORMAT(' 0 = horizontal+vertical advection * t ',e20.13,' ',e20.13)
  462. 9447 FORMAT(' 0 > horizontal diffusion * t ',e20.13,' ',e20.13)
  463. 9448 FORMAT(' 0 > vertical diffusion * t ',e20.13,' ',e20.13)
  464. 9449 FORMAT(' 0 > static instability mixing * t ',e20.13,' ',e20.13)
  465. !
  466. ENDIF
  467. !
  468. END SUBROUTINE glo_tra_wri
  469. SUBROUTINE trd_glo_init
  470. !!---------------------------------------------------------------------
  471. !! *** ROUTINE trd_glo_init ***
  472. !!
  473. !! ** Purpose : Read the namtrd namelist
  474. !!----------------------------------------------------------------------
  475. INTEGER :: ji, jj, jk ! dummy loop indices
  476. !!----------------------------------------------------------------------
  477. IF(lwp) THEN
  478. WRITE(numout,*)
  479. WRITE(numout,*) 'trd_glo_init : integral constraints properties trends'
  480. WRITE(numout,*) '~~~~~~~~~~~~~'
  481. ENDIF
  482. ! Total volume at t-points:
  483. tvolt = 0._wp
  484. DO jk = 1, jpkm1
  485. tvolt = tvolt + SUM( e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) * tmask_i(:,:) )
  486. END DO
  487. IF( lk_mpp ) CALL mpp_sum( tvolt ) ! sum over the global domain
  488. IF(lwp) WRITE(numout,*) ' total ocean volume at T-point tvolt = ',tvolt
  489. ! Initialization of potential to kinetic energy conversion
  490. rpktrd = 0._wp
  491. ! Total volume at u-, v- points:
  492. !!gm : bug? je suis quasi sur que le produit des tmask_i ne correspond pas exactement au umask_i et vmask_i !
  493. tvolu = 0._wp
  494. tvolv = 0._wp
  495. DO jk = 1, jpk
  496. DO jj = 2, jpjm1
  497. DO ji = fs_2, fs_jpim1 ! vector opt.
  498. tvolu = tvolu + e1u(ji,jj) * e2u(ji,jj) * fse3u(ji,jj,jk) * tmask_i(ji+1,jj ) * tmask_i(ji,jj) * umask(ji,jj,jk)
  499. tvolv = tvolv + e1v(ji,jj) * e2v(ji,jj) * fse3v(ji,jj,jk) * tmask_i(ji ,jj+1) * tmask_i(ji,jj) * vmask(ji,jj,jk)
  500. END DO
  501. END DO
  502. END DO
  503. IF( lk_mpp ) CALL mpp_sum( tvolu ) ! sums over the global domain
  504. IF( lk_mpp ) CALL mpp_sum( tvolv )
  505. IF(lwp) THEN
  506. WRITE(numout,*) ' total ocean volume at U-point tvolu = ',tvolu
  507. WRITE(numout,*) ' total ocean volume at V-point tvolv = ',tvolv
  508. ENDIF
  509. !
  510. END SUBROUTINE trd_glo_init
  511. !!======================================================================
  512. END MODULE trdglo