zdfini.F90 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. MODULE zdfini
  2. !!======================================================================
  3. !! *** MODULE zdfini ***
  4. !! Ocean physics : read vertical mixing namelist and check consistancy
  5. !!======================================================================
  6. !! History : 8.0 ! 1997-06 (G. Madec) Original code from inimix
  7. !! 1.0 ! 2002-08 (G. Madec) F90 : free form
  8. !! - ! 2005-06 (C. Ethe) KPP parameterization
  9. !! - ! 2009-07 (G. Madec) add avmb, avtb in restart for cen2 advection
  10. !!----------------------------------------------------------------------
  11. !!----------------------------------------------------------------------
  12. !! zdf_init : initialization, namelist read, and parameters control
  13. !!----------------------------------------------------------------------
  14. USE par_oce ! mesh and scale factors
  15. USE ldftra_oce ! ocean active tracers: lateral physics
  16. USE ldfdyn_oce ! ocean dynamics lateral physics
  17. USE zdf_oce ! TKE vertical mixing
  18. USE lib_mpp ! distribued memory computing
  19. USE zdftke ! TKE vertical mixing
  20. USE zdfgls ! GLS vertical mixing
  21. USE zdfkpp ! KPP vertical mixing
  22. USE zdfddm ! double diffusion mixing
  23. USE zdfevd ! enhanced vertical diffusion
  24. USE zdfric ! Richardson vertical mixing
  25. USE tranpc ! convection: non penetrative adjustment
  26. USE ldfslp ! iso-neutral slopes
  27. USE in_out_manager ! I/O manager
  28. USE iom ! IOM library
  29. IMPLICIT NONE
  30. PRIVATE
  31. PUBLIC zdf_init ! routine called by opa.F90
  32. !!----------------------------------------------------------------------
  33. !! NEMO/OPA 4.0 , NEMO Consortium (2011)
  34. !! $Id: zdfini.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 zdf_init
  39. !!----------------------------------------------------------------------
  40. !! *** ROUTINE zdf_init ***
  41. !!
  42. !! ** Purpose : initializations of the vertical ocean physics
  43. !!
  44. !! ** Method : Read namelist namzdf, control logicals
  45. !!----------------------------------------------------------------------
  46. INTEGER :: ioptio ! temporary scalar
  47. INTEGER :: ios
  48. !!
  49. NAMELIST/namzdf/ rn_avm0, rn_avt0, nn_avb, nn_havtb, ln_zdfexp, nn_zdfexp, &
  50. & ln_zdfevd, nn_evdm, rn_avevd, ln_zdfnpc, nn_npc, nn_npcp
  51. !!----------------------------------------------------------------------
  52. REWIND( numnam_ref ) ! Namelist namzdf in reference namelist : Vertical mixing parameters
  53. READ ( numnam_ref, namzdf, IOSTAT = ios, ERR = 901)
  54. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf in reference namelist', lwp )
  55. REWIND( numnam_cfg ) ! Namelist namzdf in reference namelist : Vertical mixing parameters
  56. READ ( numnam_cfg, namzdf, IOSTAT = ios, ERR = 902 )
  57. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf in configuration namelist', lwp )
  58. IF(lwm) WRITE ( numond, namzdf )
  59. IF(lwp) THEN !* Parameter print
  60. WRITE(numout,*)
  61. WRITE(numout,*) 'zdf_init: vertical physics'
  62. WRITE(numout,*) '~~~~~~~~'
  63. WRITE(numout,*) ' Namelist namzdf : set vertical mixing mixing parameters'
  64. WRITE(numout,*) ' vertical eddy viscosity rn_avm0 = ', rn_avm0
  65. WRITE(numout,*) ' vertical eddy diffusivity rn_avt0 = ', rn_avt0
  66. WRITE(numout,*) ' constant background or profile nn_avb = ', nn_avb
  67. WRITE(numout,*) ' horizontal variation for avtb nn_havtb = ', nn_havtb
  68. WRITE(numout,*) ' time splitting / backward scheme ln_zdfexp = ', ln_zdfexp
  69. WRITE(numout,*) ' number of time step nn_zdfexp = ', nn_zdfexp
  70. WRITE(numout,*) ' enhanced vertical diffusion ln_zdfevd = ', ln_zdfevd
  71. WRITE(numout,*) ' applied on momentum (=1/0) nn_evdm = ', nn_evdm
  72. WRITE(numout,*) ' vertical coefficient for evd rn_avevd = ', rn_avevd
  73. WRITE(numout,*) ' non-penetrative convection (npc) ln_zdfnpc = ', ln_zdfnpc
  74. WRITE(numout,*) ' npc call frequency nn_npc = ', nn_npc
  75. WRITE(numout,*) ' npc print frequency nn_npcp = ', nn_npcp
  76. ENDIF
  77. ! !* Parameter & logical controls
  78. ! ! ----------------------------
  79. !
  80. ! ! ... check of vertical mixing scheme on tracers
  81. ! ==> will be done in trazdf module
  82. !
  83. ! ! ... check of mixing coefficient
  84. IF(lwp) WRITE(numout,*)
  85. IF(lwp) WRITE(numout,*) ' vertical mixing option :'
  86. ioptio = 0
  87. IF( lk_zdfcst ) THEN
  88. IF(lwp) WRITE(numout,*) ' constant eddy diffusion coefficients'
  89. ioptio = ioptio+1
  90. ENDIF
  91. IF( lk_zdfric ) THEN
  92. IF(lwp) WRITE(numout,*) ' Richardson dependent eddy coefficients'
  93. ioptio = ioptio+1
  94. ENDIF
  95. IF( lk_zdftke ) THEN
  96. IF(lwp) WRITE(numout,*) ' TKE dependent eddy coefficients'
  97. ioptio = ioptio+1
  98. ENDIF
  99. IF( lk_zdfgls ) THEN
  100. IF(lwp) WRITE(numout,*) ' GLS dependent eddy coefficients'
  101. ioptio = ioptio+1
  102. ENDIF
  103. IF( lk_zdfkpp ) THEN
  104. IF(lwp) WRITE(numout,*) ' KPP dependent eddy coefficients'
  105. ioptio = ioptio+1
  106. ENDIF
  107. IF( ioptio == 0 .OR. ioptio > 1 .AND. .NOT. lk_esopa ) &
  108. & CALL ctl_stop( ' one and only one vertical diffusion option has to be defined ' )
  109. IF( ( lk_zdfric .OR. lk_zdfgls .OR. lk_zdfkpp ) .AND. ln_isfcav ) &
  110. & CALL ctl_stop( ' only zdfcst and zdftke were tested with ice shelves cavities ' )
  111. !
  112. ! ! ... Convection
  113. IF(lwp) WRITE(numout,*)
  114. IF(lwp) WRITE(numout,*) ' convection :'
  115. !
  116. #if defined key_top
  117. IF( ln_zdfnpc ) CALL ctl_stop( ' zdf_init: npc scheme is not working with key_top' )
  118. #endif
  119. !
  120. ioptio = 0
  121. IF( ln_zdfnpc ) THEN
  122. IF(lwp) WRITE(numout,*) ' use non penetrative convective scheme'
  123. ioptio = ioptio+1
  124. ENDIF
  125. IF( ln_zdfevd ) THEN
  126. IF(lwp) WRITE(numout,*) ' use enhanced vertical dif. scheme'
  127. ioptio = ioptio+1
  128. ENDIF
  129. IF( lk_zdftke ) THEN
  130. IF(lwp) WRITE(numout,*) ' use the 1.5 turbulent closure'
  131. ENDIF
  132. IF( lk_zdfgls ) THEN
  133. IF(lwp) WRITE(numout,*) ' use the GLS closure scheme'
  134. ENDIF
  135. IF( lk_zdfkpp ) THEN
  136. IF(lwp) WRITE(numout,*) ' use the KPP closure scheme'
  137. IF(lk_mpp) THEN
  138. IF(lwp) WRITE(numout,cform_err)
  139. IF(lwp) WRITE(numout,*) 'The KPP scheme is not ready to run in MPI'
  140. ENDIF
  141. ENDIF
  142. IF ( ioptio > 1 .AND. .NOT. lk_esopa ) CALL ctl_stop( ' chose between ln_zdfnpc and ln_zdfevd' )
  143. IF( ioptio == 0 .AND. .NOT.( lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp ) ) &
  144. CALL ctl_stop( ' except for TKE, GLS or KPP physics, a convection scheme is', &
  145. & ' required: ln_zdfevd or ln_zdfnpc logicals' )
  146. ! !* Background eddy viscosity and diffusivity profil
  147. IF( nn_avb == 0 ) THEN ! Define avmb, avtb from namelist parameter
  148. avmb(:) = rn_avm0
  149. avtb(:) = rn_avt0
  150. ELSE ! Background profile of avt (fit a theoretical/observational profile (Krauss 1990)
  151. avmb(:) = rn_avm0
  152. avtb(:) = rn_avt0 + ( 3.e-4_wp - 2._wp * rn_avt0 ) * 1.e-4_wp * gdepw_1d(:) ! m2/s
  153. IF(ln_sco .AND. lwp) CALL ctl_warn( 'avtb profile not valid in sco' )
  154. ENDIF
  155. !
  156. IF( ln_rstart ) THEN ! Read avmb, avtb in restart (if exist)
  157. ! if ln_traadv_cen, avmb, avtb have been modified in traadv_cen2 module.
  158. ! To ensure the restartability, avmb & avtb are written in the restart
  159. ! file in traadv_cen2 end read here.
  160. IF( iom_varid( numror, 'avmb', ldstop = .FALSE. ) > 0 ) THEN
  161. CALL iom_get( numror, jpdom_unknown, 'avmb', avmb )
  162. CALL iom_get( numror, jpdom_unknown, 'avtb', avtb )
  163. ENDIF
  164. ENDIF
  165. ! ! 2D shape of the avtb
  166. avtb_2d(:,:) = 1.e0 ! uniform
  167. !
  168. IF( nn_havtb == 1 ) THEN ! decrease avtb in the equatorial band
  169. ! -15S -5S : linear decrease from avt0 to avt0/10.
  170. ! -5S +5N : cst value avt0/10.
  171. ! 5N 15N : linear increase from avt0/10, to avt0
  172. WHERE(-15. <= gphit .AND. gphit < -5 ) avtb_2d = (1. - 0.09 * (gphit + 15.))
  173. WHERE( -5. <= gphit .AND. gphit < 5 ) avtb_2d = 0.1
  174. WHERE( 5. <= gphit .AND. gphit < 15 ) avtb_2d = (0.1 + 0.09 * (gphit - 5.))
  175. ENDIF
  176. !
  177. END SUBROUTINE zdf_init
  178. !!======================================================================
  179. END MODULE zdfini