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