dynadv.F90 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. MODULE dynadv
  2. !!==============================================================================
  3. !! *** MODULE dynadv ***
  4. !! Ocean active tracers: advection scheme control
  5. !!==============================================================================
  6. !! History : 1.0 ! 2006-11 (G. Madec) Original code
  7. !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase
  8. !! 3.6 ! 2015-05 (N. Ducousso, G. Madec) add Hollingsworth scheme as an option
  9. !!----------------------------------------------------------------------
  10. !!----------------------------------------------------------------------
  11. !! dyn_adv : compute the momentum advection trend
  12. !! dyn_adv_init : control the different options of advection scheme
  13. !!----------------------------------------------------------------------
  14. USE dom_oce ! ocean space and time domain
  15. USE dynadv_cen2 ! centred flux form advection (dyn_adv_cen2 routine)
  16. USE dynadv_ubs ! UBS flux form advection (dyn_adv_ubs routine)
  17. USE dynkeg ! kinetic energy gradient (dyn_keg routine)
  18. USE dynzad ! vertical advection (dyn_zad routine)
  19. !
  20. USE in_out_manager ! I/O manager
  21. USE lib_mpp ! MPP library
  22. USE timing ! Timing
  23. IMPLICIT NONE
  24. PRIVATE
  25. PUBLIC dyn_adv ! routine called by step module
  26. PUBLIC dyn_adv_init ! routine called by opa module
  27. ! !* namdyn_adv namelist *
  28. LOGICAL, PUBLIC :: ln_dynadv_vec !: vector form flag
  29. INTEGER, PUBLIC :: nn_dynkeg !: scheme of kinetic energy gradient: =0 C2 ; =1 Hollingsworth
  30. LOGICAL, PUBLIC :: ln_dynadv_cen2 !: flux form - 2nd order centered scheme flag
  31. LOGICAL, PUBLIC :: ln_dynadv_ubs !: flux form - 3rd order UBS scheme flag
  32. LOGICAL, PUBLIC :: ln_dynzad_zts !: vertical advection with sub-timestepping (requires vector form)
  33. INTEGER :: nadv ! choice of the formulation and scheme for the advection
  34. !! * Substitutions
  35. # include "domzgr_substitute.h90"
  36. # include "vectopt_loop_substitute.h90"
  37. !!----------------------------------------------------------------------
  38. !! NEMO/OPA 3.6 , NEMO Consortium (2015)
  39. !! $Id: dynadv.F90 4990 2014-12-15 16:42:49Z timgraham $
  40. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  41. !!----------------------------------------------------------------------
  42. CONTAINS
  43. SUBROUTINE dyn_adv( kt )
  44. !!---------------------------------------------------------------------
  45. !! *** ROUTINE dyn_adv ***
  46. !!
  47. !! ** Purpose : compute the ocean momentum advection trend.
  48. !!
  49. !! ** Method : - Update (ua,va) with the advection term following nadv
  50. !! NB: in flux form advection (ln_dynadv_cen2 or ln_dynadv_ubs=T)
  51. !! a metric term is add to the coriolis term while in vector form
  52. !! it is the relative vorticity which is added to coriolis term
  53. !! (see dynvor module).
  54. !!----------------------------------------------------------------------
  55. INTEGER, INTENT( in ) :: kt ! ocean time-step index
  56. !!----------------------------------------------------------------------
  57. !
  58. IF( nn_timing == 1 ) CALL timing_start('dyn_adv')
  59. !
  60. SELECT CASE ( nadv ) ! compute advection trend and add it to general trend
  61. CASE ( 0 )
  62. CALL dyn_keg ( kt, nn_dynkeg ) ! vector form : horizontal gradient of kinetic energy
  63. CALL dyn_zad ( kt ) ! vector form : vertical advection
  64. CASE ( 1 )
  65. CALL dyn_keg ( kt, nn_dynkeg ) ! vector form : horizontal gradient of kinetic energy
  66. CALL dyn_zad_zts ( kt ) ! vector form : vertical advection with sub-timestepping
  67. CASE ( 2 )
  68. CALL dyn_adv_cen2( kt ) ! 2nd order centered scheme
  69. CASE ( 3 )
  70. CALL dyn_adv_ubs ( kt ) ! 3rd order UBS scheme
  71. !
  72. CASE (-1 ) ! esopa: test all possibility with control print
  73. CALL dyn_keg ( kt, nn_dynkeg )
  74. CALL dyn_zad ( kt )
  75. CALL dyn_adv_cen2( kt )
  76. CALL dyn_adv_ubs ( kt )
  77. END SELECT
  78. !
  79. IF( nn_timing == 1 ) CALL timing_stop('dyn_adv')
  80. !
  81. END SUBROUTINE dyn_adv
  82. SUBROUTINE dyn_adv_init
  83. !!---------------------------------------------------------------------
  84. !! *** ROUTINE dyn_adv_init ***
  85. !!
  86. !! ** Purpose : Control the consistency between namelist options for
  87. !! momentum advection formulation & scheme and set nadv
  88. !!----------------------------------------------------------------------
  89. INTEGER :: ioptio, ios ! Local integer
  90. !
  91. NAMELIST/namdyn_adv/ ln_dynadv_vec, nn_dynkeg, ln_dynadv_cen2 , ln_dynadv_ubs, ln_dynzad_zts
  92. !!----------------------------------------------------------------------
  93. !
  94. REWIND( numnam_ref ) ! Namelist namdyn_adv in reference namelist : Momentum advection scheme
  95. READ ( numnam_ref, namdyn_adv, IOSTAT = ios, ERR = 901)
  96. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in reference namelist', lwp )
  97. REWIND( numnam_cfg ) ! Namelist namdyn_adv in configuration namelist : Momentum advection scheme
  98. READ ( numnam_cfg, namdyn_adv, IOSTAT = ios, ERR = 902 )
  99. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in configuration namelist', lwp )
  100. IF(lwm) WRITE ( numond, namdyn_adv )
  101. IF(lwp) THEN ! Namelist print
  102. WRITE(numout,*)
  103. WRITE(numout,*) 'dyn_adv_init : choice/control of the momentum advection scheme'
  104. WRITE(numout,*) '~~~~~~~~~~~'
  105. WRITE(numout,*) ' Namelist namdyn_adv : chose a advection formulation & scheme for momentum'
  106. WRITE(numout,*) ' Vector/flux form (T/F) ln_dynadv_vec = ', ln_dynadv_vec
  107. WRITE(numout,*) ' = 0 standard scheme ; =1 Hollingsworth scheme nn_dynkeg = ', nn_dynkeg
  108. WRITE(numout,*) ' 2nd order centred advection scheme ln_dynadv_cen2 = ', ln_dynadv_cen2
  109. WRITE(numout,*) ' 3rd order UBS advection scheme ln_dynadv_ubs = ', ln_dynadv_ubs
  110. WRITE(numout,*) ' Sub timestepping of vertical advection ln_dynzad_zts = ', ln_dynzad_zts
  111. ENDIF
  112. ioptio = 0 ! Parameter control
  113. IF( ln_dynadv_vec ) ioptio = ioptio + 1
  114. IF( ln_dynadv_cen2 ) ioptio = ioptio + 1
  115. IF( ln_dynadv_ubs ) ioptio = ioptio + 1
  116. IF( lk_esopa ) ioptio = 1
  117. IF( ioptio /= 1 ) CALL ctl_stop( 'Choose ONE advection scheme in namelist namdyn_adv' )
  118. IF( ln_dynzad_zts .AND. .NOT. ln_dynadv_vec ) &
  119. CALL ctl_stop( 'Sub timestepping of vertical advection requires vector form; set ln_dynadv_vec = .TRUE.' )
  120. IF( nn_dynkeg /= nkeg_C2 .AND. nn_dynkeg /= nkeg_HW ) &
  121. CALL ctl_stop( 'KEG scheme wrong value of nn_dynkeg' )
  122. ! ! Set nadv
  123. IF( ln_dynadv_vec ) nadv = 0
  124. IF( ln_dynzad_zts ) nadv = 1
  125. IF( ln_dynadv_cen2 ) nadv = 2
  126. IF( ln_dynadv_ubs ) nadv = 3
  127. IF( lk_esopa ) nadv = -1
  128. IF(lwp) THEN ! Print the choice
  129. WRITE(numout,*)
  130. IF( nadv == 0 ) WRITE(numout,*) ' vector form : keg + zad + vor is used'
  131. IF( nadv == 1 ) WRITE(numout,*) ' vector form : keg + zad_zts + vor is used'
  132. IF( nadv == 0 .OR. nadv == 1 ) THEN
  133. IF( nn_dynkeg == nkeg_C2 ) WRITE(numout,*) 'with Centered standard keg scheme'
  134. IF( nn_dynkeg == nkeg_HW ) WRITE(numout,*) 'with Hollingsworth keg scheme'
  135. ENDIF
  136. IF( nadv == 2 ) WRITE(numout,*) ' flux form : 2nd order scheme is used'
  137. IF( nadv == 3 ) WRITE(numout,*) ' flux form : UBS scheme is used'
  138. IF( nadv == -1 ) WRITE(numout,*) ' esopa test: use all advection formulation'
  139. ENDIF
  140. !
  141. END SUBROUTINE dyn_adv_init
  142. !!======================================================================
  143. END MODULE dynadv