tideini.F90 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. MODULE tideini
  2. !!======================================================================
  3. !! *** MODULE tideini ***
  4. !! Initialization of tidal forcing
  5. !!======================================================================
  6. !! History : 1.0 ! 2007 (O. Le Galloudec) Original code
  7. !!----------------------------------------------------------------------
  8. USE oce ! ocean dynamics and tracers variables
  9. USE dom_oce ! ocean space and time domain
  10. USE phycst
  11. USE daymod
  12. USE dynspg_oce
  13. USE tide_mod
  14. !
  15. USE iom
  16. USE in_out_manager ! I/O units
  17. USE ioipsl ! NetCDF IPSL library
  18. USE lbclnk ! ocean lateral boundary conditions (or mpp link)
  19. IMPLICIT NONE
  20. PUBLIC
  21. REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) :: omega_tide !:
  22. REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) :: v0tide !:
  23. REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) :: utide !:
  24. REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:) :: ftide !:
  25. LOGICAL , PUBLIC :: ln_tide_pot !:
  26. LOGICAL , PUBLIC :: ln_tide_ramp !:
  27. INTEGER , PUBLIC :: nb_harmo !:
  28. INTEGER , PUBLIC :: kt_tide !:
  29. REAL(wp), PUBLIC :: rdttideramp !:
  30. INTEGER , PUBLIC, ALLOCATABLE, DIMENSION(:) :: ntide !:
  31. !!----------------------------------------------------------------------
  32. !! NEMO/OPA 3.5 , NEMO Consortium (2013)
  33. !! $Id: tideini.F90 2355 2015-05-20 07:11:50Z ufla $
  34. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  35. !!----------------------------------------------------------------------
  36. CONTAINS
  37. SUBROUTINE tide_init ( kt )
  38. !!----------------------------------------------------------------------
  39. !! *** ROUTINE tide_init ***
  40. !!----------------------------------------------------------------------
  41. !! * Local declarations
  42. INTEGER :: ji, jk
  43. INTEGER, INTENT( in ) :: kt ! ocean time-step
  44. CHARACTER(LEN=4), DIMENSION(jpmax_harmo) :: clname
  45. INTEGER :: ios ! Local integer output status for namelist read
  46. !
  47. NAMELIST/nam_tide/ln_tide_pot, ln_tide_ramp, rdttideramp, clname
  48. !!----------------------------------------------------------------------
  49. IF ( kt == nit000 ) THEN
  50. !
  51. IF(lwp) THEN
  52. WRITE(numout,*)
  53. WRITE(numout,*) 'tide_init : Initialization of the tidal components'
  54. WRITE(numout,*) '~~~~~~~~~ '
  55. ENDIF
  56. !
  57. CALL tide_init_Wave
  58. !
  59. ! Read Namelist nam_tide
  60. REWIND( numnam_ref ) ! Namelist nam_tide in reference namelist : Tides
  61. READ ( numnam_ref, nam_tide, IOSTAT = ios, ERR = 901)
  62. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_tide in reference namelist', lwp )
  63. REWIND( numnam_cfg ) ! Namelist nam_tide in configuration namelist : Tides
  64. READ ( numnam_cfg, nam_tide, IOSTAT = ios, ERR = 902 )
  65. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_tide in configuration namelist', lwp )
  66. IF(lwm) WRITE ( numond, nam_tide )
  67. !
  68. nb_harmo=0
  69. DO jk = 1, jpmax_harmo
  70. DO ji = 1,jpmax_harmo
  71. IF( TRIM(clname(jk)) == Wave(ji)%cname_tide ) nb_harmo = nb_harmo + 1
  72. END DO
  73. END DO
  74. !
  75. ! Ensure that tidal components have been set in namelist_cfg
  76. IF( nb_harmo .EQ. 0 ) CALL ctl_stop( 'tide_init : No tidal components set in nam_tide' )
  77. !
  78. IF(lwp) THEN
  79. WRITE(numout,*) ' Namelist nam_tide'
  80. WRITE(numout,*) ' Apply astronomical potential : ln_tide_pot =', ln_tide_pot
  81. WRITE(numout,*) ' nb_harmo = ', nb_harmo
  82. WRITE(numout,*) ' ln_tide_ramp = ', ln_tide_ramp
  83. WRITE(numout,*) ' rdttideramp = ', rdttideramp
  84. ENDIF
  85. IF( ln_tide_ramp.AND.((nitend-nit000+1)*rdt/rday < rdttideramp) ) &
  86. & CALL ctl_stop('rdttideramp must be lower than run duration')
  87. IF( ln_tide_ramp.AND.(rdttideramp<0.) ) &
  88. & CALL ctl_stop('rdttideramp must be positive')
  89. !
  90. IF( .NOT. lk_dynspg_ts ) CALL ctl_warn( 'sbc_tide : use of time splitting is recommended' )
  91. !
  92. ALLOCATE( ntide(nb_harmo) )
  93. DO jk = 1, nb_harmo
  94. DO ji = 1, jpmax_harmo
  95. IF( TRIM(clname(jk)) .eq. Wave(ji)%cname_tide ) THEN
  96. ntide(jk) = ji
  97. EXIT
  98. END IF
  99. END DO
  100. END DO
  101. !
  102. ALLOCATE( omega_tide(nb_harmo), v0tide (nb_harmo), &
  103. & utide (nb_harmo), ftide (nb_harmo) )
  104. kt_tide = kt
  105. !
  106. ENDIF
  107. !
  108. END SUBROUTINE tide_init
  109. !!======================================================================
  110. END MODULE tideini