Exercise

Exercise#

Exercise: Setting up and running your first case

Use the 4 CESM commands to create a new case. Do the setup, build and submit your job.

Use qstat to check your job is running. This command will show all the jobs that are running on the cluster by all users, so you can also use qstat -u <username> to just see your jobs.

Check that your run completes. Check the files are in the archive directory.

Click here for hints

Create a directory to keep your CESM cases

Decide on a location where you want to keep your CESM cases. We’ll use a directory cases within your home directory as an example e.g.,

cd 
mkdir cases 

In the commands above:

  • cd brings you to your home directory

  • and mkdir cases makes the directory cases

Create a new case

To start, we will create a coupled simulation under 1850’s conditions using a 2 degree atmospheric resolution and the g17 ocean grid. We’ll call it case01 and put it in your cases directory.

cd $CESMROOT/cime/scripts
./create_newcase --case ~/cases/case01 --compset B1850-tutorial --res f19_g17

NOTE: B1850-tutorial is not an available compset in CESM2. It is a compset that has been specially designed for this tutorial.

Setup, build and submit your run

Now go in to your cases directory. You should see a sub-directory case01. This is your case directory and contains all the scripts necessary to compile and run CESM. From within your case directory, CESM can be set up, built and run, using the following three commands

cd ~/cases/case01
./case.setup          ; #(sets up the case)
qcmd -- ./case.build  ; #(builds the case)
./case.submit         ; #(submits the case to the queue)

NOTE: The qcmd command when running case.build submits the build command to the queueing system. Whether you need to add in the qcmd -- before ./case.build will depend on your system.

Check the model is running

Once you have submitted the case, you can see its status in the queue with either of the following commands:

qstat -u <username>

or this also works:

squeue -u <username>

replacing <username> with your username for the system.

You can also see CESM outputting data as the simulation progresses in the run directory, which for our purposes, is located at ~/scratch/case01/run. This is where the data are output until the run is finished, at which point it is moved to the archive directory. For our purposes, the archive directory is located at ~/scratch/archive/case01.

Check the files are in the archive directory

Once the run has finished, you can go into ~/scratch/archive/case01/atm/hist and see the output CAM history files. However, for this first run, the default length of the run is 5 days and only monthly averages are output, so that directory is empty at the moment. But, if you go into ~/scratch/archive/case01/rest/ you’ll see a directory for the 6th January, year 1 that contains the restart files that would be necessary to continue this run further.

Click here for the solution

A B1850-tutorial case with the 2 degree atmosphere and g17 ocean grid and named case01 can be set-up, built and submitted with the following commands:

cd $CESMROOT/cime/scripts
./create_newcase --case ~/cases/case01 --compset B1850-tutorial --res f19_g17
cd ~/cases/case01
./case.setup
qcmd -- ./case.build
./case.submit