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:
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:
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¶
-
In the OilFlow2D toolbar, click on the New OilFlow2D Project button
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. -
Select None in the Layers drop down menu.
-
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.
-
Keep Name initial scenario set to
base. Click the [...] button and choose theOilSpillsInARiverPart1folder for the Project Directory. This is the folder where the model will write all results and output files. -
After clicking OK, the layer templates are created, and displayed on the Layers Panel:
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.
-
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
.
Click the ... browse button and select Magdalena.tif from \ExampleProjects\OilSpillsInARiverPart1\DATA. Verify that the selected path appears under Raster dataset(s).
-
Click Add and wait for the raster to load. Then click Close and click on the Zoom Full button
.The raster will be displayed on the screen, by default it is rendered in gray gradient.
-
Right-click on the label of the created layer and select Properties to change the rendering style for a more informative color palette.
-
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:
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:
-
Click the Domain Outline layer to activate it and then click Toggle Editing (pencil) in the toolbar:
-
Clicking on the button activates the rest of the editing buttons. Now click the Add Polygon Feature tool which is the bean looking polygon
. -
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.
-
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.
If you want to make any correction to the polygon, use the Node tool
to move, add or remove nodes as necessary. -
Save the polygon by clicking the Save button
.and click on Toggle Editing icon
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
.
The following figure shows the generated mesh. You will also find the Layers panel one new layers: Trimesh :
Setting the boundary conditions¶
In this tutorial we will define inflow and outflow conditions. To define the inflow boundary condition do as follows:
-
Enter the INFLOW boundary condition polygon: Click the Toggle Editing button
to add the polygons that are going to indicate the nodes on which the inflow condition is imposed. -
Draw a polygon that includes the nodes or vertices at the lower end of the mesh as indicated in the figure:
-
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.
-
In the window change the Type of Open Boundary to Discharge vs. Time.
-
Click the Import BC File button and browse to the tutorial folder and select the 'QIN2.DAT' file, then click OK.
-
Ckick the BC Data tab. The data should look as follows:
-
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:
-
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.
-
In the window set the boundary condition Type to: Uniform flow condition, then set the So to 0.0025.
-
Click [OK] then click the Save button
to save the changes made to the layer: -
Deactivate editing mode by clicking on the Toggle Editing icon
.
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.
-
Select the Manning N layer and click the Toggle Editing button
. -
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:
-
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):
-
Click the Save icon
and then click the Editing Tool icon
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:
-
From the QGIS menu bar, select Plugins > OilFlow2D MS > Export OilFlow2D > Export Hydrodinamic OilFlow2D to run the export plugin:
-
In the Export Files to OilFlow2D dialog, make sure the option for DEM (Single Raster) has Magdalena selected. Click [OK].
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 DIPdialog.QGIS DIPis selected by default; clickOKto open it inside QGIS. To use the historical standalone option, expandMore options, selectClassic DIP, and then clickOK.
With
QGIS DIPselected, the current interface is shown below: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:
-
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:
-
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.
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.
-
Click the OilFlow2D Maps
button dropdown menu and select Results vs Time Maps. -
In the Results vs Time Maps dialog, click the Browse [...] button to open the 'base.OUTFILES' file.
-
Under Maps select Velocity Field, under Output Times select 12 hours (0000:12:00:00). Click the arrow right button
to add the 12 hour time to the list of times for Output Maps. Click [OK].After a few seconds wait, the velocity field plot will be displayed:
This concludes the tutorial Oil spills in Rivers. Part I: Hydrodynamics.























