Running stand-alone CLM with transient historical CO2 concentration

In this case you want to run a simulation with stand-alone CLM responding to changes in CO2 for a historical period. For this example, we will start with the "I_1850-2000_CN" compset that has transient: land-use, Nitrogen and Aerosol deposition already. You could also use another compset if you didn't want these other features to be transient. In order to get CO2 to be transient we need to edit the DATM template so that we add an extra streams file to describe how CO2 varies over the historical period. You also need a NetCDF datafile that datm can read that gives the variation. You could supply your own file, but we have a standard file that is used by CAM for this and our example will make use of this file.

Note: Most everything here has to do with changing datm rather than CLM to allow this to happen. As such the user that wishes to do this should first become more familiar with datm and read the CESM Data Model User's Guide especially as it pertains to the datm. Note, also that in this example we show how to edit the datm "buildnml" file for your case, but you could do something similar by editing the datm template.

Warning

This section documents the process for doing something that is non-standard. There may be errors with the documentation and process, and you may have to do some work before all of this works for you. If that is the case, we recommend that you do further research into understanding the process and the files, as well as understanding the datm and how it works. You may have to read documentation found in the code for datm as well as "csm_share".

The datm has "streams" files that have rough XML-like syntax and specify the location and file to get data from, as well as information on the variable names and the data locations of the grid points. The datm expects specific variable names and the datm "maps" the expected variable names from the file to the names expected by datm. The file we are working with here is a file with a single-point, that covers the entire globe (so the vertices go from -90 to 90 degrees in latitude and 0 to 360 degrees in longitude). Since it's a single point it's a little easier to work with than datasets that may be at a given horizontal resolution. The datm also expects that variables will be in certain units, and only expects a limited number of variables so arbitrary fields can NOT be exchanged this way. However, the process would be similar for datasets that do contain more than one point.

The three things that are needed: a domain file, a data file, and a streams text file. The domain file is a CF-compliant NetCDF file that has information on the grid points (latitudes and longitudes for cell-centers and vertices, mask , fraction, and areas). The datafile is a CF-compliant NetCDF file with the data that will be mapped. The streams text file is the XML-like file that tells datm how to find the files and how to map the variables datm knows about to the variable names on the NetCDF files. Note, that in our case the domain file and the data file are the same file. In other cases, the domain file may be separate from the data file.

First we are going to create a case, and we will edit the Buildconf/datm.buildnml.csh so that we add a CO2 data stream in. There is a streams text file available in models/lnd/clm/doc/UsersGuide/co2_streams.txt, that includes file with a CO2 time-series from 1765 to 2007.

Example 4-12. Example Transient Simulation with Historical CO2


> cd scripts
> ./create_newcase -case DATM_CO2_TSERIES -res f19_g16 -compset I_1850-2000_CN \
-mach bluefire
> cd DATM_CO2_TSERIES
# Set CCSM_BGC to CO2A so that CO2 will be passed from atmosphere to land
> ./xmlchange -file env_conf.xml -id CCSM_BGC -val CO2A
# Set CLM_CO2_TYPE to diagnostic so that the land will use the value sent from the atmosphere
> ./xmlchange -file env_conf.xml -id CLM_CO2_TYPE -val diagnostic
> ./configure -case
> cd Buildconf
# Copy the sample streams file over
> cp ../../../models/lnd/clm/doc/UsersGuide/co2_streams.txt .
The first thing we will do is to edit the datm buildnml script to add a CO2 file stream in. To do this we will apply a patch with the differences needed. The patch file addco2_datm.buildnml.diff is in models/lnd/clm/doc/UsersGuide and looks like this...

*** datm.buildnml.csh.orig	2010-06-11 10:59:29.246523532 -0600
--- datm.buildnml.csh	2010-06-11 11:06:30.710784206 -0600
***************
*** 34,48 ****
     streams        = 'clm_qian.T62.stream.Solar.txt 1895 1948 1972 ',
                      'clm_qian.T62.stream.Precip.txt 1895 1948 1972 ',
                      'clm_qian.T62.stream.TPQW.txt 1895 1948 1972 ',
!                     'presaero.stream.txt 1849 1849 2006'
     vectors        = 'null'
     mapmask        = 'nomask',
                      'nomask',
                      'nomask',
                      'nomask'
     tintalgo       = 'coszen',
                      'nearest',
                      'linear',
                      'linear'
    /
  EOF1
--- 34,56 ----
     streams        = 'clm_qian.T62.stream.Solar.txt 1895 1948 1972 ',
                      'clm_qian.T62.stream.Precip.txt 1895 1948 1972 ',
                      'clm_qian.T62.stream.TPQW.txt 1895 1948 1972 ',
!                     'presaero.stream.txt 1849 1849 2006',
!                     'datm.global1val.stream.CO2.txt 1766 1766 2005 '
     vectors        = 'null'
     mapmask        = 'nomask',
                      'nomask',
                      'nomask',
+                     'nomask',
                      'nomask'
+    mapalgo        = 'bilinear',
+                     'bilinear',
+                     'bilinear',
+                     'bilinear',
+                     'nn'
     tintalgo       = 'coszen',
                      'nearest',
                      'linear',
+                     'linear',
                      'linear'
    /
  EOF1
***************
*** 1112,1121 ****
--- 1120,1132 ----
  </streamstemplate>
  EOF1
  
+ cp $CASEBUILD/co2_streams.txt datm.global1val.stream.CO2.txt
+ 
  
  $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.Solar.txt >> $CASEBUILD/datm.input_data_list
  $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.Precip.txt >> $CASEBUILD/datm.input_data_list
  $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.TPQW.txt >> $CASEBUILD/datm.input_data_list
+ $CASETOOLS/listfilesin_streams -input_data_list -t datm.global1val.stream.CO2.txt  >> $CASEBUILD/datm.input_data_list
  
  cat >! presaero.stream.txt << EOF1
  <streamstemplate>

So to apply the patch you do this...

> cd scripts/DATM_CO2_TSERIES/Buildconf
> patch < ../../../models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff
Once, you've done that you can build and run your case normally.

Warning

The patch assumes you are using a I_1850-2000_CN compset out of the box, with DATM_PRESAERO equal to trans_1850-2000. So it assumes standard Qian atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes anything here the patch will fail, and you will need to put the changes in by hand.

Note: If the patch fails, you will have to add the changes to the datm.buildnml.csh found in the above patch file by hand. Basically, it adds an extra streams file for CO2 to the end of the streams variable, and other arrays associated with streams (adding mapalgo as a new array with bilinear for everything, but the CO2 file which should be "nn" for nearest neighbor).

Warning

The streams file above is hard-coded for the path of the file on NCAR computers. To use it on an outside machine you'll need to edit the filepath in the streams file to point to the location where you have the file.

After going through these steps, you will have a case where you have datm reading in an extra streams text file that points to a data file with CO2 data on it that will send that data to the CLM.