CE74.55 Modeling of Water Resources Systems
March 21st, 22th and 23rd, 2012

Distributed flow routing model: 1K‐FRM‐event
Demonstration and Project
Yasuto TACHIKAWA
Dept. of Civil and Earth Resources Eng., Kyoto University, Kyoto 615-8540, Japantachikawa@hywr.kuciv.kyoto-u.ac.jp

1. Introduction
1K-FRM-event is a distributed flow routing model based on kinematic wave theory. The input
topography data is generated using HydroSHED 30 second digital elevation model and flow
direction data. Forcing data to drive 1K-FRM-event such as runoff generation or precipitationis supposed to be hourly gridded data. At first, a method to develop topography data for 1KFRM-event is described. Then, by using the developed data, an example of rainfall-runoff
simulation using 1K-FRM-event is demonstrated. Figure 1 shows entire structure of thecoordinate system used for 1K-FRM-event flow routing simulation.

Figure 1: Geographic relation of flow routing simulation area and forcing data grid region.
12. Preparation of Topographic Data for 1K-FRM-event
1) Hydroshed2topo
Hydroshed2topo is a program to generate input topography data for 1K-FRM-event, which is
obtained from 1K-FRM homepage
http://hywr.kuciv.kyoto-u.ac.jp/products/1K-DHM/1K-DHM.html
2) Input data
The topographic data for a flow routing model 1K-FRM-event is generated by using theHydroSHED (http://hydrosheds.cr.usgs.gov/) 30-second digital elevation and flow direction
data. The DEM and flow direction data with ESRI grid format data for entire Asia (55E,-10S
to 180E, 60N) from HydroSHED were downloaded and they were converted to short integer
2-bite binary data format to reduce the file size. These two files:
as_dem_30s_clipped_55—10-180-60.bin (246MB)
as_dir_30s_clipped_55—10-180-60.bin (246MB)
are also obtained from 1K-FRM homepage. These two data are input files for hydroshed2topo.
3) Parameter data
All Necessary topographic input files to run the 1K-FRM-event are created by executing thehydroshed2topo.cc. The program creates additional ESRI ASCII files and those files can beimported to ArcGIS to prepare maps of the study area. First, you need to specify the study
area by editing the parameter data filehydroshed2topo/clipArea.dat
This file is a text data file. The study area is determined as a rectangular region by setting
longitude and latitude as shown in Figure 2.
zzzz

The first row specifies the number of columns for the study region. The value must be aninteger value.
The second row specifies the number of rows for the study region. The value must be an
integer value.
The third row specifies Longitude (degree) of South West (lower left) corner of the study
area. The value is a real value.
The forth row specifies Latitude (degree) of South West (lower left) corner of the study
area. The value is a real value.

The grid size is supposed to 30 second. The longitude (second) of j-th cell center is set asfollows:
longitude = (int)(SWlon*3600) + 30*j + 15;

2

120
60
138
35.5
Figure 2: Setting study area. An example of clipArea.dat.

4) Generation of topographic information for 1K-FRM-event
Compile hydroshed2topo.cc and run hydroshed2topo.exe.
5) Output files
All output files used for the 1K-FRM-event are created in the folder:hydroshed2topo/output
The files generated are below:
z modDem.bin: This is the corrected (pit removed) elevation information of the study area.
The data was written in real 4-byte binary data format.

Figure 3: A sample of modem.bin.
3zflowDir.bin: Flow direction information. The direction convention is shown in Figure 3.
The data format is integer 4-bite binary.

Figure 4: A sample of flowDir.bin.

8

1

76

2
3

5

4

Figure 5: Flow direction specified by the integer value.
z

flowAcc.bin: Flow accumulation information. The data format is integer 4-bite binary.

Figure 6: A sample of flowAcc.bin.
4zriverNum.bin: Each river basin is numbered starting from 1 and then each grid cell is
assign a value corresponding to the basin number which the cell is belongs to. The data
format is integer 4-bite binary.

Figure 7: A sample of riverNum.bin.
zriverNumList.txt: This is a text file which contains:
Column 1: river basin number of the study area,
Column 2: the basin area (acmulated number of grids).
Column 3: column number starting from 1 (starting from West),
Column 4: row number starting from 1 (starting from South),Column 5: longitude (second),Column 6: latitude (second),Column 7: longitude (degree), andColumn 8: latitude (degree)
If you want to calculate the discharge data only at some selected basins using 1K-FRMevent or 1K-FRM, you can delete all the other basins from this text file and keep only thenecessary basins.

All data begins from the South-West grid and lining to East, then, moving to the North in thenext line, which are typical GrADS data format. Sample GrADS control files are attached inhydroshed2topo to visualize the data.

5

1 5 10 59 497085 129555 138.079 35.9875
2 3 14 59 497205 129555 138.113 35.9875
3 4 16 59 497265 129555 138.129 35.9875
4 4 17 59 497295 129555 138.137 35.9875
5 4 18 59 497325 129555 138.146 35.9875…

Figure 8: An example of riverNumList.txt.

Additional files are also created, which are ESRI ASCII files to be imported to ArcGIS tovisualize the study region:zzzzzzz

cutDem.asc: The DEM data for the study region. This is the original data clipped for thestudy region.
cutDir.asc: The DIR data for the study region. This is the original data clipped for thestudy region.
modDem.asc: The DEM data for the study region. This is the corrected (pit removed)
elevation information of the study area, which corresponds to moDem.bin.
flowDir.asc: The Flow Direction data for the study region, which corresponds toflowDir.bin.
flowAcc.asc: Flow accumulation value information, which corresponds to flowAcc.bin.
riverNum.asc: The river basin numbers of the study area, which corresponds toriverNum.bin.
distance.asc: The distance from the river mouth.

3. Preparation of Forcing Data
It is necessary to create a text file of effective hourly forcing data (spatially distributed lateral
input data to slope and river such as rainfall intensity or runoff generation intensity data). If
the data duration is shorter than simulation time, remaining rainfall is assumed to zero. A partof a sample data file is shown in Figure 9. The rainfall data file name is “rain.dat” and shouldbe placed at
1k-frm-event/input/rain.dat
The first line of “rain.dat” is Year, Month, Day, Hour, Column Number, and Row Number ofspatially gridded rainfall data. From the next line, rainfall intensity values (mm/hr) are stored
beginning from the North-West grid and lining to East, then, moving to the South in the nextline. Each data is delimited by white space characters (SPACE, TAB, or CR). You can change
the rainfall intensity data for your study purpose.

6

1979 12 1 1 5 6
0.1 0.2 0.3 0.4 0.5
0.6 0.7 0.8 0.9 1.0
1.1 1.2 1.3 1.4 1.51.6 1.7 1.8 1.9 2.0
2.1 2.2 2.3 2.4 2.5
2.6 2.7 2.8 2.9 3.0…

Figure 9: Part of rain.dat. The 1st Row is: Year, Month, Day, Hour, Column Number, Row
Number. From the 2nd to 7th Rows, effective rainfall intensities (5 columns and 6 rows) inmm/hr are stored.

The geographic structure is shown in Figure 10. The rainfall intensity data represents theintensity of each grid center. The time interval of the rainfall intensity must be hour. Figure 11shows the relation between the rainfall-runoff simulation region and rainfall grid region. For
runoff simulation, the nearest grid of rainfall intensity is selected.

Figure 10: Structure of coordinate of the rainfall grid system.
7

The grid size of forcing data is set in the parameter setting file for 1K-FRM-event. The
grid center of longitude (degree) and latitude (degree) of j-th column and i-th row for input
data are set as follows:
longitude = ROF_WLON + 0.5*Delta_x + j*Delta_x; // set longitudelatitude = ROF_SLAT + 0.5*Delta_y + j*Delta_y;// set latitude

Figure 11: Geographic relation of rainfall-runoff simulation area and rainfall grid region.

4. Flow Routing Simulation Using 1K-FRM-event
Figure 11 shows the geographic relation of the rainfall-runoff simulation area and the rainfall
grid region for the example data. The procedures for runoff simulation are as follows:
1) Topography data setting: Copy the topographic information files (above mentioned fivefiles)
from hydroshed2topo/output/ to 1k-frm-event/topoData/2) Rainfall data setting: Set the rain data and place rainfall data file at81k-frm-event/input/rain.dat. (The file name must be rain.dat.)
3) Runoff simulation parameter setting: Edit the runoff simulation parameter file
1k-frm-event/param-event.datby using any text editor. Delimiter of each data is white space characters.
120

Number of columns of the study area

60

Number of rows of the study area

138.0

Longitude (degree) of South West corner of the study area

35.5

Latitude (degree) of South West corner of the study area.

5

Number of columns of the input forcing data

6

Number of rows in the input forcing data0.1875Input data grid size of x-direction (degree)

0.1875

Input data grid size of y-direction (degree)

137.75

West corner longitude of input data (degree)

35.25

South corner latitude of input data (degree)

10

Simulation duration (days)

600

simulation time step (sec)20

number of spatial divisions

0.65

0.5 < theta <= 1.0

11.0

Manning’s roughness coefficient for slope

0.03

Manning’s roughness coefficient for river250

grid accumulated number to differentiate slope and river

0.0

Initial runoff height for kinematic wave model (mm/hr)

Figure 12: An example of param-event.dat.
The parameter values to set in param-event.dat are as follows:z From 1st row to 4th row, the parameters of the study region is specified:int Col=120// number of column for study area.
int Row=60// number of row for study area.
double SWLON=138.0// Longitude (degree) of north west corner of the study area.
double SWLAT=35.5// Latitude (degree) of north west corner of the study area.
z From 5th row to 10th row, the parameters of the rainfall data is specified:int ROFnum_col = 5// Number of column of input rainfall data9

int ROFnum_row = 6// Number of row of input rainfall data
double Delta_x = 0.1875// Input data grid size of x-direction (degree)
double Delta_y = 0.1875// Input data grid size of y-direction (degree)
double ROF_WLON = 137.75// West corner longitude of input data (degree)
double ROF_SLAT = 35.25// South corner latitude of input data (degree)z The 11th row is a parameter to determine the simulation term.
int Ndays = 10// Simulation duration (days)
From 12th row to 14th row, the parameters for the finite difference condition are specified.
Usually, you do not need to change these parameter values.
int Time_Step = 600// Simulation time step (sec)int Nspace = 20// Number of spatial divisions
double Theta = 0.65// weight value 0.5 < theta <= 1.0zz From 15th row to 17th row, the parameters for the kinematic wave model are specified.
double Man_slope = 11.0 // Manning’s roughness coefficient for slope (m-s unit)
double Man_channel = 0.03 // Manning’s roughness coefficient for river (m-s unit)
int Threshold_basin = 250 // grid accumulated number to differentiate slope and riverz The 16th row is a parameter to determine the initial condition.
double initialROF = 0.0// Initial runoff height (mm/hr)

4) Rainfall-runoff simulation
Move to the folder “/project/1k-frm-event” and run“1k-frm-event.exe”
All runoff simulation results are created in
1k-frm-event/output
The files created are below:
z dischargeDaily.bin: The file contains the average daily flow (m3/sec).
z dischargeHourly.bin: The file contains the hourly flow (m3/sec).
z dischargeHourlyMaxInDay.bin: The file contains the maximum hourly flow value foreach day (m3/sec).
The data are stored in GrADS binary data format and can be visualized using GrADS(http://www.iges.org/grads/). All data arranges from west to east at the South row, then Northrow. GrADS control file:- flowAnalysisGradsDaily.ctl- flowAnalysisGradsHourly.ctl
10are attached. A sample program is also attached in ./output:- pointdata-event.cc
which extracts time series ascii data from the above binary data.

5) Compile
If you want to change the source code, compile a modified code using:z

Linux environment: The executable is created by using the GNU g++ compiler asfollowing command% g++ -o 1k-frm-event.exe 1k-frm-event.cc cellfunc.cc roffunc.cc

or Intel C++ compiler for Linux version% icc -o 1k-frm-event.exe 1k-frm-event.cc cellfunc.cc roffunc.ccz

MS Windows environment: Microsoft Visual Studio 2008 or 2010 with C++ compiler isuseful. You can download a free version of Visual C++ Express Edition from Microsoft
web site.
The solution file 1k-frm-event.sln should be created according to Microsoft Visual Studio,or Intel C++ compiler for windows versionc:\> icl 1k-frm-event.cc cellfunc.cc roffunc.cc

5. Output Data Analysis
5.1 Visualization of time and space change of discharge using GrADS
GrADS is a free visualization software mainly used by meteorologists. The software works on
Windows with cygwin and Linux environment. GrADS is available fromhttp://www.iges.org/grads/
You can use an example of GrADS control files “flowAnalysisGradsDayly.ctl” and“flowAnalysisGradsHourly.ctl” in “/project/misc/gradsControlFiles”. Please see the detail
information at the web page. Figure 13 is a spatial distribution of discharge at the study region.

11

Figure 13: Spatial view of simulated discharge using GrADS.

5.2 Visualization of time and space change of discharge using makeppm-event.exe andIrfanView
If you do not have GrADS, you can generate PPM format image files and see it using a free
image viewer IrfanView. The procedure to see the animation of time and space change ofdischarge is as follows:(1) Run the image generation program makeppm-event.exe, which is included in 1k-frmevent/output. This program reads the GrADS format output hourly discharge data
dischargeHourly.bin and generate PPM format image files under image folder. To run
the program,
1-1)
1-2)
1-3)

Open the folder “/project/1k-frm-event-ver131”
Click “makeppm-event.exe”
Image files are gerenated under “/project/1k-frm-event/image/”.

(2) Install IrfanView. This is a very popular free image viewer you can download fromhttp://www.irfanview.com/. Click
misc/irfanview/irview428_setup.exe
The viewer is installed and you will find the icon on your Windows desktop.
(3) Click the IrfanView icon and select [File]Æ[Slideshow]. Set the location of PPT image
file, then add slideshow files and play slideshow. You can enjoy the animation.

12

Set image files folder

Set slideshow time interval

Slideshow start!

Add slideshow files

Figure 14: IrfanView Slideshow setting.

(4) Another method to view the animation is to select [FIle]Æ[Open], select the image folder
and click the first image. Then, select [View]Æ[Start/Stop automatic viewing]. You canselect [View]Æ[Display option (window mode)] to enlarge the image.
5.3 Time series of discharge data at specific point
The procedures to extract the time series of discharge data at the specific point is as follows:(1) Run the time series extraction program pointdata.exe. This program reads the GrADS
format output hourly discharge data dischargeHourly.bin and generates text format timeseries data under /output. To run the program,
1-1)
1-2)
1-3)

1-4)

Open the folder “1k-frm-event-131”.
Click “pointdata-event.exe”.
You are asked to input the column and row number to extract the data. To
determine the column and row number, it is useful to see the accumulated
catchment data “/project/hydroshed2topo/output/arcgis/flowAcc.asc to examine
the discarge with large catchment size. The row and column number begins fromthe South West corner starting from 1.
The extracted data is genereated in \1k-frm-event\output\Col-Row_discharge.dat
shown in Figire 15. The first column of the data is time count (hour) and thesecondcolumn is discharge (m3/sec).
13

10.0882515

20.653777

32.26534

7.35936514.4867

620.414725.6387

832.4114

943.8638

1055.3801…

Figure 15: An example of time series discharge data extracted by using pointdata-event.exe.

(2) To draw the hydrograph, you can use Excel or GnuPlot (http://www.gnuplot.info/).

6. Project Tasks
1) Run the 1K-FRM-event model by setting different model parameters. For example,
change the Manning rouness coefficient, and see the change of time and space ofdischarge. Then, discuss why the change happens.
2) Run the 1K-FRM-event model by setting different rainfall data, and see the change oftime and space of discharge. Then, discuss why the change happens.
3) Run the hydroshed2topo to enerate topography data of different catchment. Then, apply
1K-FRM-event. If you can use ArcGIS, you can check visually your study area.
Each group is required to submit a project report with maximum 10 pages including
objectives of the project, simulation results, findings, discussion and conclusions.

14