| 1 |
heimbach |
1.8 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_uv_xy_rx.template,v 1.7 2007/07/25 21:19:44 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 |
edhill |
1.4 |
#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 |
adcroft |
1.2 |
C == Local variables == |
| 52 |
cnh |
1.3 |
C OL[wens] :: Overlap extents in west, east, north, south. |
| 53 |
|
|
C exchWidth[XY] :: Extent of regions that will be exchanged. |
| 54 |
adcroft |
1.2 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
| 55 |
cnh |
1.3 |
CEOP |
| 56 |
adcroft |
1.2 |
|
| 57 |
jmc |
1.5 |
#ifdef ALLOW_EXCH2 |
| 58 |
jmc |
1.7 |
#ifdef W2_USE_R1_ONLY |
| 59 |
|
|
CALL EXCH2_UV_CGRID_3D_RX( |
| 60 |
|
|
U Uphi, Vphi, |
| 61 |
|
|
I withSigns, 1, myThid ) |
| 62 |
|
|
#else |
| 63 |
jmc |
1.5 |
CALL EXCH2_UV_XY_RX( |
| 64 |
|
|
U Uphi, Vphi, |
| 65 |
|
|
I withSigns, myThid ) |
| 66 |
jmc |
1.7 |
#endif |
| 67 |
jmc |
1.5 |
RETURN |
| 68 |
jmc |
1.7 |
#else /* ALLOW_EXCH2 */ |
| 69 |
jmc |
1.5 |
|
| 70 |
adcroft |
1.2 |
OLw = OLx |
| 71 |
|
|
OLe = OLx |
| 72 |
|
|
OLn = OLy |
| 73 |
|
|
OLs = OLy |
| 74 |
|
|
exchWidthX = OLx |
| 75 |
|
|
exchWidthY = OLy |
| 76 |
|
|
myNz = 1 |
| 77 |
|
|
C ** NOTE ** The exchange routine we use here does not |
| 78 |
|
|
C require the preceeding and following barriers. |
| 79 |
|
|
C However, the slow, simple exchange interface |
| 80 |
|
|
C that is calling it here is meant to ensure |
| 81 |
|
|
C that threads are synchronised before exchanges |
| 82 |
|
|
C begine. |
| 83 |
|
|
IF (useCubedSphereExchange) THEN |
| 84 |
|
|
CALL EXCH_UV_RX_CUBE( Uphi, Vphi, withSigns, |
| 85 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
| 86 |
|
|
I exchWidthX, exchWidthY, |
| 87 |
|
|
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 88 |
|
|
ELSE |
| 89 |
|
|
c CALL EXCH_RX( Uphi, |
| 90 |
|
|
c I OLw, OLe, OLs, OLn, myNz, |
| 91 |
|
|
c I exchWidthX, exchWidthY, |
| 92 |
|
|
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 93 |
|
|
c CALL EXCH_RX( Vphi, |
| 94 |
|
|
c I OLw, OLe, OLs, OLn, myNz, |
| 95 |
|
|
c I exchWidthX, exchWidthY, |
| 96 |
|
|
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 97 |
|
|
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
| 98 |
|
|
_EXCH_XY_RX( Uphi, myThid ) |
| 99 |
|
|
_EXCH_XY_RX( Vphi, myThid ) |
| 100 |
|
|
ENDIF |
| 101 |
|
|
|
| 102 |
|
|
RETURN |
| 103 |
jmc |
1.7 |
#endif /* ALLOW_EXCH2 */ |
| 104 |
adcroft |
1.2 |
END |
| 105 |
jmc |
1.5 |
|
| 106 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 107 |
|
|
|
| 108 |
|
|
CEH3 ;;; Local Variables: *** |
| 109 |
|
|
CEH3 ;;; mode:fortran *** |
| 110 |
|
|
CEH3 ;;; End: *** |