Skip to content

Simulating overland oil spills from a tank break

This tutorial explains how to use the OilFlow2D model to simulate overland oil spills from a tank break. The steps to accomplish this are as follows:

  1. Start QGIS and create a new OilFlow2D project.

  2. Adding the terrain elevation data.

  3. Create the limits of the modeling area (Domain Outline).

  4. Setting the boundary conditions.

  5. Assigning Manning's n roughness coefficients.

  6. Using the Weirs layer to create the tank.

  7. Filling the tank with oil utilizing the InitialWSE layer.

  8. Generating the triangular mesh and exporting the data files to the OilFlow2D model.

  9. Configuring parameters in the Hydronia Data Input Program.

  10. Creating OilFlow2D maps and animations from results data.

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

Files with data required in this tutorial.

Start a new OilFlow2D project

  1. To create a new OilFlow2D project, click on the New OilFlow2D Project button image in the toolbar. A dialog window appears where you select the layers that will be created, the Coordinate Reference System (CRS), and the directory path where the layers will be saved. Select None, then enable Domain Outline, Manning N, BoundaryConditions, InitialWSE, and Weirs. This tutorial uses the InitialWSE layer to define the oil level and the Weirs layer to outline the tank.

  2. Select the Projection: Coordinate Reference System (CRS) EPSG code: 2202 corresponding to REGVEN / UTM zone 19N - Projected

  3. Use the same working Project Directory:

    ExampleProjects\SimulatingTankbreaks

    Create New OilFlow2D Project.

  4. After clicking OK, the templates of the layers are created, and displayed on the Layers Panel:

    Layers created for the project.

OilFlow2D will use the unit system 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.

Load elevation data

OilFlow2D uses elevation data in raster format.

  1. To load the raster elevation file, from the Layer menu, click Add Layer, and then click Add Raster Layer.... You may also click the Add Raster Layer button image.

    The following dialog will appear where you can select the raster file containing elevations. In this case, select DEM.tif from the extracted SimulatingTankbreaks folder.

    Raster data import dialog.

  2. Click Add, then click Close on the dialog and click on the Zoom Full button image or by right-clicking the DEM layer and selecting Zoom to layer.

  3. The raster will be displayed on the screen, by default it is rendered in gray gradient and will need to be changed in the layer properties by right-clicking the DEM layer and selecting Properties. Under Symbology, select the drop down menu for Render Type and select Hillshade, then click OK.

    The layer should look like the following figure:

    Digital elevation model in raster format.

    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.

  4. Save the QGIS project by clicking on the Save Project image icon in the toolbar. Make sure it is saved in the same directory that you previously selected in the Create New Project dialog above.

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.

    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.

  3. 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 10 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.

  4. 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.

Domain Outline layer.

Setting the boundary conditions

To define the boundary conditions:

Inflow boundary conditions. Draw a polygon that includes the nodes or vertices at the lower end of the mesh as indicated in the figure:

Boundary-condition polygon at the lower end of the mesh.

  1. Select the BoundaryConditions layer in the Layers panel.

  2. Click the Toggle Editing button image to add the polygons that are going to indicate the nodes on which the outflow conditions are established.

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

  4. The window contains a list to input the ID of this BC (Boundary Cond. ID). Click the dropdown menu for Type of Open Boundary select the boundary condition Type 5.Uniform flow condition. Enter the value 0.0025 in the So field.

    The window should appear as shown in Figure below:

    Uniform flow Boundary Condition parameters.

  5. Click OK to close the dialog box.

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

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.

  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 ():

    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.

Using the Weirs layer to create the tank

In this tutorial we assume that the spill occurs in a tank. We will use the Weirs layer to draw the tank in the northern part of the domain.

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

  2. Now click the Add Line Feature tool image.

  3. Left-click to create the vertices of the tank, starting from the bottom left corner and moving in the direction shown in the figure.

  4. Right-click to close the polyline, ensuring that there is a gap between the last and first vertices as shown in the figure below:

    Weir polyline, drawn counter-clockwise.

  5. Then enter the Cell Size attribute, in this case we will use 5 m:

    Weir feature attributes dialog, General tab.

  6. Click on the tab Weir crest elevation for vertex, enter the number as shown in the following figure before clicking Set a weir crest elevation for all the weir

    This will populate the WCREST column with the value entered.

    To determine the appropriate weir crest elevation, first use the Identify Features tool on the DEM to find the ground elevation where the tank will be placed. The weir crest elevation should be that ground elevation plus the desired height of the tank wall (e.g., ground elevation + 10m).

    Weir feature attributes dialog, Weir crest elevation for vertex tab.

  7. To complete entering the Weir, click Save image and then the Toggle Editing icon (pencil) image.

Generating the triangular-cell mesh

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

  1. 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.

    Inspect the weir feature to ensure that it has a minimum of two cells in between the first and last vertices.

    Weir gap with generated mesh.

Filling the tank with oil utilizing the InitialWSE layer

This layer is used to define the initial water surface elevation within the created polygon, in this tutorial it will be used to fill the tank with oil.

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

  2. Now click the Add Polygon Feature tool image.

  3. Left-click inside the Weirs polygon, staying close to each vertices to create the internal polygon of the tank.

  4. Right-click to close the polygon.

    Initial water surface elevation polygon.

  5. A dialog window is presented where you must input the initial water surface elevation, in this case we will use 909 m. This value may need to be different depending on where you place the tank within the domain.

    InitialWSE feature attributes dialog.

  6. To complete entering the InitialWSE, click Save image and then the Toggle Editing icon (pencil) image.

Exporting the files to OilFlow2D

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. Make sure all of your required layers are active before performing this step.

  2. Run the Export Hydrodynamic OilFlow2D plugin:

    Export Hydrodynamic OilFlow2D command.

  3. A dialog window is presented, where we will indicate the raster layer with the Digital Elevation Model (DEM), as this layer is not created by the plugin and its name may be arbitrary.

  4. Make sure to indicate a file name (e.g. Oilspill) including the path where the generated files will be stored, and 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. Once the process of creating the files is completed, the Hydronia Data Input Program (DIP) is opened automatically and a dialog window is presented with the model project to run. In this case: 'base.DAT' should already be set.

    After export completes, version 10 and later users see the Open DIP dialog. Keep QGIS DIP selected and click OK. To use the historical standalone option, expand More options, select Classic DIP, and click OK.

Open DIP dialog showing QGIS DIP selected by default and More options expanded with Classic DIP.

The OilFlow2D input settings are then available in QGIS DIP:

QGIS DIP Control Data panel for Simulating Tank Breaks.

The legacy configuration figure below is retained as a values reference.

Legacy configuration reference for the Hydronia Data Input Program.

  1. Ensure that the Oil Spill on Land Module is selected, the Simulation time is set to 2 hours, and the Output Interval is set to 0.1.

  2. Click Save .DAT and overwrite the 'base.dat' file.

  3. Now click on the Oil Spill on Land panel, make sure Basic Model radial button is selected, and enter the data the following data: Oil viscosity: 0.009966468 Pa.s, Flow Resistance Relation Quadratic, Oil density: 893.19 kg/m\(^3\), and Yield stress: 0.1 N/m\(^2\). In the Tables section, make sure to fill in the values as seen in the figure below:

    QGIS DIP Oil Spill on Land panel for Simulating Tank Breaks.

    The following Classic DIP Oil Spill on Land panel is retained as a legacy values reference:

    Legacy Classic DIP Oil Spill on Land panel.

  4. Click Save .DAT. This will create the TemperatureViscosityDensityQQ.txt and TemperatureTimeSeriesQQ.txt files in your scenario folder.

  5. Click the Run OilFlow2D button to run the model. An image similar to the one shown below should appear:

    The graph generated by the OilFlow2D model.

  6. When you have finalized reviewing the information included in this window, close it. 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 OilFlow2D maps

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.

    OilFlow2D Maps menu.

  2. A dialog window is presented where we will indicate the output files list 'base.OUTFILES' and the desired parameter, that will be Depth for time 2 hours. Also indicate the Raster Map option as shown.

    Window dialog of the Results vs Time Maps plugin.

  3. Click OK to start the process. After a few seconds a new layer with the requested map will be created.

  4. Right-click the newly generated layer and select Properties. In the Properties window, click on the Symbology tab and change the Mode to Equal Count (Quantile) option.

    Oil depth map at 2 hours after the initial spill.

Save the project in QGIS to continue. On the QGIS Project menu, click Save, to save the project assigning the name SimulatingTankBreaks, in the same directory that you previously selected in the Create New Project dialog above. The saved project file will be SimulatingTankBreaks.qgz.

Animating oil spill on land results in OilFlow2D

Sometimes it is better to view an animation of the results for a different audience, or to view all of the results quickly. Animations can also be exported to a movie file for maximum portability. To create an animation, complete the steps as follows:

  1. In QGIS, click on the Oil Animation Button image in the OilFlow2D toolbar.

  2. A panel will open on the bottom left side of the QGIS interface.

    Output map options for Oil Properties vs. Time Maps.

  3. Click on the Select Layer dropdown menu and select Depth. Click on the Add Layer button.

  4. After the animation loads, it will be listed in the list window under the Select layer button.

  5. in the Layers panel above, there will be a new group named ANIMATION which will contain the newly created Depth animation layer.

  6. The layer needs to be moved above the DEM layer so that it is visible when being played. Click and drag the ANIMATION group and make sure to drop it above the layers that would need to be underneath it, such as the DEM and satellite imagery layers as in the following figure:

    Layer order for Animations to be visible.

  7. To play the animation, click the Play image button in the OilFlow2D Animation panel. Make sure all other output layers have been disabled.

The user can change the speed of the animation, export the animation as a shape file, export an image of a particular frame of an animation, and finally export a video via the buttons located at the bottom of the OilFlow2d Animation panel.

This concludes the tutorial: Simulating overland oil spills from a tank break.