OpenGGCM Collaboration |
Main /
GridsTHIS PAGE NEEDS MAJOR WORK== General Considerations == The OpenGGCM numerical MHD grid is of the type "stretched-cartesian", meaning that it is an orthogonal grid with a variable spacing in each of the coordinate directions. It allows the grid to be adapted to the anticipated solution. Grid cells can be made smaller in areas where higher resolution is desired and they can also made larger in regions where coarse resolution is sufficient. The latter regions are in particular the distant tail and the solar wind regions outside of the tail. Although this strategy is less optimal compared to AMR (Adaptive Mesh Refinement) in terms of the total number of cells required to achieve a given resolution, it has a number of advantages:
In each coordinate direction the code requires <tt>x(i)</tt> and <tt>(d/di)(x(i))</tt> where <tt>i</tt> (the grid index) is considered a continuous variable. In practice it is more convenient to specify <tt>dx(x)</tt>, i.e., the cell size as a function of space, as opposed as a function of grid index. From a specification of <tt>dx(x)</tt> one needs to do an integration to get to <tt>x(i)</tt> and <tt>(d/di)(x(i)).</tt> For the x-coordinate the OpenGGCM uses the approach of specifying <tt>dx(x)</tt> and numerical integration to obtain <tt>x(i)</tt> and <tt>(d/di)(x(i))</tt>. For the y/z-coordinates <tt>y(i)</tt> (outlined for y here) is specified by an analytic function <tt>gy(iy)=dy*y*(1.0+alpha*(y**beta))**gamma</tt> where <tt>alpha, beta, and gamma </tt>are appropriate constants depending on the grid size and numer of grid points. <tt>gy(iy)</tt> is designed to provide the highest resolution at the center, with a flat part that has <tt>(d/diy)(y(iy))</tt> approximately <tt>dy</tt> and increasing <tt>(d/diy)(y(iy))</tt> towards either end. Note that decreasing dy will make the cells smaller in the center but also shrink the area to which the smaller cell size applies. To keep that area constant one must also increase the number of grid points in that direction (often dramatically). In the x-coordinate the function <tt>dx(x)</tt> is constructed as: dx = fak*(hm + (h0-hm)*tanhm(b1*(x-x1)) + (hn-hm)*tanhp(b2*(x-x5)) - (hm-hmm)*(#one-tanhm(b3*(x-(x3-dmm)))-tanhp(b3*(x-(x3+dmm)))) ) tanhm(x)=(1-tanh(x))/2 tanhp(x)=(1+tanh(x))/2 The value of fak is determined as to match the length of the box; the other constants define the shape of the function. There is no way to specify the minimum resolution a priori, but the pre-compilation will report it. The shape of the dx curve is the summation of a constant value (hmm), a negative tanh curve (height of h0-hm, width controlled by b1, centered at x1), a positive tanh curve (height of hn-hm, width controlled by b2, centered at x5), and a pair of tanh curves (height of hn-hmm, width controlled by b3, negative curve centered at x3-dmm and positive curve centered at x3+dmm). == Restrictions and performance considerations == The number of gridpoints in each coordinate must be divisible by the number of processors in the same direction, for example, NX/NPX must be an integer. Furthermore, NY/NPY and NZ/NPZ must still be divisible by 2. Pre-compilation will fail if this is not the case. '''The leading dimension of the F77 arrays is NL=((NX/NPX)+4). Most processors, including IA32, IA64, MIPS, and Power3/4 (that is, INTEL, AMD, SGI, IBM), drop significantly in performance if NL is divisible by 2, and even worse if NL is divisible by 16. This is due to "cache thrashing". A safe choice for NX is NPX times an odd number. ''' == Example grids == The following are eamples of how to specify grids in the "runme" files. These examples should cover most cases, and where they don't they are good starting points. Note that the resolution in the x-coordinate is simply proportional to NX. In the y/z directions increasing NY and/or NZ widens the high-resolution area, whereas lowering DY0/DZ0 narrows it. The example grids are labelled with 4 letter codes for use by the CCMC. Note that you probably need to change the change NPX/NPY/NPZ depending on your processor configuration within the above constraints. == Small grids. Useful for some runs but generally not sufficient resolution for substorms or FTEs: == npx 7 # number of processors in x npy 4 # number of processors in y npz 4 # number of processors in z nx 455 # number of cells in x ny 120 # number of cells in y nz 120 # number of cells in z dy0 0.25 # minimum cell size in y dz0 0.25 # minimum cell size in z xx1 -24.01 # sunward extension of box xx2 350.01 # anti-sunward extension of box yy2 48.01 # box size in +-y zz2 48.01 # box size in +-z ggx1 $v="-n $NX -x0 $XX1 -xn $XX2 " # definition and constants for x-grid ggx2 $v="-x1 -26 -x3 10 -dmm 8 -x5 80 " ggx3 $v="-h0 2.0 -hn 43 -hm 1.7 -hmm 0.70 " ggx4 $v="-b1 0.15 -b2 0.025 -b3 0.3 " npx 7 # number of processors in x npy 4 # number of processors in y npz 4 # number of processors in z nx 455 # number of cells in x ny 120 # number of cells in y nz 120 # number of cells in z dy0 0.25 # minimum cell size in y dz0 0.25 # minimum cell size in z xx1 -24.01 # sunward extension of box xx2 350.01 # anti-sunward extension of box yy2 48.01 # box size in +-y zz2 48.01 # box size in +-z ggx1 $v="-n $NX -x0 $XX1 -xn $XX2 " # definition and constants for x-grid ggx2 $v="-x1 -26 -x3 -4 -dmm 8 -x5 50 " ggx3 $v="-h0 2.0 -hn 43 -hm 1.7 -hmm 0.35 " ggx4 $v="-b1 0.15 -b2 0.025 -b3 0.3 " npx 6 # number of processors in x npy 4 # number of processors in y npz 4 # number of processors in z nx 426 # number of cells in x ny 144 # number of cells in y nz 144 # number of cells in z dy0 0.40 # minimum cell size in y dz0 0.25 # minimum cell size in z xx1 -24.01 # sunward extension of box xx2 350.01 # anti-sunward extension of box yy2 48.01 # box size in +-y zz2 48.01 # box size in +-z ggx1 $v="-n $NX -x0 $XX1 -xn $XX2 " # definition and constants for x-grid ggx2 $v="-x1 -10 -x3 40 -dmm 16 -x5 70 " ggx3 $v="-h0 1.0 -hn 5 -hm 0.60 -hmm 0.60 " ggx4 $v="-b1 0.15 -b2 0.075 -b3 0.3 " == Large grids. Useful and/or needed for runs that target mesoscale phenomena (FTEs, boundaries) or low diffusion (substorms): ==
npx 6 # number of processors in x npy 1 # number of processors in y npz 1 # number of processors in z nx 522 # number of cells in x ny 240 # number of cells in y nz 240 # number of cells in z dy0 0.25 # minimum cell size in y dz0 0.25 # minimum cell size in z xx1 -24.01 # sunward extension of box xx2 350.01 # anti-sunward extension of box yy2 48.01 # box size in +-y zz2 48.01 # box size in +-z ggx1 $v="-n $NX -x0 $XX1 -xn $XX2 " # definition and constants for x-grid ggx2 $v="-x1 -20 -x3 0 -dmm 16 -x5 30 " ggx3 $v="-h0 2.0 -hn 5 -hm 0.30 -hmm 0.30 " ggx4 $v="-b1 0.15 -b2 0.075 -b3 0.3 "
npx 14 npy 2 npz 2 nx 630 ny 200 nz 300 dy0 0.25 dz0 0.16 xx1 -20.01 xx2 500.01 yy2 36.01 zz2 36.01 ggx1 $v="-n $NX -x0 $XX1 -xn $XX2 " ggx2 $v="-x1 -26 -x3 -10 -dmm 8 -x5 80 " ggx3 $v="-h0 2.0 -hn 43 -hm 1.0 -hmm 1.00 " ggx4 $v="-b1 0.15 -b2 0.100 -b3 0.3 "
npx 10 npy 5 npz 2 nx 510 ny 350 nz 300 dy0 0.18 dz0 0.18 xx1 -18.01 xx2 300.01 yy2 38.01 zz2 38.01 ggx1 $v="-n $NX -x0 $XX1 -xn $XX2 " ggx2 $v="-x1 -12 -x3 15 -dmm 8 -x5 50 " ggx3 $v="-h0 2.0 -hn 43 -hm 1.7 -hmm 0.5 " ggx4 $v="-b1 0.15 -b2 0.025 -b3 0.3 " == Comments on optimizing grids, and a red flag ==
''' |