You are on page 1of 41

River2D

Two-Dimensional Depth Averaged Model of River


Hydrodynamics and Fish Habitat

River2D Tutorial – The Basics

by

J. Blackburn and P. M. Steffler

University of Alberta

September, 2002
1.0 Introduction

This tutorial is provided for you to learn the basics of River2D, the
two-dimensional depth averaged model of river hydrodynamics
and fish habitat. This tutorial is one in a series. Once you’ve
completed this tutorial, you may consider trying one or more of the
other tutorials. These tutorial cover the following topics:

• Fish Habitat Analyses


• River Ice Modelling
• Transient Flow Modelling
• Boundary Extraction and Mesh Merging
All of these tutorials can be obtained from the River2D website.
The address for the website is

www.river2d.ca

In this particular tutorial, you will learn how to use River2D to


obtain a steady state hydrodynamic solution. This will be
accomplished using topographic data obtained along the
Kananaskis River near Fortress Mountain in Alberta.

Along the way, you will also learn how to perform the following:

• Set or change the boundary conditions for the problem at hand


• Use River2D to obtain a steady state hydrodynamic solution
• Use various available display options for viewing and
presenting model information
• Make changes to the computational mesh in order to improve
the hydrodynamic solution
• Extract cross sectional data from the 2D topography
The files for this tutorial should be found in the same folder in
which you found this file: “R2D_theBasics”. The complete path to
this folder will vary, depending on where you put this folder after
unzipping R2D_theBasics.zip.

River2D Tutorial – The Basic – September 30, 2002 1


It is recommended that you make a hardcopy of this tutorial so that
you may maximize the River2D window on your computer screen
as you follow along. However, River2D displays many things in
colour so you may want refer to the electronic version of this
tutorial if your hardcopy is black and white.

If you have comments or questions regarding this tutorial, please


feel free to contact us.

Julia Blackburn Email: jblackburn@civil.ualberta.ca

Peter Steffler Email:pmsteffler@civil.ualberta.ca

2.0 The River2D environment

The River2D program is one of a suite of four programs which also


includes R2D_Bed, R2D_Mesh and R2D_Ice. The general
modeling procedure is to develop a bed topography file (a text file
with a .bed file name extension) from surveyed field data, and then
edit and refine the data using R2D_Bed. The resulting .bed file is
then used in R2D_Mesh to develop a computational discretization,
also called a mesh. Once the mesh is built and the boundary
conditions for the problem are set (no flow vertical walls, inflow
discharge, and outflow water surface elevation), an input file for
River2D can be created. Input files for River2D have the file
extension .cdg. Use of R2D_Ice is only required when modelling
flow under an ice cover. In this case, an ice topography file (a text
file with a .ice file name extension) would be developed using
R2D_Ice and then loaded into River2D once the .cdg file for the
domain has been opened.

To get started, we will launch River2D and open the .cdg file for
the Fortress site.

River2D Tutorial – The Basic – September 30, 2002 2


1 Launch River2D.
2 Choose File > Open and navigate to the R2D_theBasics folder.
3 Select the .cdg file for this the Fortress site. It is named
fort.cdg. Note: it may take a while for this file to load
depending on the speed of your computer.
At this point, you should see the following in your River2D
window.

Before getting into the details of what is being displayed in the


River2D viewing window, we shall go over the different
components of the River2D screen. The first item is the Menu Bar

River2D Tutorial – The Basic – September 30, 2002 3


which has many of the standard windows operations and additional
operations that are specific to River2D.

Some of the commands in the menu bar are reproduced in the


Toolbar.

The River2D screen also has a Title Bar which displays the
currently opened file, in this case, fort.cdg.

The last screen item is the status bar, located at the bottom of the
River2D screen.

Once a .cdg file has been loaded, the status bar displays the x and y
coordinates of the position of the mouse pointer. In addition to the
x and y coordinates, one other parameter is given in the status bar.
This parameter is the same as that selected using the

River2D Tutorial – The Basic – September 30, 2002 4


contour/colour command (found under the Display menu). This
parameter defaults to the bed elevation if it has not been specified
using the contour/colour command.

Now we shall focus on the contents of the River2D viewing


window. By default, River2D displays two items once a file is
loaded: the computational boundary and the water’s edge. To see
the distinction between these two items, toggle the display of the
water’s edge. This can be done by selecting the Water’s Edge
command found under Display Menu. As you can see, the water’s
edge consists of a blue line. This blue line represents the boundary
between wet and dry areas in the model. It can also be thought of a
line of zero water depth. If the Water’s Edge command is toggled
on while the model is running, it is updated to reflect areas of
drying or inundation in the solution. Now toggle the display so that
the water’s edge is not visible, so that the River2D window appears
as follows.

River2D Tutorial – The Basic – September 30, 2002 5


Outflow Boundary

No flow
Boundaries

Inflow Boundary

The item left in the window is the computational boundary. As you


can see, this boundary consists of red, blue and green lines. The
colours represent different types of boundaries. The red line
represents a “no cross-flow” or “vertical wall” condition while the
green and blue lines indicate inflow and outflow boundaries
respectively. Unlike the water’s edge, there is no command to
toggle the display of the computational boundary and therefore it is
always visible.

River2D Tutorial – The Basic – September 30, 2002 6


3.0 The .cdg file

The .cdg file used in this tutorial, fort.cdg was developed using a
bed topography file, fort.bed, and a mesh file, fort.msh. These files
can also be found in R2D_theBasics folder, as you may wish to go
through the process of creating fort.cdg yourself. In this tutorial,
we will go through the process of creating a .cdg file when we
learn how to update the computational mesh using R2D_Mesh.

The .cdg file contains all of the information necessary to obtain a


flow solution in River2D. This includes the computational mesh,
which is defined in terms of computational nodes and their
connectivity in the Triangulated Irregular Network (TIN). Each
computational node is represented by a line in the .cdg file and
consists of a node number (integer), x-coordinate (floating point
number), y-coordinate (floating point number), bed elevation
(floating point number), and bed roughness height (floating point
number). In addition, every node line contains information
regarding the initial conditions that are required as the initial guess
in the iterative solution procedure in River2D. This information
consists of x discharge intensity (floating point number), y
discharge intensity (floating point number), and water depth
(floating point number). The .cdg file also contains boundary
condition information and default values for all of the run
parameters required for River2D. (These can be changed by
manually editing the .cdg file or in the River2D environment as
will be demonstrated later). The .cdg file does not contain any
habitat or ice cover information.

If you open fort.cdg in a text editor, you will notice that the initial
x and y discharge intensities are 0 at every node (They are the last
two entries on every node line). This is because fort.cdg was
created using R2D_Mesh. When a .cdg file is created with
R2D_Mesh, the initial discharge intensities (or velocity
components) are assumed to be zero. R2D_Mesh provides initial
water depths at every node based on the water surface elevation at
the outflow boundary and a user supplied estimate of the water
surface elevation at the inflow boundary. If the loaded .cdg file is

River2D Tutorial – The Basic – September 30, 2002 7


resaved after running the model, these initial conditions will be
replaced by the newly solved depths and discharge intensities.

4.0 Using River2D’s hydrodynamic model operations

In hydrodynamic modeling, the normal sequence is to calibrate the


model using measured water level data at a known discharge and
then use the calibrated model to simulate the flow for a range of
discharges. In this tutorial, we will assume that the bed roughness
values in fort.cdg have already been calibrated and that we are now
ready to simulate the flow, for a given discharge, using our
calibrated model.

4.1 Setting Boundary Conditions

Before we can run the model, we must set the boundary conditions
for the flow situation we want to simulate. For steady simulations,
boundary conditions typically take the form of constant total
discharge at inflow sections and fixed water surface elevations at
outflow sections. In River2D, inflow and outflow boundary
sections have the generic name of ‘flow boundary’. They are called
flow boundaries to distinguish them from no flow boundaries. The
inflow and outflow boundaries (and their boundary conditions) for
this problem were defined in R2D_Mesh prior to creating fort.cdg.
So we use this opportunity to learn how to edit flow boundaries.

1 Choose Flow > Edit Flow Boundary


2 Using the mouse, click on the inflow boundary (green line).
This will open the Edit Flow Boundary dialog, as shown below.

River2D Tutorial – The Basic – September 30, 2002 8


The information used to define a flow boundary includes: a starting
node (along the boundary), an ending node (also along the
boundary), the type of flow boundary (inflow or outflow), and
information relevant to type of boundary (e.g. total discharge for
an inflow boundary). Flow boundaries are always defined walking

River2D Tutorial – The Basic – September 30, 2002 9


around the boundary with the computational mesh to the left.
Therefore flow boundaries on the external boundary are defined in
the counter clockwise direction while flow boundaries on an
internal boundary are defined in the clockwise direction.

The first portion of this dialog is used for modifying the extent
and/or location of the flow boundary. If we wanted to move or
resize this flow boundary, we would need to change the starting
and/or ending nodes. The easiest way to determine the nodes
numbers for new end points is to display the nodes numbers. This
is accomplished by selecting Display > Node Numbers.

The rest of the dialog is used for specifying the type of boundary
condition for this flow boundary: inflow, outflow, or noflow.
However, as the dialog suggests, selecting a noflow condition will
cause the flow boundary to be removed. River2D only stores
boundary conditions associated with flow boundaries. Any
boundary elements not associated with a flow boundary are by
default no flow boundaries. As you can see, this flow boundary has
a constant inflow discharge of 2 cms. An inflow boundary
condition can also be specified using a discharge hydrograph
(discharge versus time in table form). The hydrograph option is
typically used in transient simulations. At this point,

3 Confirm that, in your version, this flow boundary is indeed a


fixed discharge inflow boundary.
4 Also, verify that the value for the fixed discharge is 2 cms.
5 Press the OK button to close this dialog box.
We will now have a look at the downstream boundary conditions.
6 Choose Flow > Edit Flow Boundary
7 Click on the outflow boundary (blue line)
The Edit Flow Boundary dialog should appear as follows.

River2D Tutorial – The Basic – September 30, 2002 10


The state of the dialog box indicates that this outflow boundary has
a fixed water surface elevation of 199.2 m. There are three other
possible options for setting downstream boundary conditions: an
outflow hydrograph (elevation versus in table form), a rating curve
(discharge versus elevation, also in table form), and a depth-unit

River2D Tutorial – The Basic – September 30, 2002 11


discharge relationship (in the form of an equation). Of the four
options, the first three will apply the same water level across the
width of an outflow boundary. In some cases, the model will have
difficulties converging when the same elevation is forced across an
outflow boundary. When this occurs, the forth and last option, a
depth-unit discharge relationship, may help the model with
convergence. This option forces a weir type flow through each
boundary element in the outflow boundary. This allows the
elements within the flow boundary to respond individually to the
flow in the domain, which typically results in a water surface
elevation that varies across the outflow section. Outflow
boundaries are displayed using a blue line except those specified
using depth-unit discharge relationship, which are displayed using
a yellow (gold) line. In a steady simulation, a constant water
surface elevation is usually used. The outflow hydrograph and
rating curve options are typically used in transient simulations.
And as explained above, the depth unit-discharge relationship is a
trouble shooting option which can be used in either steady or
transient analyses.

Since we are going to use River2D to obtain a steady state


solution, the fixed water surface elevation at the downstream end is
appropriate. At this time,

8 Confirm that this outflow boundary is specified as a constant


water surface elevation of 199.2m.
9 Press the OK button to close this dialog box.
4.2 Running the Hydrodynamic Model

Now we will learn how to run the 2D hydrodynamic model in


River2D to obtain a steady state solution. To start, we shall open
the Run Steady dialog box.

1 Choose Flow > Run Steady


The Run Steady dialog box should appear as follows.

River2D Tutorial – The Basic – September 30, 2002 12


This dialog contains a list a values. Some of these values are user
input run parameters (all of the white edit boxes) while the others
report values associated with model performance and model
convergence. The specific uses of all the values in this dialog are
detailed below.

The "present time" value is the point in pseudo time at which the
solution is currently running or has stopped at. This value can be
reset before the start of a subsequent run.

"Final time" is the time at which execution of the hydrodynamic


model will be stopped. Actually, execution is halted when the
present time is greater than the final time.

"Time increment" is the size of the current time step. It may be set
at the start of a run. If it is too long, the program will automatically
adjust it downward. Over the course of the iterations this value
normally increases steadily. Occasionally, it will decrease
dramatically and then gradually grow again. If this happens

River2D Tutorial – The Basic – September 30, 2002 13


frequently, there may be a problem with the boundary conditions
and/or the mesh.

"Max time increment" is a user specified setting for the largest


time step allowed. This provides an extra measure of control on the
convergence process.

"Solution change" is the relative overall change in the solution


variables over the latest iteration. The size of this value relative to
the goal solution change will govern how quickly the time
increment increases. Once the maximum time increment is
reached, the solution change should decrease with each iteration.
When this becomes sufficiently small (approx 0.00001), the
solution can be considered converged.

"Goal solution change" is the user specified target relative overall


solution change. The bigger this value, the bigger the time
increments that will be used and hopefully the fewer the number of
iterations required to reach steady state. However, nonlinear
instabilities are more likely to arise, leading to more frequent
episodes of time step reduction followed by gradual increase
phenomenon.

"Log file name" is the name of the text file to which a record of the
program execution is written. This record includes the time, time
increment, solution change for each iteration. If an iteration is
rejected, further information which may help localize the problem
is also written. The log file is always appended to and never
overwritten. It resides in the same directory as the current .cdg file.

"Total Inflow" and “Total Outflow” represent the total discharge


flowing into and out of the model, respectively. One characteristic
of a steady state flow condition is that these two values should be
equal. In practice, due to approximation errors, they will not be
precisely equal. Instead, there will be a slight difference (relative
to the total discharge) between the two values. The progress of the
solution toward steady state can be observed by tracking these
numbers. Note that in some cases the total discharge moving
through the model may not be equal to the discharge specified at
the inflow boundary. When this occurs, it is generally due to the

River2D Tutorial – The Basic – September 30, 2002 14


location of the downstream boundary; turbulent eddies may cause
additional inflow.

"Update display every ____ time steps" is used to set how often the
display updates. As drawing the display takes some processor time
away from the computations, it may be advisable to limit the
number of times that the screen is redrawn.

"Current step #" keeps track of the number of time step iterations
since the start of the latest run.

Before pressing the “Run” button, we will set up the display so that
the velocity magnitude in the model is displayed in the viewing
window as a colour fill map. In a colour fill map, the colour
spectrum (in this case, red is highest and blue is lowest) is scaled to
a specified parameter.

1 Choose Display > Contour/colour


The Colour/Contour dialog box will appear as follows.

River2D Tutorial – The Basic – September 30, 2002 15


2 In the Contour/Shade drop down list box select “Velocity
Magnitude”.
3 Select the “Display Colour Shading” and the “Clip Colour
Shading to Water’s Edge” options.
4 The colour spectrum in a colour fill map can be scaled either
automatically or manually. If the colour spectrum is scaled
automatically, then the maximum and minimum limits are set
using the maximum and minimum values in the model (for the
specified parameter). On the other hand, the limits are set
manually, then the values above and below the set limits are
assigned no colour (white). Here, we will use automatic
scaling. Therefore, in the Colour Range group box select the
“Automatic” radio option.
5 Click the “OK” button to close the dialog box.
For starters, we will leave all of the parameters set to their default
values. Once calculations have begun, you will notice the
following changes in the Run Steady dialog box.

• The “Run” button caption will change to “Stop.”


• When the value in the “Current iteration #” box increases to 1,
the “Present Time” box will still read 0. For this first iteration,
the actual solution change (value in the “Solution change” box)
is 3.6 times greater than the goal solution change (value in the
“Goal solution change” box). When the actual change is
greater than 1.25 times the goal change, the current iteration is
rejected and a new time step increment is calculated (based on
the unsuccessful time step increment and the ratio of the goal
to actual change) and a new iteration is attempted. In this case,
only one failed attempt occurs before the solution starts to
progress and the “Present Time” box starts to increase. In
some problems, you may find that a number of iterations may
be rejected before a small enough time step is found that will
allow the solution to progress.
• With every iteration after the first, the time step increment will
increase after each iteration until the maximum time step
increment of 100 is reached.

River2D Tutorial – The Basic – September 30, 2002 16


As the solution progresses, you should notice the following
changes in the River2D viewing window.

• After every iteration, the water’s edge will update in the


viewing window to reflect the changes in the solution. At first,
these updates will appear negligible; however, as the time step
increment increases, the updates will be more dramatic.
• The velocity magnitude colour fill map will go from being one
colour to many colours once the water in the model starts to
move.

At this time, press the “Run” button and look for the changes
described above. Let the solution proceed to the final time of 1000
at which time the Run Steady box should appear as follows.

At this point, you should notice that the solution has not yet
converged. Two items in the Run Steady box indicate lack of
convergence. The first indicator is the value in the “Solution

River2D Tutorial – The Basic – September 30, 2002 17


change” box. Only when this value becomes sufficiently small,
approximately 0.00001 or less, can the solution be considered as
converged. The second indicator is the total discharge moving
through the system. Theoretically, the total inflow and total
outflow should be equal for a steady state flow condition. In
practice, due to approximation errors, these values will never be
exactly equal but will rather have a small difference (relative to the
inflow boundary condition discharge) when convergence is
achieved. At the present time, the total outflow is close to twice the
total inflow.

We will now set the parameters in the run box so that the solution
converges. Set the value in the “Final time” box to 25000 and
increase the value in the “Max time increment” box to 500.
Redrawing the display take some processor time away from the
model computations. Therefore, for the rest of the computations
we will limit the number of times the screen is updated to once
every 10 time steps iterations. To accomplish this set the value in
the “Update display every ____ time steps” to 10. When these
three parameters are set, press the “Run” button. Once the model
approaches the final time of 25000, start to watch the values in the
“Total Inflow” and “Total Outflow” boxes.

When the model halts, the Run Steady box should appear as
follows.

River2D Tutorial – The Basic – September 30, 2002 18


At this point, the solution has effectively converged. The value in
the “Solution change” box is now very small, less than 0.00001,
and the “Total Inflow” is approximately equal to the “Total
Outflow” with less than a 0.2% difference. Another indicator that
the solution has converged is that, the “Total Inflow” and “Total
Outflow” have remained relatively constant for at least the last 10
iterations. Now that we have obtained solution convergence, press
the to close the Run Steady box.

Note: The size of the difference between total inflow and total
outflow is a function of the mesh discretization. In cases
where you are not happy with this error, you will need a
computational mesh with a finer discretization.

5.0 Extracting cross section data from the 2D domain

In River2D, the user has the option to extract data in various forms
from the model to an output file. These forms include extracting

River2D Tutorial – The Basic – September 30, 2002 19


information from all of the nodes, from points within a user
defined grid, or from points along a user defined section (line). All
three of these formats are useful when comparing model results to
field measurements. In this part of the tutorial, we are going to
learn how to extract model data along a cross section in the model.
To learn about the other methods for extracting data, refer to the
River2D user’s manual.

With the converged solution in your River2D window (or


fortfinal.cdg if you are just joining in now), use the “Scale to Fit”
command under the Display menu. We are going to extract cross
section information from the model from the channel to the left of
the island, which we will call Section 1. To extract cross section
data in River2D, we use the “Extract section to csv file” command
found under the Display menu. This command allows the user to
define a cross section by two endpoints with specified point
spacing and output the section information to a csv (comma
separated values) file. In the csv file, there is one line for every
point along the section. Each line contains the point number
(integer), the x coordinate (floating point number), the y coordinate
(floating point number) and one parameter for that particular point
(floating point number). The parameter in the file is the one that is
selected in the “Contour/colour” dialog box. At Section 1, we are
going to extract first the bed elevation and then the velocity
magnitude.

River2D Tutorial – The Basic – September 30, 2002 20


1 Choose Display > Contour/colour.
2 In the Contour/colour dialog box change the Colour/Contour
variable to Bed Elevation and then press the “OK” button.
3 Choose Display > Extract section to csv file. This opens the
Extent and Spacing dialog box. Fill in the fields so that the box
appears as shown below.

By filling the dialog this way, we are saying “Extract information


along a line starting at point 1 (x1 = 4960, y1 = 4980) and ending
at point 2 (x2 = 4985, y2 = 4980) with a point spacing of 0.5”.

4 Click the “OK” button.


5 At this point, a Save As dialog opens. Since the bed elevation
is the parameter selected in the Contour/colour dialog box, it
will be the parameter in the csv file. Therefore, navigate to the
R2D_theBasics folder and save the file as
my_bed_elevation.csv.
Now that we have defined the points (x,y) in the section, we can
output the velocity magnitude to another csv file using the “Extract
points to csv file” command. This command allows the user to
create a new csv file based on the points in another csv file.
Therefore, we can create a new csv file containing the velocity
magnitude at the x and y coordinates in my_bed_elevation.csv.

River2D Tutorial – The Basic – September 30, 2002 21


6 Open the Colour/Contour dialog box and change the
Colour/Contour variable to Velocity Magnitude.
7 Choose Display > Extract points to csv file.
8 In the file browsing dialog box, navigate to the R2D_theBasics
folder. Select my_bed_elevation.csv and then click the “Open”
button.
9 At this point, a Save As dialog opens. As this csv file will
contain the velocity magnitude at each point in the section, we
will save it as my_velocity_magnitude.csv.
10 Launch a spreadsheet program and open
my_bed_elevation.csv. The first several lines of the file should
look similar to those below.

Notice that some of the numbers in the first column are negative.
This because any point in the section which is not “inside” the
computational mesh will have a negative point number. As you can
see, points outside the mesh are assigned a bed elevation of 100.

River2D Tutorial – The Basic – September 30, 2002 22


11 Open my_velocity_magnitude.csv. It should look very similar
to my_bed_elevation.csv except that the last column contains
the velocity magnitude rather than the bed elevation.
If you were to plot station (x coordinate) versus parameter, for both
parameters (not including the points outside the mesh), on to a
single plot, your plot should look similar to the one below.

Notice that the bed and velocity data are very jagged. This is
because the mesh is quite coarse in this region. In the next section,
we will learn how to refine the mesh and improve the
computational solution.

6.0 Changing mesh density to improve the solution

In this part of the tutorial, you will learn how to increase the mesh
density to improve the flow solution in River2D. This will involve
use of Mesh Edit menu in River2D. The Mesh Edit menu contains
some basic mesh editing commands which have been implemented
primarily for mesh refinement. R2D_Mesh, the mesh editing
component of the River2D package, allows the user to perform
more complex mesh edits. If you wish to learn more about
R2D_Mesh and mesh editing, you are referred to the R2D_Mesh
user’s manual, which can be obtained from the River2D website.

River2D Tutorial – The Basic – September 30, 2002 23


If you still have the River2D window set to display the velocity
magnitude using a colour fill, the converged solution for fort.cdg
should appear as follows. (Note: Clip to Water’s Edge has been
selected.)

(If you wish to follow along from this point, but you have not gone
through the process of running the model in section 4.0, you can
still do so. Open fortfinal.cdg, which is found in the
R2D_theBasics folder. Return to section 4.2 and follow the steps to
set the display as it appears above.)

River2D Tutorial – The Basic – September 30, 2002 24


Use one of the map scale tools to zoom in on the area to the left of
the large island, so that you can see the detail of the velocity
magnitude colour map as shown below.

Move the mouse around on the colour map and monitor the
velocity magnitudes on the Status Bar. Notice that the velocity is
quite high where the map is shaded red. Although regions of high
velocity can occur; however, the diamond shape pattern in the
shading may be indicative of a region where the mesh density is to
low. To see if this is a possibility, we will have a look at the

River2D Tutorial – The Basic – September 30, 2002 25


computational mesh in this area. Choose Display > Mesh so that
the River2D window appears as follows.

Notice that the mesh density drops off in the region where the
velocity magnitudes are very high. To try to improve the solution
in this region, we will first refine the mesh and then rerun the
model to obtain a new solution. This will be accomplished using
the River2D commands found under the Mesh Edit menu. To make
any changes to the mesh, we must first load the original bed
topography that was used to create the mesh into the River2D
environment. This is because each new node inserted into the mesh

River2D Tutorial – The Basic – September 30, 2002 26


must obtain its bed elevation and roughness values by linear
interpolating from the bed topography. The bed topography is
loaded using the “Load Bed File” command found under the Mesh
Edit menu.

1 Choose Mesh Edit> Load Bed File. In the file browsing dialog
box, navigate to the R2D_theBasics folder.
2 Select fort.bed.
At this point the River2D viewing window should appear as
follows.

River2D Tutorial – The Basic – September 30, 2002 27


Notice the thin grey lines that have appeared in the viewing
window. These are contour lines of the bed topography. The
presence of the bed contours is an indication that the bed
topography has loaded correctly. The contour interval for the bed
topography map can be set in the Mesh Edit Options dialog, which
is accessed through the Options menu. Now that we know that the
bed topography has loaded correctly, choose Display>Bed
Contours to toggle off the display of the bed topography contour
map.

There are a number of ways to add nodes to the domain to increase


the density of the mesh. Here we will accomplish this using the
“Add Floating Node” command.

1 Choose Mesh Edit> Add Floating Node. At this point, the


cursor should change to a cross hair to indicate the change to
the “Add Floating Node” mode.
2 Using your mouse, select points on the mesh where the mesh
density needs improving in a manner similar to what is shown
below.

River2D Tutorial – The Basic – September 30, 2002 28


3 Once you have finished adding nodes, choose Mesh Edit>
Triangulate to incorporate the new nodes into the mesh.
4 Repeat steps 2 and 3 if you want to add more nodes.
5 Choose Mesh Edit > Smooth. Repeat until the number of nodes
is no longer changing (around 10 times).
6 To check the number of nodes, Choose Mesh Edit>Mesh
Information. This brings up the information box show below.
In addition to the number of nodes and number of elements in
the mesh, this information box also contains another value.
This value is called the Mesh Quality Index (QI) and it

River2D Tutorial – The Basic – September 30, 2002 29


provides the user with a measure of the quality of the triangles
in the mesh. The triangle quality is calculated as the ratio of
triangle area to the circumcircle area (the circle which passes
through the three points defining the triangle. The value
reported in the Mesh Information box is, in fact, the minimum
triangle quality of all of the triangles in the mesh.

7 Once the number of nodes is no longer changing, the mesh in


the problem region should appear similar to what is shown
below.

River2D Tutorial – The Basic – September 30, 2002 30


8 At this point, save the refined mesh under a new name. Choose
File>Save As and navigate to the R2D_theBasics folder and
type my_fort.cdg in file name field.
9 Click the “Save” button.
We now have a newly created .cdg file called my_fort.cdg which
incorporates the changes in the mesh.

At this point, we will run my_fort.cdg to obtain a new flow


solution. (If you wish to follow from this point but have not
created my_fort.cdg, you can do so by using fortnew.cdg instead.)

River2D Tutorial – The Basic – September 30, 2002 31


10 With my_fort.cdg loaded into the River2D environment, open
the Run Steady dialog box.
11 Set the present time to 0, set the final time to 5000 and set the
max time increment to 100.
12 Press the “Run” button.
Once the model stops, you should find that the solution has
converged. At this point, we can re-examine the solution in the
area where the density of the mesh was increased. Zoom in on the
problem area. The colour map of the velocity magnitude should
appear similar to the one shown below.

River2D Tutorial – The Basic – September 30, 2002 32


As you can see, the velocity is still higher in the area where the
mesh density has been increased. However, it is now possible to
have more confidence in the solution in this region.

We can also observe the improvement to the solution by


comparing pre and post refinement cross section data. To
accomplish this, follow the steps outlined in Section 5 and save the
bed elevation and velocity magnitude cross sections to
bed_elevation_new.csv and velocity_magnitude_new.csv. The
plot for the new cross section data should appear similar to the one
below. Notice that the velocity distribution is much smoother than
it was previously. Also, the maximum velocity in the channel is
not quite as high as it was prior to refinement.

There are probably other areas in the Fortress site where the
solution would benefit from increasing the mesh density; however,
for the purpose of this tutorial, we will accept the current solution.
Increasing the mesh density has the effect of slowing the
computation time for each time step. Therefore, in the mesh design
process, there comes a point where benefits of increasing a mesh’s
density become too costly in terms of computational effort.

Choose File > Save as and save the converged solution under the
file name my_fortfinal.cdg.

River2D Tutorial – The Basic – September 30, 2002 33


7.0 Presenting your results

As shown throughout this tutorial, the colour fill map is an


effective visualization tool. In River2D, there are two additional
display features that may also be helpful for visualizing the model.
These are the contour map and the vector plot.

In River2D, the user can display a vector plot of velocity or


discharge intensity using the “Vector” command. To display a
contour map, the user must access the “Contour/colour” command.
As a result, the user can create a contour map of any of the
parameter in the Contour/colour Dialog. As examples, we will
display the bed elevation contour map of the Fortress site bed
topography and a vector plot of the velocity results.

1 With my_fortfinal.cdg (or fortnewfinal.cdg if you are just


joining in) loaded in River2D, set the display so that only the
computational boundary is visible and open the Contour/colour
dialog.
2 In the Colour/Contour Variable drop down list box select “Bed
Elevation”.
3 Select the “Display Contour Lines” option.
4 Once you choose to display contour lines, you must choose a
contour interval value. For the Fortress site, the bed elevation
ranges from about 198 m to about 200m. Therefore, a contour
interval of 0.25 m is probably reasonable. In the “Contour
Interval” box enter the value 0.25.
5 Click the “OK” button.
If you zoom in on the region around the large island, you should
see the following.

River2D Tutorial – The Basic – September 30, 2002 34


As you can see, contour values are not shown on the map.
However, they may be found by pointing the cursor at any line and
reading the parameter value from the Status Bar.

The vector display is independent from the other display options


and may overlay a contour or colour fill display. The combination
of depth shown using a colour spectrum map and velocity shown
as vectors is a particularly effective way to visualize the overall
flow field. Therefore, we will create a velocity vector plot in
combination with a colour fill map of the water depth.

River2D Tutorial – The Basic – September 30, 2002 35


1 Using what you have learnt thus far, change the display so that
only a colour fill map of the water depth is visible.
2 Choose Display > Vector. This opens the Vector Plot dialog
box as shown below.

3 In the Plot group box, choose the “Velocity” radio button.


4 Notice the “Vector Location” group box on the right. This
allows the user to indicate where the vectors are to be plotted.
The “At Nodes” option is most useful for evaluating the
solution quality. The “On Grid” option usually gives a better
picture of the flow field. For this example, choose the “On
Grid” radio button.
5 The “Scale” option determines the length of the vectors. Set
this value to 7. This means that a velocity of 1 m/s will be
drawn as a vector of length 7m on the map.

River2D Tutorial – The Basic – September 30, 2002 36


6 The “Grid Spacing” option sets distance on the map between
grid points. Set this value to 3.
7 The last option in the dialog is “Minimum Depth”. This option
sets the minimum water depth that must be present for a vector
to be drawn. Set this value to 0.05.
8 Press the “OK” button to accept the chosen options and close
the dialog box.
If you zoom in on the area just below the large island, your
River2D display should appear similar to that below. Notice how
the vector plot illustrates the flow separation around the
island.

This type of combination plot is also an effective way to present


your results to others. In River2D, there are a number of features
that allow you to annotate your plots for presentation. These
features can be accessed using the “Annotation” command. As an

River2D Tutorial – The Basic – September 30, 2002 37


example, we will get the above combination plot ready for
presentation.

1 Choose Display > Annotation. This opens the Annotation


dialog box as show below.

2 For this example we will use all of the annotation options.


Therefore, place a check mark beside every option.
The “Axes” option adds a bounding box around what is
currently in the viewing window and displays the coordinates
of the box.

The “Colour Legend” option shows the mapping of the colour


spectrum to the parameter values and gives the name of the
parameter being displayed by a colour fill.

The “Distance Scale” option displays a scale bar in the viewing


window. The field beside this option is for setting the reference
distance of the scale bar. Leave this value at 10.

The “Vector Scale” option displays a reference vector in the


viewing window. The field beside this option is for setting the
scale of the reference vector. Leave this value at 1.

River2D Tutorial – The Basic – September 30, 2002 38


The “Title” option places a title across the top of the bounding
box. Give our plot an appropriate title in the field beside this
option.

The “Inflow Discharge” and “Outflow Discharge” options


display the current total inflow and total outflow for the model.
These are displayed at the top right corner of the display.

The “Time” option places the current model time (in seconds)
in the space below the colour legend.

3 Press the “OK” button to accept the changes and close the
dialog box. If you still have the display zoomed in on the
region below the island, your River2D window should look
similar to the following.

River2D Tutorial – The Basic – September 30, 2002 39


Once your plot is presentation ready, you can use the “Print”
command to print a copy of your plot. The Print command is set up
to send whatever is displayed in the River2D viewing window to
the selected printer (which includes all of the annotations).
Because the shape and/or orientation of the paper may be different
from the screen, the printed output may appear smaller of may
include area not visible on the screen. Some trial and error (using
the Print Preview command and making adjustments to the
window size and shape) may be necessary to obtain the desired
results on paper.

You can also save your plot to an Enhanced Windows Metafile


(EMF). This is accomplished using the “Save As EMF” command
found under the file menu. An EMF is a vector based file format
which is excellent for presentation purposes. Currently, the EMF’s
generated by this command can be imported into any Microsoft
Office application that accepts image files.

8.0 Concluding Remarks

At this point we conclude “theBasics” tutorial. This tutorial was


designed to give an overview of the functionality of River2D. For
more information on any of the topics covered in this tutorial,
please refer to the River2D user’s manual. Check out the other
tutorials in this series for topics not covered in this tutorial. Again,
if you have any comments or questions regarding this tutorial,
please contact the authors.

River2D Tutorial – The Basic – September 30, 2002 40

You might also like