NOAA

Geophysical Fluid
Dynamics Laboratory

Skip to: [content] [navigation]
If you are using Navigator 4.x or Internet Explorer 4.x or Omni Web 4.x , this site will not render correctly!

gfdl's home page > people > John Dunne >

Running MOM4 through the XML script

Description

This HOWTO describes in detail the process of running tracer experiments in MOM4. Three resources exist for this process: A description of the syntax for the xml scripting language, a quickstart on running cm2 experiments using the xml script, and general information on fms architecture (which includes the above two links). The goal of this document is to guide you to successfully:

1) Get the xml script
2) Get the model code and create a makefile
3) Compile the model code
4) Create a model runscript
5) Execute a runscript (run the model)
6) Look at the results



1) Get the xml script

Create a new folder in your home directory:

mkdir ~/khartoum
Get the xml script, mom4_rts_smg.xml:

cp /home/jpd/khartoum/mom4_rts_smg.xml ~/khartoum/
If you don't want to put it in ~/khartoum, you will have to edit the beginning of the xml file where the directory structure is defined by changing:

<directory type="root">/khartoum</directory>
<directory type="archive">/khartoum/</directory>
<directory type="work">/</directory>

to suit your purposes (i.e. putting things in your /net or whatever)


2) Get the model code and create a makefile

Build the model code base and create a master compilation runscript. This must be done on a PC rather than interactively on the parallel computer system (Large Scale Cluster or Analysis Cluster). First, you can see what model experiments are available to you in this xml with:

cd ~/khartoum ~fms/bin/rtslist -v -x mom4_rts_smg.xml
The "-v" option prints out the descriptions for each experiment in addition to the name. In this example, you will be using the simplest biogeochemical scenario, mom4_test4.

/home/fms/bin/rtsmake -x mom4_rts_smg.xml mom4_test4
If this works correctly, it will complete with the line:

    TO SUBMIT: qsub /home/USERNAME/khartoum/scripts/mk_mom4_test4

where USERNAME is your username. This script (mk_mom4_test4) will create a makefile and execute that makefile to compile the code.

3) Compile the model code

This runscript can only be executed on the parallel computer system. There are two ways to do this, but for the purposes of this exercise, please pick the second one:
  • The first method is to submit mk_mom4_test4 as a batch job to the qeue for the Large Scale Cluster (LSC - meant for large jobs), with:
    qsub /home/USERNAME/khartoum/scripts/mk_mom4_test4
    An even easier way to do this would have been to as the -s option to the above statement and have the job submitted automatically with:

    /home/fms/bin/rtsmake -x mom4_rts_smg.xml -s mom4_test4
  • The second method is for those who are either impatient or just curious to see the compilation as it transpires. This is especially appropriate during development/debugging as the print out to the screen will show where and why compilation fails.
    Open a new command window and log on for an interactive session on the Analysis Cluster (AC - primarily for interactive sessions, post-processing and analysis) to execute the runscript interactively with:

    qlogin -pe ac.inter 1 exec tcsh cd ~/khartoum/scripts mk_mom4_test4

4) Create a runscript

After this completes successfully, go back to a PC shell and create a runscript:

/home/fms/bin/rtsrun4 -x mom4_rts_smg.xml -r basic mom4_test4
If this works, it will respond with:

    TO SUBMIT:: qsub /home/USERNAME/khartoum/scripts/mom4_test4_1x0m10d_20pe

The trailing syntax of mom4_test4_1x0m10d_20pe means that the runscript will run one time (1x) for zero months (0m), one day (1d) on twelve processors (12pe).
If you get an error message of PERMISSION DENIED, try creating (or adding to your existing) ~/.rhosts file with a line that has the name of the computer that you are currently on. This will tell the qeueing system to accept commands from that computer.

5) Execute a runscript (run the model)

Again, you can either execute this as a batch job with:

qsub /home/USERNAME/khartoum/scripts/mom4_test4_1x0m1d_12pe
(in which case it would have been even easier to just add the -s option to the rtsrun4 command in order to submit it automatically)
or interactively on the AC (which I prefer, for short/small runs) with:

mom4_test4_1x0m1d_12pe
If you are running interactively, a huge amount of text will scroll across the screen as the model configures itself and executes, if you get the big, banner message:

END OF RUN

Congratulations!!! you've successfully run MOM4!


6) Look at the results

Output of a model run will be in three directories: ascii - the description of the setup of the run and verbose comments printed out during the run, restart - the model fields necessary to initialize future runs of the model, and history - output of the model, both averaged over specified time intervals and instantaneous "snapshots". To view the model output, you must be on the AC. By default, all of the output are automatically compressed and stored onto tape for permanent storage. Access the output with:

cd /archive/USERNAME/khartoum/mom4_test4/1x0m1d_12pe/history/ ls
In this directory, there should be a single file, 19800101.nc.cpio, that has the output, and a directory called "/raw", that contains the output from the various individual processors. If there are more (or less), then it probably means that the archiving process is not complete... wait for it to finish. For bigger models (like OM3), this can take up to an hour. For OM1 runs, it's usually only a few seconds. Once ready, get the output with:

cpio -iv < 19800101.nc.cpio
This will bring the output back from tape and extract it into the individual files. This process can take a minute or so, as the little robots in the basement find the data. The files will print out as they are recieved. The tracer output is divided into physical output fields, tracer concentration fields (standing crop; SC), 3-dimensional flux fields (3d), 2-dimensional flux fields (2d), all as averages and snapshots of fields (snap). When the command line prompt returns, start a viewing/analysis package (on either the AC or your PC) such as:

ferret
Note that in order to run Ferret on the AC, you must have something equivalent to the following in your ~/.cshrc file:
    if ( `hostname` =~ anc[1-2] ) then
      # put aliases unique to AC graphics software here
      set ferret_path_file = /home/mh2/.ferret_paths_i686
      set mh2_ext_fcns = /home/mh2/.ferret_paths_ac
      if (-e ) then
        source
        source
      endif
      setenv FMS_BIN_DIR /net2/mh2/fms/bin
    endif

While in Ferret, you can open up a file with:

use 1980jan02h00.ocean_ocmip2_biotic_sc.nc
Basic commands in Ferret to look at the output include:

show data
to view the data parameters and their sizes, and plotting with commands like:

shade no3[k=1] plot no3[k=1,x=140W]
See the ferret homepage for details. Terminate Ferret with:

quit
and terminate your AC session with:

exit
Happy modeling!




smaller bigger reset
last modified:September 22 2004.