dynldf_lap.F90 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. MODULE dynldf_lap
  2. !!======================================================================
  3. !! *** MODULE dynldf_lap ***
  4. !! Ocean dynamics: lateral viscosity trend
  5. !!======================================================================
  6. !! History : OPA ! 1990-09 (G. Madec) Original code
  7. !! 4.0 ! 1991-11 (G. Madec)
  8. !! 6.0 ! 1996-01 (G. Madec) statement function for e3 and ahm
  9. !! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module
  10. !! - ! 2004-08 (C. Talandier) New trends organization
  11. !!----------------------------------------------------------------------
  12. !!----------------------------------------------------------------------
  13. !! dyn_ldf_lap : update the momentum trend with the lateral diffusion
  14. !! using an iso-level harmonic operator
  15. !!----------------------------------------------------------------------
  16. USE oce ! ocean dynamics and tracers
  17. USE dom_oce ! ocean space and time domain
  18. USE phycst ! physical constants
  19. USE ldfdyn_oce ! ocean dynamics: lateral physics
  20. USE zdf_oce ! ocean vertical physics
  21. !
  22. USE in_out_manager ! I/O manager
  23. USE iom ! I/O library
  24. USE timing ! Timing
  25. IMPLICIT NONE
  26. PRIVATE
  27. PUBLIC dyn_ldf_lap ! called by step.F90
  28. !! * Substitutions
  29. # include "domzgr_substitute.h90"
  30. # include "ldfdyn_substitute.h90"
  31. # include "vectopt_loop_substitute.h90"
  32. !!----------------------------------------------------------------------
  33. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  34. !! $Id: dynldf_lap.F90 4990 2014-12-15 16:42:49Z timgraham $
  35. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  36. !!----------------------------------------------------------------------
  37. CONTAINS
  38. SUBROUTINE dyn_ldf_lap( kt )
  39. !!----------------------------------------------------------------------
  40. !! *** ROUTINE dyn_ldf_lap ***
  41. !!
  42. !! ** Purpose : Compute the before horizontal tracer (t & s) diffusive
  43. !! trend and add it to the general trend of tracer equation.
  44. !!
  45. !! ** Method : The before horizontal momentum diffusion trend is an
  46. !! harmonic operator (laplacian type) which separates the divergent
  47. !! and rotational parts of the flow.
  48. !! Its horizontal components are computed as follow:
  49. !! difu = 1/e1u di[ahmt hdivb] - 1/(e2u*e3u) dj-1[e3f ahmf rotb]
  50. !! difv = 1/e2v dj[ahmt hdivb] + 1/(e1v*e3v) di-1[e3f ahmf rotb]
  51. !! in the rotational part of the diffusion.
  52. !! Add this before trend to the general trend (ua,va):
  53. !! (ua,va) = (ua,va) + (diffu,diffv)
  54. !!
  55. !! ** Action : - Update (ua,va) with the iso-level harmonic mixing trend
  56. !!----------------------------------------------------------------------
  57. INTEGER, INTENT( in ) :: kt ! ocean time-step index
  58. !
  59. INTEGER :: ji, jj, jk ! dummy loop indices
  60. REAL(wp) :: zua, zva, ze2u, ze1v ! local scalars
  61. REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z2d ! 2D workspace
  62. !!----------------------------------------------------------------------
  63. !
  64. IF( nn_timing == 1 ) CALL timing_start('dyn_ldf_lap')
  65. !
  66. IF( kt == nit000 ) THEN
  67. IF(lwp) WRITE(numout,*)
  68. IF(lwp) WRITE(numout,*) 'dyn_ldf : iso-level harmonic (laplacian) operator'
  69. IF(lwp) WRITE(numout,*) '~~~~~~~ '
  70. ENDIF
  71. ! ! ===============
  72. DO jk = 1, jpkm1 ! Horizontal slab
  73. ! ! ===============
  74. DO jj = 2, jpjm1
  75. DO ji = fs_2, fs_jpim1 ! vector opt.
  76. ze2u = rotb (ji,jj,jk) * fsahmf(ji,jj,jk) * fse3f(ji,jj,jk)
  77. ze1v = hdivb(ji,jj,jk) * fsahmt(ji,jj,jk)
  78. ! horizontal diffusive trends
  79. zua = - ( ze2u - rotb (ji,jj-1,jk)*fsahmf(ji,jj-1,jk)*fse3f(ji,jj-1,jk) ) / ( e2u(ji,jj) * fse3u(ji,jj,jk) ) &
  80. + ( hdivb(ji+1,jj,jk)*fsahmt(ji+1,jj,jk) - ze1v ) / e1u(ji,jj)
  81. zva = + ( ze2u - rotb (ji-1,jj,jk)*fsahmf(ji-1,jj,jk)*fse3f(ji-1,jj,jk) ) / ( e1v(ji,jj) * fse3v(ji,jj,jk) ) &
  82. + ( hdivb(ji,jj+1,jk)*fsahmt(ji,jj+1,jk) - ze1v ) / e2v(ji,jj)
  83. ! add it to the general momentum trends
  84. ua(ji,jj,jk) = ua(ji,jj,jk) + zua
  85. va(ji,jj,jk) = va(ji,jj,jk) + zva
  86. END DO
  87. END DO
  88. ! ! ===============
  89. END DO ! End of slab
  90. ! ! ===============
  91. IF( iom_use('dispkexyfo') ) THEN ! ocean Kinetic Energy dissipation per unit area
  92. ! ! due to lateral friction (xy=lateral)
  93. ! see NEMO_book appendix C, §C.7.2 (N.B. here averaged at t-points)
  94. ! local dissipation of KE at t-point due to laplacian operator is given by :
  95. ! - ahmt hdivb**2 - mi( mj(ahmf rotb**2 e1f*e2f*e3t) ) / (e1e2t*e3t)
  96. !
  97. ALLOCATE( z2d(jpi,jpj) )
  98. z2d(:,:) = 0._wp
  99. DO jk = 1, jpkm1
  100. DO jj = 2, jpjm1
  101. DO ji = 2, jpim1
  102. z2d(ji,jj) = z2d(ji,jj) - ( &
  103. & hdivb(ji,jj,jk)**2 * fsahmt(ji,jj,jk) * fse3t_n(ji,jj,jk) &
  104. & + 0.25_wp * ( &
  105. & rotb (ji ,jj ,jk)**2 * fsahmf(ji ,jj ,jk) * e12f(ji ,jj ) * fse3f(ji ,jj ,jk) &
  106. & + rotb (ji-1,jj ,jk)**2 * fsahmf(ji-1,jj ,jk) * e12f(ji-1,jj ) * fse3f(ji-1,jj ,jk) &
  107. & + rotb (ji ,jj-1,jk)**2 * fsahmf(ji ,jj-1,jk) * e12f(ji ,jj-1) * fse3f(ji ,jj-1,jk) &
  108. & + rotb (ji-1,jj-1,jk)**2 * fsahmf(ji-1,jj-1,jk) * e12f(ji-1,jj-1) * fse3f(ji-1,jj-1,jk) &
  109. & ) * r1_e12t(ji,jj) ) * tmask(ji,jj,jk)
  110. END DO
  111. END DO
  112. END DO
  113. z2d(:,:) = rau0 * z2d(:,:)
  114. CALL lbc_lnk( z2d,'T', 1. )
  115. CALL iom_put( 'dispkexyfo', z2d )
  116. DEALLOCATE( z2d )
  117. ENDIF
  118. IF( nn_timing == 1 ) CALL timing_stop('dyn_ldf_lap')
  119. !
  120. END SUBROUTINE dyn_ldf_lap
  121. !!======================================================================
  122. END MODULE dynldf_lap