1 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_uv_3d_rx.template,v 1.2 2006/11/17 22:35:03 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_EEOPTIONS.h" |
6 |
#ifdef ALLOW_EXCH2 |
7 |
#include "W2_OPTIONS.h" |
8 |
#endif |
9 |
|
10 |
CBOP |
11 |
C !ROUTINE: EXCH_UV_3D_RX |
12 |
|
13 |
C !INTERFACE: |
14 |
SUBROUTINE EXCH_UV_3D_RX( |
15 |
U Uphi, Vphi, |
16 |
I withSigns, myNz, myThid ) |
17 |
|
18 |
C !DESCRIPTION: |
19 |
C *==========================================================* |
20 |
C | SUBROUTINE EXCH_UV_3D_RX |
21 |
C | o Handle exchanges for _RX, 3-dimensional vector arrays. |
22 |
C *==========================================================* |
23 |
C | Vector arrays need to be rotated and interchaged for |
24 |
C | exchange operations on some grids. This driver routine |
25 |
C | branches to support this. |
26 |
C *==========================================================* |
27 |
|
28 |
C !USES: |
29 |
IMPLICIT NONE |
30 |
C === Global data === |
31 |
#include "SIZE.h" |
32 |
#include "EEPARAMS.h" |
33 |
#include "EESUPPORT.h" |
34 |
#include "EXCH.h" |
35 |
|
36 |
C !INPUT/OUTPUT PARAMETERS: |
37 |
C === Routine arguments === |
38 |
C phi :: Array with overlap regions are to be exchanged |
39 |
C Note - The interface to EXCH_RX assumes that |
40 |
C the standard Fortran 77 sequence association rules |
41 |
C apply. |
42 |
C myNz :: 3rd dimension of array to exchange |
43 |
C myThid :: My thread id. |
44 |
INTEGER myNz |
45 |
_RX Uphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy) |
46 |
_RX Vphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy) |
47 |
LOGICAL withSigns |
48 |
INTEGER myThid |
49 |
|
50 |
C !LOCAL VARIABLES: |
51 |
C == Local variables == |
52 |
C OL[wens] :: Overlap extents in west, east, north, south. |
53 |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
54 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
55 |
|
56 |
CEOP |
57 |
#ifdef ALLOW_EXCH2 |
58 |
#ifdef W2_USE_R1_ONLY |
59 |
CALL EXCH2_UV_CGRID_3D_RX( |
60 |
U Uphi, Vphi, |
61 |
I withSigns, myNz, myThid ) |
62 |
#else |
63 |
CALL EXCH2_UV_3D_RX( |
64 |
U Uphi, Vphi, |
65 |
I withSigns, myNz, myThid ) |
66 |
#endif |
67 |
RETURN |
68 |
#else /* ALLOW_EXCH2 */ |
69 |
|
70 |
OLw = OLx |
71 |
OLe = OLx |
72 |
OLn = OLy |
73 |
OLs = OLy |
74 |
exchWidthX = OLx |
75 |
exchWidthY = OLy |
76 |
C ** NOTE ** The exchange routine we use here does not |
77 |
C require the preceeding and following barriers. |
78 |
C However, the slow, simple exchange interface |
79 |
C that is calling it here is meant to ensure |
80 |
C that threads are synchronised before exchanges |
81 |
C begine. |
82 |
IF (useCubedSphereExchange) THEN |
83 |
CALL EXCH_UV_RX_CUBE( Uphi, Vphi, withSigns, |
84 |
I OLw, OLe, OLs, OLn, myNz, |
85 |
I exchWidthX, exchWidthY, |
86 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
87 |
ELSE |
88 |
CALL EXCH_RX( Uphi, |
89 |
I OLw, OLe, OLs, OLn, myNz, |
90 |
I exchWidthX, exchWidthY, |
91 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
92 |
CALL EXCH_RX( Vphi, |
93 |
I OLw, OLe, OLs, OLn, myNz, |
94 |
I exchWidthX, exchWidthY, |
95 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
96 |
ENDIF |
97 |
|
98 |
RETURN |
99 |
#endif /* ALLOW_EXCH2 */ |
100 |
END |
101 |
|
102 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
103 |
|
104 |
CEH3 ;;; Local Variables: *** |
105 |
CEH3 ;;; mode:fortran *** |
106 |
CEH3 ;;; End: *** |