Professional Documents
Culture Documents
The Basics PDF
The Basics PDF
by
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:
www.river2d.ca
Along the way, you will also learn how to perform the following:
To get started, we will launch River2D and open the .cdg file for
the Fortress site.
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
No flow
Boundaries
Inflow Boundary
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.
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
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.
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,
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.
"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
"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.
"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.
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
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.
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.
In River2D, the user has the option to extract data in various forms
from the model to an output file. These forms include extracting
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.
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.
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.
(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.)
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
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
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.
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.
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.