trddyn.F90 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. MODULE trddyn
  2. !!======================================================================
  3. !! *** MODULE trddyn ***
  4. !! Ocean diagnostics: ocean dynamic trends
  5. !!=====================================================================
  6. !! History : 3.5 ! 2012-02 (G. Madec) creation from trdmod: split DYN and TRA trends
  7. !! and manage 3D trends output for U, V, and KE
  8. !!----------------------------------------------------------------------
  9. !!----------------------------------------------------------------------
  10. !! trd_dyn : manage the type of momentum trend diagnostics (3D I/O, domain averaged, KE)
  11. !! trd_dyn_iom : output 3D momentum and/or tracer trends using IOM
  12. !! trd_dyn_init : initialization step
  13. !!----------------------------------------------------------------------
  14. USE oce ! ocean dynamics and tracers variables
  15. USE dom_oce ! ocean space and time domain variables
  16. USE zdf_oce ! ocean vertical physics variables
  17. USE trd_oce ! trends: ocean variables
  18. USE zdfbfr ! bottom friction
  19. USE sbc_oce ! surface boundary condition: ocean
  20. USE phycst ! physical constants
  21. USE trdken ! trends: Kinetic ENergy
  22. USE trdglo ! trends: global domain averaged
  23. USE trdvor ! trends: vertical averaged vorticity
  24. USE trdmxl ! trends: mixed layer averaged
  25. USE in_out_manager ! I/O manager
  26. USE lbclnk ! lateral boundary condition
  27. USE iom ! I/O manager library
  28. USE lib_mpp ! MPP library
  29. USE wrk_nemo ! Memory allocation
  30. IMPLICIT NONE
  31. PRIVATE
  32. PUBLIC trd_dyn ! called by all dynXX modules
  33. !! * Substitutions
  34. # include "domzgr_substitute.h90"
  35. # include "vectopt_loop_substitute.h90"
  36. !!----------------------------------------------------------------------
  37. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  38. !! $Id: trddyn.F90 2355 2015-05-20 07:11:50Z ufla $
  39. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  40. !!----------------------------------------------------------------------
  41. CONTAINS
  42. SUBROUTINE trd_dyn( putrd, pvtrd, ktrd, kt )
  43. !!---------------------------------------------------------------------
  44. !! *** ROUTINE trd_mod ***
  45. !!
  46. !! ** Purpose : Dispatch momentum trend computation, e.g. 3D output,
  47. !! integral constraints, barotropic vorticity, kinetic enrgy,
  48. !! and/or mixed layer budget.
  49. !!----------------------------------------------------------------------
  50. REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: putrd, pvtrd ! U and V trends
  51. INTEGER , INTENT(in ) :: ktrd ! trend index
  52. INTEGER , INTENT(in ) :: kt ! time step
  53. !!----------------------------------------------------------------------
  54. !
  55. putrd(:,:,:) = putrd(:,:,:) * umask(:,:,:) ! mask the trends
  56. pvtrd(:,:,:) = pvtrd(:,:,:) * vmask(:,:,:)
  57. !
  58. !!gm NB : here a lbc_lnk should probably be added
  59. !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  60. ! 3D output of momentum and/or tracers trends using IOM interface
  61. !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  62. IF( ln_dyn_trd ) CALL trd_dyn_iom( putrd, pvtrd, ktrd, kt )
  63. !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  64. ! Integral Constraints Properties for momentum and/or tracers trends
  65. !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  66. IF( ln_glo_trd ) CALL trd_glo( putrd, pvtrd, ktrd, 'DYN', kt )
  67. !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  68. ! Kinetic Energy trends
  69. !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  70. IF( ln_KE_trd ) CALL trd_ken( putrd, pvtrd, ktrd, kt )
  71. !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  72. ! Vorticity trends
  73. !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  74. IF( ln_vor_trd ) CALL trd_vor( putrd, pvtrd, ktrd, kt )
  75. !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  76. ! Mixed layer trends for active tracers
  77. !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  78. !!gm IF( ln_dyn_mxl ) CALL trd_mxl_dyn
  79. !
  80. END SUBROUTINE trd_dyn
  81. SUBROUTINE trd_dyn_iom( putrd, pvtrd, ktrd, kt )
  82. !!---------------------------------------------------------------------
  83. !! *** ROUTINE trd_dyn_iom ***
  84. !!
  85. !! ** Purpose : output 3D trends using IOM
  86. !!----------------------------------------------------------------------
  87. REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: putrd, pvtrd ! U and V trends
  88. INTEGER , INTENT(in ) :: ktrd ! trend index
  89. INTEGER , INTENT(in ) :: kt ! time step
  90. !
  91. INTEGER :: ji, jj, jk ! dummy loop indices
  92. INTEGER :: ikbu, ikbv ! local integers
  93. REAL(wp), POINTER, DIMENSION(:,:) :: z2dx, z2dy ! 2D workspace
  94. REAL(wp), POINTER, DIMENSION(:,:,:) :: z3dx, z3dy ! 3D workspace
  95. !!----------------------------------------------------------------------
  96. !
  97. SELECT CASE( ktrd )
  98. CASE( jpdyn_hpg ) ; CALL iom_put( "utrd_hpg", putrd ) ! hydrostatic pressure gradient
  99. CALL iom_put( "vtrd_hpg", pvtrd )
  100. CASE( jpdyn_spg ) ; CALL iom_put( "utrd_spg", putrd ) ! surface pressure gradient
  101. CALL iom_put( "vtrd_spg", pvtrd )
  102. CASE( jpdyn_spgexp ); CALL iom_put( "utrd_spgexp", putrd ) ! surface pressure gradient (explicit)
  103. CALL iom_put( "vtrd_spgexp", pvtrd )
  104. CASE( jpdyn_spgflt ); CALL iom_put( "utrd_spgflt", putrd ) ! surface pressure gradient (filtered)
  105. CALL iom_put( "vtrd_spgflt", pvtrd )
  106. CASE( jpdyn_pvo ) ; CALL iom_put( "utrd_pvo", putrd ) ! planetary vorticity
  107. CALL iom_put( "vtrd_pvo", pvtrd )
  108. CASE( jpdyn_rvo ) ; CALL iom_put( "utrd_rvo", putrd ) ! relative vorticity (or metric term)
  109. CALL iom_put( "vtrd_rvo", pvtrd )
  110. CASE( jpdyn_keg ) ; CALL iom_put( "utrd_keg", putrd ) ! Kinetic Energy gradient (or had)
  111. CALL iom_put( "vtrd_keg", pvtrd )
  112. CALL wrk_alloc( jpi, jpj, jpk, z3dx, z3dy )
  113. z3dx(:,:,:) = 0._wp ! U.dxU & V.dyV (approximation)
  114. z3dy(:,:,:) = 0._wp
  115. DO jk = 1, jpkm1 ! no mask as un,vn are masked
  116. DO jj = 2, jpjm1
  117. DO ji = 2, jpim1
  118. z3dx(ji,jj,jk) = un(ji,jj,jk) * ( un(ji+1,jj,jk) - un(ji-1,jj,jk) ) / ( 2._wp * e1u(ji,jj) )
  119. z3dy(ji,jj,jk) = vn(ji,jj,jk) * ( vn(ji,jj+1,jk) - vn(ji,jj-1,jk) ) / ( 2._wp * e2v(ji,jj) )
  120. END DO
  121. END DO
  122. END DO
  123. CALL lbc_lnk( z3dx, 'U', -1. )
  124. CALL lbc_lnk( z3dy, 'V', -1. )
  125. CALL iom_put( "utrd_udx", z3dx )
  126. CALL iom_put( "vtrd_vdy", z3dy )
  127. CALL wrk_dealloc( jpi, jpj, jpk, z3dx, z3dy )
  128. CASE( jpdyn_zad ) ; CALL iom_put( "utrd_zad", putrd ) ! vertical advection
  129. CALL iom_put( "vtrd_zad", pvtrd )
  130. CASE( jpdyn_ldf ) ; CALL iom_put( "utrd_ldf", putrd ) ! lateral diffusion
  131. CALL iom_put( "vtrd_ldf", pvtrd )
  132. CASE( jpdyn_zdf ) ; CALL iom_put( "utrd_zdf", putrd ) ! vertical diffusion
  133. CALL iom_put( "vtrd_zdf", pvtrd )
  134. ! ! wind stress trends
  135. CALL wrk_alloc( jpi, jpj, z2dx, z2dy )
  136. z2dx(:,:) = ( utau_b(:,:) + utau(:,:) ) / ( fse3u(:,:,1) * rau0 )
  137. z2dy(:,:) = ( vtau_b(:,:) + vtau(:,:) ) / ( fse3v(:,:,1) * rau0 )
  138. CALL iom_put( "utrd_tau", z2dx )
  139. CALL iom_put( "vtrd_tau", z2dy )
  140. CALL wrk_dealloc( jpi, jpj, z2dx, z2dy )
  141. CASE( jpdyn_bfr ) ! called if ln_bfrimp=T
  142. CALL iom_put( "utrd_bfr", putrd ) ! bottom friction (explicit case)
  143. CALL iom_put( "vtrd_bfr", pvtrd )
  144. CASE( jpdyn_atf ) ; CALL iom_put( "utrd_atf", putrd ) ! asselin filter trends
  145. CALL iom_put( "vtrd_atf", pvtrd )
  146. CASE( jpdyn_bfri ) ; IF( ln_bfrimp ) THEN ! bottom friction (implicit case)
  147. CALL wrk_alloc( jpi, jpj, jpk, z3dx, z3dy )
  148. z3dx(:,:,:) = 0._wp ; z3dy(:,:,:) = 0._wp ! after velocity known (now filed at this stage)
  149. DO jk = 1, jpkm1
  150. DO jj = 2, jpjm1
  151. DO ji = 2, jpim1
  152. ikbu = mbku(ji,jj) ! deepest ocean u- & v-levels
  153. ikbv = mbkv(ji,jj)
  154. z3dx(ji,jj,jk) = bfrua(ji,jj) * un(ji,jj,ikbu) / fse3u(ji,jj,ikbu)
  155. z3dy(ji,jj,jk) = bfrva(ji,jj) * vn(ji,jj,ikbv) / fse3v(ji,jj,ikbv)
  156. END DO
  157. END DO
  158. END DO
  159. CALL lbc_lnk( z3dx, 'U', -1. ) ; CALL lbc_lnk( z3dy, 'V', -1. )
  160. CALL iom_put( "utrd_bfri", z3dx )
  161. CALL iom_put( "vtrd_bfri", z3dy )
  162. CALL wrk_dealloc( jpi, jpj, jpk, z3dx, z3dy )
  163. ENDIF
  164. END SELECT
  165. !
  166. END SUBROUTINE trd_dyn_iom
  167. !!======================================================================
  168. END MODULE trddyn