zdfmxl.F90 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. MODULE zdfmxl
  2. !!======================================================================
  3. !! *** MODULE zdfmxl ***
  4. !! Ocean physics: mixed layer depth
  5. !!======================================================================
  6. !! History : 1.0 ! 2003-08 (G. Madec) original code
  7. !! 3.2 ! 2009-07 (S. Masson, G. Madec) IOM + merge of DO-loop
  8. !! 3.7 ! 2012-03 (G. Madec) make public the density criteria for trdmxl
  9. !! - ! 2014-02 (F. Roquet) mixed layer depth calculated using N2 instead of rhop
  10. !!----------------------------------------------------------------------
  11. !! zdf_mxl : Compute the turbocline and mixed layer depths.
  12. !!----------------------------------------------------------------------
  13. USE oce ! ocean dynamics and tracers variables
  14. USE dom_oce ! ocean space and time domain variables
  15. USE zdf_oce ! ocean vertical physics
  16. USE in_out_manager ! I/O manager
  17. USE prtctl ! Print control
  18. USE phycst ! physical constants
  19. USE iom ! I/O library
  20. USE lib_mpp ! MPP library
  21. USE wrk_nemo ! work arrays
  22. USE timing ! Timing
  23. USE trc_oce, ONLY : lk_offline ! offline flag
  24. IMPLICIT NONE
  25. PRIVATE
  26. PUBLIC zdf_mxl ! called by step.F90
  27. PUBLIC zdf_mxl_alloc ! Used in zdf_tke_init
  28. INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nmln !: number of level in the mixed layer (used by TOP)
  29. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hmld !: mixing layer depth (turbocline) [m]
  30. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hmlp !: mixed layer depth (rho=rho0+zdcrit) [m]
  31. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hmlpt !: mixed layer depth at t-points [m]
  32. REAL(wp), PUBLIC :: rho_c = 0.01_wp !: density criterion for mixed layer depth
  33. REAL(wp) :: avt_c = 5.e-4_wp ! Kz criterion for the turbocline depth
  34. !! * Substitutions
  35. # include "domzgr_substitute.h90"
  36. !!----------------------------------------------------------------------
  37. !! NEMO/OPA 4.0 , NEMO Consortium (2011)
  38. !! $Id: zdfmxl.F90 4990 2014-12-15 16:42:49Z timgraham $
  39. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  40. !!----------------------------------------------------------------------
  41. CONTAINS
  42. INTEGER FUNCTION zdf_mxl_alloc()
  43. !!----------------------------------------------------------------------
  44. !! *** FUNCTION zdf_mxl_alloc ***
  45. !!----------------------------------------------------------------------
  46. zdf_mxl_alloc = 0 ! set to zero if no array to be allocated
  47. IF( .NOT. ALLOCATED( nmln ) ) THEN
  48. ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), STAT= zdf_mxl_alloc )
  49. !
  50. IF( lk_mpp ) CALL mpp_sum ( zdf_mxl_alloc )
  51. IF( zdf_mxl_alloc /= 0 ) CALL ctl_warn('zdf_mxl_alloc: failed to allocate arrays.')
  52. !
  53. ENDIF
  54. END FUNCTION zdf_mxl_alloc
  55. SUBROUTINE zdf_mxl( kt )
  56. !!----------------------------------------------------------------------
  57. !! *** ROUTINE zdfmxl ***
  58. !!
  59. !! ** Purpose : Compute the turbocline depth and the mixed layer depth
  60. !! with density criteria.
  61. !!
  62. !! ** Method : The mixed layer depth is the shallowest W depth with
  63. !! the density of the corresponding T point (just bellow) bellow a
  64. !! given value defined locally as rho(10m) + rho_c
  65. !! The turbocline depth is the depth at which the vertical
  66. !! eddy diffusivity coefficient (resulting from the vertical physics
  67. !! alone, not the isopycnal part, see trazdf.F) fall below a given
  68. !! value defined locally (avt_c here taken equal to 5 cm/s2 by default)
  69. !!
  70. !! ** Action : nmln, hmld, hmlp, hmlpt
  71. !!----------------------------------------------------------------------
  72. INTEGER, INTENT(in) :: kt ! ocean time-step index
  73. !
  74. INTEGER :: ji, jj, jk ! dummy loop indices
  75. INTEGER :: iikn, iiki, ikt ! local integer
  76. REAL(wp) :: zN2_c ! local scalar
  77. INTEGER, POINTER, DIMENSION(:,:) :: imld ! 2D workspace
  78. !!----------------------------------------------------------------------
  79. !
  80. IF( nn_timing == 1 ) CALL timing_start('zdf_mxl')
  81. !
  82. CALL wrk_alloc( jpi,jpj, imld )
  83. IF( kt == nit000 ) THEN
  84. IF(lwp) WRITE(numout,*)
  85. IF(lwp) WRITE(numout,*) 'zdf_mxl : mixed layer depth'
  86. IF(lwp) WRITE(numout,*) '~~~~~~~ '
  87. ! ! allocate zdfmxl arrays
  88. IF( zdf_mxl_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'zdf_mxl : unable to allocate arrays' )
  89. ENDIF
  90. ! w-level of the mixing and mixed layers
  91. nmln(:,:) = nlb10 ! Initialization to the number of w ocean point
  92. hmlp(:,:) = 0._wp ! here hmlp used as a dummy variable, integrating vertically N^2
  93. zN2_c = grav * rho_c * r1_rau0 ! convert density criteria into N^2 criteria
  94. DO jk = nlb10, jpkm1
  95. DO jj = 1, jpj ! Mixed layer level: w-level
  96. DO ji = 1, jpi
  97. ikt = mbkt(ji,jj)
  98. hmlp(ji,jj) = hmlp(ji,jj) + MAX( rn2b(ji,jj,jk) , 0._wp ) * fse3w(ji,jj,jk)
  99. IF( hmlp(ji,jj) < zN2_c ) nmln(ji,jj) = MIN( jk , ikt ) + 1 ! Mixed layer level
  100. END DO
  101. END DO
  102. END DO
  103. !
  104. ! w-level of the turbocline
  105. imld(:,:) = mbkt(:,:) + 1 ! Initialization to the number of w ocean point
  106. DO jk = jpkm1, nlb10, -1 ! from the bottom to nlb10
  107. DO jj = 1, jpj
  108. DO ji = 1, jpi
  109. IF( avt (ji,jj,jk) < avt_c * wmask(ji,jj,jk) ) imld(ji,jj) = jk ! Turbocline
  110. END DO
  111. END DO
  112. END DO
  113. ! depth of the mixing and mixed layers
  114. DO jj = 1, jpj
  115. DO ji = 1, jpi
  116. iiki = imld(ji,jj)
  117. iikn = nmln(ji,jj)
  118. hmld (ji,jj) = fsdepw(ji,jj,iiki ) * ssmask(ji,jj) ! Turbocline depth
  119. hmlp (ji,jj) = fsdepw(ji,jj,iikn ) * ssmask(ji,jj) ! Mixed layer depth
  120. hmlpt(ji,jj) = fsdept(ji,jj,iikn-1) * ssmask(ji,jj) ! depth of the last T-point inside the mixed layer
  121. END DO
  122. END DO
  123. ! no need to output in offline mode
  124. IF( .NOT.lk_offline ) THEN
  125. IF ( iom_use("mldr10_1") ) THEN
  126. IF( ln_isfcav ) THEN
  127. CALL iom_put( "mldr10_1", hmlp - risfdep) ! mixed layer thickness
  128. ELSE
  129. CALL iom_put( "mldr10_1", hmlp ) ! mixed layer depth
  130. END IF
  131. END IF
  132. IF ( iom_use("mldkz5") ) THEN
  133. IF( ln_isfcav ) THEN
  134. CALL iom_put( "mldkz5" , hmld - risfdep ) ! turbocline thickness
  135. ELSE
  136. CALL iom_put( "mldkz5" , hmld ) ! turbocline depth
  137. END IF
  138. END IF
  139. ENDIF
  140. IF(ln_ctl) CALL prt_ctl( tab2d_1=REAL(nmln,wp), clinfo1=' nmln : ', tab2d_2=hmlp, clinfo2=' hmlp : ', ovlap=1 )
  141. !
  142. CALL wrk_dealloc( jpi,jpj, imld )
  143. !
  144. IF( nn_timing == 1 ) CALL timing_stop('zdf_mxl')
  145. !
  146. END SUBROUTINE zdf_mxl
  147. !!======================================================================
  148. END MODULE zdfmxl