Skip to content

Creating your first river flow application with OilFlow2D

This section provides a step-by-step guide to help you get started with a OilFlow2D project using the QGIS interface. The example illustrates the model application to simulate flow in a river with a single inflow upstream and a single outflow downstream. It includes instructions to enter the terrain elevation data, create the mesh, prepare the layers with the input information, and run OilFlow2D.

Starting a new project

The files required to follow this tutorial can be extracted from the 'ExampleProjects' zip file under the 'Hoh_QGIS_Metric_Units' folder. This zip file is downloaded separately from your installation materials.

Files with data required for the example.

The first step is to start the QGIS software clicking the QGIS desktop icon . If this icon is not available, you can run the 'qgis-bin.exe' executable on the QGIS 'bin' subdirectory. After loading, you will see a window similar to the one shown below:

QGIS interface indicating window areas.

For pre-v10 or standalone OilFlow2D installations, if you don't see the toolbar with the model icons as shown, activate the standalone plugin using the Manage and Install Plugins... command under the Plugins menu.

Plugins window showing standalone OilFlow2D activated (pre-v10/standalone).

For version 10 and later, use the unified Hydronia2DMS plugin. In Manage and Install Plugins..., search the Installed list for Hydronia2DMS, confirm it is enabled, and verify that the OilFlow2D-flavored toolbar is visible before continuing. Hydronia2DMS exposes the OilFlow2D-flavored toolbar.

QGIS Plugins window showing Hydronia2DMS installed for version 10 and later.

Start a new project

  1. To create a new OilFlow2D project, click on the New OilFlow2D Project button in the toolbar. A dialog window appears where you select the optional component layers, the Coordinate Reference System (CRS), and the project directory.

  2. Select None in the Layers drop down menu.

  3. Select the Projection button. In the Filter textbox, type 2855 and select the Coordinate Reference System as shown:

    Coordinate Reference System Selector dialog window.

  4. Click OK.

  5. After confirming the CRS selection, the Projection button displays EPSG:2855, corresponding to the NAD83(HARN)/Washington North Coordinate Reference System (CRS):

    Create New OilFlow2D Project configured for Hoh_QGIS_Metric_Units.

  6. Keep Name initial scenario set to base. Click the button and choose the Hoh_QGIS_Metric_Units folder for the Project Directory. This is the folder where the model will write all results and output files.

  7. After clicking OK, the layer templates are created, and displayed on the Layers Panel

    The model will use the unit system as that defined in the projection you selected. If the projection has coordinates in feet, units will be set to English. If the projection coordinates are in meters, units will be set to Metric/SI.

    Layers created for the project.

  8. On the QGIS Project menu, click Save, to save the project in the same directory that you previously selected in the Create New Project dialog above.

Load elevation data

In this tutorial we will use a raster file that contains the terrain and river bed bottom elevation data in ASCII grid format.

  1. To load an ASCII grid file, click the Add Raster Layer button .

  2. In the dialog search for the tutorial folder and select the 'hohdem2.tif' file as shown:

    Dialog to create a layer from a raster file.

  3. While on the dialog, click Add and click Close.

  4. Use the Zoom to Layer button to center the image.

    Once the process is completed, the raster will be displayed on the screen, by default it is rendered in gray gradient as shown.

    Digital elevation model in raster format.

    Right-clicking on the label of the new raster layer and selecting Properties allows you to change the rendering style for a more informative palette such as Hillshade for instance.

    Window to change the raster layer render style.

    And now the raster layer is displayed with the new palette selected:

    Digital elevation model with Hillshade render.

  5. You should move the raster layer dragging it to the end of the list of layers to avoid that it would hide or interfere visually with the other layers.

Create the limits of the modeling area

We define the limits of the modeling area drawing a polygon on the Domain Outline layer. To create it do as follows:

  1. Click the Domain Outline layer to activate it and then click Toggle Editing (pencil) in the toolbar

  2. This activates the rest of the editing buttons. Now click the Add Feature tool which is the bean-looking polygon .

    Proceed to delineate the outline of the polygon by clicking the vertices with the left mouse button.

    Make sure that the polygon is contained within the limits of the raster layer since the program will not extrapolate elevations to areas that are outside of the available data on the raster layer.

  3. To finalize and close the polygon, right-click on the map view area. A dialog window to input the cell size attribute of the newly created polygon will appear. The CellSize value for the reference size of the mesh cell is indicated. Enter a value of 20 m.

    CellSize defined for the Domain Outline layer.

    If you want to make any correction in the outline of the created polygon, use the Node Tool .

  4. Save the polygon by clicking the Save button .

  5. and click on Toggle Editing button to deactivate the layer Edit mode

    The Domain Outline is now complete.

Domain Outline layer.

Generating the triangular-cell mesh

Now that the Domain Outline layer has been created, proceed to create the mesh by clicking on the Generate Trimesh button

The following figure shows the generated mesh. You will also see in the Layers panel the new layer: Trimesh

Resulting mesh.

You can see the mesh generation statistics, and other messages produced by the mesh generation program while creating the mesh in the Log messages panel. This window is accessed from the View menu, then by clicking Panels.

Message panel of the registry with GMSH messages.

Setting up the boundary conditions

Inflow boundary conditions:

  1. Select the BoundaryConditions layer in the Layers panel.

  2. Click the Toggle Editing button to add the polygons that will indicate the open boundary segments where inflow and outflow conditions are imposed. Draw a polygon at the upper end of the mesh as indicated in the figure:

    Polygon that covers the nodes defining the Inflow boundary condition segment.

  3. To finish the polygon, right-click on desired location. A window to enter the attributes of the newly created polygon is displayed.

  4. In the Boundary Cond. ID enter the desired name or leave the default.

  5. From Type of Open Boundary list, select 2. Discharge vs. Time

  6. Click Import BC File button, and search for the 'QIN.DAT' hydrograph file as shown below:

    Inflow boundary condition parameters.

    Hydrograph loaded from the ‘QIN.DAT‘ file.

  7. Click OK to close the dialog and then click Save .

Outflow boundary conditions:

  1. Draw the polygon defining the outflow boundary condition at the downstream end of the channel as shown.

    Polygon that defines the outflow boundary condition segment.

  2. Right click to close the polygon. A dialog window will appear to enter the parameters. Select the condition type Uniform flow conditions and enter the channel slope. Slope is entered in So as shown:

    Parameters for the uniform flow outflow open boundary condition.

  3. Save the changes made to the layer by clicking the Save button .

  4. Deactivate editing mode by clicking on the Toggle Editing button .

    The figure below shows how the BoundaryConditions layer should look:

    Polygons that define the inflow and outflow boundary conditions.

Assigning Manning's n

To assign Manning's n values, we enter polygons with given n's. There can be as many polygons as those required to reproduce the spatial variability of this parameter. In this example, a single polygon will be drawn for the entire area.

  1. Select the Manning N layer and click the Toggle Editing button

  2. Draw a polygon that covers the entire domain. The polygon may extend beyond the mesh area as shown:

    Capa Manning N.

  3. Close the polygon by right-clicking on the end vertex and enter a Manning's n equal to 0.035:

    Diálogo para ingresar ManningN.

  4. Click Save , and then click the Toggle Editing button to deactivate editing mode.

Save the QGIS project using the Save command in the Project menu. Name the project file 'Hoh.qgs'.

Exporting the files

Once the layers with the input data to the model have been created, we need to export data files required to run OilFlow2D.

  1. Activate the DEM layer.

  2. Open Plugins > OilFlow2D MS > Export OilFlow2D and click the exact visible action Export Hydrodinamic OilFlow2D.

  3. In the Export Files to OilFlow2D dialog, keep Scenario Name set to base and choose DEM in the DEM (Single Raster) field.

    The Scenario Name is also used for the exported filenames; do not change those filenames manually.

  4. Click OK. A message at the top of the Map area shows the progress of the export process.

    After export completes, version 10 and later users see the Open DIP dialog. QGIS DIP is selected by default; click OK to open it inside QGIS. To use the historical standalone option, expand More options, select Classic DIP, and then click OK. Open DIP dialog showing QGIS DIP selected by default and More options expanded with Classic DIP. Example run name shown.

    With QGIS DIP selected, the current interface is shown below:

    QGIS DIP interface for OilFlow2D.

    QGIS DIP and Classic DIP use the same project settings, but their interfaces look different. Older standalone or non-maintenance versions may open Classic DIP automatically. The project-specific Classic DIP settings and Run steps below are retained.

    Hydronia Data Input Program window.

  5. Click the Run OilFlow2D button to run the model.

  6. A dialog box will ask if you want to save changes. No changes were made, so select [No].

    An image similar to the one shown below should appear:

    Window displayed while the model runs.

Take some time to explore the information included in this window.

This concludes the Creating your first OilFlow2D application tutorial.