dynnxt_c1d.F90 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. MODULE dynnxt_c1d
  2. !!======================================================================
  3. !! *** MODULE dynnxt_c1d ***
  4. !! Ocean dynamics: time stepping in 1D configuration
  5. !!======================================================================
  6. !! History : 2.0 ! 2004-10 (C. Ethe) Original code from dynnxt.F90
  7. !! 3.0 ! 2008-04 (G.madec) Style only
  8. !!----------------------------------------------------------------------
  9. #if defined key_c1d
  10. !!----------------------------------------------------------------------
  11. !! 'key_c1d' 1D Configuration
  12. !!----------------------------------------------------------------------
  13. !! dyn_nxt_c1d : update the horizontal velocity from the momentum trend
  14. !!----------------------------------------------------------------------
  15. USE oce ! ocean dynamics and tracers
  16. USE dom_oce ! ocean space and time domain
  17. USE in_out_manager ! I/O manager
  18. USE lbclnk ! lateral boundary condition (or mpp link)
  19. USE prtctl ! Print control
  20. IMPLICIT NONE
  21. PRIVATE
  22. PUBLIC dyn_nxt_c1d ! routine called by step.F90
  23. !!----------------------------------------------------------------------
  24. !! NEMO/C1D 3.3 , NEMO Consortium (2010)
  25. !! $Id: dynnxt_c1d.F90 2355 2015-05-20 07:11:50Z ufla $
  26. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  27. !!----------------------------------------------------------------------
  28. CONTAINS
  29. SUBROUTINE dyn_nxt_c1d ( kt )
  30. !!----------------------------------------------------------------------
  31. !! *** ROUTINE dyn_nxt_c1d ***
  32. !!
  33. !! ** Purpose : Compute the after horizontal velocity from the momentum trend.
  34. !!
  35. !! ** Method : Apply lateral boundary conditions on the trends (ua,va)
  36. !! through calls to routine lbc_lnk.
  37. !! After velocity is compute using a leap-frog scheme environment:
  38. !! (ua,va) = (ub,vb) + 2 rdt (ua,va)
  39. !! Time filter applied on now horizontal velocity to avoid the
  40. !! divergence of two consecutive time-steps and swap of dynamics
  41. !! arrays to start the next time step:
  42. !! (ub,vb) = (un,vn) + atfp [ (ub,vb) + (ua,va) - 2 (un,vn) ]
  43. !! (un,vn) = (ua,va)
  44. !!
  45. !! ** Action : - Update ub,vb arrays, the before horizontal velocity
  46. !! - Update un,vn arrays, the now horizontal velocity
  47. !!----------------------------------------------------------------------
  48. INTEGER, INTENT( in ) :: kt ! ocean time-step index
  49. !!
  50. INTEGER :: jk ! dummy loop indices
  51. REAL(wp) :: z2dt ! temporary scalar
  52. !!----------------------------------------------------------------------
  53. IF( kt == nit000 ) THEN
  54. IF(lwp) WRITE(numout,*)
  55. IF(lwp) WRITE(numout,*) 'dyn_nxt_c1d : time stepping on 1D configuation'
  56. IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
  57. ENDIF
  58. z2dt = 2._wp * rdt ! Local constant initialization
  59. IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt
  60. CALL lbc_lnk( ua, 'U', -1. ) ; CALL lbc_lnk( va, 'V', -1. ) ! Lateral boundary conditions
  61. DO jk = 1, jpkm1 ! Next Velocity
  62. ua(:,:,jk) = ( ub(:,:,jk) + z2dt * ua(:,:,jk) ) * umask(:,:,jk)
  63. va(:,:,jk) = ( vb(:,:,jk) + z2dt * va(:,:,jk) ) * vmask(:,:,jk)
  64. END DO
  65. DO jk = 1, jpkm1 ! Time filter and swap of dynamics arrays
  66. IF( neuler == 0 .AND. kt == nit000 ) THEN ! Euler (forward) time stepping
  67. ub(:,:,jk) = un(:,:,jk)
  68. vb(:,:,jk) = vn(:,:,jk)
  69. un(:,:,jk) = ua(:,:,jk)
  70. vn(:,:,jk) = va(:,:,jk)
  71. ELSE ! Leap-frog time stepping
  72. ub(:,:,jk) = atfp * ( ub(:,:,jk) + ua(:,:,jk) ) + atfp1 * un(:,:,jk)
  73. vb(:,:,jk) = atfp * ( vb(:,:,jk) + va(:,:,jk) ) + atfp1 * vn(:,:,jk)
  74. un(:,:,jk) = ua(:,:,jk)
  75. vn(:,:,jk) = va(:,:,jk)
  76. ENDIF
  77. END DO
  78. IF(ln_ctl) CALL prt_ctl( tab3d_1=un, clinfo1=' nxt_c1d - Un: ', mask1=umask, &
  79. & tab3d_2=vn, clinfo2=' Vn: ' , mask2=vmask )
  80. !
  81. END SUBROUTINE dyn_nxt_c1d
  82. #else
  83. !!----------------------------------------------------------------------
  84. !! Default key NO 1D Config
  85. !!----------------------------------------------------------------------
  86. CONTAINS
  87. SUBROUTINE dyn_nxt_c1d ( kt )
  88. WRITE(*,*) 'dyn_nxt_c1d: You should not have seen this print! error?', kt
  89. END SUBROUTINE dyn_nxt_c1d
  90. #endif
  91. !!======================================================================
  92. END MODULE dynnxt_c1d