| 1 |
dimitri |
1.3 |
C $Header: /usr/local/gcmpack/MITgcm_contrib/high_res_cube/code-mods/exch2_uv_xy_rl.F,v 1.2 2003/11/22 01:16:18 dimitri Exp $ |
| 2 |
cnh |
1.1 |
C $Name: $ |
| 3 |
|
|
|
| 4 |
|
|
#include "CPP_EEOPTIONS.h" |
| 5 |
|
|
|
| 6 |
|
|
CBOP |
| 7 |
|
|
C !ROUTINE: EXCH_UV_XY_RL |
| 8 |
|
|
|
| 9 |
|
|
C !INTERFACE: |
| 10 |
|
|
SUBROUTINE EXCH2_UV_XY_RL( |
| 11 |
|
|
U Uphi, Vphi, withSigns, |
| 12 |
|
|
I myThid ) |
| 13 |
|
|
IMPLICIT NONE |
| 14 |
|
|
C !DESCRIPTION: |
| 15 |
|
|
C *==========================================================* |
| 16 |
|
|
C | SUBROUTINE EXCH_UV_XY_RL |
| 17 |
|
|
C | o Handle exchanges for _RL, two-dimensional arrays. |
| 18 |
|
|
C *==========================================================* |
| 19 |
|
|
C | Driver exchange routine which branches to cube sphere or |
| 20 |
|
|
C | global, simple cartesian index grid. Exchange routine is |
| 21 |
|
|
C | called with two arrays that are components of a vector. |
| 22 |
|
|
C | These components are rotated and interchanged on the |
| 23 |
|
|
C | rotated grid during cube exchanges. |
| 24 |
|
|
C *==========================================================* |
| 25 |
|
|
|
| 26 |
|
|
C !USES: |
| 27 |
|
|
C === Global data === |
| 28 |
|
|
#include "SIZE.h" |
| 29 |
|
|
#include "EEPARAMS.h" |
| 30 |
|
|
#include "EESUPPORT.h" |
| 31 |
|
|
#include "W2_EXCH2_TOPOLOGY.h" |
| 32 |
|
|
#include "W2_EXCH2_PARAMS.h" |
| 33 |
|
|
|
| 34 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
| 35 |
|
|
C === Routine arguments === |
| 36 |
|
|
C Uphi :: Arrays with overlap regions are to be exchanged |
| 37 |
|
|
C Vphi Note - The interface to EXCH_ assumes that |
| 38 |
|
|
C the standard Fortran 77 sequence association rules |
| 39 |
|
|
C apply. |
| 40 |
|
|
C myThid :: My thread id. |
| 41 |
|
|
C withSigns :: Flag controlling whether vector is signed. |
| 42 |
|
|
_RL Uphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
| 43 |
|
|
_RL Vphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
| 44 |
|
|
LOGICAL withSigns |
| 45 |
|
|
INTEGER myThid |
| 46 |
|
|
|
| 47 |
|
|
C !LOCAL VARIABLES: |
| 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 |
|
|
INTEGER bi, bj, myTile |
| 53 |
|
|
CEOP |
| 54 |
|
|
|
| 55 |
|
|
OLw = OLx |
| 56 |
|
|
OLe = OLx |
| 57 |
|
|
OLn = OLy |
| 58 |
|
|
OLs = OLy |
| 59 |
|
|
exchWidthX = OLx |
| 60 |
|
|
exchWidthY = OLy |
| 61 |
|
|
myNz = 1 |
| 62 |
|
|
C ** NOTE ** The exchange routine we use here does not |
| 63 |
|
|
C require the preceeding and following barriers. |
| 64 |
|
|
C However, the slow, simple exchange interface |
| 65 |
|
|
C that is calling it here is meant to ensure |
| 66 |
|
|
C that threads are synchronised before exchanges |
| 67 |
|
|
C begine. |
| 68 |
|
|
IF (useCubedSphereExchange) THEN |
| 69 |
|
|
CALL EXCH2_RL2_CUBE( Uphi, Vphi, withSigns, 'UV', |
| 70 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
| 71 |
|
|
I exchWidthX, exchWidthY, |
| 72 |
|
|
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 73 |
|
|
CALL EXCH2_RL2_CUBE( Uphi, Vphi, withSigns, 'UV', |
| 74 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
| 75 |
|
|
I exchWidthX, exchWidthY, |
| 76 |
|
|
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 77 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
| 78 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
| 79 |
|
|
myTile = W2_myTileList(bi) |
| 80 |
dimitri |
1.2 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
| 81 |
|
|
& exch2_isSedge(myTile) .EQ. 1 ) THEN |
| 82 |
|
|
Uphi(snx+1, 0,bi,bj)= vPhi(snx+1, 1,bi,bj) |
| 83 |
cnh |
1.1 |
ENDIF |
| 84 |
|
|
IF ( withSigns ) THEN |
| 85 |
dimitri |
1.2 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
| 86 |
|
|
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
| 87 |
|
|
Uphi(snx+1,sny+1,bi,bj)=-vPhi(snx+1,sny+1,bi,bj) |
| 88 |
cnh |
1.1 |
ENDIF |
| 89 |
|
|
ELSE |
| 90 |
dimitri |
1.2 |
IF ( exch2_isEedge(myTile) .EQ. 1 .AND. |
| 91 |
|
|
& exch2_isNedge(myTile) .EQ. 1 ) THEN |
| 92 |
|
|
Uphi(snx+1,sny+1,bi,bj)= vPhi(snx+1,sny+1,bi,bj) |
| 93 |
cnh |
1.1 |
ENDIF |
| 94 |
|
|
ENDIF |
| 95 |
|
|
ENDDO |
| 96 |
|
|
ENDDO |
| 97 |
|
|
|
| 98 |
|
|
ELSE |
| 99 |
|
|
c CALL EXCH_RL( Uphi, |
| 100 |
|
|
c I OLw, OLe, OLs, OLn, myNz, |
| 101 |
|
|
c I exchWidthX, exchWidthY, |
| 102 |
|
|
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 103 |
|
|
c CALL EXCH_RL( Vphi, |
| 104 |
|
|
c I OLw, OLe, OLs, OLn, myNz, |
| 105 |
|
|
c I exchWidthX, exchWidthY, |
| 106 |
|
|
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
| 107 |
|
|
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
| 108 |
|
|
_EXCH_XY_RL( Uphi, myThid ) |
| 109 |
|
|
_EXCH_XY_RL( Vphi, myThid ) |
| 110 |
|
|
ENDIF |
| 111 |
|
|
|
| 112 |
|
|
RETURN |
| 113 |
|
|
END |