Welcome to the new DiscussCESM forum!
We are still working on the website migration, so you may experience downtime during this process.

Existing users, please reset your password before logging in here: https://xenforo.cgd.ucar.edu/cesm/index.php?lost-password/

CPLHIST3HrWx on an unstructured grid

I'd like to run off-line CLM4/5 simulations using CAM outputs on an unstructured grid like those for SE and MPAS dycores. I tried first by remapping the CCSM4 outputs (found in namelist_definition_datm.xml) to a ~1degree unstructured grid along with corresponding domain files, surface file, and initial file, but got the following run-time error

0: ERROR: (shr_dmodel_readstrm) ERROR in data sizes
1: (shr_dmodel_readstrm) ERROR in data sizes 40962 248 39716 55296

(40962 is the number of columns in the unstructured grid; I don't know how the model gets other three numbers)

The subroutine generated this error message (shr_dmodel_readstrm) seems to assume that the forcing data has both x and y dimensions (code snippet below), is this true?
Are there any (relatively) simple ways to use unstructured 1D data as atmospheric forcing? I'd like to avoid remapping all the 3/6 hourly CAM outputs to a regular lat/lon grid.

if (gsize == nx*ny) then
   d3dflag = .false.
elseif (gsize == nx*ny*nz) then
   d3dflag = .true.
   write(logunit,F01) "ERROR in data sizes ",nx,ny,nz,gsize
   call shr_sys_abort(subname//"ERROR in data sizes")




Erik Kluzek
CSEG and Liaisons
Staff member
The MCT version of datm see isn't going to be able to remap from or to an unstructured grid. But it should be able to handle it if you set it up without any remapping. So if it's run at the same resolution and doesn't try to remap. There is an option in the datm_in namelist file that sets mapalgo for the forcing stream. You'll need to change that to the option that doesn't do mapping (I think it's none or copy).

But the NUOPC version should be able to handle the remapping. so if you are using the latest development version you might be able to do this.
Hi Erik, thank you so much for the reply. Running off-line CLM without the need for remapping by the coupler is indeed my plan, so your suggestion is great for me. Let me give it a try with the CESM2 code I have, and get back to you here with the result.

If it still seems difficult for me, I'll think about the latest development version. Sounds like the NUOPC version offers nice flexibility for users!

Hi Eric,

I've made it work using the CESM2 model code (beta version) I have. From your suggestion, I was able to find relevant materials in CLM4.5 user guide,


and examples 4-9 and 4-11.

Specifically, I did:
0) (have had done the following before posting my question)
a. remapped the forcing files to the unstructured grid (atmo variables, aerosol, and topography)
b. set the atm and lnd domain file to be the one for the unstructured grid in env_run.xml ("ATM_DOMAIN_FILE" and "LND_DOMAIN_FILE")
c. after create a case, create copies of the stream files for forcing data (I have 5 of these from $caseroot/CaseDocs to $caseroot directory, with "user_" prepented to each of the file name
cp $casedir/CaseDocs/datm.streams.txt.CPLHIST3HrWx.Precip $casedir/user_datm.streams.txt.CPLHIST3HrWx.Precip
cp $casedir/CaseDocs/datm.streams.txt.CPLHIST3HrWx.Solar $casedir/user_datm.streams.txt.CPLHIST3HrWx.Solar
cp $casedir/CaseDocs/datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip $casedir/user_datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip
cp $casedir/CaseDocs/datm.streams.txt.presaero.clim_2000 $casedir/user_datm.streams.txt.presaero.clim_2000
cp $casedir/CaseDocs/datm.streams.txt.topo.observed $casedir/user_datm.streams.txt.topo.observed

and in each of the file, set the domain file to be the one for the unstructured grid. Those are hard-coded and "ATM_DOMAIN_FILE" and "LND_DOMAIN_FILE" in env_run.xml do not change those in the stream files.

But these steps were not enough, leading to the error I mentioned in my post.

Then I further did the following:

1) set remapping and filling algorithms to be "copy" in user_nl_datm to tell that I don't need remapping during model integration.
mapalgo = "copy", "copy", "copy", "copy", "copy"
fillalgo = "copy", "copy", "copy", "copy", "copy"

2) added a dimension "nj" to all the input forcing files such that all variables have the dimensions consistent with the domain file (time, nj, ncol) with nj being 1.
(used ncl to do this)

With those steps, I finally ran a 5-day test simulation (I compset) successfully with all the forcing and land model operating on an unstructured grid.

Thank you so much for your help. Please let me know if you find any mistakes or improvements I can make to the above procedure.