1 |
cnh |
1.1 |
% Create exch2 communication map and schedule for a cube sphere grid with |
2 |
|
|
% constant tile size tnx x tny. |
3 |
|
|
|
4 |
|
|
% Use red-green-blue shorthand for cube index space specification |
5 |
|
|
% In this notation cube faces are laid out as shown below |
6 |
|
|
% |
7 |
|
|
% |
8 |
|
|
% f5(nr,ng) f6(nb,ng) |
9 |
|
|
% f3(ng,nb) f4(nr,nb) |
10 |
|
|
% f1(nb,nr) f2(nb,nr) |
11 |
|
|
% |
12 |
|
|
nr=64; nb=32; ng=128; |
13 |
|
|
%nr=576; nb=576; ng=576; |
14 |
|
|
%nr=672; nb=672; ng=672; |
15 |
|
|
nr=32; nb=32; ng=32; |
16 |
|
|
%nr=510; nb=510; ng=510; |
17 |
|
|
%nr=30; nb=30; ng=30; |
18 |
|
|
|
19 |
|
|
% Choose tile subgrid sizes for each face. |
20 |
|
|
% nr,nb,ng must be integer multiples of tnx and tny. |
21 |
|
|
tnx=85;tny=85; |
22 |
|
|
%tnx=10;tny=10; |
23 |
|
|
%tnx=16;tny=16; |
24 |
|
|
tnx=16;tny=32; |
25 |
|
|
%tnx=192;tny=64; |
26 |
|
|
|
27 |
|
|
% Make list of domains. Assume MITgcm standard cube layout, three color path labeling and |
28 |
|
|
% global indexing convention. |
29 |
|
|
clear domain ndomains domain_nx domain_ny |
30 |
|
|
[ndomains,domain,domain_nx,domain_ny] = exch2_setup_cs6_domains(nr,nb,ng); |
31 |
|
|
|
32 |
|
|
% Now create basic tile definitions for each domain with their offsets within the domain |
33 |
|
|
% tn[xy] :: tile extents in x and y |
34 |
|
|
% tbase[xy] :: offset of tile local coords from domain coords |
35 |
|
|
% :: tdom[xy] = tlocal[xy] + tbase[xy] |
36 |
|
|
% t[xy]globallo :: global composite domain coordinate associated with |
37 |
|
|
% :: tlocal[xy]=(1,1) |
38 |
|
|
% mydomain :: domain number the tile belongs to |
39 |
|
|
% tileid :: identifier number for tile |
40 |
|
|
% tx :: tile x coordinate within domain tiling |
41 |
|
|
% ty :: tile y coordinate within domain tiling |
42 |
|
|
clear tile |
43 |
|
|
[tile,ntiles,ierr,domain]= ... |
44 |
|
|
exch2_setup_cs6_tiles(tnx,tny,domain,ndomains); |
45 |
|
|
|
46 |
|
|
% Set neighbor domains for each tile |
47 |
|
|
[tile] = exch2_setup_cs6_get_neighbor_domains(tile, domain, ntiles); |
48 |
|
|
|
49 |
|
|
% Let try and figure out what points I send my edges to. We do this by a search procedure |
50 |
|
|
% rather than a functional relationship. The search procedure visits each edge of each tile |
51 |
|
|
% in turn. For internal edges (edges that don't cross a domain boundary) the index range at |
52 |
|
|
% +/-1 in the normal direction to the edge is searched for. This identifies all the tiles that % border this tile. |
53 |
|
|
[tile] = exch2_setup_cs6_get_internal_neighbor_tiles( tile, domain, ntiles); |
54 |
|
|
[tile] = exch2_setup_cs6_get_internal_neighbor_index_ranges(tile, domain, ntiles); |
55 |
|
|
|
56 |
|
|
[tile] = exch2_setup_cs6_get_external_neighbor_tiles( tile, domain, ntiles); |
57 |
|
|
% Draw a picture of the domain and its tiles in the standard cube layout |
58 |
|
|
exch2_setup_cs6_plot(domain, tile, tnx, tny); |
59 |
|
|
|
60 |
|
|
% Write attributes for a tile |
61 |
|
|
exch2_setup_cs6_print( domain, tile, 1) |