lbclnk.f90 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. MODULE lbclnk
  2. !!======================================================================
  3. !! *** MODULE lbclnk ***
  4. !! Ocean : lateral boundary conditions
  5. !!=====================================================================
  6. !! OPA 9.0 , LOCEAN-IPSL (2005)
  7. !! $Id: lbclnk.F90 1344 2009-03-27 14:02:19Z rblod $
  8. !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
  9. !!----------------------------------------------------------------------
  10. !!----------------------------------------------------------------------
  11. !! Default option shared memory computing
  12. !!----------------------------------------------------------------------
  13. !! lbc_lnk : generic interface for lbc_lnk_3d and lbc_lnk_2d
  14. !! lbc_lnk_3d : set the lateral boundary condition on a 3D variable
  15. !! on OPA ocean mesh
  16. !! lbc_lnk_2d : set the lateral boundary condition on a 2D variable
  17. !! on OPA ocean mesh
  18. !!----------------------------------------------------------------------
  19. !! * Modules used
  20. ! USE oce ! ocean dynamics and tracers
  21. USE dom_oce ! ocean space and time domain
  22. ! USE in_out_manager ! I/O manager
  23. USE lbcnfd ! north fold
  24. IMPLICIT NONE
  25. PRIVATE
  26. PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions
  27. !!----------------------------------------------------------------------
  28. CONTAINS
  29. SUBROUTINE lbc_lnk( pt2d, cd_type, psgn, cd_mpp, pval )
  30. !!---------------------------------------------------------------------
  31. !! *** ROUTINE lbc_lnk_2d ***
  32. !!
  33. !! ** Purpose : set lateral boundary conditions (non mpp case)
  34. !!
  35. !! ** Method :
  36. !!
  37. !! History :
  38. !! ! 97-06 (G. Madec) Original code
  39. !! ! 01-05 (E. Durand) correction
  40. !! 8.5 ! 02-09 (G. Madec) F90: Free form and module
  41. !! ! 09-03 (R. Benshila) External north fold treatment
  42. !!----------------------------------------------------------------------
  43. !! * Arguments
  44. CHARACTER(len=1), INTENT( in ) :: &
  45. cd_type ! nature of pt2d grid-point
  46. ! ! = T , U , V , F or W gridpoints
  47. ! ! = I sea-ice U-V gridpoint (= F ocean grid point with indice shift)
  48. REAL(wp), INTENT( in ) :: &
  49. psgn ! control of the sign change
  50. ! ! =-1 , the sign is modified following the type of b.c. used
  51. ! ! = 1 , no sign change
  52. REAL(wp), DIMENSION(jpi,jpj), INTENT( inout ) :: &
  53. pt2d ! 2D array on which the boundary condition is applied
  54. CHARACTER(len=3), INTENT( in ), OPTIONAL :: &
  55. cd_mpp ! fill the overlap area only (here do nothing)
  56. REAL(wp) , INTENT(in ), OPTIONAL :: pval ! background value (used at closed boundaries)
  57. !! * Local declarations
  58. REAL(wp) :: zland
  59. IF( PRESENT( pval ) ) THEN ! set land value (zero by default)
  60. zland = pval
  61. ELSE
  62. zland = 0.e0
  63. ENDIF
  64. IF (PRESENT(cd_mpp)) THEN
  65. ! only fill the overlap area and extra allows
  66. ! this is in mpp case. In this module, just do nothing
  67. ELSE
  68. ! ! East-West boundaries
  69. ! ! ====================
  70. SELECT CASE ( nperio )
  71. !
  72. CASE ( 1 , 4 , 6 ) !** cyclic east-west
  73. pt2d( 1 ,:) = pt2d(jpim1,:) ! all points
  74. pt2d(jpi,:) = pt2d( 2 ,:)
  75. !
  76. CASE DEFAULT !** East closed -- West closed
  77. SELECT CASE ( cd_type )
  78. CASE ( 'T' , 'U' , 'V' , 'W' ) ! T-, U-, V-, W-points
  79. pt2d( 1 ,:) = zland
  80. pt2d(jpi,:) = zland
  81. CASE ( 'F' ) ! F-point
  82. pt2d(jpi,:) = zland
  83. END SELECT
  84. !
  85. END SELECT
  86. ! ! North-South boundaries
  87. ! ! ======================
  88. SELECT CASE ( nperio )
  89. !
  90. CASE ( 2 ) !** South symmetric -- North closed
  91. SELECT CASE ( cd_type )
  92. CASE ( 'T' , 'U' , 'W' ) ! T-, U-, W-points
  93. pt2d(:, 1 ) = pt2d(:,3)
  94. pt2d(:,jpj) = zland
  95. CASE ( 'V' , 'F' ) ! V-, F-points
  96. pt2d(:, 1 ) = psgn * pt2d(:,2)
  97. pt2d(:,jpj) = zland
  98. END SELECT
  99. !
  100. CASE ( 3 , 4 , 5 , 6 ) !** North fold T or F-point pivot -- South closed
  101. SELECT CASE ( cd_type ) ! South : closed
  102. CASE ( 'T' , 'U' , 'V' , 'W' , 'I' ) ! all points except F-point
  103. pt2d(:, 1 ) = zland
  104. END SELECT
  105. ! ! North fold
  106. pt2d( 1 ,1 ) = zland
  107. pt2d( 1 ,jpj) = zland
  108. pt2d(jpi,jpj) = zland
  109. CALL lbc_nfd( pt2d(:,:), cd_type, psgn )
  110. !
  111. CASE DEFAULT !** North closed -- South closed
  112. SELECT CASE ( cd_type )
  113. CASE ( 'T' , 'U' , 'V' , 'W' ) ! T-, U-, V-, W-points
  114. pt2d(:, 1 ) = zland
  115. pt2d(:,jpj) = zland
  116. CASE ( 'F' ) ! F-point
  117. pt2d(:,jpj) = zland
  118. END SELECT
  119. !
  120. END SELECT
  121. ENDIF
  122. END SUBROUTINE lbc_lnk
  123. !!======================================================================
  124. END MODULE lbclnk