1 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_uv_xy_rx.template,v 1.5 2004/11/16 17:21:40 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_EEOPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: EXCH_UV_XY_RX |
9 |
|
10 |
C !INTERFACE: |
11 |
SUBROUTINE EXCH_UV_XY_RX( |
12 |
U Uphi, Vphi, |
13 |
I withSigns, myThid ) |
14 |
IMPLICIT NONE |
15 |
C !DESCRIPTION: |
16 |
C *==========================================================* |
17 |
C | SUBROUTINE EXCH_UV_XY_RX |
18 |
C | o Handle exchanges for _RX, two-dimensional arrays. |
19 |
C *==========================================================* |
20 |
C | Driver exchange routine which branches to cube sphere or |
21 |
C | global, simple cartesian index grid. Exchange routine is |
22 |
C | called with two arrays that are components of a vector. |
23 |
C | These components are rotated and interchanged on the |
24 |
C | rotated grid during cube exchanges. |
25 |
C *==========================================================* |
26 |
|
27 |
C !USES: |
28 |
C === Global data === |
29 |
#include "SIZE.h" |
30 |
#include "EEPARAMS.h" |
31 |
#include "EESUPPORT.h" |
32 |
#include "EXCH.h" |
33 |
|
34 |
C !INPUT/OUTPUT PARAMETERS: |
35 |
C === Routine arguments === |
36 |
C Uphi :: Arrays with overlap regions are to be exchanged |
37 |
C Vphi Note - The interface to EXCH_ assumes that |
38 |
C the standard Fortran 77 sequence association rules |
39 |
C apply. |
40 |
C myThid :: My thread id. |
41 |
C withSigns :: Flag controlling whether vector is signed. |
42 |
_RX Uphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
43 |
_RX Vphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
44 |
LOGICAL withSigns |
45 |
INTEGER myThid |
46 |
|
47 |
C !LOCAL VARIABLES: |
48 |
C == Local variables == |
49 |
C OL[wens] :: Overlap extents in west, east, north, south. |
50 |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
51 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
52 |
CEOP |
53 |
|
54 |
#ifdef ALLOW_EXCH2 |
55 |
CALL EXCH2_UV_XY_RX( |
56 |
U Uphi, Vphi, |
57 |
I withSigns, myThid ) |
58 |
RETURN |
59 |
#else |
60 |
|
61 |
OLw = OLx |
62 |
OLe = OLx |
63 |
OLn = OLy |
64 |
OLs = OLy |
65 |
exchWidthX = OLx |
66 |
exchWidthY = OLy |
67 |
myNz = 1 |
68 |
C ** NOTE ** The exchange routine we use here does not |
69 |
C require the preceeding and following barriers. |
70 |
C However, the slow, simple exchange interface |
71 |
C that is calling it here is meant to ensure |
72 |
C that threads are synchronised before exchanges |
73 |
C begine. |
74 |
IF (useCubedSphereExchange) THEN |
75 |
CALL EXCH_UV_RX_CUBE( Uphi, Vphi, withSigns, |
76 |
I OLw, OLe, OLs, OLn, myNz, |
77 |
I exchWidthX, exchWidthY, |
78 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
79 |
ELSE |
80 |
c CALL EXCH_RX( Uphi, |
81 |
c I OLw, OLe, OLs, OLn, myNz, |
82 |
c I exchWidthX, exchWidthY, |
83 |
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
84 |
c CALL EXCH_RX( Vphi, |
85 |
c I OLw, OLe, OLs, OLn, myNz, |
86 |
c I exchWidthX, exchWidthY, |
87 |
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
88 |
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
89 |
_EXCH_XY_RX( Uphi, myThid ) |
90 |
_EXCH_XY_RX( Vphi, myThid ) |
91 |
ENDIF |
92 |
|
93 |
RETURN |
94 |
#endif |
95 |
END |
96 |
|
97 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
98 |
|
99 |
CEH3 ;;; Local Variables: *** |
100 |
CEH3 ;;; mode:fortran *** |
101 |
CEH3 ;;; End: *** |