| 403 |
\varlink{exch2\_oj\_f}{exch2_oj_f} are indexed to tile number and |
\varlink{exch2\_oj\_f}{exch2_oj_f} are indexed to tile number and |
| 404 |
neighbor and specify the relative offset within the subdomain of the |
neighbor and specify the relative offset within the subdomain of the |
| 405 |
array index of a variable going from a neighboring tile $N$ to a local |
array index of a variable going from a neighboring tile $N$ to a local |
| 406 |
tile $T$. Consider the six-tile case (Fig. \ref{fig:6tile}), where |
tile $T$. Consider \code{T=1} in the six-tile topology |
| 407 |
\code{exch2\_oi(1,1)=33}, \code{exch2\_oi(2,1)=0}, |
(Fig. \ref{fig:6tile}), where |
| 408 |
\code{exch2\_oi(3,1)=32}, and \code{exch2\_oi(4,1)=-32}. Each of these |
|
| 409 |
indicates the offset in the $x$ direction \\ |
\begin{verbatim} |
| 410 |
|
exch2_oi(1,1)=33 |
| 411 |
|
exch2_oi(2,1)=0 |
| 412 |
|
exch2_oi(3,1)=32 |
| 413 |
|
exch2_oi(4,1)=-32 |
| 414 |
|
\end{verbatim} |
| 415 |
|
|
| 416 |
|
The simplest case is \code{exch2\_oi(2,1)}, the southern neighbor, |
| 417 |
|
which is \code{Tn=6}. The axes of \code{T} and \code{Tn} have the |
| 418 |
|
same orientation and their $x$ axes have the same origin, and so an |
| 419 |
|
exchange between the two requires no changes to the $x$ index. For |
| 420 |
|
the western neighbor (\code{Tn=5}), \code{code\_oi(3,1)=32} since the |
| 421 |
|
\code{x=0} vector on \code{T} corresponds to the \code{y=32} vector on |
| 422 |
|
\code{Tn}. The eastern edge of \code{T} shows the reverse case |
| 423 |
|
(\code{exch2\_oi(4,1)=-32)}, where \code{x=32} on \code{T} exchanges |
| 424 |
|
with \code{x=0} on \code{Tn=2}. The most interesting case, where |
| 425 |
|
\code{exch2\_oi(1,1)=33} and \code{Tn=3}, involves a reversal of |
| 426 |
|
indices. As in every case, the offset \code{exch2\_oi} is added to |
| 427 |
|
the original $x$ index of \code{T} multiplied by the transformation |
| 428 |
|
factor \code{exch2\_pi(t,N,T)}. Here \code{exch2\_pi(1,1,1)=0} since |
| 429 |
|
the $x$ axis of \code{T} is orthogonal to the $x$ axis of \code{Tn}. |
| 430 |
|
\code{exch2\_pi(2,1,1)=-1} since the $x$ axis of \code{T} corresponds |
| 431 |
|
to the $y$ axis of \code{Tn}, but the axes are reversed. The result |
| 432 |
|
is that the index of the northern edge of \code{T}, which runs |
| 433 |
|
\code{(1:32)}, is transformed to |
| 434 |
|
\code{(-1:-32)}. \code{exch2\_oi(1,1)} is then added to this range to |
| 435 |
|
get back \code{(1:32)} -- the index of the $y$ axis of \code{Tn}. |
| 436 |
|
This transformation may seem overly convoluted for the six-tile case, |
| 437 |
|
but it is necessary to provide a general solution for various |
| 438 |
|
topologies. \\ |
| 439 |
|
|
| 440 |
|
|
| 441 |
|
|
| 442 |
Finally, \varlink{exch2\_itlo\_c}{exch2_itlo_c}, |
Finally, \varlink{exch2\_itlo\_c}{exch2_itlo_c}, |
| 443 |
\varlink{exch2\_ithi\_c}{exch2_ithi_c}, |
\varlink{exch2\_ithi\_c}{exch2_ithi_c}, |
| 500 |
|
|
| 501 |
\subsection{Key Routines} |
\subsection{Key Routines} |
| 502 |
|
|
| 503 |
|
Most of the subroutines particular to exch2 handle the exchanges |
| 504 |
|
themselves and are of the same format as those described in |
| 505 |
|
\ref{sect:cube_sphere_communication} \sectiontitle{Cube sphere |
| 506 |
|
communication}. Like the original routines, they are written as |
| 507 |
|
templates which the local Makefile converts from RX into RL and RS |
| 508 |
|
forms. \\ |
| 509 |
|
|
| 510 |
|
The interfaces with the core model subroutines are |
| 511 |
|
\code{EXCH\_UV\_XY\_RX}, \code{EXCH\_UV\_XYZ\_RX} and \code{EXCH\_XY\_RX}. |
| 512 |
|
They override the standard exchange routines when \code{genmake2} is |
| 513 |
|
run with \code{exch2} option. They in turn call the local exch2 |
| 514 |
|
subroutines \code{EXCH2\_UV\_XY\_RX} and \code{EXCH2\_UV\_XYZ\_RX} for two |
| 515 |
|
and three dimensional vector quantities, and \code{EXCH2\_XY\_RX} and |
| 516 |
|
\code{EXCH2\_XYZ\_RX} for two and three dimensional scalar quantities. |
| 517 |
|
These subroutines set the dimensions of the area to be exchanged, call |
| 518 |
|
\code{EXCH2\_RX1\_CUBE} for scalars and \code{EXCH2\_RX2\_CUBE} for |
| 519 |
|
vectors, and then handle the singularities at the cube corners. \\ |
| 520 |
|
|
| 521 |
|
The separate scalar and vector forms of \code{EXCH2\_RX1\_CUBE} and |
| 522 |
|
\code{EXCH2\_RX2\_CUBE} reflect that the vector-handling subrouine needs |
| 523 |
|
to pass both the $x$ and $y$ components of the vectors. This arises |
| 524 |
|
from the topological folding discussed above, where the $x$ and $y$ |
| 525 |
|
axes get swapped in some cases. This swapping is not an issue with |
| 526 |
|
the scalar version. These subroutines call \code{EXCH2\_SEND\_RX1} and |
| 527 |
|
\code{EXCH2\_SEND\_RX2}, which do most of the work using the variables |
| 528 |
|
discussed above. \\ |
| 529 |
|
|
|
|
|
|
\subsection{References} |
|