dynzdf.F90 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. MODULE dynzdf
  2. !!==============================================================================
  3. !! *** MODULE dynzdf ***
  4. !! Ocean dynamics : vertical component of the momentum mixing trend
  5. !!==============================================================================
  6. !! History : 1.0 ! 2005-11 (G. Madec) Original code
  7. !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase
  8. !!----------------------------------------------------------------------
  9. !!----------------------------------------------------------------------
  10. !! dyn_zdf : Update the momentum trend with the vertical diffusion
  11. !! dyn_zdf_init : initializations of the vertical diffusion scheme
  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 variables
  16. USE dynzdf_exp ! vertical diffusion: explicit (dyn_zdf_exp routine)
  17. USE dynzdf_imp ! vertical diffusion: implicit (dyn_zdf_imp routine)
  18. USE ldfdyn_oce ! ocean dynamics: lateral physics
  19. USE trd_oce ! trends: ocean variables
  20. USE trddyn ! trend manager: dynamics
  21. USE in_out_manager ! I/O manager
  22. USE lib_mpp ! MPP library
  23. USE prtctl ! Print control
  24. USE wrk_nemo ! Memory Allocation
  25. USE timing ! Timing
  26. IMPLICIT NONE
  27. PRIVATE
  28. PUBLIC dyn_zdf ! routine called by step.F90
  29. PUBLIC dyn_zdf_init ! routine called by opa.F90
  30. INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used, defined from ln_zdf... namlist logicals
  31. REAL(wp) :: r2dt ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0
  32. !! * Substitutions
  33. # include "domzgr_substitute.h90"
  34. # include "zdfddm_substitute.h90"
  35. # include "vectopt_loop_substitute.h90"
  36. !!----------------------------------------------------------------------
  37. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  38. !! $Id: dynzdf.F90 4990 2014-12-15 16:42:49Z timgraham $
  39. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  40. !!----------------------------------------------------------------------
  41. CONTAINS
  42. SUBROUTINE dyn_zdf( kt )
  43. !!----------------------------------------------------------------------
  44. !! *** ROUTINE dyn_zdf ***
  45. !!
  46. !! ** Purpose : compute the vertical ocean dynamics physics.
  47. !!---------------------------------------------------------------------
  48. !!
  49. INTEGER, INTENT( in ) :: kt ! ocean time-step index
  50. !
  51. REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdu, ztrdv
  52. !!---------------------------------------------------------------------
  53. !
  54. IF( nn_timing == 1 ) CALL timing_start('dyn_zdf')
  55. !
  56. ! ! set time step
  57. IF( neuler == 0 .AND. kt == nit000 ) THEN ; r2dt = rdt ! = rdtra (restart with Euler time stepping)
  58. ELSEIF( kt <= nit000 + 1 ) THEN ; r2dt = 2. * rdt ! = 2 rdttra (leapfrog)
  59. ENDIF
  60. IF( l_trddyn ) THEN ! temporary save of ta and sa trends
  61. CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv )
  62. ztrdu(:,:,:) = ua(:,:,:)
  63. ztrdv(:,:,:) = va(:,:,:)
  64. ENDIF
  65. SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend
  66. !
  67. CASE ( 0 ) ; CALL dyn_zdf_exp( kt, r2dt ) ! explicit scheme
  68. CASE ( 1 ) ; CALL dyn_zdf_imp( kt, r2dt ) ! implicit scheme
  69. !
  70. CASE ( -1 ) ! esopa: test all possibility with control print
  71. CALL dyn_zdf_exp( kt, r2dt )
  72. CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf0 - Ua: ', mask1=umask, &
  73. & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' )
  74. CALL dyn_zdf_imp( kt, r2dt )
  75. CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf1 - Ua: ', mask1=umask, &
  76. & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' )
  77. END SELECT
  78. IF( l_trddyn ) THEN ! save the vertical diffusive trends for further diagnostics
  79. ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
  80. ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
  81. CALL trd_dyn( ztrdu, ztrdv, jpdyn_zdf, kt )
  82. CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv )
  83. ENDIF
  84. ! ! print mean trends (used for debugging)
  85. IF(ln_ctl) CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf - Ua: ', mask1=umask, &
  86. & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' )
  87. !
  88. IF( nn_timing == 1 ) CALL timing_stop('dyn_zdf')
  89. !
  90. END SUBROUTINE dyn_zdf
  91. SUBROUTINE dyn_zdf_init
  92. !!----------------------------------------------------------------------
  93. !! *** ROUTINE dyn_zdf_init ***
  94. !!
  95. !! ** Purpose : initializations of the vertical diffusion scheme
  96. !!
  97. !! ** Method : implicit (euler backward) scheme (default)
  98. !! explicit (time-splitting) scheme if ln_zdfexp=T
  99. !!----------------------------------------------------------------------
  100. USE zdftke
  101. USE zdfgls
  102. USE zdfkpp
  103. !!----------------------------------------------------------------------
  104. !
  105. ! Choice from ln_zdfexp read in namelist in zdfini
  106. IF( ln_zdfexp ) THEN ; nzdf = 0 ! use explicit scheme
  107. ELSE ; nzdf = 1 ! use implicit scheme
  108. ENDIF
  109. !
  110. ! Force implicit schemes
  111. IF( lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp ) nzdf = 1 ! TKE, GLS or KPP physics
  112. IF( ln_dynldf_iso ) nzdf = 1 ! iso-neutral lateral physics
  113. IF( ln_dynldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate
  114. !
  115. IF( lk_esopa ) nzdf = -1 ! Esopa key: All schemes used
  116. !
  117. IF(lwp) THEN ! Print the choice
  118. WRITE(numout,*)
  119. WRITE(numout,*) 'dyn_zdf_init : vertical dynamics physics scheme'
  120. WRITE(numout,*) '~~~~~~~~~~~'
  121. IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used'
  122. IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme'
  123. IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme'
  124. ENDIF
  125. !
  126. END SUBROUTINE dyn_zdf_init
  127. !!==============================================================================
  128. END MODULE dynzdf