| 1 | 
C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_uv_xy_rx.template,v 1.10 2009/04/28 15:17:00 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 | 
 | 
| 18 | 
C     !DESCRIPTION: | 
| 19 | 
C     *==========================================================* | 
| 20 | 
C     | SUBROUTINE EXCH_UV_XY_RX | 
| 21 | 
C     | o Handle exchanges for _RX, 2-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 | 
 | 
| 31 | 
C     === Global data === | 
| 32 | 
#include "SIZE.h" | 
| 33 | 
#include "EEPARAMS.h" | 
| 34 | 
 | 
| 35 | 
C     !INPUT/OUTPUT PARAMETERS: | 
| 36 | 
C     === Routine arguments === | 
| 37 | 
C     Uphi      :: 2 components of a vector field with overlap regions | 
| 38 | 
C     Vphi      :: to be exchanged | 
| 39 | 
C     withSigns :: Flag controlling whether vector is signed. | 
| 40 | 
C     myThid    :: my Thread Id. number | 
| 41 | 
      _RX Uphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) | 
| 42 | 
      _RX Vphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) | 
| 43 | 
      LOGICAL withSigns | 
| 44 | 
      INTEGER myThid | 
| 45 | 
 | 
| 46 | 
C     !LOCAL VARIABLES: | 
| 47 | 
#ifndef ALLOW_EXCH2 | 
| 48 | 
C     == Local variables == | 
| 49 | 
C     OL[wens]       :: Overlap extents in west, east, north, south. | 
| 50 | 
C     exchWidth[XY]  :: Extent of regions that will be exchanged. | 
| 51 | 
      INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz | 
| 52 | 
#endif | 
| 53 | 
CEOP | 
| 54 | 
 | 
| 55 | 
#ifdef ALLOW_EXCH2 | 
| 56 | 
#ifdef W2_USE_R1_ONLY | 
| 57 | 
      CALL EXCH2_UV_CGRID_3D_RX( | 
| 58 | 
     U                     Uphi, Vphi, | 
| 59 | 
     I                     withSigns, 1, myThid ) | 
| 60 | 
#else | 
| 61 | 
      CALL EXCH2_UV_3D_RX( | 
| 62 | 
     U                     Uphi, Vphi, | 
| 63 | 
     I                     withSigns, 1, myThid ) | 
| 64 | 
#endif | 
| 65 | 
      RETURN | 
| 66 | 
#else /* ALLOW_EXCH2 */ | 
| 67 | 
 | 
| 68 | 
      OLw        = OLx | 
| 69 | 
      OLe        = OLx | 
| 70 | 
      OLn        = OLy | 
| 71 | 
      OLs        = OLy | 
| 72 | 
      exchWidthX = OLx | 
| 73 | 
      exchWidthY = OLy | 
| 74 | 
      myNz       = 1 | 
| 75 | 
      IF (useCubedSphereExchange) THEN | 
| 76 | 
       CALL EXCH1_UV_RX_CUBE( Uphi, Vphi, withSigns, | 
| 77 | 
     I            OLw, OLe, OLs, OLn, myNz, | 
| 78 | 
     I            exchWidthX, exchWidthY, | 
| 79 | 
     I            EXCH_UPDATE_CORNERS, myThid ) | 
| 80 | 
      ELSE | 
| 81 | 
       CALL EXCH1_RX( Uphi, | 
| 82 | 
     I            OLw, OLe, OLs, OLn, myNz, | 
| 83 | 
     I            exchWidthX, exchWidthY, | 
| 84 | 
     I            EXCH_UPDATE_CORNERS, myThid ) | 
| 85 | 
       CALL EXCH1_RX( Vphi, | 
| 86 | 
     I            OLw, OLe, OLs, OLn, myNz, | 
| 87 | 
     I            exchWidthX, exchWidthY, | 
| 88 | 
     I            EXCH_UPDATE_CORNERS, myThid ) | 
| 89 | 
      ENDIF | 
| 90 | 
 | 
| 91 | 
      RETURN | 
| 92 | 
#endif /* ALLOW_EXCH2 */ | 
| 93 | 
      END | 
| 94 | 
 | 
| 95 | 
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| | 
| 96 | 
 | 
| 97 | 
CEH3 ;;; Local Variables: *** | 
| 98 | 
CEH3 ;;; mode:fortran *** | 
| 99 | 
CEH3 ;;; End: *** |