Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Preferred method:
    • Here we follow a procedure developed by Oksana Guba where we draw the PNG image on top of a background image of a cubed-sphere grid.  This allows one to have better control over the refined region’s boundaries and avoid notches and other types of glitches in the transition region.  
    • If the fine region will be (for example) NE120 (¼ degree), make a uniform NE60.g file (exactly half the resolution of the fine region).  This can be done via; SQuadGen --resolution 60 --refine_level 0 --output NE60.g
    • Create a lat/lon plot of this NE60 mesh, without any borders or axis, and convert to a PNG file with an aspect ratio of 2.  The final resolution should be something like 2048x4096.   Here's an example of the kind of file you want:  Image Added
    • This PNG file will be used as a background image in Photoshop or GIMP.  The PNG of the refined region is then drawn on top of this image (in a separate layer).
    • For best results, create a PNG that is transparent (so you can see the NE60 grid behind it) and then fill in, in white, the elements that should be refined to NE120.  For best results the border should follow the grid lines, or go at a 45 degree angle (i.e. over 1 element, then down 1 element, and repeat).  
    • Save the new PNG (without the background image).  Here we assume the file is called newmesh.png
    • ./SQuadGen --refine_file  newmesh.png --refine_level 3 --refine_type LOWCONN \
      --resolution 15 --smooth_type SPRING --smooth_dist 3 --smooth_iter 20 \
      --output newmesh.g
    • Plot the final grid and make sure it does not have any highly deformed elements.
    • Please note:  If you use the LOWCONN option for --refine_type, try to avoid six elements around one point by editing the white parts of the PNG.  Six elements around a point is unavoidable with the CUBIT option.  
  2. Alternative Method:
    • An additional method may be easier if you are interested in relatively structured shapes.
    • Create a white PNG with 2x1 dimensions (e.g., 2048x4096) in Paint/Paintbrush/your favorite tool. Add the refinement patch (ex: a rectangle) as a solid black shape.
    • NOTE: geographical placement can be roughly controlled by running ImageMagick’s composite routine which overlays a world_map PNG (included in SQuadGen) with your refinement. Adjust newmesh.png accordingly
      composite -watermark 50% -gravity center world_map_2.png newmesh.png overlay.png
    • ./SQuadGen --refine_file  newmesh.png --refine_level 3 --refine_type CUBIT \
      --resolution 15 --smooth_type SPRING --smooth_dist 3 --smooth_iter 20 \
      --output newmesh.g --invert
    • NOTE: “--invert” will invert the refinement/non-refined patterns (“--invert” required for black refinement patches on white background, not needed for white on black)
    • Use vi (or other text editor) to modify refine_map.dat in the SQuadGen directory. This is a map which controls the cubed-sphere elements at the level of refinement at each location. (0 indicates no refinement, 1 indicates 1 level of refinement, etc.). Here you can fix notches/cutouts in the transition region caused by the the remapping from the lat-lon projection of the PNG to the cubed sphere grid.
    • ./SQuadGen --refine_file  newmesh.png --refine_level 3 --refine_type CUBIT \
      --resolution 15 --smooth_type SPRING --smooth_dist 3 --smooth_iter 20 \
      --output newmesh.g --invert --loadcsrefinementmap
      The “--loadcsrefinementmap” while force SQuadGen to use the now-modified refine_map.dat file.

...