How to create a 1D-2D link file for a TUFLOW model

Introduction

2D TUFLOW models can receive boundary data from outputs from an associated 1D model, e.g. when Flood Modeller models in-bank flows, and passes any overtopping flow to TUFLOW to model floodplain flow.

The link between the 1D and 2D models is defined by lines connecting node points to the appropriate section of a boundary line. In TUFLOW, these are defined in a MIF/MID file with 1D/2D connection lines referenced as 'CN'. The boundary lines they link to are referenced as 'HX'. Both these and the node points are defined in separate MIF/MID files.

In Flood Modeller, the 1D-2D link lines are defined in a custom polyline shapefile. Flood Modeller provides a function for making these lines more easily. Alternatively, the lines can be defined as a standard polyline shapefile, and the required attribute fields for the polyline can then be added manually by the modeller. Additionally, Flood Modeller provides a snapping function to enable the precise connection of specific points.

Method

The recommended procedure for creating TUFLOW 1D-2D link lines is as follows:

1. Load boundary line shapefile and Flood Modeller node points

Shapefiles representing the TUFLOW model boundary line and the 1D model node points are required to define the path of the new link lines. The standard ‘Add GIS Data’ button is used to add the boundary line shapefile to the Layers box. Select ‘Add GIS Data’ from the Home tab under the GIS Data section. Use the same procedure to load the .gxy file.

You will be prompted to save your .gxy file as a new point shapefile, which will be created from your georeferenced 1D nodes. A filename and location for the new shapefile will need to be specified. The new file will be added to the viewport and the Layers Box. Note; if the gxy file has been loaded in Flood Modeller before, then just load the point shapefile that was created previously.

2. Start drawing a new link lines shapefile

To start drawing a new link lines shapefile click the Connection Line button in the TUFLOW section of the 2D Build toolbar tab. You will be prompted to provide a new filename and location for the new link line shapefile.

Alternatively select New > Shapefile from the Home tab to access the following window:

Select the required file type and specify a filename and location for the new link line shapefile. Click the OK button to continue.

After a filename is specified the new shapefile will be added to the Layers Box and automatically put into edit mode. The snapping control can be activated by selecting it in the Layer Editor.

3. Set snapping control

 

Useful tip: The link lines should join perpendicular to the boundary line. It may therefore be necessary to first edit your boundary line to add extra points (vertex) into each segment to enable you to snap to the most appropriate locations. Alternatively you could use the 2D model link line generator tool to set up a line that traces along your boundary and places points exactly perpendicular to the 1D node point locations. You can then utilise this line in the snapping operation instead of your TUFLOW boundary line.

4. Draw link lines

Use the pan and zoom tools to position the map view where you wish to draw your link line. Then click on the Line button, in the Draw section of the Layer Editor tab to activate the drawing tool on your map (the mouse pointer will change to a pencil icon). Draw a link line as follows:

As you are drawing, a menu bar should appear on your map with options to undo the last point, stop drawing the line or cancel. Alternatively you can click Stop Edit and Save on the Layer Editor.

Note that until a save operation is performed, the new edits are not save to the disk.

5. Define link line attributes

If a polyline shapefile is to be exported to a link lines MIF/MID file, then the required attributes are: id, type, flags, name, f, d, td, a and b. These should be created automatically if the shapefile has been created as a link line in Flood Modeller. Within these files, Field should be set to ‘CN’.

While in edit mode, if the attribute table is not automatically visible, it can be activated by right-clicking on the link line file in the Layers Box and selecting Show Attributes from the displayed menu.

All associated attribute data are then displayed in tabular format within a new window. The field headings are listed with a required field type code. . These are ‘String’ for text entry, 'Double' for a decimal number entry (i.e. real number) and 'Integer' for an integer number entry. The values assigned to each attribute can be edited to your required values. Editing is done by clicking on a cell in the attribute table and typing in a new value. Alternatively double clicking on a feature row in the attribute table displays the attributes of the selected feature in a new window, as shown in the example below:

Edit values here by double-clicking on a cell and typing in your new value. After editing attributes for one feature you can use the buttons provided in the lower right of the window to accept edits and move on to edit an adjacent feature. Alternatively, you can use the buttons provided in the upper right of the window to move to adjacent features without applying any changes or to close the window to return to the main attribute table.

Continue editing until your attribute table is fully populated.

If the shapefile does not contain all required fields, then access the 'Edit Attribute table fields’ option, accessed at the top of the main attribute table window. This will display the tool shown below:

6. Save link line file

When all required changes have been made, select Stop Edit from the Layer Editor (left hand button) and select to save changes when prompted.

7. Export data to MIF/MID format

Highlight the shapefile in the Layers Box and click the SHP to MIF button located in the TUFLOW section of the 2D Build toolbar tab. A browser window will be displayed for you to select a filename and location for the new MIF/MID files.

Click the Save button to create the new file or click the Cancel button to close the window without creating a new file. Note it is possible to load the new MIF/MID file created into the Flood Modeller viewport (where it will be displayed again as a shapefile).

8. Set up TUFLOW 1D-2D Link Line Attributes in a standard polyline shapefile

If you are using an existing shapefile that does not contain all the required fields, then you can use Flood Modeller to append the fields required by TUFLOW. The procedure is as follows:

To define a new attribute field using the New Field function (upper right corner of the Field Editor window), you must define an attribute field name and type, i.e. string, integer or real number (for the latter, a number of decimal places to store is set by the precision value). Click on the 'Add New Field At End' button to create the new field within your shapefile. For a TUFLOW link lines shapefile this method must be repeated for all required fields.

Note that no existing fields are removed from your shapefile in this process. Unwanted fields can be removed by selecting them in the Field Editor table, placing a tick in the adjacent box, and clicking the 'Delete Checked' button in the toolbar.

When you close the Field Editor window, your updates should appear in the attributes table, ready for you to start adding values against the new attributes (as described in Step 6 above).