Tutorial for Using the CAM Initial Condition Data Processing Tool – interpic

This tutorial introduces the *interpic* tool, which can interpolate an existing initial condition file to a new grid based on a given template file.

Pre-run Debugging and Troubleshooting
The *interpic* tool is included with CESM2, and the code can be found in this directory: `$CESMDIR/components/cam/tools`. It is recommended to use `interpic_new`.

If you encounter an “ifort” related error when you try to make the tool for the first time by following the `README` in the directory, refer to this discussion (https://forum.cmascenter.org/t/smoke-compilation/1197/2). The error is related to the wrong use of the netCDF-Fortran flag.

To resolve this issue, modify line 99 in the `Makefile` as follows:

LDFLAGS = -L$(LIB_NETCDF) -lnetcdff -lnetcdf

That is, replace the original `-lnetcdf` with `-lnetcdff -lnetcdf`.

Then, you can follow the `README` instructions to run the process and create an executable file named “interpic”:

make INC_NETCDF=$NETCDF4/include LIB_NETCDF=$NETCDF4/lib

Ensure that `$NETCDF` is replaced with the path to the version of netCDF used by CESM.

Running the Process
Once the “interpic” executable file is successfully generated, you can interpolate the initial condition files for CAM-SE (Spectral Element dynamical core) according to the instructions in the `README`. Based on my experience, the following is a guide to interpolating the initial condition files for the CAM-FV (Finite Volume dynamical core) model:

1. Rename the variables in the original initial condition file:

ncrename -v US,U -v VS,V $INICFILE

2. Use the interpic tool to interpolate to the target grid:

./interpic -s -t $template $INICFILE $NEW_INICFILE

3. Rename the variables in the newly generated initial condition file:

ncrename -v U,US -v V,VS $NEW_INICFILE

After this, the newly generated initial condition file can be used as input to run CESM.

Additional Resources
If you need to apply the FCSD compset and use MERRA2 32L reanalysis data as nudging input, pre-processed data from 2009/01 to 2021/09 is available on the server and can be used directly. The path is as follows:
`/data4/cesmdata/inputdata/atm/cam/met/MERRA2/0.9×1.25_32L`.

References
– Debugging method source: https://yjwang39.github.io/Momento/models/#utilities
– A reliable tutorial for analyzing CESM model source code using Doxygen (http://www.doxygen.nl/) and Graphviz (http://www.graphviz.org/) can be found at the following link: https://blog.csdn.net/benkaoya/article/details/79763668. You can also download the Doxygen configuration file used by the author.

Feel free to reach out for discussion! Email: @mailto:yjwang@smail.nju.edu.cn