Compiling MODFLOW2005 on the Janus computing cluster

Perhaps you are new to working with source code, and you want to know how to compile your first program on a super computer or cluster. Here’s some instructions on how to do so.

The link from USGS (http://water.usgs.gov/ogw/modflow/MODFLOW.html#downloads) had a link that said “MODFLOW-2005 source code and sample problems converted to the Unix file structure”.

I downloaded the folder, extracted it, and transferred it to Janus. If you don’t know how to transfer files, use Globus Connect or another service, as documented in our post about what software to install and our post on cluster commands.

The folder contains some subfolders, /doc/, /src/, /test-out/, and /test-run/. The source code is in /src/.

When you look at source code, different folks break it up in different ways. Sometimes the actual code is in /src/ and then the actual executable files are stored in a ‘binary’ folder called /bin/. Or something like that. But anyway, what you want to look for is a file called a makefile. Luckily, the friendly folks at USGS have put the makefile in the /src/ folder.

On Janus, navigate to the /src/ folder and type the command:

make

and this will compile the files. Of course, there is a problem (there’s always a problem!) This time it says:

f90: command not found

After looking at the webpage for compilers at research computing (https://www.rc.colorado.edu/support/userguide/compilersandmpi) it turns out that they have several packs of compilers we can load up. In Linux/Unix, the GNU compilers are standard. There is also such a compiler as the Intel family of compilers, too.

For our purposes, we will use the GNU fortran compiler. First, to load that family of compilers run the command:

module load gcc

The makefile for the project needs to know that you are using the gfortran compiler. So, edit the Makefile in the /src/ folder. Instead of modifying the actual line it’s always a good idea to comment out the command. So replace:

F90= f90

with:

#F90= f90
F90= gfortran

and save the file. Now, when you run:


make

you’ll see some magic happen. If you see a few warnings that’s ok.

Finally, to run the program, simply type the name of the executable:


./mf2005

I don’t know anything about MODFLOW but these words indicate it looks like it’s working:

MODFLOW-2005
U.S. GEOLOGICAL SURVEY MODULAR FINITE-DIFFERENCE GROUND-WATER FLOW MODEL
Version 1.11.00 8/8/2013

Enter the name of the NAME FILE:

Voila! Now follow the readme and documentation to actually try some examples. But hopefully this will help someone out there that is new to compiling and using clusters.

Advertisements

2 thoughts on “Compiling MODFLOW2005 on the Janus computing cluster

  1. Pingback: Invoking a Matlab wrapper while running a Parallel C process | Water Programming: A Collaborative Research Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s