Matlab code to generate topology description for MITgcm cs6 conventions. o To run start matlab and execute script driver.m o To set sizes edit lines in driver.m Settings nr, ng, nb are index space sizes for cube grid. These are the number of points normal to the red, green and blue circumferences of a cube. Note - nr, ng and nb do not have to equal, however the current physical grid generation software assumes they are equal. Settings tnx and tny are the tile sizes ( these correspond to snx and sny in SIZE.h ). tnx and tny must subdivide nr, ng and nb exactly. The product nsx*npx from SIZE.h needs to equal the number of tiles created by driver.m The key output from this code is a Fortran header file W2_EXCH2_TOPOLOGY.h and one or more Fotran files called e2setup*.F. These are written by exch2_setup_cs6_print.m. The header file contains the declarations of the arrays used to describe the index space topology of the cube domain. The e2setp*.F files contain the code to initialize these arrays. Two output options ( variable outmode ) are available in exch2_setup_cs6_print.m. One produces a single file e2setup.F with a driver routine that calls a setup routine for each tile. For large numbers of tiles this file can be huge and can cause some Fortran compilers (g77 certainly) to allocate ridiculous amounts of memory to parse this file. An alternate output mode produces one file for each tile initialization routine and one file "e2setup.F" for the driver. This mode is kinder to the compiler but creates a visually annoying large number of source files (one for each tile). File list driver.m :: Controls the topology generation exch2_setup_cs6_domains.m :: Defines the cube faces (aka domains) exch2_setup_cs6_get_external_neighbor_index_ranges.m :: Figures out the index remapping operators :: and index ranges for halo's between cube faces. exch2_setup_cs6_get_external_neighbor_tiles.m :: Figures out neighbor between domains for each tile. exch2_setup_cs6_get_internal_neighbor_index_ranges.m :: Figures out the index remapping operators :: and index ranges for halo's within a cube face. exch2_setup_cs6_get_internal_neighbor_tiles.m :: Figures out neighbors with a domain for each tile. exch2_setup_cs6_get_neighbor_domains.m :: Defines connectivity between domains. exch2_setup_cs6_plot.m :: Plots the tiles using the conventional cube :: domain layout. exch2_setup_cs6_print.m :: Writes the Fortran code that defines the topology :: and that is linked with the model run. exch2_setup_cs6_tiles.m :: Builds lists of each tile and its location within :: a domain and within the global index space.