Skip to content

Oil spills in Rivers. Part I: Hydrodynamics

This tutorial guides in the application of OilFlow2D to simulate oil spills in rivers. The first part explains how to setup and run the hydrodynamic stage, where the model is used to generate the velocity field in the river. The second part, included in a separate chapter, explains how to enter the spill locations, and other oil data to simulate oil trajectories and fate.

Tutorial data

Before starting the project with QGIS. It is recommended to create a folder that will contain all the necessary data such as the boundary condition files, the elevation data files, either in ASCII or in raster format, etc.

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

The folder contains the files shown:

Files with data required in this tutorial.

Starting QGIS

The first step is to start the QGIS software. After loading the QGIS, you will get a window is similar to the one shown below:

QGIS interface for OilFlow2D indicating window areas. 1: Menu bar, 2: Tool bar, 3: Layer panel, 4: Maps view area, 5: Status bar.

Note the tool bar contains icons that give access to all the OilFlow2D components. Some of the icons have a drop down list that allow getting to more tools.

Start a new OilFlow2D project

  1. In the OilFlow2D toolbar, click on the New OilFlow2D Project button image to start a new OilFlow2D project. A dialog window appears where you select the optional component layers, the Coordinate Reference System (CRS), the initial scenario name, and the project directory.

  2. Select None in the Layers drop down menu.

  3. Select the Projection button. Click on the [EPSG] projection button and select: Coordinate Reference System (CRS) EPSG 3116 corresponding to MAGNA-SIRGAS Colombia Bogota zone - Projected (meters), and click OK.

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

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

    Create New OilFlow2D Project configured for OilSpillsInARiverPart1.

    OilFlow2D 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 or SI.

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

Load elevation data

OilFlow2D uses elevation data in raster format. To load the raster, from the Layer menu, click Add Layer, and then click Add Raster Layer.... You may also click the Add Raster Layer button image.

Click the ... browse button and select Magdalena.tif from \ExampleProjects\OilSpillsInARiverPart1\DATA. Verify that the selected path appears under Raster dataset(s).

Raster data import dialog.

  1. Click Add and wait for the raster to load. Then click Close and click on the Zoom Full button image.

    The raster will be displayed on the screen, by default it is rendered in gray gradient.

  2. Right-click on the label of the created layer and select Properties to change the rendering style for a more informative color palette.

  3. In the Symbology tab, under Render Type, select Singleband pseudocolor. Under the Color Ramp dropdown menu, select Spectral. Then click the [Classify] button to create the classes and then click [OK] to close the Layer Properties window. The layer should look as follows:

    Digital elevation model in raster format created by interpolation.

    It is convenient to move the raster layer to the end of the list of layers, thus it does not interfere with the display of other layers.

Create the limits of the modeling area (Domain Outline)

The limits of the modeling area are defined using 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:

    Menu buttons for digitalization toolbar.

  2. Clicking on the button activates the rest of the editing buttons. Now click the Add Polygon Feature tool which is the bean looking polygon image.

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

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

    Domain Outline layer.

  4. To finalize and close the polygon, right-click anywhere on the screen. A dialog window to input the cell size attribute of the newly created polygon. The value for the reference size of the mesh cell is indicated. Enter a value of 50 m.

    Input of attributes for the Domain Outline layer.

    If you want to make any correction to the polygon, use the Node tool image to move, add or remove nodes as necessary.

  5. Save the polygon by clicking the Save button image.

    and click on Toggle Editing icon image to deactivate the layer edit mode and complete the Domain Outline.

Generating the triangular-cell mesh

Now that the Domain Outline layer has been created, proceed to create the mesh.

To generate the mesh, click on the icon image.

The following figure shows the generated mesh. You will also find the Layers panel one new layers: Trimesh :

Mesh generated.

Setting the boundary conditions

In this tutorial we will define inflow and outflow conditions. To define the inflow boundary condition do as follows:

  1. Enter the INFLOW boundary condition polygon: Click the Toggle Editing button image to add the polygons that are going to indicate the nodes on which the inflow condition is imposed.

  2. Draw a polygon that includes the nodes or vertices at the lower 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 the last vertex. A window to enter the attributes of the newly created polygon is displayed. It is important that the boundary condition polygon would cover completely the outflow segment.

  4. In the window change the Type of Open Boundary to Discharge vs. Time.

    Inflow boundary condition data.

  5. Click the Import BC File button and browse to the tutorial folder and select the 'QIN2.DAT' file, then click OK.

  6. Ckick the BC Data tab. The data should look as follows:

    Inflow hydrograph read from the 'QIN2.DAT' file.

  7. Enter the OUTFLOW boundary condition polygon: Draw a polygon that includes the nodes or vertices at the lower end of the mesh as indicated in the figure:

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

  8. To finish the polygon, right-click on the last vertex. A window to enter the attributes of the newly created polygon is displayed. It is important that the boundary condition polygon would cover completely the outflow segment.

  9. In the window set the boundary condition Type to: Uniform flow condition, then set the So to 0.0025.

    Outflow condition data.

  10. Click [OK] then click the Save button image to save the changes made to the layer:

  11. Deactivate editing mode by clicking on the Toggle Editing icon image.

Assigning Manning's n roughness coefficients

Manning's coefficients are used in OilFlow2D to represent the terrain roughness. To assign Manning's n values, we will enter polygons with particular n's. There can be as many polygons as required to reproduce the spatial variability of this parameter. In this example, a single polygon will be used for the entire area.

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

  2. Draw the polygon around the entire domain taking care that it covers all the cells. You should have an image like the one shown below:

    Editing the Manning N layer.

  3. Close the last vertices on the polygon by right-clicking on the desired position. The following dialog window is presented where you must input the Manning's n value associated to the polygon (0.025):

    Dialog to input Manning N Feature Attributes.

  4. Click the Save icon image and then click the Editing Tool icon image to deactivate editing mode.

Exporting the files to OilFlow2D and running the model

Once the layers with the input information to the model have been created, the next step is to run the tool that exports the data files in the proper format required by OilFlow2D. The process is as follows:

  1. From the QGIS menu bar, select Plugins > OilFlow2D MS > Export OilFlow2D > Export Hydrodinamic OilFlow2D to run the export plugin:

    Plugins menu path to Export Hydrodinamic OilFlow2D.

  2. In the Export Files to OilFlow2D dialog, make sure the option for DEM (Single Raster) has Magdalena selected. Click [OK].

    Window dialog of the Export to OilFlow2D tool with the example data.

    While exporting the data, you will be able to see the task progress at the top of the message bar. 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 Control Data panel for Oil Spills in a River Part I.

    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.

    Enter the parameters as shown:

    The following Classic DIP configuration is retained as a legacy values reference:

    Legacy Classic DIP configuration window.

  3. Then click the Run OilFlow2D button to run the model. When asked to save your changes, click [Yes]. Overwrite the 'base.dat' file, and click [OK].

    An image similar to the one shown below should appear:

    Window appearing when the model is running.

  4. When you have finalized reviewing the information included in this window, you may click [Close].

    The following post processing window will appear indicating the final post-processed task performed by the OilFlow2D model. The window will close automatically.

    Final post-processes.

Creating a velocity field map

Once OilFlow2D has finished running, you may want to create maps using the model results. OilFlow2D QGIS plugin offers several tools to create maps and animations. In this section we will show how to create depth maps.

  1. Click the OilFlow2D Maps image button dropdown menu and select Results vs Time Maps.

    image

  2. In the Results vs Time Maps dialog, click the Browse [...] button to open the 'base.OUTFILES' file.

  3. Under Maps select Velocity Field, under Output Times select 12 hours (0000:12:00:00). Click the arrow right button image to add the 12 hour time to the list of times for Output Maps. Click [OK].

    image

    After a few seconds wait, the velocity field plot will be displayed:

    image

This concludes the tutorial Oil spills in Rivers. Part I: Hydrodynamics.