| 1 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_uv_xy_rx.template,v 1.9 2007/08/17 18:34:17 jmc 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_XY_RX |
| 12 |
|
| 13 |
C !INTERFACE: |
| 14 |
SUBROUTINE EXCH_UV_XY_RX( |
| 15 |
U Uphi, Vphi, |
| 16 |
I withSigns, myThid ) |
| 17 |
IMPLICIT NONE |
| 18 |
C !DESCRIPTION: |
| 19 |
C *==========================================================* |
| 20 |
C | SUBROUTINE EXCH_UV_XY_RX |
| 21 |
C | o Handle exchanges for _RX, two-dimensional arrays. |
| 22 |
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 |
C | These components are rotated and interchanged on the |
| 27 |
C | rotated grid during cube exchanges. |
| 28 |
C *==========================================================* |
| 29 |
|
| 30 |
C !USES: |
| 31 |
C === Global data === |
| 32 |
#include "SIZE.h" |
| 33 |
#include "EEPARAMS.h" |
| 34 |
cph-mpi#include "EESUPPORT.h" |
| 35 |
c#include "EXCH.h" |
| 36 |
|
| 37 |
C !INPUT/OUTPUT PARAMETERS: |
| 38 |
C === Routine arguments === |
| 39 |
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 |
_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 |
C !LOCAL VARIABLES: |
| 51 |
#ifndef ALLOW_EXCH2 |
| 52 |
C == Local variables == |
| 53 |
C OL[wens] :: Overlap extents in west, east, north, south. |
| 54 |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
| 55 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
| 56 |
#endif |
| 57 |
CEOP |
| 58 |
|
| 59 |
#ifdef ALLOW_EXCH2 |
| 60 |
#ifdef W2_USE_R1_ONLY |
| 61 |
CALL EXCH2_UV_CGRID_3D_RX( |
| 62 |
U Uphi, Vphi, |
| 63 |
I withSigns, 1, myThid ) |
| 64 |
#else |
| 65 |
CALL EXCH2_UV_XY_RX( |
| 66 |
U Uphi, Vphi, |
| 67 |
I withSigns, myThid ) |
| 68 |
#endif |
| 69 |
RETURN |
| 70 |
#else /* ALLOW_EXCH2 */ |
| 71 |
|
| 72 |
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 |
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 |
ENDIF |
| 105 |
|
| 106 |
RETURN |
| 107 |
#endif /* ALLOW_EXCH2 */ |
| 108 |
END |
| 109 |
|
| 110 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 111 |
|
| 112 |
CEH3 ;;; Local Variables: *** |
| 113 |
CEH3 ;;; mode:fortran *** |
| 114 |
CEH3 ;;; End: *** |