updtide.F90 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. MODULE updtide
  2. !!======================================================================
  3. !! *** MODULE updtide ***
  4. !! Initialization of tidal forcing
  5. !!======================================================================
  6. !! History : 9.0 ! 07 (O. Le Galloudec) Original code
  7. !!----------------------------------------------------------------------
  8. #if defined key_tide
  9. !!----------------------------------------------------------------------
  10. !! 'key_tide' : tidal potential
  11. !!----------------------------------------------------------------------
  12. !! upd_tide : update tidal potential
  13. !!----------------------------------------------------------------------
  14. USE oce ! ocean dynamics and tracers variables
  15. USE dom_oce ! ocean space and time domain
  16. USE in_out_manager ! I/O units
  17. USE phycst ! physical constant
  18. USE sbctide ! tide potential variable
  19. USE tideini, ONLY: ln_tide_ramp, rdttideramp
  20. IMPLICIT NONE
  21. PUBLIC
  22. PUBLIC upd_tide ! called in dynspg_... modules
  23. !!----------------------------------------------------------------------
  24. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  25. !! $Id: updtide.F90 2678 2015-11-26 09:59:07Z ufla $
  26. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  27. !!----------------------------------------------------------------------
  28. CONTAINS
  29. SUBROUTINE upd_tide( kt, kit, time_offset )
  30. !!----------------------------------------------------------------------
  31. !! *** ROUTINE upd_tide ***
  32. !!
  33. !! ** Purpose : provide at each time step the astronomical potential
  34. !!
  35. !! ** Method : computed from pulsation and amplitude of all tide components
  36. !!
  37. !! ** Action : pot_astro actronomical potential
  38. !!----------------------------------------------------------------------
  39. INTEGER, INTENT(in) :: kt ! ocean time-step index
  40. INTEGER, INTENT(in), OPTIONAL :: kit ! external mode sub-time-step index (lk_dynspg_ts=T)
  41. INTEGER, INTENT(in), OPTIONAL :: time_offset ! time offset in number
  42. ! of internal steps (lk_dynspg_ts=F)
  43. ! of external steps (lk_dynspg_ts=T)
  44. !
  45. INTEGER :: joffset ! local integer
  46. INTEGER :: ji, jj, jk ! dummy loop indices
  47. REAL(wp) :: zt, zramp ! local scalar
  48. REAL(wp), DIMENSION(nb_harmo) :: zwt
  49. !!----------------------------------------------------------------------
  50. !
  51. ! ! tide pulsation at model time step (or sub-time-step)
  52. zt = ( kt - kt_tide ) * rdt
  53. !
  54. joffset = 0
  55. IF( PRESENT( time_offset ) ) joffset = time_offset
  56. !
  57. IF( PRESENT( kit ) ) THEN
  58. zt = zt + ( kit + joffset - 1 ) * rdt / REAL( nn_baro, wp )
  59. ELSE
  60. zt = zt + joffset * rdt
  61. ENDIF
  62. !
  63. zwt(:) = omega_tide(:) * zt
  64. pot_astro(:,:) = 0._wp ! update tidal potential (sum of all harmonics)
  65. DO jk = 1, nb_harmo
  66. pot_astro(:,:) = pot_astro(:,:) + amp_pot(:,:,jk) * COS( zwt(jk) + phi_pot(:,:,jk) )
  67. END DO
  68. !
  69. IF( ln_tide_ramp ) THEN ! linear increase if asked
  70. zt = ( kt - nit000 ) * rdt
  71. IF( PRESENT( kit ) ) zt = zt + ( kit + joffset -1) * rdt / REAL( nn_baro, wp )
  72. zramp = MIN( MAX( zt / (rdttideramp*rday) , 0._wp ) , 1._wp )
  73. pot_astro(:,:) = zramp * pot_astro(:,:)
  74. ENDIF
  75. !
  76. END SUBROUTINE upd_tide
  77. #else
  78. !!----------------------------------------------------------------------
  79. !! Dummy module : NO TIDE
  80. !!----------------------------------------------------------------------
  81. CONTAINS
  82. SUBROUTINE upd_tide( kt, kit, time_offset ) ! Empty routine
  83. INTEGER, INTENT(in) :: kt ! integer arg, dummy routine
  84. INTEGER, INTENT(in), OPTIONAL :: kit ! optional arg, dummy routine
  85. INTEGER, INTENT(in), OPTIONAL :: time_offset ! optional arg, dummy routine
  86. WRITE(*,*) 'upd_tide: You should not have seen this print! error?', kt
  87. END SUBROUTINE upd_tide
  88. #endif
  89. !!======================================================================
  90. END MODULE updtide