MESH - A Community Hydrology - Land Surface Model


The information on this page may not be up-to-date. Consider reviewing these documents instead:

Compiling and Configuring Watroute
Calibrating Watroute and Standalone MESH with Ostrich: Sample Files

 

 The current version of standalone MESH is based on an integrated land surface scheme and a river routing system. The land surface scheme is the Canadian Land Surface Scheme (CLASS) with enhanced hydrology for overland and inter flow. The river routing system is based on an older version of watroute from the WATFLOOD hydrological model. There is no feedback from the routing component to the enhanced land surface scheme and running the two components one after the other will bring a number of advantages. One of the drawbacks in the current integrated MESH modelling system is that its base flow scheme is very crude and it requires a major code modification to call an external base flow model. On the other hand, the RPN version of watroute has an advanced base flow scheme which has been part of the WATFLOOD model. This page will help MESH model users to independently run the enhanced land surface scheme of MESH and the RPN version of watroute (or any other  ground water model and routing algorithm).

 How does it work?

With the PRINTRUNOFFFILEFLAG and PRINTLEAKAGEFILEFLAG set to 1, the MESH model produces gridded runoff and recharge r2c files (Note that the two flags are included into the MESH code recently and make sure that you are using the latest MESH executable). The name of the runoff r2c file is hard coded as 'WR_runoff.r2c' and the name of the recharge r2c file is hard coded as 'WR_recharge.r2c'. The runoff r2c file includes the surface runoff and interflow contribution of the grid area to the grid outlet. The recharge r2c file represents water percolating from the base of the grid soil layer to the ground water. For each grid cell in the computational domain, watroute computes the base flow contibution of the grid and adds it to the already computed runoff (from the runoff r2c file). Watroute finally routes the total flow from each grid through the river system.

How to get the RPN watroute executable

The following describes how to get the source code and compile using a variety of compilers. If you use a different compiler, please add instructions for that compiler to this page.

1) Getting the Source Code

The source code can be obtained from one of three sources:

a) If you have access, the source code can be obtained from the RPN subversion repository (svn://mrbsvn.cmc.ec.gc.ca/mesh/offline/trunk/v333/src/watroute).

b) If you have access, the source code can be obtained from the standalone MESH repository (along with the sample files) in \TRUNK\Routing_Model\RPN_watroute\code. The example files are available in \TRUNK\Routing_Model\RPN_watroute\example_from_wiki.

c) Otherwise it can be obtained from an ftp site maintained by the Hydrometeorology and Arctic Laboratory at the National Hydrology Research Centre (contact Bruce Davison - bruce.davison@ec.gc.ca).

2) Compiling the Code

2.1) gfortran

The gfortran compiler is a free compiler and is available for Linux and Windows operating systems. Both the RPN and standalone MESH repositories contain the makefile (that can easily be modified for other compilers) and a definition file (makefile.def) to define the object fiels for the corresponding watroute source files. Executing the 'make' command on the command line (under the directory where the source files, the makefile and the makefile.def files exist) will produce the watroute executable.

Linux Operating System

Installation of gfortran compiler in a Linux (Ubuntu) system is straight foreward. One only needs to write 'gfortran' on the command line of a terminal and the Linux system will guide the installation process. Once the gfortran compiler is installed, follow the following steps to build the watroute executable:

  1. Open the terminal and change the directory where the code and the make file reside, and
  2. Issue the command ‘make’ and that should compile all the watroute source codes and build a new watroute executable.
Windows Operating System

For Windows operating system the MinGW, a contraction of "Minimalist GNU for Windows", provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications. One component is a port of the GNU Compiler Collection (GCC), including C, C++, ADA and FORTRAN compilers. MSYS (a contraction of "Minimal SYStem") is a Bourne Shell command line interpreter system that provides a general purpose command line environment, which is particularly suited to use with MinGW, for porting of many Open Source applications to the MS-Windows platform. Download and install MinGW and MSYS from the following link http://sourceforge.net/projects/mingw/files/MinGW/.

  1. Copy the watroute source code and the make file in a directory accessible to the MinGW shell terminal,
  2. Open the MinGW terminal and change the directory where the code and the make file reside, and
  3. Issue the command ‘make’ and that should compile all the watroute source codes and build a new watroute executable.

2.2) Intel Visual Fortran using the Visual Studio 2008 IDE

 Create a new project in the IDE by adding a new empty project console application. Then add all of the fortran (*.f) files in the 'Source Files' folder. The default debug and release properties will need to be changed. For the debug version, the /Fortran/Run-time/Check Array and String Bounds property will need to be set to 'No'. For the release version, the /Fortran/Libraries/Runtime Library property will need to be set to "Debug Multithreaded (/libs:static /threads/ dbglibs)"

How to run the MESH-watroute modelling system

Once the MESH and watroute executables are in place, follow the following steps to run the MESH-watroute modelling system:

  1. Run the MESH model with PRINTRUNOFFFILEFLAG and PRINTLEAKAGEFILEFLAG set to 1. Refer to the standalone MESH wiki site (other pages in this site) for problems related to input, initialization and other required files necessary to run the MESH model. The only difference in this case (from previous MESH runs) is that two files (WR_runoff.r2c and WR_recharge.r2c) will be generated. Click here for a sample WR_runoff.r2c file and click here for a sample WR_recharge.r2c file.
  2. In addition to the runoff and the recharge files (produced by MESH) watroute requires the following files:
    1. The MESH drainage database r2c file. This is the same as the 'MESH_drainage_database.r2c' file used by the MESH model. Click here to download a sample drainage database file.
    2. Gridded r2c file that contains attribute values for 11 parameters (Flz, Pwr, R1n, R2n, mndr, aa2, aa3, aa4, theta, widep and kcond). For details of the parameters refer to page 117 of the WATFLOOD manual. Click here for a sample r2c parameter file. In this sample case the parameter file is named as 'new_ch_par.r2c'.
    3.  Gridded initialization file for five state variables (qi1, qo1, store1, over and lzs). For details of the five state variables of watroute (which represent initial flows in each grid) refer to pages 24, 187 and 190  of the WATFLOOD manual. Click here for a sample initialization file. In this sample case the parameter file is named as 'flow_initzero.r2c'. Copy 'flow_initzero.r2c' and rename it as 'flow_init.r2c'. Note that every time watroute is run it will update the flow initialization file.
    4. Time series stream flow values for flow station(s). Click here for a sample stream flow file. Make sure that latitude and longitude locations (:ColumnLocationX and  :ColumnLocationY) are specified such that the I, J location matches the intended location of the station in the drainage database file.
    5. There are extra files needed by watroute due to modifications of the code for modelling of the Great Lakes. These files include reservoir file and lake water level files. One can use the following files as they are (File1, File2, File3, File4, File5, File6) and that should not affect the simulation in any other basin than the Great Lakes.
    6. The event file named as 'event.evt'. This is the main file that provides all the information (including the file names for the above mentioned files). For details of an event file refer to pages 20 to 27  of the WATFLOOD manual. Click here for a sample event file.
  3. Creat the following subdirectories:
    1. event 
    2. basin
    3. input
  4. Move the 'event.evt' file to the event directory, the 'new_ch_par.r2c' file to basin directory, and the '20040601_REL.tb0' and '20040601_str.tb0' files to the input directory.
  5.  Run the watroute executable using the command 'watroute streamflow_comparison'. A successful run should produce a  stream flow output file named as 'spl_rpn.csv'. This file contains observed and simulated stream flow time series values for the specified stations. Note that every time watroute is run it will append to an existing 'spl_rpn.csv' file and it is important to remove any existing such file during a fresh run. Click here for a 'spl_rpn.csv' file that should be produced by a successful run using the above files. Note that watroute will automatically update the initialization file (flow_init.r2c). So any consequent runs with the updated initialization file will produce different results than the values shown in the sample 'spl_rpn.csv' file provided in this wiki site. One has to replace the updated 'flow_init.r2c' file with a copy of 'flow_initzero.r2c' to reproduce the same result. A number of other files will also be created. These can be ignored for the time-being.
  • No labels