lbclnk.F90 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. MODULE lbclnk
  2. !!======================================================================
  3. !! *** MODULE lbclnk ***
  4. !! Ocean : lateral boundary conditions
  5. !!=====================================================================
  6. !! History : OPA ! 1997-06 (G. Madec) Original code
  7. !! NEMO 1.0 ! 2002-09 (G. Madec) F90: Free form and module
  8. !! 3.2 ! 2009-03 (R. Benshila) External north fold treatment
  9. !! 3.5 ! 2012 (S.Mocavero, I. Epicoco) Add 'lbc_bdy_lnk'
  10. !! and lbc_obc_lnk' routine to optimize
  11. !! the BDY/OBC communications
  12. !! 3.4 ! 2012-12 (R. Bourdalle-Badie and G. Reffray) add a C1D case
  13. !! 3.6 ! 2015-06 (O. Tintó and M. Castrillo) add lbc_lnk_multi
  14. !!----------------------------------------------------------------------
  15. #if defined key_mpp_mpi
  16. !!----------------------------------------------------------------------
  17. !! 'key_mpp_mpi' MPI massively parallel processing library
  18. !!----------------------------------------------------------------------
  19. !! lbc_lnk : generic interface for mpp_lnk_3d and mpp_lnk_2d routines defined in lib_mpp
  20. !! lbc_lnk_e : generic interface for mpp_lnk_2d_e routine defined in lib_mpp
  21. !! lbc_bdy_lnk : generic interface for mpp_lnk_bdy_2d and mpp_lnk_bdy_3d routines defined in lib_mpp
  22. !!----------------------------------------------------------------------
  23. USE lib_mpp ! distributed memory computing library
  24. INTERFACE lbc_lnk_multi
  25. MODULE PROCEDURE mpp_lnk_2d_9, mpp_lnk_2d_multiple
  26. END INTERFACE
  27. INTERFACE lbc_lnk
  28. MODULE PROCEDURE mpp_lnk_3d_gather, mpp_lnk_3d, mpp_lnk_2d
  29. END INTERFACE
  30. INTERFACE lbc_bdy_lnk
  31. MODULE PROCEDURE mpp_lnk_bdy_2d, mpp_lnk_bdy_3d
  32. END INTERFACE
  33. INTERFACE lbc_lnk_e
  34. MODULE PROCEDURE mpp_lnk_2d_e
  35. END INTERFACE
  36. INTERFACE lbc_lnk_icb
  37. MODULE PROCEDURE mpp_lnk_2d_icb
  38. END INTERFACE
  39. PUBLIC lbc_lnk ! ocean lateral boundary conditions
  40. PUBLIC lbc_lnk_multi ! modified ocean lateral boundary conditions
  41. PUBLIC lbc_lnk_e
  42. PUBLIC lbc_bdy_lnk ! ocean lateral BDY boundary conditions
  43. PUBLIC lbc_lnk_icb
  44. !!----------------------------------------------------------------------
  45. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  46. !! $Id: lbclnk.F90 4990 2014-12-15 16:42:49Z timgraham $
  47. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  48. !!----------------------------------------------------------------------
  49. #else
  50. !!----------------------------------------------------------------------
  51. !! Default option shared memory computing
  52. !!----------------------------------------------------------------------
  53. !! lbc_lnk : generic interface for lbc_lnk_3d and lbc_lnk_2d
  54. !! lbc_lnk_3d : set the lateral boundary condition on a 3D variable on ocean mesh
  55. !! lbc_lnk_2d : set the lateral boundary condition on a 2D variable on ocean mesh
  56. !! lbc_bdy_lnk : set the lateral BDY boundary condition
  57. !!----------------------------------------------------------------------
  58. USE oce ! ocean dynamics and tracers
  59. USE dom_oce ! ocean space and time domain
  60. USE in_out_manager ! I/O manager
  61. USE lbcnfd ! north fold
  62. IMPLICIT NONE
  63. PRIVATE
  64. INTERFACE lbc_lnk
  65. MODULE PROCEDURE lbc_lnk_3d_gather, lbc_lnk_3d, lbc_lnk_2d
  66. END INTERFACE
  67. INTERFACE lbc_lnk_e
  68. MODULE PROCEDURE lbc_lnk_2d_e
  69. END INTERFACE
  70. INTERFACE lbc_lnk_multi
  71. MODULE PROCEDURE lbc_lnk_2d_9, lbc_lnk_2d_multiple
  72. END INTERFACE
  73. INTERFACE lbc_bdy_lnk
  74. MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d
  75. END INTERFACE
  76. INTERFACE lbc_lnk_icb
  77. MODULE PROCEDURE lbc_lnk_2d_e
  78. END INTERFACE
  79. TYPE arrayptr
  80. REAL , DIMENSION (:,:), POINTER :: pt2d
  81. END TYPE arrayptr
  82. PUBLIC arrayptr
  83. PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions
  84. PUBLIC lbc_lnk_e
  85. PUBLIC lbc_lnk_multi ! modified ocean lateral boundary conditions
  86. PUBLIC lbc_bdy_lnk ! ocean lateral BDY boundary conditions
  87. PUBLIC lbc_lnk_icb
  88. !!----------------------------------------------------------------------
  89. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  90. !! $Id: lbclnk.F90 4990 2014-12-15 16:42:49Z timgraham $
  91. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  92. !!----------------------------------------------------------------------
  93. CONTAINS
  94. # if defined key_c1d
  95. !!----------------------------------------------------------------------
  96. !! 'key_c1d' 1D configuration
  97. !!----------------------------------------------------------------------
  98. SUBROUTINE lbc_lnk_3d_gather( pt3d1, cd_type1, pt3d2, cd_type2, psgn )
  99. !!---------------------------------------------------------------------
  100. !! *** ROUTINE lbc_lnk_3d_gather ***
  101. !!
  102. !! ** Purpose : set lateral boundary conditions on two 3D arrays (C1D case)
  103. !!
  104. !! ** Method : call lbc_lnk_3d on pt3d1 and pt3d2
  105. !!----------------------------------------------------------------------
  106. CHARACTER(len=1) , INTENT(in ) :: cd_type1, cd_type2 ! nature of pt3d grid-points
  107. REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pt3d1 , pt3d2 ! 3D array on which the lbc is applied
  108. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  109. !!----------------------------------------------------------------------
  110. !
  111. CALL lbc_lnk_3d( pt3d1, cd_type1, psgn)
  112. CALL lbc_lnk_3d( pt3d2, cd_type2, psgn)
  113. !
  114. END SUBROUTINE lbc_lnk_3d_gather
  115. SUBROUTINE lbc_lnk_3d( pt3d, cd_type, psgn, cd_mpp, pval )
  116. !!---------------------------------------------------------------------
  117. !! *** ROUTINE lbc_lnk_3d ***
  118. !!
  119. !! ** Purpose : set lateral boundary conditions on a 3D array (C1D case)
  120. !!
  121. !! ** Method : 1D case, the central water column is set everywhere
  122. !!----------------------------------------------------------------------
  123. CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points
  124. REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pt3d ! 3D array on which the lbc is applied
  125. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  126. CHARACTER(len=3) , INTENT(in ), OPTIONAL :: cd_mpp ! MPP only (here do nothing)
  127. REAL(wp) , INTENT(in ), OPTIONAL :: pval ! background value (for closed boundaries)
  128. !
  129. INTEGER :: jk ! dummy loop index
  130. REAL(wp) :: ztab ! local scalar
  131. !!----------------------------------------------------------------------
  132. !
  133. DO jk = 1, jpk
  134. ztab = pt3d(2,2,jk)
  135. pt3d(:,:,jk) = ztab
  136. END DO
  137. !
  138. END SUBROUTINE lbc_lnk_3d
  139. SUBROUTINE lbc_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
  140. !!---------------------------------------------------------------------
  141. !! *** ROUTINE lbc_lnk_2d ***
  142. !!
  143. !! ** Purpose : set lateral boundary conditions on a 2D array (non mpp case)
  144. !!
  145. !! ** Method : 1D case, the central water column is set everywhere
  146. !!----------------------------------------------------------------------
  147. CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points
  148. REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pt2d ! 2D array on which the lbc is applied
  149. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  150. CHARACTER(len=3) , INTENT(in ), OPTIONAL :: cd_mpp ! MPP only (here do nothing)
  151. REAL(wp) , INTENT(in ), OPTIONAL :: pval ! background value (for closed boundaries)
  152. !
  153. REAL(wp) :: ztab ! local scalar
  154. !!----------------------------------------------------------------------
  155. !
  156. ztab = pt2d(2,2)
  157. pt2d(:,:) = ztab
  158. !
  159. END SUBROUTINE lbc_lnk_2d
  160. SUBROUTINE lbc_lnk_2d_multiple( pt2d_array , type_array , psgn_array , num_fields )
  161. !!
  162. INTEGER :: num_fields
  163. TYPE( arrayptr ), DIMENSION(:) :: pt2d_array
  164. CHARACTER(len=1), DIMENSION(:), INTENT(in ) :: type_array ! define the nature of ptab array grid-points
  165. ! ! = T , U , V , F , W and I points
  166. REAL(wp) , DIMENSION(:), INTENT(in ) :: psgn_array ! =-1 the sign change across the north fold boundary
  167. ! ! = 1. , the sign is kept
  168. !
  169. INTEGER :: ii !!MULTI SEND DUMMY LOOP INDICES
  170. !
  171. DO ii = 1, num_fields
  172. CALL lbc_lnk_2d( pt2d_array(ii)%pt2d, type_array(ii), psgn_array(ii) )
  173. END DO
  174. !
  175. END SUBROUTINE lbc_lnk_2d_multiple
  176. SUBROUTINE lbc_lnk_2d_9( pt2dA, cd_typeA, psgnA, pt2dB, cd_typeB, psgnB, pt2dC, cd_typeC, psgnC &
  177. & , pt2dD, cd_typeD, psgnD, pt2dE, cd_typeE, psgnE, pt2dF, cd_typeF, psgnF &
  178. & , pt2dG, cd_typeG, psgnG, pt2dH, cd_typeH, psgnH, pt2dI, cd_typeI, psgnI, cd_mpp, pval)
  179. !!---------------------------------------------------------------------
  180. ! Second 2D array on which the boundary condition is applied
  181. REAL(wp), DIMENSION(jpi,jpj), TARGET , INTENT(inout) :: pt2dA
  182. REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dB , pt2dC , pt2dD , pt2dE
  183. REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dF , pt2dG , pt2dH , pt2dI
  184. ! define the nature of ptab array grid-points
  185. CHARACTER(len=1) , INTENT(in ) :: cd_typeA
  186. CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeB , cd_typeC , cd_typeD , cd_typeE
  187. CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeF , cd_typeG , cd_typeH , cd_typeI
  188. ! =-1 the sign change across the north fold boundary
  189. REAL(wp) , INTENT(in ) :: psgnA
  190. REAL(wp) , OPTIONAL, INTENT(in ) :: psgnB , psgnC , psgnD , psgnE
  191. REAL(wp) , OPTIONAL, INTENT(in ) :: psgnF , psgnG , psgnH , psgnI
  192. CHARACTER(len=3) , OPTIONAL, INTENT(in ) :: cd_mpp ! fill the overlap area only
  193. REAL(wp) , OPTIONAL, INTENT(in ) :: pval ! background value (used at closed boundaries)
  194. !!
  195. !!---------------------------------------------------------------------
  196. !!The first array
  197. CALL lbc_lnk( pt2dA, cd_typeA, psgnA )
  198. !! Look if more arrays to process
  199. IF(PRESENT (psgnB) )CALL lbc_lnk( pt2dB, cd_typeB, psgnB )
  200. IF(PRESENT (psgnC) )CALL lbc_lnk( pt2dC, cd_typeC, psgnC )
  201. IF(PRESENT (psgnD) )CALL lbc_lnk( pt2dD, cd_typeD, psgnD )
  202. IF(PRESENT (psgnE) )CALL lbc_lnk( pt2dE, cd_typeE, psgnE )
  203. IF(PRESENT (psgnF) )CALL lbc_lnk( pt2dF, cd_typeF, psgnF )
  204. IF(PRESENT (psgnG) )CALL lbc_lnk( pt2dG, cd_typeG, psgnG )
  205. IF(PRESENT (psgnH) )CALL lbc_lnk( pt2dH, cd_typeH, psgnH )
  206. IF(PRESENT (psgnI) )CALL lbc_lnk( pt2dI, cd_typeI, psgnI )
  207. END SUBROUTINE lbc_lnk_2d_9
  208. #else
  209. !!----------------------------------------------------------------------
  210. !! Default option 3D shared memory computing
  211. !!----------------------------------------------------------------------
  212. SUBROUTINE lbc_lnk_3d_gather( pt3d1, cd_type1, pt3d2, cd_type2, psgn )
  213. !!---------------------------------------------------------------------
  214. !! *** ROUTINE lbc_lnk_3d_gather ***
  215. !!
  216. !! ** Purpose : set lateral boundary conditions on two 3D arrays (non mpp case)
  217. !!
  218. !! ** Method : psign = -1 : change the sign across the north fold
  219. !! = 1 : no change of the sign across the north fold
  220. !! = 0 : no change of the sign across the north fold and
  221. !! strict positivity preserved: use inner row/column
  222. !! for closed boundaries.
  223. !!----------------------------------------------------------------------
  224. CHARACTER(len=1) , INTENT(in ) :: cd_type1, cd_type2 ! nature of pt3d grid-points
  225. REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pt3d1 , pt3d2 ! 3D array on which the lbc is applied
  226. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  227. !!----------------------------------------------------------------------
  228. !
  229. CALL lbc_lnk_3d( pt3d1, cd_type1, psgn)
  230. CALL lbc_lnk_3d( pt3d2, cd_type2, psgn)
  231. !
  232. END SUBROUTINE lbc_lnk_3d_gather
  233. SUBROUTINE lbc_lnk_3d( pt3d, cd_type, psgn, cd_mpp, pval )
  234. !!---------------------------------------------------------------------
  235. !! *** ROUTINE lbc_lnk_3d ***
  236. !!
  237. !! ** Purpose : set lateral boundary conditions on a 3D array (non mpp case)
  238. !!
  239. !! ** Method : psign = -1 : change the sign across the north fold
  240. !! = 1 : no change of the sign across the north fold
  241. !! = 0 : no change of the sign across the north fold and
  242. !! strict positivity preserved: use inner row/column
  243. !! for closed boundaries.
  244. !!----------------------------------------------------------------------
  245. CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points
  246. REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pt3d ! 3D array on which the lbc is applied
  247. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  248. CHARACTER(len=3) , INTENT(in ), OPTIONAL :: cd_mpp ! MPP only (here do nothing)
  249. REAL(wp) , INTENT(in ), OPTIONAL :: pval ! background value (for closed boundaries)
  250. !!
  251. REAL(wp) :: zland
  252. !!----------------------------------------------------------------------
  253. IF( PRESENT( pval ) ) THEN ; zland = pval ! set land value (zero by default)
  254. ELSE ; zland = 0._wp
  255. ENDIF
  256. IF( PRESENT( cd_mpp ) ) THEN
  257. ! only fill the overlap area and extra allows
  258. ! this is in mpp case. In this module, just do nothing
  259. ELSE
  260. !
  261. ! ! East-West boundaries
  262. ! ! ======================
  263. SELECT CASE ( nperio )
  264. !
  265. CASE ( 1 , 4 , 6 ) !** cyclic east-west
  266. pt3d( 1 ,:,:) = pt3d(jpim1,:,:) ! all points
  267. pt3d(jpi,:,:) = pt3d( 2 ,:,:)
  268. !
  269. CASE DEFAULT !** East closed -- West closed
  270. SELECT CASE ( cd_type )
  271. CASE ( 'T' , 'U' , 'V' , 'W' ) ! T-, U-, V-, W-points
  272. pt3d( 1 ,:,:) = zland
  273. pt3d(jpi,:,:) = zland
  274. CASE ( 'F' ) ! F-point
  275. pt3d(jpi,:,:) = zland
  276. END SELECT
  277. !
  278. END SELECT
  279. !
  280. ! ! North-South boundaries
  281. ! ! ======================
  282. SELECT CASE ( nperio )
  283. !
  284. CASE ( 2 ) !** South symmetric -- North closed
  285. SELECT CASE ( cd_type )
  286. CASE ( 'T' , 'U' , 'W' ) ! T-, U-, W-points
  287. pt3d(:, 1 ,:) = pt3d(:,3,:)
  288. pt3d(:,jpj,:) = zland
  289. CASE ( 'V' , 'F' ) ! V-, F-points
  290. pt3d(:, 1 ,:) = psgn * pt3d(:,2,:)
  291. pt3d(:,jpj,:) = zland
  292. END SELECT
  293. !
  294. CASE ( 3 , 4 , 5 , 6 ) !** North fold T or F-point pivot -- South closed
  295. SELECT CASE ( cd_type ) ! South : closed
  296. CASE ( 'T' , 'U' , 'V' , 'W' , 'I' ) ! all points except F-point
  297. pt3d(:, 1 ,:) = zland
  298. END SELECT
  299. ! ! North fold
  300. CALL lbc_nfd( pt3d(:,:,:), cd_type, psgn )
  301. !
  302. CASE DEFAULT !** North closed -- South closed
  303. SELECT CASE ( cd_type )
  304. CASE ( 'T' , 'U' , 'V' , 'W' ) ! T-, U-, V-, W-points
  305. pt3d(:, 1 ,:) = zland
  306. pt3d(:,jpj,:) = zland
  307. CASE ( 'F' ) ! F-point
  308. pt3d(:,jpj,:) = zland
  309. END SELECT
  310. !
  311. END SELECT
  312. !
  313. ENDIF
  314. !
  315. END SUBROUTINE lbc_lnk_3d
  316. SUBROUTINE lbc_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
  317. !!---------------------------------------------------------------------
  318. !! *** ROUTINE lbc_lnk_2d ***
  319. !!
  320. !! ** Purpose : set lateral boundary conditions on a 2D array (non mpp case)
  321. !!
  322. !! ** Method : psign = -1 : change the sign across the north fold
  323. !! = 1 : no change of the sign across the north fold
  324. !! = 0 : no change of the sign across the north fold and
  325. !! strict positivity preserved: use inner row/column
  326. !! for closed boundaries.
  327. !!----------------------------------------------------------------------
  328. CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points
  329. REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pt2d ! 2D array on which the lbc is applied
  330. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  331. CHARACTER(len=3) , INTENT(in ), OPTIONAL :: cd_mpp ! MPP only (here do nothing)
  332. REAL(wp) , INTENT(in ), OPTIONAL :: pval ! background value (for closed boundaries)
  333. !!
  334. REAL(wp) :: zland
  335. !!----------------------------------------------------------------------
  336. IF( PRESENT( pval ) ) THEN ; zland = pval ! set land value (zero by default)
  337. ELSE ; zland = 0._wp
  338. ENDIF
  339. IF (PRESENT(cd_mpp)) THEN
  340. ! only fill the overlap area and extra allows
  341. ! this is in mpp case. In this module, just do nothing
  342. ELSE
  343. !
  344. ! ! East-West boundaries
  345. ! ! ====================
  346. SELECT CASE ( nperio )
  347. !
  348. CASE ( 1 , 4 , 6 ) !** cyclic east-west
  349. pt2d( 1 ,:) = pt2d(jpim1,:) ! all points
  350. pt2d(jpi,:) = pt2d( 2 ,:)
  351. !
  352. CASE DEFAULT !** East closed -- West closed
  353. SELECT CASE ( cd_type )
  354. CASE ( 'T' , 'U' , 'V' , 'W' ) ! T-, U-, V-, W-points
  355. pt2d( 1 ,:) = zland
  356. pt2d(jpi,:) = zland
  357. CASE ( 'F' ) ! F-point
  358. pt2d(jpi,:) = zland
  359. END SELECT
  360. !
  361. END SELECT
  362. !
  363. ! ! North-South boundaries
  364. ! ! ======================
  365. SELECT CASE ( nperio )
  366. !
  367. CASE ( 2 ) !** South symmetric -- North closed
  368. SELECT CASE ( cd_type )
  369. CASE ( 'T' , 'U' , 'W' ) ! T-, U-, W-points
  370. pt2d(:, 1 ) = pt2d(:,3)
  371. pt2d(:,jpj) = zland
  372. CASE ( 'V' , 'F' ) ! V-, F-points
  373. pt2d(:, 1 ) = psgn * pt2d(:,2)
  374. pt2d(:,jpj) = zland
  375. END SELECT
  376. !
  377. CASE ( 3 , 4 , 5 , 6 ) !** North fold T or F-point pivot -- South closed
  378. SELECT CASE ( cd_type ) ! South : closed
  379. CASE ( 'T' , 'U' , 'V' , 'W' , 'I' ) ! all points except F-point
  380. pt2d(:, 1 ) = zland
  381. END SELECT
  382. ! ! North fold
  383. CALL lbc_nfd( pt2d(:,:), cd_type, psgn )
  384. !
  385. CASE DEFAULT !** North closed -- South closed
  386. SELECT CASE ( cd_type )
  387. CASE ( 'T' , 'U' , 'V' , 'W' ) ! T-, U-, V-, W-points
  388. pt2d(:, 1 ) = zland
  389. pt2d(:,jpj) = zland
  390. CASE ( 'F' ) ! F-point
  391. pt2d(:,jpj) = zland
  392. END SELECT
  393. !
  394. END SELECT
  395. !
  396. ENDIF
  397. !
  398. END SUBROUTINE lbc_lnk_2d
  399. SUBROUTINE lbc_lnk_2d_multiple( pt2d_array , type_array , psgn_array , num_fields )
  400. !!
  401. INTEGER :: num_fields
  402. TYPE( arrayptr ), DIMENSION(:) :: pt2d_array
  403. CHARACTER(len=1), DIMENSION(:), INTENT(in ) :: type_array ! define the nature of ptab array grid-points
  404. ! ! = T , U , V , F , W and I points
  405. REAL(wp) , DIMENSION(:), INTENT(in ) :: psgn_array ! =-1 the sign change across the north fold boundary
  406. ! ! = 1. , the sign is kept
  407. !
  408. INTEGER :: ii !!MULTI SEND DUMMY LOOP INDICES
  409. !
  410. DO ii = 1, num_fields
  411. CALL lbc_lnk_2d( pt2d_array(ii)%pt2d, type_array(ii), psgn_array(ii) )
  412. END DO
  413. !
  414. END SUBROUTINE lbc_lnk_2d_multiple
  415. SUBROUTINE lbc_lnk_2d_9( pt2dA, cd_typeA, psgnA, pt2dB, cd_typeB, psgnB, pt2dC, cd_typeC, psgnC &
  416. & , pt2dD, cd_typeD, psgnD, pt2dE, cd_typeE, psgnE, pt2dF, cd_typeF, psgnF &
  417. & , pt2dG, cd_typeG, psgnG, pt2dH, cd_typeH, psgnH, pt2dI, cd_typeI, psgnI, cd_mpp, pval)
  418. !!---------------------------------------------------------------------
  419. ! Second 2D array on which the boundary condition is applied
  420. REAL(wp), DIMENSION(jpi,jpj), TARGET , INTENT(inout) :: pt2dA
  421. REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dB , pt2dC , pt2dD , pt2dE
  422. REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dF , pt2dG , pt2dH , pt2dI
  423. ! define the nature of ptab array grid-points
  424. CHARACTER(len=1) , INTENT(in ) :: cd_typeA
  425. CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeB , cd_typeC , cd_typeD , cd_typeE
  426. CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeF , cd_typeG , cd_typeH , cd_typeI
  427. ! =-1 the sign change across the north fold boundary
  428. REAL(wp) , INTENT(in ) :: psgnA
  429. REAL(wp) , OPTIONAL, INTENT(in ) :: psgnB , psgnC , psgnD , psgnE
  430. REAL(wp) , OPTIONAL, INTENT(in ) :: psgnF , psgnG , psgnH , psgnI
  431. CHARACTER(len=3) , OPTIONAL, INTENT(in ) :: cd_mpp ! fill the overlap area only
  432. REAL(wp) , OPTIONAL, INTENT(in ) :: pval ! background value (used at closed boundaries)
  433. !!
  434. !!---------------------------------------------------------------------
  435. !!The first array
  436. CALL lbc_lnk( pt2dA, cd_typeA, psgnA )
  437. !! Look if more arrays to process
  438. IF(PRESENT (psgnB) )CALL lbc_lnk( pt2dB, cd_typeB, psgnB )
  439. IF(PRESENT (psgnC) )CALL lbc_lnk( pt2dC, cd_typeC, psgnC )
  440. IF(PRESENT (psgnD) )CALL lbc_lnk( pt2dD, cd_typeD, psgnD )
  441. IF(PRESENT (psgnE) )CALL lbc_lnk( pt2dE, cd_typeE, psgnE )
  442. IF(PRESENT (psgnF) )CALL lbc_lnk( pt2dF, cd_typeF, psgnF )
  443. IF(PRESENT (psgnG) )CALL lbc_lnk( pt2dG, cd_typeG, psgnG )
  444. IF(PRESENT (psgnH) )CALL lbc_lnk( pt2dH, cd_typeH, psgnH )
  445. IF(PRESENT (psgnI) )CALL lbc_lnk( pt2dI, cd_typeI, psgnI )
  446. END SUBROUTINE lbc_lnk_2d_9
  447. #endif
  448. SUBROUTINE lbc_bdy_lnk_3d( pt3d, cd_type, psgn, ib_bdy )
  449. !!---------------------------------------------------------------------
  450. !! *** ROUTINE lbc_bdy_lnk ***
  451. !!
  452. !! ** Purpose : wrapper rountine to 'lbc_lnk_3d'. This wrapper is used
  453. !! to maintain the same interface with regards to the mpp
  454. !case
  455. !!
  456. !!----------------------------------------------------------------------
  457. CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points
  458. REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pt3d ! 3D array on which the lbc is applied
  459. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  460. INTEGER :: ib_bdy ! BDY boundary set
  461. !!
  462. CALL lbc_lnk_3d( pt3d, cd_type, psgn)
  463. END SUBROUTINE lbc_bdy_lnk_3d
  464. SUBROUTINE lbc_bdy_lnk_2d( pt2d, cd_type, psgn, ib_bdy )
  465. !!---------------------------------------------------------------------
  466. !! *** ROUTINE lbc_bdy_lnk ***
  467. !!
  468. !! ** Purpose : wrapper rountine to 'lbc_lnk_3d'. This wrapper is used
  469. !! to maintain the same interface with regards to the mpp
  470. !case
  471. !!
  472. !!----------------------------------------------------------------------
  473. CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points
  474. REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pt2d ! 3D array on which the lbc is applied
  475. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  476. INTEGER :: ib_bdy ! BDY boundary set
  477. !!
  478. CALL lbc_lnk_2d( pt2d, cd_type, psgn)
  479. END SUBROUTINE lbc_bdy_lnk_2d
  480. SUBROUTINE lbc_lnk_2d_e( pt2d, cd_type, psgn, jpri, jprj )
  481. !!---------------------------------------------------------------------
  482. !! *** ROUTINE lbc_lnk_2d ***
  483. !!
  484. !! ** Purpose : set lateral boundary conditions on a 2D array (non mpp case)
  485. !! special dummy routine to allow for use of halo indexing in mpp case
  486. !!
  487. !! ** Method : psign = -1 : change the sign across the north fold
  488. !! = 1 : no change of the sign across the north fold
  489. !! = 0 : no change of the sign across the north fold and
  490. !! strict positivity preserved: use inner row/column
  491. !! for closed boundaries.
  492. !!----------------------------------------------------------------------
  493. CHARACTER(len=1) , INTENT(in ) :: cd_type ! nature of pt3d grid-points
  494. REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pt2d ! 2D array on which the lbc is applied
  495. REAL(wp) , INTENT(in ) :: psgn ! control of the sign
  496. INTEGER , INTENT(in ) :: jpri ! size of extra halo (not needed in non-mpp)
  497. INTEGER , INTENT(in ) :: jprj ! size of extra halo (not needed in non-mpp)
  498. !!----------------------------------------------------------------------
  499. CALL lbc_lnk_2d( pt2d, cd_type, psgn )
  500. !
  501. END SUBROUTINE lbc_lnk_2d_e
  502. #endif
  503. !!======================================================================
  504. END MODULE lbclnk