Weather and Climate Prediction Exercise 2
Due Friday Jan 21

In class today, complete as much as you can. You can do part III using my output, but be sure sometime later that your run gives the same answers by remaking at least one figure.


I. Build CAM (5-10 min)

II. Run CAM and monitor the job in the queue system (2 min, plus some wait time)

III. Analyze CAM output in MATLAB, make movies if you like, and write up answers to a few questions (a couple of hours max)

I. Build CAM

  Typically we put all our various CAM runs in subdirectories of a single directory called "camruns". The subdirectories are named after the case, which here is barowave1deg. It is best to put the directory on disk in the computer lab. The following will do so:

cd /home/disk/p/atms380/$LOGNAME
mkdir camruns
mkdir camruns/barowave1deg
cd camruns/barowave1deg

 You are now in the "work" directory. Copy the build script from the class script directory here. The dot at the end of the command puts the file in the current directory (dot = here).

cp /home/disk/p/atms380/scripts/bld-cam4.csh .

 Execute the script:


   Wait a few minutes. When done list the executable, which is binary and can't be viewed.

ls -l bld/cam

   should say roughly (size may vary a bit)
   -rwxr--r--  1 bitz atgstaff 12395972 Jan  6 11:30 bld/cam*

   Also look at what was placed in subdirectory run

ls -l run

   should say roughly
  -rwxr--r-- 1 bitz atgstaff 3048 Jan  1 11:26 atm_in*
  lrwxrwxrwx 1 bitz atgstaff   10 Jan  1 11:26 cam -> ../bld/cam*
  -rwxr--r-- 1 bitz atgstaff   49 Jan  1 11:26 drv_flds_in*
  -rwxr--r-- 1 bitz atgstaff  355 Jan  1 11:26 drv_in*

   Finally list the script that you will use to submit the run to the queue. It is text and can be viewed in a text editor if you like.

ls -l run-cam4.csh

   should say roughly
   -rw-r--r-- 1 bitz atgstaff 1066 Jan  1 11:30 run-cam4.csh

You have just compiled CAM to use MPI (message passing interface), so it will run on multiple processors but the processors do not used share memory.

Sometime go back and look at the "in" files, which are namelists that give CAM information for the run. I have some notes about what they mean here.


You are about to run what is known as a "initial" or "startup" run. The initial conditions were described in class. The model will run for 30 days and produce daily output for a number of variables. All this is defined in the "in" files. Start from your "work" directory, and send the run script to the queue. Please ONLY SEND IT ONCE (more about that below).

cd /home/disk/p/atms380/$LOGNAME/camruns/barowave1deg
qsub run-cam4.csh
Verify your job is in the queue
  should say roughly
  job-ID  prior   name       user         state submit/start at     queue           slots ja-task-ID
 189590 0.55500 barowave1d bitz         r     01/01/2011 12:21:37 MPI@wx.atmos.wa    16       

The state "r" means it is running. It might say "qw" which means it is waiting in the queue until one of the machines on the cluster is free. Type qstat a few times over the course of a few minutes and if the job is not running,
qstat -u "*"
to see all the jobs in the queue. This should give you an idea how long you will have to wait.

If the job exits the queue very quickly (nothing is returned when you type qstat) tell Cecilia.

Once the job starts to run, it will take about 40 min. A file named "cam.out" will appear in the run subdirectory and accumulate standard output from the model in bunches. It is not pretty, but it can be helpful if something goes wrong. You can look at it when in the run directory with more cam.out or tail cam.out. Be patient, the model writes in bunches when it fills a "buffer". The buffer is big, so the time between writing bunches is long. The order stuff is written varies owing to parallel processes and can be less than obvious.

If for some reason you wish to kill your job.
qdel xxxxx                     fill in the x's with the job-ID and this will cancel your job

If the job completes, a bunch more files will appear in the run directory with names like barowave1deg.etc. The "cam2.h0" file contains the output "history" of the run. The other files have r's in their names and these are so-called "restart" files that could be used to continue the run from where it left off if you so desire (we will do this another time).

Troubleshooting: send Cecilia an email with your directory name and a brief description.

III. Analyze CAM - turn in about a page on a-d below, plus figures. Next week, you will need to edit the matlab file that you use to remake a figure with your own output so it reads your data file not mine. Otherwise you don't need to edit them much at all. Feel free though.

  Make a supdirectory of your "work" directory for this case and call it something like mfiles. Go to that directory and copy the analysis files to your directory for this exercise. Start matlab

cd /home/disk/p/atms380/$LOGNAME/camruns/barowave1deg
mkdir mfiles
cd mfiles
/home/disk/p/atms380/scripts/analyze_ex2* .
matlab &

  a) Run analyze_ex2_a in matlab. Check out all four options. Make movies if you like (these can be saved and run without matlab using a web browser or other software). To turn in: Describe the time evolution of the behavior that you see. Consider growth rates, wavelength, wavenumber, differences between the hemisphere, etc. Use your understanding of meteorology as best you can, or describe what you see generically as an instability problem. I encourage you to print out a couple of your favorite figures using the print icon on the figure window and turn them in.

b) Run analyze_ex2_b in matlab. The figures illustrate the relative phase of the waves at the upper and lower levels for day 9. Figure 1 is just the height of pressure surfaces contoured like a topo map. The heights are higher to the south. Thus their is a pressure gradient force perpendicular to the contours (on average pointing to the north) and a coriolis force pointing roughly opposite but not exactly because this flow is not balanced. We know it is not balanced because it is unsteady. Figure 2 shows the departure of the height from the zonal mean. It helps us to see where the waves crests and troughs lie. First from Fig 1, note how the wave crests line up along a curving "axis" north to south. Now look at Fig 2 to see how the red contours correspond to the ridge axis. Likewise for troughs. Now notice how easy it is to see in Fig 2 that the upper level ridge and trough axes are shifted westward of the lower level axis.

Theory tells us that temperature gradients fuel growth of waves because winds transport heat to deepen upper level wave amplitudes. However, for wave growth there must be a phase shift between upper and lower waves so the heat transported near the surface around highs and lows can deepen the upper level structure. With no phase shift, the heat transported near the surface is exactly inbetween crests and troughs aloft, and therefore cannot deepen the troughs or raise the crests. Instead it causes the crests and troughs to shift. Pure growth would happen if 90 degrees out of phase. Our phase shift is definitely less that 90 degrees and therefore we see some growth and some shifting to the east. This is a somewhat advanced topic. Do your best to see and interpret these behaviors in the figures. It may be challenging. Ask Cecilia for help if you wish.

To turn in: Estimate and discuss the characterstics of the phase shift in the upper and lower waves that you see in the simulation. Where is the phase shift between waves at upper and lower levels a maximum and minimum (eye-ball this) and how does this correspond to relative wave growth? Print the figures and turn them in.

  c) Run analyze_ex2_c in matlab.  The figures are fairly self explanatory. To turn in: Discuss the winds at both levels. Print the figures and turn them in too.

  d) Propose an experiment you would like to try to probe this system further. Explain why and offer a hypothesis as best you can. I won't evaluate if your hypothesis is correct. Famous modeler Syukuro Manabe said roughly, "Use the model to tell you the answer". If possible we will try some of these ideas later! One suggestion is to mess with the initial conditions. But say how.

Return to Homepage