Build IWFM on Linux

The Integrated Water Flow Model (IWFM) is a water resources management and planning model that simulates groundwater, surface water, stream-groundwater interaction, and other components of the hydrologic system.

The model is written in Fortran, and windows executables for 32 and 64bit OS are readily available from their website. However for linux the code has to be compiled. In this post I’ll describe the tweaks needed to compile IWFM under Ubuntu. Using this process I have been able to compile IWFM on my desktop PC and a local installation on the UCDavis cluster.

Although the source code of the program is available it does not contain makefiles for linux builds. Yet the developers can provide upon request a linux version of the source code with all necessary files.

The code I received provided 2 makefiles for 32 and 64bit system. Here I’m explaining the installation of the 64bit version. The entry point of the installation is the file 

We need first to change the path of the on the second line. First do a search to find the location of the file using for example $ locate and then change the path after source accordingly. The rest of the file is good to go. However we need few additional tweaks:

1) find the paths for the files ieee_exceptions.modintr and ieee_arithmetic.modintr.

2) The folders ../x64/Debug and ../x64/Release contain a makefile named makefile_objs_D and makefile_objs respectively. In these files there is an absolute definition of the location of the above files which is very unlikely that matches yours. Correct those paths accordingly

For the cluster installation we should load first the appropriate module. for example $ module load intel

Finally compile the code by running the $ ./

Note: The above steps worked for my desktop PC. However in the cluster I was getting warnings related to some ar flags that should be changed to xiar. In this case one need to modify the makefile under ../IWFM_UTIL/x64/Release and change the ar flag of the build library to xiar. It should read as

IWFM_Util_x64.a : $(OBJS)
               xiar rc IWFM_Util_x64.a $(OBJS) 


Leave a Reply

Your email address will not be published. Required fields are marked *