1 |
jmc |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/exch2/exch_uv_xy_rx.template,v 1.2 2004/04/05 15:27:06 edhill Exp $ |
2 |
cnh |
1.3 |
C $Name: $ |
3 |
adcroft |
1.2 |
|
4 |
jmc |
1.5 |
#include "PACKAGES_CONFIG.h" |
5 |
adcroft |
1.2 |
#include "CPP_EEOPTIONS.h" |
6 |
|
|
|
7 |
cnh |
1.3 |
CBOP |
8 |
|
|
C !ROUTINE: EXCH_UV_XY_RX |
9 |
|
|
|
10 |
|
|
C !INTERFACE: |
11 |
adcroft |
1.2 |
SUBROUTINE EXCH_UV_XY_RX( |
12 |
jmc |
1.5 |
U Uphi, Vphi, |
13 |
|
|
I withSigns, myThid ) |
14 |
adcroft |
1.2 |
IMPLICIT NONE |
15 |
cnh |
1.3 |
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 |
adcroft |
1.2 |
|
27 |
cnh |
1.3 |
C !USES: |
28 |
adcroft |
1.2 |
C === Global data === |
29 |
|
|
#include "SIZE.h" |
30 |
|
|
#include "EEPARAMS.h" |
31 |
|
|
#include "EESUPPORT.h" |
32 |
edhill |
1.4 |
#include "EXCH.h" |
33 |
adcroft |
1.2 |
|
34 |
cnh |
1.3 |
C !INPUT/OUTPUT PARAMETERS: |
35 |
adcroft |
1.2 |
C === Routine arguments === |
36 |
cnh |
1.3 |
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 |
adcroft |
1.2 |
_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 |
cnh |
1.3 |
C !LOCAL VARIABLES: |
48 |
adcroft |
1.2 |
C == Local variables == |
49 |
cnh |
1.3 |
C OL[wens] :: Overlap extents in west, east, north, south. |
50 |
|
|
C exchWidth[XY] :: Extent of regions that will be exchanged. |
51 |
adcroft |
1.2 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
52 |
cnh |
1.3 |
CEOP |
53 |
adcroft |
1.2 |
|
54 |
jmc |
1.5 |
#ifdef ALLOW_EXCH2 |
55 |
|
|
CALL EXCH2_UV_XY_RX( |
56 |
|
|
U Uphi, Vphi, |
57 |
|
|
I withSigns, myThid ) |
58 |
|
|
RETURN |
59 |
|
|
#endif |
60 |
|
|
|
61 |
adcroft |
1.2 |
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 |
|
|
END |
95 |
jmc |
1.5 |
|
96 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
97 |
|
|
|
98 |
|
|
CEH3 ;;; Local Variables: *** |
99 |
|
|
CEH3 ;;; mode:fortran *** |
100 |
|
|
CEH3 ;;; End: *** |