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

Compare with Current View Page History

« Previous Version 6 Next »

Instructions for creating a new grid and using it in a beta version of CESM3 on NCAR high-performance computer system, derecho and casper.

For instructions on connecting to derecho or casper see: https://ncar.github.io/CESM-Tutorial/notebooks/prereqs/prereqs_overview.html   

Create a new variable resolution mesh (VRM)

Create a directory in your /glade/work/$USER/ space to save your created files.

On casper start the VRM Editor: 

> /glade/work/emmons/tutorial_Nanjing/VRM_tools/VRM_Editor/src/VRM_Editor

Set up the base grid

On the ‘VRM’ tab, select:

  • Grid Type: CubeSquared
  • Base Resolution: 30
  • Click Generate VarMesh. See image below for what it should look like. 

Adjust Longitude Shift, Rotate-X and Rotate-Y so that your region of interest is centered within a cube face.  You can zoom in/out by using the scroll button of your mouse. The right and left arrow keys move the map sideways; up/down to shift the map N/S.

For example, set Longitude Shift to 30 and Rotate-X to 25, then click Generate VarMesh, to produce grid shown below.  

When satisfied with the face location, record the Longitude Shift, Rotate-X and Rotate-Y values (you will need them later).

Create draft refinement region

The default resolution of the Editor map is a bit coarse, so read in a higher resolution map. In the "Actions" menu (upper left), select Read Refinement Map.

Open /glade/work/emmons/Community_Mesh_Generation_Toolkit_Nov23/VRM_tools/VRM_Editor/src/REFMAP_1440x720.nc.  For easier access, copy this file to your working directory.

On the ‘Edit’ tab, click ‘Edit refine Map’.

Select ‘Polygon Editor’ - a green box appears over the Pacific. Drag and adjust the 8 points to create a refinement region. Use the scroll button of your mouse to zoom in and out, and the arrow keys to shift the map. Try to have the polygon borders be parallel to the grid lines.

Click ‘Apply’ (with Value =1.00)

To save this, click 'Exit Edit Mode' and 'Yes' to save.

Go to 'Display' tab, check Refinement Map to see the refined region as a red box.

Go back to ‘VRM’ tab.  For best results (in many cases), the following settings are recommended:

  • Refine Type = LOWCONN
  • Select Refine Level (1 = ~0.5 deg, 2=0.25 deg, 3=⅛ deg=14km, …).  Resolution in the refined region is the base grid resolution divided by 2^(refinement level)
  • Smoothing Options: Spring, with Iterations = 3, Length = 3

Click 'Generate VarMesh'.  This is a refined mesh with 1/8 degree resolution at center:

The LOWCONN setting uses templates that span 2x2 base elements to transition between resolutions, and the SPRING smoothing rounds out the element shapes to reduce sharp angles.  There may be situations when other settings give better results.

Uneven edges might be removed with small adjustments (0.1) to Longitude Shift or Rotate-X, -Y values.

It is best to have a couple of rows at each intermediate resolution.  This can be done by making a 'halo' in the Editor: make the polygon a bit larger than the refined region, and set the value at the appropriate fraction.  See past presentations for details.

Save the Refinement Map - under the Actions menu. This writes a netcdf file of the map of refinement values (0 for no refinement, 1 for maximum refinement).  Save the files as something like: REFMAP_{yourLabel}.nc.

Save frequently as the VRM Editor on the Mac tends to crash.  You can then Read the refinement later and start adjusting the grid from that point.  

Also, make note of any Longitude Shift and Rotate-X, -Y values as those are not saved in the Refinement map file.

If you are happy with your grid, under Actions: Write Exodus File - give it a name like {yourLabel}_{resolution}_EXODUS.nc 

Save Refinement Grid

If you have trouble making a refined region with smooth borders and transitions, you can save the grid as a text file and manually edit it. 

Once you have a rough version of your grid, save a Refinement Grid - in the Actions menu, select 'Write Refinement Grid'.

This is a text file similar to the Refinement Map, so name it something like: RefGrid_{yourLabel}_{resolution}.dat

Record the Longitude Shift, Rotate-X and Rotate-Y values.

Then edit the RefGrid file to have straight edges for each refine level.  This file has 0 for no refinement and 1, 2, 3, etc. for each refine level. 


Use Create_VRMgrid to create EXODUS file from Refinement Grid

The command line ‘Create_VRMgrid’ will create an EXODUS file from the updated Refinement Grid file.

> /glade/work/emmons/tutorial_Nanjing/VRM_tools/VRM_Editor/src/Create_VRMgrid 
--refine_type "LOWCONN" {or "CUBIT"}
--grid_type "CubeSquared"
--resolution 30
--refine_level {refinement [1,2,3 …]}
--smooth_type "SPRING" --smooth_dist 3 --smooth_iter 3
--x_rotate {xrot_value} --y_rotate {yrot_value} --lon_shift {lonshift_value}
--refine_file REFMAP_{yourLabel}_{resolution}.nc
--refine_cube RefGrid_{yourLabel}_{resolution}.dat
--output {yourLabel}_{resolution}_EXODUS.nc

(be sure this is all on one line)

For this example: /glade/derecho/scratch/emmons/nanjing_musica_tutorial> /glade/work/emmons/tutorial_Nanjing/VRM_tools/VRM_Editor/src/Create_VRMgrid --refine_type "LOWCONN" --grid_type "CubeSquared" --resolution 30 --refine_level 3 --smooth_type "SPRING" --smooth_dist 3 --smooth_iter 3 --x_rotate 25  --y_rotate 0  --lon_shift 30  --refine_file REFMAP_Nanjing_ne30x8.nc  --refine_cube RefGrid_Nanjing01_ne30x8.dat --output Nanjing01_ne30x8_EXODUS.nc 


Plot EXODUS file with (python notebook ... ~/musica_naeuas/notebooks_naeuas/Plot_exodus_naeuas.ipynb)

Create grid files



Generate CESM input files on new grid



Set up CESM3 with new grid



Set up a CAM case for testing new grid



Set up a CAM-chem case for production



  • No labels