Exercise 2

Exercise 2#

Exercise: Customize your CAM history files

Create a case called b1850_high_freq using the compset B1850-tutorial at f19_g17 resolution.

In addition to the monthly history file h0, add the following output:

  • an h1 file with daily averages of TREFHT and PRECT

  • an h2 file with instantaneous values of PSL and U10 every 6 hours.

Set your namelist so that you output:

  • a single h1 file with all the daily averaged output for the 5 day run.

  • multiple h2 files, one for each day i.e., containing four 6 hourly time values.

Your goal is to produce:

  • one h1 file with 5 timesteps and

  • five h2 files with 4 timesteps each.

Use the default 5-day run length and make a 5-day run

Click here for hints

# How do I control the output?

Use namelist variables: nhtfrq, mfilt, fincl.

Look at the online documentation for these variables.

# Check your setting

Check in the CaseDocs directory. Is your atm_in file correct? Does it contain the namelist additions you made? What about the file atm_in in your run directory?

You should find that the changes you have made have propagated to all the atm_in files.

If you would like to propagate the changes to the atm in files without building you can also run the command

./preview namelists.

# Check when it is running

Is it running successfully and producing the extra history files? One way to check is to go to the run directory as it is running and see whether the history files are arriving. Once it has finished, do you see the history files in the archive directory? How many time values are in each file? Does it make sense?

When your run is completed, go to the archive directory and navigate to the subdirectory atm/hist

cd ~/scratch/archive/b1850_high_freq
cd atm/hist

What files are in this directory?

Click here for the solution

# go into scripts directory into the CESM code

cd $CESMROOT/cime/scripts

# Create a new case

Create a new case b1850_high_freq with the command:

./create_newcase --case ~/cases/b1850_high_freq --compset B1850-tutorial --res f19_g17 

# go into the case you just created in the last step

cd ~/cases/b1850_high_freq 

# Setup
Invoke case.setup with the command:

./case.setup

# Customize namelists

Edit the file user_nl_cam and add the lines:

fincl2='TREFHT','PRECT'
fincl3='PSL:I','U10:I'
nhtfrq=0,-24,-6
mfilt =1,5,4

# Build and submit

Build the model and submit your job:

qcmd -- ./case.build
./case.submit

# Look at your solution

When the run is completed, look into the archive directory for: b1850_high_freq.

(1) Check the contents of your archive directory:

cd ~/scratch/archive/b1850_high_freq/atm/hist
ls 

(2) Compare the contents of the h1 and h2 files using ncdump. Look at the variables attributes. What is the difference between the 2 files ?