ldftra.F90 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. MODULE ldftra
  2. !!======================================================================
  3. !! *** MODULE ldftra ***
  4. !! Ocean physics: lateral diffusivity coefficient
  5. !!=====================================================================
  6. !! History : ! 1997-07 (G. Madec) from inimix.F split in 2 routines
  7. !! NEMO 1.0 ! 2002-09 (G. Madec) F90: Free form and module
  8. !! 2.0 ! 2005-11 (G. Madec)
  9. !!----------------------------------------------------------------------
  10. !!----------------------------------------------------------------------
  11. !! ldf_tra_init : initialization, namelist read, and parameters control
  12. !! ldf_tra_c3d : 3D eddy viscosity coefficient initialization
  13. !! ldf_tra_c2d : 2D eddy viscosity coefficient initialization
  14. !! ldf_tra_c1d : 1D eddy viscosity coefficient initialization
  15. !!----------------------------------------------------------------------
  16. USE oce ! ocean dynamics and tracers
  17. USE dom_oce ! ocean space and time domain
  18. USE phycst ! physical constants
  19. USE ldftra_oce ! ocean tracer lateral physics
  20. USE ldfslp ! ???
  21. USE in_out_manager ! I/O manager
  22. USE ioipsl
  23. USE lib_mpp ! distribued memory computing library
  24. USE lbclnk ! ocean lateral boundary conditions (or mpp link)
  25. IMPLICIT NONE
  26. PRIVATE
  27. PUBLIC ldf_tra_init ! called by opa.F90
  28. !! * Substitutions
  29. # include "domzgr_substitute.h90"
  30. # include "vectopt_loop_substitute.h90"
  31. !!----------------------------------------------------------------------
  32. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  33. !! $Id: ldftra.F90 4624 2014-04-28 12:09:03Z acc $
  34. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  35. !!----------------------------------------------------------------------
  36. CONTAINS
  37. SUBROUTINE ldf_tra_init
  38. !!----------------------------------------------------------------------
  39. !! *** ROUTINE ldf_tra_init ***
  40. !!
  41. !! ** Purpose : initializations of the tracer lateral mixing coeff.
  42. !!
  43. !! ** Method : the Eddy diffusivity and eddy induced velocity ceoff.
  44. !! are defined as follows:
  45. !! default option : constant coef. aht0, aeiv0 (namelist)
  46. !! 'key_traldf_c1d': depth dependent coef. defined in
  47. !! in ldf_tra_c1d routine
  48. !! 'key_traldf_c2d': latitude and longitude dependent coef.
  49. !! defined in ldf_tra_c2d routine
  50. !! 'key_traldf_c3d': latitude, longitude, depth dependent coef.
  51. !! defined in ldf_tra_c3d routine
  52. !!
  53. !! N.B. User defined include files. By default, 3d and 2d coef.
  54. !! are set to a constant value given in the namelist and the 1d
  55. !! coefficients are initialized to a hyperbolic tangent vertical
  56. !! profile.
  57. !!----------------------------------------------------------------------
  58. INTEGER :: ioptio ! temporary integer
  59. INTEGER :: ios ! temporary integer
  60. LOGICAL :: ll_print = .FALSE. ! =T print eddy coef. in numout
  61. !!
  62. NAMELIST/namtra_ldf/ ln_traldf_lap , ln_traldf_bilap, &
  63. & ln_traldf_level, ln_traldf_hor , ln_traldf_iso, &
  64. & ln_traldf_grif , ln_traldf_gdia , &
  65. & ln_triad_iso , ln_botmix_grif , &
  66. & rn_aht_0 , rn_ahtb_0 , rn_aeiv_0, &
  67. & rn_slpmax , rn_chsmag , rn_smsh, &
  68. & rn_aht_m
  69. !!----------------------------------------------------------------------
  70. ! Define the lateral tracer physics parameters
  71. ! =============================================
  72. REWIND( numnam_ref ) ! Namelist namtra_ldf in reference namelist : Lateral physics on tracers
  73. READ ( numnam_ref, namtra_ldf, IOSTAT = ios, ERR = 901)
  74. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in reference namelist', lwp )
  75. REWIND( numnam_cfg ) ! Namelist namtra_ldf in configuration namelist : Lateral physics on tracers
  76. READ ( numnam_cfg, namtra_ldf, IOSTAT = ios, ERR = 902 )
  77. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in configuration namelist', lwp )
  78. IF(lwm) WRITE ( numond, namtra_ldf )
  79. IF(lwp) THEN ! control print
  80. WRITE(numout,*)
  81. WRITE(numout,*) 'ldf_tra_init : lateral tracer physics'
  82. WRITE(numout,*) '~~~~~~~~~~~~ '
  83. WRITE(numout,*) ' Namelist namtra_ldf : lateral mixing parameters (type, direction, coefficients)'
  84. WRITE(numout,*) ' laplacian operator ln_traldf_lap = ', ln_traldf_lap
  85. WRITE(numout,*) ' bilaplacian operator ln_traldf_bilap = ', ln_traldf_bilap
  86. WRITE(numout,*) ' iso-level ln_traldf_level = ', ln_traldf_level
  87. WRITE(numout,*) ' horizontal (geopotential) ln_traldf_hor = ', ln_traldf_hor
  88. WRITE(numout,*) ' iso-neutral ln_traldf_iso = ', ln_traldf_iso
  89. WRITE(numout,*) ' iso-neutral (Griffies) ln_traldf_grif = ', ln_traldf_grif
  90. WRITE(numout,*) ' Griffies strmfn diagnostics ln_traldf_gdia = ', ln_traldf_gdia
  91. WRITE(numout,*) ' lateral eddy diffusivity rn_aht_0 = ', rn_aht_0
  92. WRITE(numout,*) ' background hor. diffusivity rn_ahtb_0 = ', rn_ahtb_0
  93. WRITE(numout,*) ' eddy induced velocity coef. rn_aeiv_0 = ', rn_aeiv_0
  94. WRITE(numout,*) ' maximum isoppycnal slope rn_slpmax = ', rn_slpmax
  95. WRITE(numout,*) ' pure lateral mixing in ML ln_triad_iso = ', ln_triad_iso
  96. WRITE(numout,*) ' lateral mixing on bottom ln_botmix_grif = ', ln_botmix_grif
  97. WRITE(numout,*)
  98. ENDIF
  99. ! ! convert DOCTOR namelist names into OLD names
  100. aht0 = rn_aht_0
  101. ahtb0 = rn_ahtb_0
  102. aeiv0 = rn_aeiv_0
  103. ! ! Parameter control
  104. ! ... Check consistency for type and direction :
  105. ! ==> will be done in traldf module
  106. ! ... Space variation of eddy coefficients
  107. ioptio = 0
  108. #if defined key_traldf_c3d
  109. IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude, depth)'
  110. ioptio = ioptio + 1
  111. #endif
  112. #if defined key_traldf_c2d
  113. IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( latitude, longitude)'
  114. ioptio = ioptio + 1
  115. #endif
  116. #if defined key_traldf_c1d
  117. IF(lwp) WRITE(numout,*) ' tracer mixing coef. = F( depth )'
  118. ioptio = ioptio + 1
  119. IF( .NOT. ln_zco ) CALL ctl_stop( 'key_traldf_c1d can only be used in z-coordinate - full step' )
  120. #endif
  121. IF( ioptio == 0 ) THEN
  122. IF(lwp) WRITE(numout,*) ' tracer mixing coef. = constant (default option)'
  123. ELSEIF( ioptio > 1 ) THEN
  124. CALL ctl_stop(' use only one of the following keys:', &
  125. & ' key_traldf_c3d, key_traldf_c2d, key_traldf_c1d' )
  126. ENDIF
  127. IF( ln_traldf_bilap ) THEN
  128. IF(lwp) WRITE(numout,*) ' biharmonic tracer diffusion'
  129. IF( aht0 > 0 .AND. .NOT. lk_esopa ) CALL ctl_stop( 'The horizontal diffusivity coef. aht0 must be negative' )
  130. ELSE
  131. IF(lwp) WRITE(numout,*) ' harmonic tracer diffusion (default)'
  132. IF( aht0 < 0 .AND. .NOT. lk_esopa ) CALL ctl_stop('The horizontal diffusivity coef. aht0 must be positive' )
  133. ENDIF
  134. ! Lateral eddy diffusivity and eddy induced velocity coefficients
  135. ! ================================================================
  136. #if defined key_traldf_c3d
  137. CALL ldf_tra_c3d( ll_print ) ! aht = 3D coef. = F( longitude, latitude, depth )
  138. #elif defined key_traldf_c2d
  139. CALL ldf_tra_c2d( ll_print ) ! aht = 2D coef. = F( longitude, latitude )
  140. #elif defined key_traldf_c1d
  141. CALL ldf_tra_c1d( ll_print ) ! aht = 1D coef. = F( depth )
  142. #else
  143. ! Constant coefficients
  144. IF(lwp)WRITE(numout,*)
  145. IF(lwp)WRITE(numout,*) ' constant eddy diffusivity coef. ahtu = ahtv = ahtw = aht0 = ', aht0
  146. IF( lk_traldf_eiv ) THEN
  147. IF(lwp)WRITE(numout,*) ' constant eddy induced velocity coef. aeiu = aeiv = aeiw = aeiv0 = ', aeiv0
  148. ENDIF
  149. #endif
  150. #if defined key_traldf_smag && ! defined key_traldf_c3d
  151. CALL ctl_stop( 'key_traldf_smag can only be used with key_traldf_c3d' )
  152. #endif
  153. #if defined key_traldf_smag
  154. IF(lwp) WRITE(numout,*)' SMAGORINSKY DIFFUSION'
  155. IF(lwp .AND. rn_smsh < 1) WRITE(numout,*)' only shear is used '
  156. IF(lwp.and.ln_traldf_bilap) CALL ctl_stop(' SMAGORINSKY + BILAPLACIAN - UNSTABLE OR NON_CONSERVATIVE' )
  157. #endif
  158. !
  159. END SUBROUTINE ldf_tra_init
  160. #if defined key_traldf_c3d
  161. # include "ldftra_c3d.h90"
  162. #elif defined key_traldf_c2d
  163. # include "ldftra_c2d.h90"
  164. #elif defined key_traldf_c1d
  165. # include "ldftra_c1d.h90"
  166. #endif
  167. !!======================================================================
  168. END MODULE ldftra