Versions Compared

Key

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

These instructions are specifically for NCAR computers derecho and casper.

The following steps describe creating a new grid and using it in a beta version of CESM3.  Instructions for CESM2.2 are available in the step-by-step guide.

...

> cd ${VRM_tools}/VRM_Editor/src
> module load gcc/12.2.0 
> module load ncarenv/23.10
> qmake VRM_Editor.pro
> make

Running "make" produces a lot of warning messages; that’s ok.  For Linux users, with the Qt and netCDF packages installed, building the editor should be as simple as for Casper.

Correct the file Create_VRMgrid.cpp:

Change:

       CommandLineDouble (MyGridYRotate       ,"x_rotate"      ,0.0);

To: 

       CommandLineDouble (MyGridYRotate       ,"y_rotate"      ,0.0);

Build Create_VRMgrid on Casper: 

...

The resulting file is assigned to ncdata in user_nl_cam.

This script uses the interpic program provided in CESM source code, but must first be compiled.  If you do not already have CESM code, see "Set up CESM3" below.

On casper, in CESM source code, ./components/cam/tools/interpic_new:

Edit Makefile:
l.15 from: LIB_NETCDF := /usr/local/lib
     to: LIB_NETCDF := $(NETCDF)/lib
l.18 from: INC_NETCDF := /usr/local/include
     to: INC_NETCDF := $(NETCDF)/include
l.99 from: LDFLAGS = -L$(LIB_NETCDF) -lnetcdf
     to: LDFLAGS = -L$(LIB_NETCDF) -lnetcdff -lnetcdf  

Currently Loaded Modules:
  1) ncarenv/23.10 (S)   2) intel/2023.2.1   3) ncarcompilers/1.0.0   4) hdf5/1.12.2   5) netcdf/4.9.2

> gmake

This should have created the executable ‘interpic’.  Alternatively, the instructions below use an existing executable available on casper.

> cd> cd $REPO/inic
> cp /glade/work/emmons/tutorial_Nanjing/VRM_tools/gen_CAMncdata/TEMPLATES/interpic_script_TEMPLATE.sh interpic_script_Nanjing.sh
> vi interpic_script_Nanjing.sh


Edit the script to point to your grid files.  This template includes the path to an existing executable of interpic, which is available in the CESM source code. 

# USER CHANGES
VRdate="YYMMDD"
VRgridName="ne0np4.NAME.ne30xR"
VRgridLabel="NAME_RESOL"
VRrepoPath="your_repo_path"
# end of USER CHANGES

...

Check there are no errors in the log file. This should have created an ic file with the dimensions of your new grid: cami-mam4_0000-01-01_ne0np4.Nanjing.ne30x8_L32_c240809.nc-mam4_0000-01-01_ne0np4.Nanjing.ne30x8_L32_c240809.nc

On your own computer, you can find ${VRM_tools}/gen_CAMncdata/TEMPLATES/interpic_script_TEMPLATE.sh, and use the interpic executable that you created.  You can start with any *.cam.i.* file that you have available.

Regrid 'atmsrf' file

The resulting file is assigned to drydep_srf_file in user_nl_cam.

Copy On casper: copy the template script to your working directory and edit for your grid. Be sure directory $REPO/maps exists.

...

Check there are no errors in the log file. This writes atmsrf_ne0np4.Nanjing.ne30x8_240809.nc.the log file. This writes atmsrf_ne0np4.Nanjing.ne30x8_240809.nc. 

On your own computer: find ${VRM_tools}/gen_atmsrf/TEMPLATES/gen_atmsrf_TEMPLATE.ncl

Create Topography file

The resulting file is assigned to bnd_topo in user_nl_cam.

...

Modify the bold text to point to your SCRIP file, grid name, etc.

Can add option --output_data_directory to specify location of final topography file (be sure it the directory already exists).

This can take several hours.  

Generate CTSM (CLM) surface datasets

On derecho, use CTSM5.2 3 source code to create the needed surfdata and landuse_timeseries files. (Latest tag is good to use, as of 1/25/25 it is ctsm5.3.020).

> git clone https://github.com/ESCOMP/CTSM ctsm5.2.0073
> cd ctsm5.2.0073
> git checkout ctsm5.23.0070
> bin/git-fleximod update

...

Run the make namelist script (modify the bold text for your resolution, MESH file and your ncol for model-mesh-nx)

(npl) > /glade/work/emmons/cesm_src_derecho/ctsm5.2.007/tools/mksurfdata_esmf/gen_mksurfdata_namelist --res Nanjing_ne30x8 --start-year 1979 --end-year 2026 --ssp-rcp SSP3-7.0 --model-mesh /glade/work/emmons/tutorial_Nanjing/ne0np4.Nanjing.ne30x8/grids/Nanjing_ne30x8_np4_MESH.nc --model-mesh-nx 60482 --model-mesh-ny 1

...

This creates the netcdf files that will be used in your simulation, specified in user_nl_clm: fsurdat = '/repo_path/land/surfdata_ ... .nc' and flanduse_timeseries = '/repo_path/land/landuse.timeseries_ ... .nc'.  In your $REPO, create a directory 'land' (mkdir $REPO/land) and copy these 2 nc files to it.

> conda deactivate

Anchor
Add grid to CESM
Add grid to CESM
Set up CESM3 with new grid

On Updated June 2025: On derecho, checkout a CESM3 beta tag (that uses ctsm5.2).  It is recommended the source code is cloned into your work (or scratch, if necessary; you might run out of space in home) directory where sufficient storage is available. CESM3 has replaced manage_externals with git-fleximod, which requires the following commands:

...

Below, $CESMCODE refers to yourcesm3_0_beta01 directory directory.

CCS_CONFIG

1. Add an entry for your new ESMF mesh file in <cesm>/ccs_config/component_grids_nuopc.xml

...