New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
lbclnk.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/lbclnk.F90 @ 2339

Last change on this file since 2339 was 2339, checked in by rblod, 13 years ago

Correct a bug in rev2335 supposed to be only an innocent suppression of cpp keys ; I will definitely dedicate my day to read SVN book and find a way to allow Gurvan to commit only in DOC directory

  • Property svn:keywords set to Id
File size: 12.7 KB
Line 
1MODULE 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   !!----------------------------------------------------------------------
10#if   defined key_mpp_mpi
11   !!----------------------------------------------------------------------
12   !!   'key_mpp_mpi'             MPI massively parallel processing library
13   !!----------------------------------------------------------------------
14   !!   lbc_lnk      : generic interface for mpp_lnk_3d and mpp_lnk_2d routines defined in lib_mpp
15   !!   lbc_lnk_e    : generic interface for mpp_lnk_2d_e routine defined in lib_mpp
16   !!----------------------------------------------------------------------
17   USE lib_mpp          ! distributed memory computing library
18
19   INTERFACE lbc_lnk
20      MODULE PROCEDURE mpp_lnk_3d_gather, mpp_lnk_3d, mpp_lnk_2d
21   END INTERFACE
22
23   INTERFACE lbc_lnk_e
24      MODULE PROCEDURE mpp_lnk_2d_e
25   END INTERFACE
26
27   PUBLIC lbc_lnk       ! ocean lateral boundary conditions
28   PUBLIC lbc_lnk_e
29
30   !!----------------------------------------------------------------------
31   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
32   !! $Id$
33   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
34   !!----------------------------------------------------------------------
35
36#else
37   !!----------------------------------------------------------------------
38   !!   Default option                              shared memory computing
39   !!----------------------------------------------------------------------
40   !!   lbc_lnk      : generic interface for lbc_lnk_3d and lbc_lnk_2d
41   !!   lbc_lnk_3d   : set the lateral boundary condition on a 3D variable on ocean mesh
42   !!   lbc_lnk_2d   : set the lateral boundary condition on a 2D variable on ocean mesh
43   !!----------------------------------------------------------------------
44   USE oce             ! ocean dynamics and tracers   
45   USE dom_oce         ! ocean space and time domain
46   USE in_out_manager  ! I/O manager
47   USE lbcnfd          ! north fold
48
49   IMPLICIT NONE
50   PRIVATE
51
52   INTERFACE lbc_lnk
53      MODULE PROCEDURE lbc_lnk_3d_gather, lbc_lnk_3d, lbc_lnk_2d
54   END INTERFACE
55
56   INTERFACE lbc_lnk_e
57      MODULE PROCEDURE lbc_lnk_2d
58   END INTERFACE
59
60   PUBLIC   lbc_lnk       ! ocean/ice  lateral boundary conditions
61   PUBLIC   lbc_lnk_e 
62   
63   !!----------------------------------------------------------------------
64   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
65   !! $Id$
66   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
67   !!----------------------------------------------------------------------
68CONTAINS
69
70   SUBROUTINE lbc_lnk_3d_gather( pt3d1, cd_type1, pt3d2, cd_type2, psgn )
71      !!---------------------------------------------------------------------
72      !!                  ***  ROUTINE lbc_lnk_3d_gather  ***
73      !!
74      !! ** Purpose :   set lateral boundary conditions on two 3D arrays (non mpp case)
75      !!
76      !! ** Method  :   psign = -1 :    change the sign across the north fold
77      !!                      =  1 : no change of the sign across the north fold
78      !!                      =  0 : no change of the sign across the north fold and
79      !!                             strict positivity preserved: use inner row/column
80      !!                             for closed boundaries.
81      !!----------------------------------------------------------------------
82      CHARACTER(len=1)                , INTENT(in   ) ::   cd_type1, cd_type2   ! nature of pt3d grid-points
83      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pt3d1   , pt3d2      ! 3D array on which the lbc is applied
84      REAL(wp)                        , INTENT(in   ) ::   psgn                 ! control of the sign
85      !!----------------------------------------------------------------------
86      !
87      CALL lbc_lnk_3d( pt3d1, cd_type1, psgn)
88      CALL lbc_lnk_3d( pt3d2, cd_type2, psgn)
89      !
90   END SUBROUTINE lbc_lnk_3d_gather
91
92
93   SUBROUTINE lbc_lnk_3d( pt3d, cd_type, psgn, cd_mpp, pval )
94      !!---------------------------------------------------------------------
95      !!                  ***  ROUTINE lbc_lnk_3d  ***
96      !!
97      !! ** Purpose :   set lateral boundary conditions on a 3D array (non mpp case)
98      !!
99      !! ** Method  :   psign = -1 :    change the sign across the north fold
100      !!                      =  1 : no change of the sign across the north fold
101      !!                      =  0 : no change of the sign across the north fold and
102      !!                             strict positivity preserved: use inner row/column
103      !!                             for closed boundaries.
104      !!----------------------------------------------------------------------
105      CHARACTER(len=1)                , INTENT(in   )           ::   cd_type   ! nature of pt3d grid-points
106      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout)           ::   pt3d      ! 3D array on which the lbc is applied
107      REAL(wp)                        , INTENT(in   )           ::   psgn      ! control of the sign
108      CHARACTER(len=3)                , INTENT(in   ), OPTIONAL ::   cd_mpp    ! MPP only (here do nothing)
109      REAL(wp)                        , INTENT(in   ), OPTIONAL ::   pval      ! background value (for closed boundaries)
110      !!
111      REAL(wp) ::   zland
112      !!----------------------------------------------------------------------
113
114      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value (zero by default)
115      ELSE                         ;   zland = 0.e0
116      ENDIF
117
118
119      IF( PRESENT( cd_mpp ) ) THEN
120         ! only fill the overlap area and extra allows
121         ! this is in mpp case. In this module, just do nothing
122      ELSE
123         !
124         !                                     !  East-West boundaries
125         !                                     ! ======================
126         SELECT CASE ( nperio )
127         !
128         CASE ( 1 , 4 , 6 )                       !**  cyclic east-west
129            pt3d( 1 ,:,:) = pt3d(jpim1,:,:)            ! all points
130            pt3d(jpi,:,:) = pt3d(  2  ,:,:)
131            !
132         CASE DEFAULT                             !**  East closed  --  West closed
133            SELECT CASE ( cd_type )
134            CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points
135               pt3d( 1 ,:,:) = zland
136               pt3d(jpi,:,:) = zland
137            CASE ( 'F' )                               ! F-point
138               pt3d(jpi,:,:) = zland
139            END SELECT
140            !
141         END SELECT
142         !
143         !                                     ! North-South boundaries
144         !                                     ! ======================
145         SELECT CASE ( nperio )
146         !
147         CASE ( 2 )                               !**  South symmetric  --  North closed
148            SELECT CASE ( cd_type )
149            CASE ( 'T' , 'U' , 'W' )                   ! T-, U-, W-points
150               pt3d(:, 1 ,:) = pt3d(:,3,:)
151               pt3d(:,jpj,:) = zland
152            CASE ( 'V' , 'F' )                         ! V-, F-points
153               pt3d(:, 1 ,:) = psgn * pt3d(:,2,:)
154               pt3d(:,jpj,:) = zland
155            END SELECT
156            !
157         CASE ( 3 , 4 , 5 , 6 )                   !**  North fold  T or F-point pivot  --  South closed
158            SELECT CASE ( cd_type )                    ! South : closed
159            CASE ( 'T' , 'U' , 'V' , 'W' , 'I' )             ! all points except F-point
160               pt3d(:, 1 ,:) = zland
161            END SELECT
162            !                                          ! North fold
163            pt3d( 1 ,jpj,:) = zland
164            pt3d(jpi,jpj,:) = zland
165            CALL lbc_nfd( pt3d(:,:,:), cd_type, psgn )
166            !
167         CASE DEFAULT                             !**  North closed  --  South closed
168            SELECT CASE ( cd_type )
169            CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points
170               pt3d(:, 1 ,:) = zland
171               pt3d(:,jpj,:) = zland
172            CASE ( 'F' )                               ! F-point
173               pt3d(:,jpj,:) = zland
174            END SELECT
175            !
176         END SELECT
177         !
178      ENDIF
179      !
180   END SUBROUTINE lbc_lnk_3d
181
182
183   SUBROUTINE lbc_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
184      !!---------------------------------------------------------------------
185      !!                 ***  ROUTINE lbc_lnk_2d  ***
186      !!
187      !! ** Purpose :   set lateral boundary conditions on a 2D array (non mpp case)
188      !!
189      !! ** Method  :   psign = -1 :    change the sign across the north fold
190      !!                      =  1 : no change of the sign across the north fold
191      !!                      =  0 : no change of the sign across the north fold and
192      !!                             strict positivity preserved: use inner row/column
193      !!                             for closed boundaries.
194      !!----------------------------------------------------------------------
195      CHARACTER(len=1)            , INTENT(in   )           ::   cd_type   ! nature of pt3d grid-points
196      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout)           ::   pt2d      ! 2D array on which the lbc is applied
197      REAL(wp)                    , INTENT(in   )           ::   psgn      ! control of the sign
198      CHARACTER(len=3)            , INTENT(in   ), OPTIONAL ::   cd_mpp    ! MPP only (here do nothing)
199      REAL(wp)                    , INTENT(in   ), OPTIONAL ::   pval      ! background value (for closed boundaries)
200      !!
201      REAL(wp) ::   zland
202      !!----------------------------------------------------------------------
203
204      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value (zero by default)
205      ELSE                         ;   zland = 0.e0
206      ENDIF
207
208      IF (PRESENT(cd_mpp)) THEN
209         ! only fill the overlap area and extra allows
210         ! this is in mpp case. In this module, just do nothing
211      ELSE     
212         !
213         !                                     ! East-West boundaries
214         !                                     ! ====================
215         SELECT CASE ( nperio )
216         !
217         CASE ( 1 , 4 , 6 )                       !** cyclic east-west
218            pt2d( 1 ,:) = pt2d(jpim1,:)               ! all points
219            pt2d(jpi,:) = pt2d(  2  ,:)
220            !
221         CASE DEFAULT                             !** East closed  --  West closed
222            SELECT CASE ( cd_type )
223            CASE ( 'T' , 'U' , 'V' , 'W' )            ! T-, U-, V-, W-points
224               pt2d( 1 ,:) = zland
225               pt2d(jpi,:) = zland
226            CASE ( 'F' )                              ! F-point
227               pt2d(jpi,:) = zland
228            END SELECT
229            !
230         END SELECT
231         !
232         !                                     ! North-South boundaries
233         !                                     ! ======================
234         SELECT CASE ( nperio )
235         !
236         CASE ( 2 )                               !**  South symmetric  --  North closed
237            SELECT CASE ( cd_type )
238            CASE ( 'T' , 'U' , 'W' )                   ! T-, U-, W-points
239               pt2d(:, 1 ) = pt2d(:,3)
240               pt2d(:,jpj) = zland
241            CASE ( 'V' , 'F' )                         ! V-, F-points
242               pt2d(:, 1 ) = psgn * pt2d(:,2)
243               pt2d(:,jpj) = zland
244            END SELECT
245            !
246         CASE ( 3 , 4 , 5 , 6 )                   !**  North fold  T or F-point pivot  --  South closed
247            SELECT CASE ( cd_type )                    ! South : closed
248            CASE ( 'T' , 'U' , 'V' , 'W' , 'I' )             ! all points except F-point
249               pt2d(:, 1 ) = zland
250            END SELECT
251            !                                          ! North fold
252            pt2d( 1 ,1  ) = zland 
253            pt2d( 1 ,jpj) = zland 
254            pt2d(jpi,jpj) = zland
255            CALL lbc_nfd( pt2d(:,:), cd_type, psgn )
256            !
257         CASE DEFAULT                             !**  North closed  --  South closed
258            SELECT CASE ( cd_type )
259            CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points
260               pt2d(:, 1 ) = zland
261               pt2d(:,jpj) = zland
262            CASE ( 'F' )                               ! F-point
263               pt2d(:,jpj) = zland
264            END SELECT
265            !
266         END SELECT
267         !
268      ENDIF
269      !   
270   END SUBROUTINE lbc_lnk_2d
271
272#endif
273
274   !!======================================================================
275END MODULE lbclnk
Note: See TracBrowser for help on using the repository browser.