Exercise 1: History Variables#
A common reason to edit user_nl_clm is to control history output, the files CLM writes with its simulated variables. By default CLM writes one monthly history file (*.clm2.h0.*.nc) containing a standard set of fields. The variable hist_fincl1 lets you add fields to that file, using the name of the variable as listed in the CLM history fields documentation.
You can see a list of all the available history variables in the CLM documentation.
Exercise: Add a variable to the history output#
Create a case called i2000_bgc_hist_update using the compset I2000Clm60BgcCrujra and resolution f19_f19_mt233.
Use hist_fincl1 in user_nl_clm to add the variable AGSB (aboveground stem biomass) to the default monthly history file:
hist_fincl1 = 'AGSB'
Run the case for 1 month, then open the history file and confirm the variable is there.
Think about: Why did we use hist_fincl1 instead of editing an XML variable?
Click here for hints
How do I compile?
You can compile with the command:
qcmd -- ./case.build
How do I verify the history variable is there?
Use:
ncdump -h <history_file> | grep "AGSB"
Click here for the solution
Create a new case
Create a new case called i2000_bgc_hist_update:
cd /glade/u/home/$USER/code/my_clm_code/cime/scripts/
./create_newcase --case ~/cases/i2000_bgc_hist_update \
--compset I2000Clm60BgcCrujra \
--res f19_f19_mt233 \
--run-unsupported
Setup
Invoke case.setup:
cd ~/cases/i2000_bgc_hist_update
./case.setup
Customize CAM namelist
Edit the file user_nl_clm and add:
hist_fincl1 = 'AGSB'
This tells CLM to include AGSB in its history output.
Set run length
Run the model for one month:
./xmlchange STOP_N=1
./xmlchange STOP_OPTION=nmonths
Change the job queue, wallclock time, and account number
Update the wallclock time. If needed, change the job queue and project number. For example, to run in the tutorial queue using project UESM0016, use:
./xmlchange JOB_WALLCLOCK_TIME=01:00:00
./xmlchange JOB_QUEUE=tutorial
./xmlchange PROJECT=UESM0016 --force
Use the project number provided for the tutorial.
Build and submit
Build the model and submit the case:
qcmd -- ./case.build
./case.submit
Check the output
When the run is complete, go to the archive directory:
cd /glade/derecho/scratch/$USER/archive/i2000_bgc_hist_update/lnd/hist
ls
There are two files:
i2000_bgc_hist_update.clm2.h0a.2000-01.nc
i2000_bgc_hist_update.clm2.h0i.2000-01.nc
Look at the CLM history file header of i2000_bgc_hist_update.clm2.h0a.2000-01.nc:
ncdump -h i2000_bgc_hist_update.clm2.h0a.2000-01.nc | grep "AGSB"
Check that the history variable is there:
float AGSB(time, lat, lon) ;
AGSB:long_name = "Aboveground stem biomass" ;
AGSB:units = "kg/m^2" ;
AGSB:cell_methods = "time: mean" ;
AGSB:_FillValue = 1.e+36f ;
AGSB:missing_value = 1.e+36f ;
AGSB:landunit_mask = "unknown" ;