User Manual for Distributed Hydrological Model: 1K‐DHM‐event
Version 1.35, May 21, 2013
Yasuto TACHIKAWA and Tomohiro TANAKA
Dept. of Civil and Earth Resources Eng., Kyoto University, Kyoto 615-8540, Japantachikawa@hywr.kuciv.kyoto-u.ac.jp

1. Introduction
1K-DHM-event is a distributed hydrologic model based on kinematic wave theory. The
model structure is the same as the 1K-FRM-event; only the discharge-stage relationship isdifferent. 1K-FRM adopts a surface flow momentum equation; 1K-DHM includes a surfacesubsurface flow momentum equation. From version 1.35, a dam operation is possible toinclude 1H-DHM. The source programs are coded using C++ language and works under
Microsoft windows environment and the Linux environment. All program source codes andinput topography data in the Asian region are provided from the home page of Hydrology andWater Resources Research Laboratory at Department of Civil and Earth Resources
Engineering, Kyoto University:
http://hywr.kuciv.kyoto-u.ac.jp/products/1K-DHM/1K-DHM.html
The input topography data is generated using HydroSHED 30 second digital elevation modeland flow direction data. Forcing data to drive 1K-DHM-event such as runoff generation or
precipitation is supposed to be hourly gridded data. At first, a method to develop topography
data for 1K-DHM-event is described. Then, by using the developed data, an example ofrainfall-runoff simulation using 1K-DHM-event is demonstrated. Figure 1 shows entire
structure of the coordinate system used for 1K-DHM-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-DHM-event
1) Hydroshed2topo
Hydroshed2topo is a program to generate input topography data for 1K-DHM-event, which is
obtained from 1K-DHM homepage.
2) Input data
The topographic data for a flow routing model 1K-DHM-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 obtained from 1K-DHM homepage. These two data are input files for hydroshed2topo.
3) Parameter data
All Necessary topographic input files to run the 1K-DHM-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.
The first row specifies the number of columns for the study region. The value must be an
integer 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 as
follows:
longitude = (int)(SWlon*3600) + 30*j + 15;
latitude = (int)(SWlat*3600) + 30*i + 15;

2

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

4) Generation of topographic information for 1K-DHM-event
Compile hydroshed2topo.cc and run hydroshed2topo.exe.
5) Output files
All output files used for the 1K-DHM-event are created in the folder:hydroshed2topo/output
The files generated are below:
 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

flowDir.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

7
6

2
3

5

4

Figure 5: Flow direction specified by the integer value.
flowAcc.bin: Flow accumulation information. The data format is integer 4-bite binary.

Figure 6: A sample of flowAcc.bin.

4riverNum.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.
riverNumList.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-DHMevent or 1K-DHM, 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:








cutDem.asc: The DEM data for the study region. This is the original data clipped for the
study region.
cutDir.asc: The DIR data for the study region. This is the original data clipped for the
study 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-dhm-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 next
line. 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.5
1.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) in
mm/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 11
shows 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-DHM-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 + j*Delta_x; // set longitudelatitude = ROF_SLAT + j*Delta_y;// set latitude

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

4. Hydrologic Simulation Using 1K-DHM-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 five
files)
from hydroshed2topo/output/ to 1k-dhm-event/topoData/
2) Rainfall data setting: Set the rain data and place rainfall data file at
1k-dhm-event/input/rain.dat. (The file name must be rain.dat.)

83) Runoff simulation parameter setting: Edit the runoff simulation parameter file
1k-dhm-event/param-event.dat
by 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 data

0.1875

Input data grid size of x-direction (degree)

0.1875

Input data grid size of y-direction (degree)

137.8

Longitude of the center of the Southwest corner of input data (degree)

35.325Latitude of the center of the Southwest corner of input data (degree)

4

Simulation duration (days)

600

simulation time step (sec)20

number of spatial divisions

0.65

0.5 < theta <= 1.0

0.5

Manning’s roughness coefficient for slope (m-s unit)

0.0046

Hydraulic conductivity (m/s)

0.3440Depth of capillary and non-capillary soil layers (m)0.2875Depth of capillary soil layers (m)6.3486

Exponent constant of unsaturated hydraulic conductivity (-)

0.03

Manning’s roughness coefficient for river (m-s unit)

250

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: 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.

9 From 5th row to 10th row, the parameters of the rainfall data is specified:int ROFnum_col = 5// Number of column of input rainfall data
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// Longitude of the center of the Southwest corner of// Input data (degree)
double ROF_SLAT = 35.25// Latitude of the center of the Southwest corner of// input data (degree) The 11th row is a parameter to determine the simulation term.
int Ndays = 4// 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.0 From 15th row to 22nd row, the parameters for the kinematic wave model are specified.
double Man_slope = 0.5// Manning’s roughness coefficient for slope (m-s)
double Ka = 0.0046// Hydraulic conductivity (m/s)
double Da = 0.3440// Depth of capillary and non-capillary soil layers (m)double Dm = 0.2875// Depth of capillary soil layers (m)double Beta = 6.3486// Exponent constant of unsaturated hydraulic conductivity (-)
double Man_channel = 0.03 // Manning’s roughness coefficient for river (m-s)
int Threshold_basin = 250 // grid accumulated number to differentiate slope and river The 23rd 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-dhm-event” and run“1k-dhm-event.exe”
All runoff simulation results are created in
1k-dhm-event/output
The files created are below:
 dischargeDaily.bin: The file contains the average daily flow (m3/sec).
 dischargeHourly.bin: The file contains the hourly flow (m3/sec).
10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 North
row. GrADS control file:- flowAnalysisGradsDaily.ctl- flowAnalysisGradsHourly.ctl
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) Dam model inclusion
To include dam model, you need to edit main program 1k-dhm-event.cc and cellfunc-event.cc.
The 306th line to 321st line and the 362nd line to the 364th line in 1k-dhm-event.cc are thesetting for dam model. A dam model operation is implemented in several member functions:

setDamGrid: setting the grid of dam location,
calculateDamOutflow: dam operation,
setDamInitialState: setting of initial state variables, andsetDamParameter: setting of parameter values

These functions should be set by users depending on a study catchment. Default model setting
is no dam model.
6) Compile
If you want to change the source code, compile a modified code using:Linux environment: The executable is created by using the GNU g++ compiler asfollowing command% g++ -o 1k-dhm-event 1k-dhm-event.cc cellfunc-event.cc roffunc-event.cc

For Intel C++ compiler of Linux version% icc -o 1k-dhm-event 1k-dhm-event.cc cellfunc-event.cc roffunc-event.cc

11

MS Windows environment: Microsoft Visual Studio 2008 or 2010 with C++ compiler isuseful. You can download a free version of Visual C++ Express Edition 2008 or 2010
from Microsoft web site.
The solution file 1k-dhm-event.sln should be created according to the Microsoft Visual Studio touse Visual Studio environment. You can also use the command prompt window of the Microsoft
Visual Studio. In this case, after opening the command prompt window, you can compile theprogram as:% cl 1k-dhm-event.cc cellfunc-event.cc roffunc-event.cc
For Intel C++ compiler of windows version
c:\> icl 1k-dhm-event.cc cellfunc-event.cc roffunc-event.cc

5. Output Data Analysis
5.1 Visualization of time and space change of discharge using GRADSGRADS is a free visualization software mainly used by meteorologists. The software works
on Windows and Linux/Unix environment. GRADS is available from http://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.

12

Figure 13: Spatial view of simulated discharge using GrADS.

5.2 Visualization of time and space change of discharge using makeImage.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.exe, which is downloaded from 1K-DHM
home page. 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-dhm-event”
Click “makeppm.exe”
Image files are gerenated under “/project/1k-dhm-event/image/”.

(2) Install IrfanView. This is a very popular free image viewer. Click
misc/irfanview/irview428_setup.exe
The viewer is installed and you will find the icon on your MS-Windows desktop.
(3) Click the IrfanView icon and select [File][Slideshow]. Then, set the location of PPT
image file. You can enjoy the animation.

13

Set image files folder

Set slideshow time interval

Slideshow start!

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)

Open the folder “1k-dhm-event”.
Click “pointdata.exe”.
You will be 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/ESRIBasin.asc to examine thediscarge with large catchment size. The row and column number begins from theNorth West corner starting from 1.

14

1-4)

The extracted data is genereated under \1k-dhm-event\output\Col-Rowdischarge.dat. The first column of the data is time count (hour) and thesecondcolumn is discharge (m3/sec).
1

0.0882515

20.65377732.2653

4

7.359365

14.48676

20.414

7

25.6387832.4114943.863810

55.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/).

15