ROMS for beginners

Instructions and hints for beginners

Moderators: arango, robertson

Post Reply
Message
Author
jcwarner
Posts: 1172
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

ROMS for beginners

#1 Unread post by jcwarner »

ROMS is a very complex model with many options and capabilities. Because there are so many options, it can be difficult to get started. I am writing this to help those who need the basics.

ROMS methodology

ROMS is composed of many Fortran files (*.F), a few header files (*.h), a variable definitions file (varinfo.dat), various input scripts (*.in), and several Makefiles. ROMS also uses NetCDF for input/output (I/O) so users need to acquire those interface files (all described below). ROMS is distributed with an application already defined, the UPWELLING case. So we will install the model, run it, and look at output for that case. Then we will give tips on how to develop your own application.

Basic steps to run ROMS

1) Install (untar or unzip) the distributed file to a working directory.

2) Install NetCDF library. You may need to get the source code and build the libraries yourself, or there may be precompiled NetCDF libraries already out there. You just need to get them or build them, and place the libraries on your computer in the right location.

For windows, or cygwin on a windows machine, using the g95 or Compaq Fortran 90 compiler, get the precompiled libraries at:

http://my.unidata.ucar.edu/content/soft ... #platforms

For windows, or cygwin on a windows machine, using the intel 8.1 compiler, use attached precompiled library netcdfs_intel8.lib (or build your own).

For other operating systems, you may need to compile the files from the source code:

http://my.unidata.ucar.edu/content/soft ... index.html

To find out where to put the files, we need to look at the Makefile (next step). Look in the Makefile for something called NETCDF_LIBDIR. This is the path where you installed the NetCDF library (libnetcdf.a). Also look in the Makefile for something called NETCDF_INDDIR. This is the path where you installed the include NetCDF file (netcdf.inc).netcdf.h to that directory.

3) Make the program. Depending on the operating system, you need to select which Makefile to use. For example, on a Unix DEC Alpha running in shared-memory mode (OpenMP) use Makefile.OMP_alpha. You can either type:

make -f Makefile.OMP_alpha clobber
make -f Makefile.OMP_alpha

or

cp Makefile.OMP_alpha Makefile
make clobber
make

The make utility uses by default a file called makefile or Makefile if the -f option is not specified. It is recommended to do a make clobber everytime that your start compiling a new application. This will clean your directory of all intermediary files.

4) to run ROMS in windows with cygwin, for example, type

./oceanS.exe < ocean_upw.in > & ocean_upw.out &

In Unix, the executable file created by the Makefile (see macro BIN in the Makefile) does not have the .exe extension.

5) To look at the output, you can use free NetCDFviewers such as ncbrowse, check the following link:

http://www.unidata.ucar.edu/packages/ne ... tware.html

Alternatevely, you can use the NetCDF interface for Matlab from:

http://woodshole.er.usgs.gov/staffpages ... c4ml5.html

How To Develop Your Own Application

Look in the test cases for an existing application that is similar to what you are doing. Then modify it. For each application, the user will most likely edit the following files:
  • cppdefs.h
    ocean_*.in
    mod_param.F
    analytical.F
cppdefs.h: The flexibility in ROMS comes from the many options available in the code. For each application, the user needs to develop a set of CPP (C pre-processor) definitions that will activate sections of the code. This is all accomplished in cppdefs.h. This file specifies (defines) all the options that should be used for each application. At the top of cppdefs.h is a list of applications. Only one application should be defined at any given time. The default application that ROMS has defined is UPWELLING. So it says:

#define UPWELLING

If you scroll down the file (very far down, near the bottom of the file) you will see all the options set for the upwelling case. There are many other applications set up in ROMS already. For your own application, you will most likely start by copying an existing definition set, renaming it to YOUR_APP, and then activating your application by saying at the top of cppdefs.h:

#define YOUR_APP
#undef UPWELLING

Below the applications is a list of all CPP options in ROMS. It might help to print this put and see what options were selected for a certain application.

ocean_upw.in: this is the input script file for the application of UPWELLING. There are many other input files included in the distribution. For your own application you can copy this file and rename it to your own title. Description of the input is in this file, at the end.

mod_param.F: here is where you tell the model how many interior grid points in x-, y- and z-directions (Lm,Mm,N). Also, how many sediment or biological parameters.

analytical.F: if you want to specify initial conditions or forcings as simple analytical functions. Or if you are using a simple analytical grid, it can be defined in here. If you want to generate your own real grid, you can use:

http://woodshole.er.usgs.gov/staffpages ... agrid.html

Hope this gets you started, good luck :!:

Post Reply