crslbclnk.F90 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. MODULE crslbclnk
  2. !!======================================================================
  3. !! *** MODULE crslbclnk ***
  4. !! A temporary solution for lbclnk for coarsened grid.
  5. !! Ocean : lateral boundary conditions for grid coarsening
  6. !!=====================================================================
  7. !! History : ! 2012-06 (J. Simeon, G. Madec, C. Ethe, C. Calone) Original code
  8. USE dom_oce
  9. USE crs
  10. USE lbclnk
  11. USE par_kind, ONLY: wp
  12. USE in_out_manager
  13. INTERFACE crs_lbc_lnk
  14. MODULE PROCEDURE crs_lbc_lnk_3d, crs_lbc_lnk_3d_gather, crs_lbc_lnk_2d
  15. END INTERFACE
  16. PUBLIC crs_lbc_lnk
  17. !! $Id: crslbclnk.F90 2355 2015-05-20 07:11:50Z ufla $
  18. CONTAINS
  19. SUBROUTINE crs_lbc_lnk_3d( pt3d1, cd_type1, psgn, cd_mpp, pval )
  20. !!---------------------------------------------------------------------
  21. !! *** SUBROUTINE crs_lbc_lnk ***
  22. !!
  23. !! ** Purpose : set lateral boundary conditions for coarsened grid
  24. !!
  25. !! ** Method : Swap domain indices from full to coarse domain
  26. !! before arguments are passed directly to lbc_lnk.
  27. !! Upon exiting, switch back to full domain indices.
  28. !!----------------------------------------------------------------------
  29. !! Arguments
  30. CHARACTER(len=1) , INTENT(in ) :: cd_type1 ! grid type
  31. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  32. REAL(wp), DIMENSION(jpi_crs,jpj_crs,jpk), INTENT(inout) :: pt3d1 ! 3D array on which the lbc is applied
  33. REAL(wp) , INTENT(in ), OPTIONAL :: pval ! valeur sur les halo
  34. CHARACTER(len=3) , INTENT(in ), OPTIONAL :: cd_mpp ! MPP only (here do nothing)
  35. !! local vairables
  36. LOGICAL :: ll_grid_crs
  37. REAL(wp) :: zval ! valeur sur les halo
  38. !!----------------------------------------------------------------------
  39. ll_grid_crs = ( jpi == jpi_crs )
  40. IF( PRESENT(pval) ) THEN ; zval = pval
  41. ELSE ; zval = 0.0
  42. ENDIF
  43. IF( .NOT. ll_grid_crs ) CALL dom_grid_crs ! Save the parent grid information & Switch to coarse grid domain
  44. IF( PRESENT( cd_mpp ) ) THEN ; CALL lbc_lnk( pt3d1, cd_type1, psgn, cd_mpp, pval=zval )
  45. ELSE ; CALL lbc_lnk( pt3d1, cd_type1, psgn, pval=zval )
  46. ENDIF
  47. IF( .NOT. ll_grid_crs ) CALL dom_grid_glo ! Return to parent grid domain
  48. END SUBROUTINE crs_lbc_lnk_3d
  49. SUBROUTINE crs_lbc_lnk_3d_gather( pt3d1, cd_type1, pt3d2, cd_type2, psgn )
  50. !!---------------------------------------------------------------------
  51. !! *** SUBROUTINE crs_lbc_lnk ***
  52. !!
  53. !! ** Purpose : set lateral boundary conditions for coarsened grid
  54. !!
  55. !! ** Method : Swap domain indices from full to coarse domain
  56. !! before arguments are passed directly to lbc_lnk.
  57. !! Upon exiting, switch back to full domain indices.
  58. !!----------------------------------------------------------------------
  59. !! Arguments
  60. CHARACTER(len=1) , INTENT(in ) :: cd_type1,cd_type2 ! grid type
  61. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  62. REAL(wp), DIMENSION(jpi_crs,jpj_crs,jpk), INTENT(inout) :: pt3d1,pt3d2 ! 3D array on which the lbc is applied
  63. !! local vairables
  64. LOGICAL :: ll_grid_crs
  65. !!----------------------------------------------------------------------
  66. ll_grid_crs = ( jpi == jpi_crs )
  67. IF( .NOT. ll_grid_crs ) CALL dom_grid_crs ! Save the parent grid information & Switch to coarse grid domain
  68. CALL lbc_lnk( pt3d1, cd_type1, pt3d2, cd_type2, psgn )
  69. IF( .NOT. ll_grid_crs ) CALL dom_grid_glo ! Return to parent grid domain
  70. END SUBROUTINE crs_lbc_lnk_3d_gather
  71. SUBROUTINE crs_lbc_lnk_2d(pt2d, cd_type, psgn, cd_mpp, pval)
  72. !!---------------------------------------------------------------------
  73. !! *** SUBROUTINE crs_lbc_lnk ***
  74. !!
  75. !! ** Purpose : set lateral boundary conditions for coarsened grid
  76. !!
  77. !! ** Method : Swap domain indices from full to coarse domain
  78. !! before arguments are passed directly to lbc_lnk.
  79. !! Upon exiting, switch back to full domain indices.
  80. !!----------------------------------------------------------------------
  81. !! Arguments
  82. CHARACTER(len=1) , INTENT(in ) :: cd_type ! grid type
  83. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  84. REAL(wp), DIMENSION(jpi_crs,jpj_crs), INTENT(inout) :: pt2d ! 2D array on which the lbc is applied
  85. REAL(wp) , INTENT(in ), OPTIONAL :: pval ! valeur sur les halo
  86. CHARACTER(len=3) , INTENT(in ), OPTIONAL :: cd_mpp ! MPP only (here do nothing)
  87. !! local variables
  88. LOGICAL :: ll_grid_crs
  89. REAL(wp) :: zval ! valeur sur les halo
  90. !!----------------------------------------------------------------------
  91. ll_grid_crs = ( jpi == jpi_crs )
  92. IF( PRESENT(pval) ) THEN ; zval = pval
  93. ELSE ; zval = 0.0
  94. ENDIF
  95. IF( .NOT. ll_grid_crs ) CALL dom_grid_crs ! Save the parent grid information & Switch to coarse grid domain
  96. IF( PRESENT( cd_mpp ) ) THEN ; CALL lbc_lnk( pt2d, cd_type, psgn, cd_mpp, pval=zval )
  97. ELSE ; CALL lbc_lnk( pt2d, cd_type, psgn, pval=zval )
  98. ENDIF
  99. IF( .NOT. ll_grid_crs ) CALL dom_grid_glo ! Return to parent grid domain
  100. END SUBROUTINE crs_lbc_lnk_2d
  101. END MODULE crslbclnk