Tutorial Module07 Archive

From Tuflow
Jump to navigation Jump to search

    Introduction

    In this module we will incorporate within the tutorial model a more detailed representation of the proposed development first introduced in Module 5. We will be utilising a more complex method to alter the ground elevations and will also incorporate 1D elements into the model to represent the drainage network. The method of modelling a bridge demonstrated in the 'FINB2' scenario of Module 6 will be taken forward for this module to produce a final developed 'DEV' scenario. This will involve:

    • Modification of the floodplain topography by the creation of a 3D TIN surface;
    • Revising the land use;
    • The addition of pipes and pits to represent an underground drainage network; and
    • The addition of an inflow into the pipe network.

    GIS Inputs

    The steps necessary to modify each of the GIS inputs are demonstrated in MapInfo, ArcGIS and QuantumGIS (QGIS). At each stage please select your GIS package to view relevant instructions.

    Define Elevations (Building a TIN)

    We have provided the GIS layers necessary to modify the ground elevations to represent the proposed development. This part of the tutorial will demonstrate how a TIN is created from these GIS layers. We will also update the GIS defining the road crest level. Follow the instructions below for your preferred GIS package.

    Define Surface Roughness

    We have provided the GIS layers necessary to modify the land use areas that will change as part of the proposed development. This part of the tutorial will require populating the layer attributes to assign Manning’s n roughness values to each land use. Follow the instructions below for your preferred GIS package.

    Define Pipe Network

    This part of the module creates the GIS layers that make up a pipe network. The pits of the pipe network will be linked to the 2D domain. We will also create the pit inlet database which links the GIS layers to depth-discharge curves. Follow the instructions below for your preferred GIS package.

    Define Boundary Conditions

    This part of the module demonstrates how an inflow can be applied directly to the pits of the pipe network. A GIS layer of the inflow boundary has been provided. We will also modify the existing Boundary Conditions Database to include these new inflows. Follow the instructions below for your preferred GIS package.

    Modify Simulation Control Files and Set-up a TUFLOW Scenario

    Now that we have made all of the necessary changes to the GIS layers, we need to update our control files to include all the changes representing the proposed development. Module 6 introduced a scenario named ‘FIN’ which included changes to an existing structure in the model as part of the final proposed development. For this module, we will incorporate the model changes into this existing scenario.

    TGC File

    There have been two changes to the model that impact the TGC file:

    • We have created two layers that together form a 3D TIN representing changes to the ground elevations.
    • We have created two 2d_mat layers that represent changes to the land use at the location of the proposed development.

    We will also be making the necessary amendments to the control files to incorporate the representation of the bridge in the 'FINB2' scenario into a final 'DEV' scenario.

    1. Begin by opening M06_5m_001.tgc in your text editor. Save the file as M07_5m_001.tgc.

    MapInfo Users

    1. The command lines specifying the active and in-active areas of the model need to be updated for the 'DEV' scenario to match the 'FINB2' scenario. Delete or comment out the command Read GIS Code BC == mi\2d_bc_M04_HX_001.MIF and replace it with an If Scenario to define all scenarios as shown below:
      If Scenario == EXG | FINB1 | FINB3
      Read GIS Code BC == mi\2d_bc_M04_HX_001.MIF
      Else If Scenario == DEV | FINB2
      Read GIS Code BC == mi\2d_bc_M06_HX_001.MIF
      Else
      Pause == Scenario not recognised
      End If

      We will also now delete or comment out the command Read GIS Code BC == mi\2d_bc_M06_HX_001.MIF within the FINB2 Scenario at the end of code. The new If Scenario block we have added means this command is no longer needed.

    2. We will now add the commands to modify the topography to represent the proposed development. Within the If Scenario logic block for the 'DEV' scenario, comment out or delete the command Read GIS Z Shape == mi\2d_zsh_M05_development_001.MIF. This command is no longer needed as it will be superseded by a more detailed representation of the proposed development. Add the following commands in its place:

      Create TIN Zpts WRITE TIN == mi\2d_ztin_M07_development_001.MIF | mi\2d_ztin_M07_development_001_P.MIF
      Read GIS Z HX Line MAX == mi\2d_bc_M06_HX_001.MIF | mi\2d_bc_M06_HX_001_P.MIF

      The Create TIN Zpts Write TIN command creates and writes an SMS .tin file to the same location as the GIS layer (in this case the TUFLOW\model\mi folder). The TIN can be viewed, checked and modified in SMS. This can then be read into the model directly using the Read TIN zpts command for any subsequent model simulations.

    3. Our intention for the 2d_mat layers created in this module is for them to build upon the existing commands which modify roughness. We would like for the new layers to overwrite the existing layers at the location of the proposed development. This process of layering and building up the model is a powerful tool in TUFLOW that minimises data duplication and provides a means of quality control. We need to ensure that the commands reading in our new 2d_mat layers are read in after the existing commands. Create another If Scenario logic block after the command Read GIS Mat == mi\2d_mat_M01_002.MIF, inserting the following:

      If Scenario == DEV
      Read GIS Mat == mi\2d_mat_M07_DEV_001.MIF
      Read GIS Mat == mi\2d_mat_M07_DEV_Buildings_001.MIF
      Else If Scenario == EXG | FINB1 | FINB2 | FINB3

      Else
      Pause == Scenario not recognised
      End If

    QGIS or ArcGIS Users

    1. The command lines specifying the active and in-active areas of the model need to be updated for the 'DEV' scenario to match the 'FINB2' scenario. Delete or comment out the command Read GIS Code == gis\2d_code_M04_null_creek_001_R.shp and replace it with an If Scenario to define all scenarios as shown below:
      If Scenario == EXG | FINB1 | FINB3
      Read GIS Code BC == gis\2d_code_M04_null_creek_001_R.shp
      Else If Scenario == DEV | FINB2
      Read GIS Code BC == gis\2d_code_M06_null_creek_001_R.shp
      Else
      Pause == Scenario not recognised
      End If

      We will also now delete or comment out the command Read GIS Code == gis\2d_code_M06_null_creek_001_R.shp within the FINB2 Scenario at the end of code. The new If Scenario block we have added means this command is no longer needed.

    2. We will now add the commands to modify the topography to represent the proposed development. Within the If Scenario logic block for the 'DEV' scenario, comment out or delete the command Read GIS Z Shape == gis\2d_zsh_M05_development_001_R.shp. This command is no longer needed as it will be superseded by a more detailed representation of the proposed development. Add the following commands in its place:

      Create TIN Zpts WRITE TIN == gis\2d_ztin_M07_development_001_R.SHP | gis\2d_ztin_M07_development_001_P.SHP
      Read GIS Z HX Line MAX == gis\2d_bc_M06_HX_001_L.shp | gis\2d_bc_M06_HX_001_P.shp


      The Create TIN Zpts Write TIN command creates and writes an SMS .tin file to the same location as the GIS layer (in this case the TUFLOW\model\gis folder). The TIN can be viewed, checked and modified in SMS. This can then be read into the model directly using the Read TIN zpts command for any subsequent model simulations.

    3. Our intention for the 2d_mat layers created in this module is for them to build upon the existing commands which modify roughness. We would like for the new layers to overwrite the existing layers at the location of the proposed development. This process of layering and building up the model is a powerful tool in TUFLOW that minimises data duplication and provides a means of quality control. We need to ensure that the commands reading in our new 2d_mat layers are read in after the existing commands.
      Create a second If Scenario logic block after the command Read GIS Mat == mi\2d_mat_M01_002_R.SHP, inserting the following:

      If Scenario == DEV
      Read GIS Mat == gis\2d_mat_M07_FIN_001_R.SHP
      Read GIS Mat == gis\2d_mat_M07_FIN_Buildings_001_R.SHP
      Else If Scenario == EXG | FINB1 | FINB2 | FINB3

      Else
      Pause == Scenario not recognised
      End If

    4. Save the file. The tgc file is now ready to be used.

    ECF File

    There have been three changes to the model that impact the ECF file:

    • We have created a 1d_nwk layer representing the culverts of the proposed pipe network
    • We have created a 1d_nwk layer representing the pits of the proposed pipe network
    • We have created a pit inlet database that links depth-discharge curves to the pit inlet type.

    Currently the 'DEV' scenario is included within the same If Scenario logic block as the 'EXG' scenario. We will modify this so that each scenario has their own group of commands.

    1. Open M06_1d_001.ecf in your text editor and save as M07_1d_001.ecf

    MapInfo Users

    1. Remove 'DEV' from the command line Else If Scenario == EXG | DEV so that the Read GIS Network == mi\1d_nwk_M04_culverts_001.MIF command is only read in for the 'EXG' scenario.
    2. Add a final Else If Scenario logic block after the commands for the 'EXG' scenario as follows:
      Else If Scenario == DEV
      Read GIS Network == mi\1d_nwk_M06_culverts_001.MIF
      Read GIS Network == mi\1d_nwk_M06_bridge_001.MIF
      Read GIS Network == mi\1d_nwk_M06_weir_001.MIF
      Read GIS Table Links == bg\1d_bg_M06_bridge_001.MIF
      Read GIS Table Links == bg\1d_bg_M06_weir_001.MIF
      Read GIS Network == mi\1d_nwk_M07_Pipes_001.MIF
      Read GIS Network == mi\1d_nwk_M07_Pits_001.MIF
      Pit Inlet Database == ..\pit_dbase\pit_inlet_dbase.csv

    QGIS or ArcGIS Users

    1. Remove 'DEV' from the command line Else If Scenario == EXG | DEV so that the Read GIS Network == gis\1d_nwk_M04_culverts_001_L.SHP command is only read in for the 'EXG' scenario.
    2. Add a final Else If Scenario logic block after the commands for the 'EXG' scenario as follows:
      Else If Scenario == DEV
      Read GIS Network == gis\1d_nwk_M06_culverts_001_L.SHP
      Read GIS Network == gis\1d_nwk_M06_bridge_001_L.SHP
      Read GIS Network == gis\1d_nwk_M06_weir_001_L.SHP
      Read GIS Table Links == bg\1d_bg_M06_bridge_001_L.SHP
      Read GIS Table Links == bg\1d_bg_M06_weir_001_L.SHP
      Read GIS Network == gis\1d_nwk_M07_Pipes_001_L.shp
      Read GIS Network == gis\1d_nwk_M07_Pits_001_P.shp
      Pit Inlet Database == ..\pit_dbase\pit_inlet_dbase.csv
    3. Save the file. The 1D control file is now ready to be used.

    TBC File

    There has been one change to the model that impacts the TBC file:

    • We have created a 2d_sa layer to define inflows into the pipe network.

    Again, we will place these new commands within an If Scenario logic block specific to the ‘DEV’ scenario.

    1. Open M06_5m_001.tbc in your text editor and save as M07_5m_001.tbc

    MapInfo Users

    1. Insert the following commands after the existing Read GIS SA == mi\2d_sa_M01_002.MIF command:

      If Scenario == DEV
      Read GIS SA PITS == mi\2d_sa_M07_001.MIF
      Else If Scenario == EXG | FINB1 | FINB2 | FINB3
      Else
      Pause == Scenario not recognised
      End If

    2. Modify the existing If Scenario logic block such that the 'DEV' scenario reads in the same set of commands as the 'FINB2' scenario. The second logic block should now look like the following:
      If Scenario == EXG | FINB1 | FINB3
      Read GIS BC == mi\2d_bc_M04_HX_001.MIF
      Else If Scenario == DEV | FINB2
      Read GIS BC == mi\2d_bc_M06_HX_001.MIF
      Else
      Pause == Scenario not recognised
      End If

    QGIS or ArcGIS Users

    1. Insert the following commands after the existing Read GIS SA == gis\2d_sa_M01_002_R.shp command:

      If Scenario == DEV
      Read GIS SA PITS == gis\2d_sa_M07_001_R.SHP
      Else If Scenario == EXG | FINB1 | FINB2 | FINB3
      Else
      Pause == Scenario not recognised
      End If

    2. Modify the existing If Scenario logic block such that the 'DEV' scenario reads in the same set of commands as the 'FINB2' scenario. The second logic block should now look like the following:
      If Scenario == EXG | FINB1 | FINB3
      Read GIS BC == gis\2d_bc_M04_HX_001_L.shp
      Else If Scenario == DEV | FINB2
      Read GIS BC == gis\2d_bc_M06_HX_001_L.shp
      Else
      Pause == Scenario not recognised
      End If
    3. Save the file. The tbc file is now ready to be used.

    TCF File

    We will need to create a new tcf file that references the new tgc, ecf and tbc files.

    1. Open M06_5m_~s1~_001.tcf and save as M07_5m_~s1~_001.tcf
    2. Update the following commands:
      Geometry Control File == ..\model\ M07_5m_001.tgc
      ESTRY Control File == ..\model\ M07_1d_001.ecf
      BC Control File == ..\model\ M07_5m_001.tbc

    3. We have also created a new bc_dbase in this module which will need to be referenced. Update the command as follows:
      BC Database == ..\bc_dbase\bc_dbase_M07.csv

    4. Lastly, update the following command to specify a new output folder for the results of this module:
      Output Folder == ..\results\M07\2d

    5. Save the file. The tcf file is now ready to be used.

    Run the Simulation

    Using your preferred method for starting TUFLOW, run the newly created M07_5m_~s1~_001.tcf. Please refer to Module 1 for a detailed description of the various methods for running a TUFLOW simulation.
    In this tutorial we are using a batch file to run simulations. The command line in our batch file will be similar to that used in Module 6:

    set TUFLOWEXE=C:\TUFLOW\Releases\2017-09-AC\w64\TUFLOW_iSP_w64.exe

    set RUN=start "TUFLOW" /wait "%TUFLOWEXE%" -b

    %RUN% -s1 DEV M07_5m_~s1~_001.tcf

    If the model fails to start correctly please refer to the troubleshooting section at the end of this page.

    Review Check Files

    Once the model has compiled and the simulation started, we can review the check files to ensure the changes have been correctly applied. The following section of this module outlines how the generated check files can be used to review each of the key changes we have made to the model. Note that there is often more than one check file that can be used to review each component of the model. The below steps outline just how some of these check files can be used.

    Review Model Input Files
    When using the If Scenario commands in a model, one of the most important checks is to confirm that the correct layers have been read into the model for each scenario. This can be done by viewing the automatically generated MapInfo workspace in a text editor. This workspace along with one created for the QGIS package can be found in the TUFLOW\runs\log folder. They can be reviewed individually or compared with each other to highlight any differences.

    Review Created TIN
    From the TUFLOW\check\2d\ folder import (into MapInfo) or open (ArcMap and QGIS):

    • M07_5m_DEV_001_sh_obj_check
    • 2d_ztin_M07_development_001.MIF_T0001.tin
    • M07_5m_DEV_001_DEM_Z.flt


    The _sh_obj_check file has been written as we have specified the WRITE TIN option as part of the Create TIN Zpts command. The check file shows the triangles that have been generated for the TIN produced from the two 2d_ztin layers that we have read into the tgc that make up the proposed ground elevations of the new development. As mentioned previously, a .TIN file has also been written to the TUFLOW\model\mi or TUFLOW\model\GIS folder. This file can be viewed and edited directly in SMS. The M07_5m_DEV_001_DEM_Z.flt is a grid of the final zpts used by TUFLOW after processing of each of the layers within the tgc. It can be read by most mainstream GIS software and also visualised in SMS.

    Review Changes to Roughness
    From the TUFLOW\check\2d\ folder import (into MapInfo) or open (ArcMap and QGIS):

    • M07_5m_DEV_001_grd_check


    The grd_check file contains information on all cells within the model extent, such as ZC elevation and the location of the cell in relation to the model origin. One of the attributes of this check layer is the Material ID assigned to each cell. A review of this check file is recommended particularly when using multiple GIS layers to define the roughness of a 2D domain. The file can be colour coded to provide a visual representation of the roughness assigned to the entire model extent by:

    • Thematically mapping the grd_check layer in MapInfo
    • Changing the style of the grd_check file to 'Categorized' by the 'Material' column in QGIS
    • By right clicking on the grd_check layer within the table of contents and click Properties. Once the properties dialogue window is open select the Symbology tab. Choose the Unique values option under Categories in the left-hand list and map the Value Field of interest.


    Review Pipe Network
    From the TUFLOW\check\1d\ folder import (into MapInfo) or open (ArcMap and QGIS):

    • M07_5m_DEV_001_nwk_C_check
    • M07_5m_DEV_001_nwk_N_check


    These two check files provide information on the all 1D elements within the model. The _nwk_C_check layer provides information on all 1D channels (including structures) in the model, whilst the _nwk_N_check layer provides information on the nodes. Notice how the _nwk_C check layer shows a series of orange dashed lines at the locations where we have specified pits in the model. These lines represent 'pit channels', zero length channels that connect the 1D pipe network to the 2D floodplain. Viewing in conjunction with the _nwk_N check layer shows two nodes are created at the upstream (ground level) and downstream (invert of the pipe network) ends of the pit channel. The orange triangle at the upstream end provides information on the link created with the 2D floodplain. The blue diamond at the downstream end provides information on the automatically created manhole at the junction between the culverts of the pipe network.

    Review Boundaries and 1D/2D Links
    From the TUFLOW\check\2d\ folder import (into MapInfo) or open (ArcMap and QGIS):

    • M07_5m_DEV_001_1d_to_2d_check
    • M07_5m_DEV_001_sac_check


    The _1d_to_2d_check layer highlights the location of all 1D/2D boundary links within the model. Where we have digitised the pipe network, this check file shows the SX boundaries that have been created at the location of the pits. This check file also shows the ZC elevation of the SX boundary which can be compared to surrounding ZC elevations by viewing alongside the grd_check layer. The check layer also shows the HX boundaries digitised along the river banks in Module 4.

    The _sac_check layer highlights the 2D cells connected to 1D pits where the 2d_sa inflow boundaries have been applied. The check file has been colour coded to show which 2D cells each of the four inflow boundaries has been applied to. The flow is distributed equally among each of the 2D cells.

    Review the Results

    Open the 2D results in your results viewer or import to your GIS package. It can be seen that during the flood event the capacity of the pipe network is exceeded resulting in flooding of the roads in the proposed development.
    M07 2d Results.PNG

    The 1D results can be viewed by importing the time series (_TS.mif or _TS_P.shp from the TUFLOW\results\1D folder, or opening any of the csv files outputted to TUFLOW\results\1d\csv. Another useful method for viewing the results of pipe networks is by importing in the _1d_ccA result layer found in the TUFLOW/results/1D folder. For each culvert or bridge within the model extent, this layer will provide information on the performance of the structure. Information such as percentage full and the time (in hours) the structure is at capacity are shown in this result layer. The layer is also automatically colour coded with thicker, dark purple lines highlighting structures that have reached capacity during the simulation. Thinner, pink lines show pipes that still have capacity.

    M07 ccA Results.PNG

    Conclusion

    We have added to the model a final proposed development scenario. Using the Create TIN Zpts command, we have altered the ground elevations to represent the development. We have also added a 1D pipe network which has been linked to the 2D domain. A pit inlet database has been created to specify a depth-discharge relationship for flow into and out of the pits.

    Troubleshooting

    If the TUFLOW simulation fails to start TUFLOW will output the error in a number of locations. Firstly, check the Console Window or the TUFLOW Log File (.tlf) (located in the TUFLOW\runs\log\ folder with the name M07_5m_DEV_001.tlf). This file can be opened in a text editor and the error is generally located at the end of the file. You can however search for "Error" if you cannot see the error. In most cases there is also a spatial location for the error message (if the error reported in the log file is prefixed by XY:). To check the location of the geographic errors, open the M07_5m_DEV_001_messages.mif or M07_5m_DEV_001_messages_P.shp file in your GIS package.

    This section contains links to some possible problems that may occur when progressing through the fourth tutorial module. If you experience an issue that is not detailed, please email support@tuflow.com or add and describe the problem on the discussion page.


    Advanced - HPC Solver (Optional)

    This section will introduce how to run the model TUFLOW’s HPC (Heavily Parallelised Compute) solver, and how to fix some common issues that may occur when trying to run a simulation using Graphics Processing Unit (GPU) hardware.

    TUFLOW HPC can run between 10 and 100 times faster than TUFLOW Classic using NVidia Graphics Processing Units (GPU)(depending on the model configuration and hardware performance).

    Model Setup

    To switch on the HPC solver with scenario control, please see HPC Model Setup section of Module 5 (recommended).
    To run the HPC solver using another .tcf file, simply perform the following steps:

    1. Save the TUFLOW runfile (M07_5m_~s1~_001.tcf) as M07_5m_~s1~_002.tcf.
    2. Add the following command to the TCF file:
      Solution Scheme == HPC ! Use HPC solver to run the model
    3. If you have a CUDA enabled NVIDIA GPU device, you can also add the following command to run the HPC solver using GPU hardware:
      Hardware == GPU ! Run HPC solver on GPU
    4. Save the TCF file.
    5. Update the batch file with the changes highlighted below in red.
      set TUFLOWEXE=C:\TUFLOW\Releases\2017-09-AC\w64\TUFLOW_iSP_w64.exe

      set RUN=start "TUFLOW" /wait "%TUFLOWEXE%" -b

      %RUN% -s1 DEV M07_5m_~s1~_001.tcf
      %RUN% -s1 DEV M07_5m_~s1~_002.tcf

    6. Run the TUFLOW Classic and HPC simulations.
    7. Review the results.


    TIP: To switch on the HPC solver via scenario control commands, please see the HPC Model Setup section of Module 5 (recommended).

    Also, to learn how to optimise a HPC simulation to achieve the fastest simulation speed please complete Tutorial Module 2 and Tutorial Module 3

    Results

    Using the methods described above in the Viewing Results section of Module 1.

    • Check the simulation logs in the DOS window, .tlf and .hpc.tlf log files.
    • View the results in your preferred package.

    Do the logs and results appear different to the TUFLOW Classic simulation?

    Troubleshooting for GPU Simulations

    If you receive the following error when trying to run the TUFLOW HPC model using GPU hardware:

    TUFLOW GPU: Interrogating CUDA enabled GPUs … 
    TUFLOW GPU: Error: Non-CUDA Success Code returned 
    

    or

    ERROR 2785 - No GPU devices found, enabled or compatible.
    

    Please try the following steps:

    1. Check if your GPU card is an NVIDIA GPU card. Currently, TUFLOW does not run on AMD type GPU.
    2. Check if your NVIDIA GPU card is CUDA enabled and whether the latest drivers are installed. Please see GPU Setup.


    If you experience an issue that is not detailed above please send an email to support@tuflow.com