dynspg_exp.F90 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. MODULE dynspg_exp
  2. !!======================================================================
  3. !! *** MODULE dynspg_exp ***
  4. !! Ocean dynamics: surface pressure gradient trend
  5. !!======================================================================
  6. !! History : 2.0 ! 2005-11 (V. Garnier, G. Madec, L. Bessieres) Original code
  7. !! 3.2 ! 2009-06 (G. Madec, M. Leclair, R. Benshila) introduce sshwzv module
  8. !!----------------------------------------------------------------------
  9. #if defined key_dynspg_exp || defined key_esopa
  10. !!----------------------------------------------------------------------
  11. !! 'key_dynspg_exp' explicit free surface
  12. !!----------------------------------------------------------------------
  13. !! dyn_spg_exp : update the momentum trend with the surface
  14. !! pressure gradient in the free surface constant
  15. !! volume case with vector optimization
  16. !!----------------------------------------------------------------------
  17. USE oce ! ocean dynamics and tracers
  18. USE dom_oce ! ocean space and time domain
  19. USE sbc_oce ! surface boundary condition: ocean
  20. USE phycst ! physical constants
  21. !
  22. USE in_out_manager ! I/O manager
  23. USE lib_mpp ! distributed memory computing library
  24. USE lbclnk ! ocean lateral boundary conditions (or mpp link)
  25. USE prtctl ! Print control
  26. USE iom ! I/O library
  27. USE timing ! Timing
  28. IMPLICIT NONE
  29. PRIVATE
  30. PUBLIC dyn_spg_exp ! routine called by step.F90
  31. !! * Substitutions
  32. # include "domzgr_substitute.h90"
  33. # include "vectopt_loop_substitute.h90"
  34. !!----------------------------------------------------------------------
  35. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  36. !! $Id: dynspg_exp.F90 4990 2014-12-15 16:42:49Z timgraham $
  37. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  38. !!----------------------------------------------------------------------
  39. CONTAINS
  40. SUBROUTINE dyn_spg_exp( kt )
  41. !!----------------------------------------------------------------------
  42. !! *** routine dyn_spg_exp ***
  43. !!
  44. !! ** Purpose : Compute the now trend due to the surface pressure
  45. !! gradient in case of explicit free surface formulation and
  46. !! add it to the general trend of momentum equation.
  47. !!
  48. !! ** Method : Explicit free surface formulation. Add to the general
  49. !! momentum trend the surface pressure gradient :
  50. !! (ua,va) = (ua,va) + (spgu,spgv)
  51. !! where spgu = -1/rau0 d/dx(ps) = -g/e1u di( sshn )
  52. !! spgv = -1/rau0 d/dy(ps) = -g/e2v dj( sshn )
  53. !!
  54. !! ** Action : (ua,va) trend of horizontal velocity increased by
  55. !! the surf. pressure gradient trend
  56. !!---------------------------------------------------------------------
  57. INTEGER, INTENT(in) :: kt ! ocean time-step index
  58. !!
  59. INTEGER :: ji, jj, jk ! dummy loop indices
  60. !!----------------------------------------------------------------------
  61. !
  62. IF( nn_timing == 1 ) CALL timing_start('dyn_spg_exp')
  63. !
  64. IF( kt == nit000 ) THEN
  65. IF(lwp) WRITE(numout,*)
  66. IF(lwp) WRITE(numout,*) 'dyn_spg_exp : surface pressure gradient trend'
  67. IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ (explicit free surface)'
  68. !
  69. spgu(:,:) = 0._wp ; spgv(:,:) = 0._wp
  70. !
  71. IF( lk_vvl .AND. lwp ) WRITE(numout,*) ' lk_vvl=T : spg is included in dynhpg'
  72. ENDIF
  73. IF( .NOT. lk_vvl ) THEN !* fixed volume : add the surface pressure gradient trend
  74. !
  75. DO jj = 2, jpjm1 ! now surface pressure gradient
  76. DO ji = fs_2, fs_jpim1 ! vector opt.
  77. spgu(ji,jj) = - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj)
  78. spgv(ji,jj) = - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj)
  79. END DO
  80. END DO
  81. !
  82. DO jk = 1, jpkm1 ! Add it to the general trend
  83. DO jj = 2, jpjm1
  84. DO ji = fs_2, fs_jpim1 ! vector opt.
  85. ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj)
  86. va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj)
  87. END DO
  88. END DO
  89. END DO
  90. !
  91. ENDIF
  92. !
  93. IF( nn_timing == 1 ) CALL timing_stop('dyn_spg_exp')
  94. !
  95. END SUBROUTINE dyn_spg_exp
  96. #else
  97. !!----------------------------------------------------------------------
  98. !! Default case : Empty module No standart explicit free surface
  99. !!----------------------------------------------------------------------
  100. CONTAINS
  101. SUBROUTINE dyn_spg_exp( kt ) ! Empty routine
  102. WRITE(*,*) 'dyn_spg_exp: You should not have seen this print! error?', kt
  103. END SUBROUTINE dyn_spg_exp
  104. #endif
  105. !!======================================================================
  106. END MODULE dynspg_exp