Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

These instructions were originally written by Oksana Guba and posted at https://docs.google.com/document/d/1ymlTgKz2SIvveRS72roKvNHN6a79B4TLOGrypPjRvg0/edit?usp=sharing .

  1. Check-out HOMME.  Run CMAKE regression tests to ensure HOMME builds and runs on your platform.  Check out and compile SQuadGen from github. SQuadGen needs a version of netcdf with C++ support.    
  2. Run SQuadGen (or CUBIT) to make an Exodus format “grid file”.  Here we’ll refer to that file as: newmesh.g. SQuadGen requires the user to specify the refinement area via a PNG image.  This can be generated in a variety of ways.
  • One 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.  
    • 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.  
  • An 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.


  1. To test the new grid, run an idealized problem in standalone HOMME.  Here we give instructions for running the Jablonowski & Williamson baroclinic instability problem.  
  • Edit or modify homme/test/jw_baroclinic/run.job for your system
  • This script will configure, build and run the baroclinic problem for a variety of uniform resolutions.
  • Use this script to generate a working namelist.  Edit the namelist for newmesh.g:
    • ne=0
    • mesh_file = “/user/path/to/newmesh.g”
    • Use tensor hyperviscosity.  Enabled with a non-zero value of hypervis_scaling.  Settings are grid independent.  
      • nu = 8.0e-8,  nu_div = 8.0e-8, nu_p = 8.0e-8
      • hypervis_scaling=3.2
    • OR: use the older scalar hypervisosity.  Enabled with a non-zero value hypervis_power.  Settings are grid independent. Warning: set only one of hypervis_scaling or hypervis_power.  
      • nu = 1e15,  nu_div = 1e15, nu_p = 1e15
      • fine_ne=30    
      • hypervis_power=3.322
      • max_hypervis_courant = 1.9
    • In idealized test cases (Guba et al., GMD, 2014) the tensor formulation shows less sensitivity to grid quality and less noise in the mesh transition region.  However, in realistic simulations the differences between tensor and scalar hyperviscosity are less noticeable.  
    • use new, simplified dycore settings:  
      • tstep_type=5, qsplit=1, rsplit=3, hypervis_subcycle=4
    • Also change the value of  ‘tstep’ to a value known to work with the finest resolution in newmesh.g
    • Decrease tstep until run is stable
    • HOMME will interpolate the results  (u,v,T, vorticity and divergence, and tracers) and output on a NETCDF lat/lon grid and can be examined with NCL or ncview
  • No labels