Instructions for creating a new grid and using it in a beta version of CESM3 on the 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
Naming Conventions
$(grid_name) = ne0np4.NAME.ne30xR where NAME is a unique name for your grid, ne30 is for the base resolution, R is for the refinement factor of the highest resolution region. All variable resolution grids with 4 GLL points must begin with ne0np4.
$(grid_label) = NAME_ne30xR
In the examples below, a grid for a small refined region at ne30x8 (ne240, 1/8 deg) centered over Nanjing will be created, using NAME=Nanjing, RESOL=ne30x8, so
$(grid_name) = ne0np4.Nanjing.ne30x8 and $(grid_label) = Nanjing_ne30x8.
Create a new variable resolution mesh (VRM)
...
Click 'Generate VarMesh'. This is case has Refine Lev = 3, to give a refined mesh with 1/8 degree resolution at center:
...
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 detailsFor an ne30 base grid with Refine Level=3 (ne240), the halo region surrounding the finest refinement (at ne120 resolution) should have a Value=0.66.
Then a second halo, at ne60 resolution, can be created with Value=0.33.
If making a refined region with the finest resolution ne120, then make one halo with Value=0.5.
When satisfied with the halos, Exit Edit Mode, Yes to save, and go back to VRM tab. With the same settings as above (LOWCONN, Refine lev =3, etc.), click Generate VarMesh:
The halos can be adjusted repeatedly in the Edit menu until satisfied with the grid. Once the grid is at least close to what you want proceed to steps below.
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_Nanjing_{yourLabel}ne30x8.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.
...
If you are happy with your grid, under Actions: Write Exodus File - give it a name like {yourLabel}_{resolution}_EXODUS.nc Nanjing_ne30x8_EXODUS.nc. If you want to make further manual edits to your grid, do not save the EXODUS file.
Write Refinement Grid - for manual editing of refinement region and halosSave Refinement Grid
If you have trouble making a refined region grid with smooth borders and transitions around the refinement region, you can save the grid as a text file and manually edit it.
...
This is a text file similar to the Refinement Map, so name it something like: RefGrid_{yourLabel}_{resolution}Nanjing_ne30x8.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 For a refinement factor of 8 (refine level=3) the file has 0 for no refinement and 1, 2, 3, etc. for each refine level.
This example shows irregular borders, and different width halos:
After editing, a clean grid template looks like this:
Use Create_VRMgrid to create EXODUS file from Refinement Grid
...
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_Nanjing01Nanjing_ne30x8.dat --output Nanjing01Nanjing_ne30x8_EXODUS.nc
Plot EXODUS file with (python notebook ... ~/musica_naeuas/notebooks_naeuas/Plot_exodus_naeuas.ipynb)
...