Difference between revisions of "Tutorial M08"

From Tuflow
Jump to navigation Jump to search
 
(7 intermediate revisions by 3 users not shown)
Line 53: Line 53:
 
<ol><font color="blue"><tt>Timestep </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2 </tt></font> <font color="green"><tt> ! Specifies the first 2D computational timestep of 2 seconds</tt></font> <br></ol>
 
<ol><font color="blue"><tt>Timestep </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2 </tt></font> <font color="green"><tt> ! Specifies the first 2D computational timestep of 2 seconds</tt></font> <br></ol>
 
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>5m </tt></font> <font color="green"><tt>      ! 5m scenario</tt></font> <br>
 
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>5m </tt></font> <font color="green"><tt>      ! 5m scenario</tt></font> <br>
<ol><font color="blue"><tt>Timestep </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>1 </tt></font> <font color="green"><tt>  ! Specifies the first 2D computational timestep of 1 seconds</tt></font> <br></ol>
+
<ol><font color="blue"><tt>Timestep </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>1 </tt></font> <font color="green"><tt>  ! Specifies the first 2D computational timestep of 1 second</tt></font> <br></ol>
 
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2.5m </tt></font> <font color="green"><tt>    ! 2.5m scenario</tt></font> <br>
 
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2.5m </tt></font> <font color="green"><tt>    ! 2.5m scenario</tt></font> <br>
 
<ol><font color="blue"><tt>Timestep </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>0.5 </tt></font> <font color="green"><tt>  ! Specifies the first 2D computational timestep of 0.5 seconds</tt></font> <br></ol>
 
<ol><font color="blue"><tt>Timestep </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>0.5 </tt></font> <font color="green"><tt>  ! Specifies the first 2D computational timestep of 0.5 seconds</tt></font> <br></ol>
Line 66: Line 66:
 
<li>Save a copy of '''_run_M02_HPC.bat''' as '''_run_M08_HPC.bat''' in the '''Module_08\TUFLOW\runs''' folder.
 
<li>Save a copy of '''_run_M02_HPC.bat''' as '''_run_M08_HPC.bat''' in the '''Module_08\TUFLOW\runs''' folder.
 
<li>Update the batch file to reference the '''M08_~s1~_001.tcf''' and include a scenario switch (-s1) defining cell size:<br>
 
<li>Update the batch file to reference the '''M08_~s1~_001.tcf''' and include a scenario switch (-s1) defining cell size:<br>
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>exe</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\..\exe\2023-03-AA\TUFLOW_iSP_w64.exe"</tt></font> <br>
+
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>exe</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\..\exe\2023-03-AF\TUFLOW_iSP_w64.exe"</tt></font> <br>
 
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>run</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>start "TUFLOW" /wait</tt></font> <font color="orange"><tt> %exe%</tt></font> <font color="black"><tt> -b</tt></font> <br>
 
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>run</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>start "TUFLOW" /wait</tt></font> <font color="orange"><tt> %exe%</tt></font> <font color="black"><tt> -b</tt></font> <br>
 
<font color="orange"><tt>%run% </tt></font> <font color="black"><tt> -s1 10m M08_~s1~_001.tcf </tt></font> <br>
 
<font color="orange"><tt>%run% </tt></font> <font color="black"><tt> -s1 10m M08_~s1~_001.tcf </tt></font> <br>
Line 80: Line 80:
 
== Check Files ==
 
== Check Files ==
 
While the model is running, review the added features are specified correctly:
 
While the model is running, review the added features are specified correctly:
:*<u>[[Tutorial_M08_001_Check_Files_QGIS | QGIS]]</u>
+
:*<u>[[Tutorial_M08_001_Check_Files_QGIS | QGIS - SHP]]</u>
 +
:*<u>[[Tutorial_M08_001_Check_Files_QGIS_GPKG | QGIS - GPKG]]</u>
 
Compare the model cell count:
 
Compare the model cell count:
 
<ol>
 
<ol>
Line 101: Line 102:
 
<li>The file shows the simulation times for all the simulations.
 
<li>The file shows the simulation times for all the simulations.
 
<br>
 
<br>
[[File:M08 TUFLOW Simulations.png]]<br>
+
[[File:M08_TUFLOW_Simulations_f.png]]<br>
 +
<br>
 
</ol>
 
</ol>
 
<br>
 
<br>
Line 111: Line 113:
 
== GIS Inputs ==
 
== GIS Inputs ==
 
Create, import and view input data:<br>
 
Create, import and view input data:<br>
:*<u>[[Tutorial_M08_002_GIS_Inputs_QGIS | QGIS]]</u><br>
+
:*<u>[[Tutorial_M08_002_GIS_Inputs_QGIS | QGIS - SHP]]</u><br>
 +
:*<u>[[Tutorial_M08_002_GIS_Inputs_QGIS_GPKG | QGIS - GPKG]]</u><br>
  
 
== Simulation Control Files ==  
 
== Simulation Control Files ==  
Line 118: Line 121:
 
<li>Save a copy of '''M08_001.tgc''' as '''M08_002.tgc''' in the '''Module_08\TUFLOW\model''' folder. <br>
 
<li>Save a copy of '''M08_001.tgc''' as '''M08_002.tgc''' in the '''Module_08\TUFLOW\model''' folder. <br>
 
<li>Open the '''M08_002.tgc''' in a text editor.
 
<li>Open the '''M08_002.tgc''' in a text editor.
<li>Include the following if scenario logic block for existing and developed case after the '<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh_M02_rd_crest_001_L.shp | gis\2d_zsh_M02_rd_crest_001_P.shp</tt></font>' command:<br>
+
<li>Include the following if scenario logic block for existing and developed case after the '<font color="blue"><tt>Read GIS Z Shape</tt></font>' command:<br>
 +
 
 +
<u>'''QGIS - SHP'''</u><br>
 
<font color="blue"><tt>If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>EXG </tt></font> <font color="green"><tt>          ! Beginning of if statement - existing scenario</tt></font> <br>
 
<font color="blue"><tt>If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>EXG </tt></font> <font color="green"><tt>          ! Beginning of if statement - existing scenario</tt></font> <br>
 
<ol><font color="green"><tt> ! Defines a placeholder</tt></font> <br></ol>
 
<ol><font color="green"><tt> ! Defines a placeholder</tt></font> <br></ol>
 
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>DEV </tt></font> <font color="green"><tt>    ! Development scenario</tt></font> <br>
 
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>DEV </tt></font> <font color="green"><tt>    ! Development scenario</tt></font> <br>
<ol><font color="blue"><tt>Create TIN Zpts </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh_M02_landscape_002_R.shp | gis\2d_zsh_M02_landscape_002_L.shp | gis\2d_zsh_M02_landscape_002_P.shp </tt></font> <font color="green"><tt>        ! Defines areas of complex landscaping</tt></font> <br></ol>
+
<ol><font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh_M02_landscape_002_R.shp | gis\2d_zsh_M02_landscape_002_L.shp | gis\2d_zsh_M02_landscape_002_P.shp </tt></font> <font color="green"><tt>        ! Defines areas of complex landscaping</tt></font> <br></ol>
 
<font color="blue"><tt>Else </tt></font> <font color="green"><tt>  ! Else statement</tt></font> <br>
 
<font color="blue"><tt>Else </tt></font> <font color="green"><tt>  ! Else statement</tt></font> <br>
 
<ol><font color="blue"><tt>Pause </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>Error: Scenario Name Not Valid </tt></font> <font color="green"><tt>  ! Displays specified text if different scenario name is called </tt></font> <br></ol>
 
<ol><font color="blue"><tt>Pause </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>Error: Scenario Name Not Valid </tt></font> <font color="green"><tt>  ! Displays specified text if different scenario name is called </tt></font> <br></ol>
 
<font color="blue"><tt>End If </tt></font> <font color="green"><tt>  ! End of if statement</tt></font> <br>
 
<font color="blue"><tt>End If </tt></font> <font color="green"><tt>  ! End of if statement</tt></font> <br>
 +
 +
<u>'''QGIS - GPKG'''</u><br>
 +
<font color="blue"><tt>If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>EXG </tt></font> <font color="green"><tt>          ! Beginning of if statement - existing scenario</tt></font> <br>
 +
<ol><font color="green"><tt> ! Defines a placeholder</tt></font> <br></ol>
 +
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>DEV </tt></font> <font color="green"><tt>    ! Development scenario</tt></font> <br>
 +
<ol><font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_zsh_M02_landscape_002_R | 2d_zsh_M02_landscape_002_L | 2d_zsh_M02_landscape_002_P </tt></font> <font color="green"><tt>        ! Defines areas of complex landscaping</tt></font> <br></ol>
 +
<font color="blue"><tt>Else </tt></font> <font color="green"><tt>  ! Else statement</tt></font> <br>
 +
<ol><font color="blue"><tt>Pause </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>Error: Scenario Name Not Valid </tt></font> <font color="green"><tt>  ! Displays specified text if different scenario name is called </tt></font> <br></ol>
 +
<font color="blue"><tt>End If </tt></font> <font color="green"><tt>  ! End of if statement</tt></font> <br>
 +
 +
<li>Include the following if scenario logic block for existing and developed case after the '<font color="blue"><tt>Read GIS Mat</tt></font>' command:<br>
 +
 +
<u>'''QGIS - SHP'''</u><br>
 +
<font color="blue"><tt>If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>EXG </tt></font> <font color="green"><tt>          ! Beginning of if statement - existing scenario</tt></font> <br>
 +
<ol><font color="green"><tt> ! Defines a placeholder</tt></font> <br></ol>
 +
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>DEV </tt></font> <font color="green"><tt>    ! Development scenario</tt></font> <br>
 +
<ol><font color="blue"><tt>Read GIS Mat </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_mat_M02_landscape_002_R.shp </tt></font> <font color="green"><tt>        ! Sets material values according to attributes in the GIS layer</tt></font> <br></ol>
 +
<font color="blue"><tt>Else </tt></font> <font color="green"><tt>  ! Else statement</tt></font> <br>
 +
<ol><font color="blue"><tt>Pause </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>Error: Scenario Name Not Valid </tt></font> <font color="green"><tt>  ! Displays specified text if different scenario name is called </tt></font> <br></ol>
 +
<font color="blue"><tt>End If </tt></font> <font color="green"><tt>  ! End of if statement</tt></font> <br>
 +
 +
<u>'''QGIS - GPKG'''</u><br>
 +
<font color="blue"><tt>If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>EXG </tt></font> <font color="green"><tt>          ! Beginning of if statement - existing scenario</tt></font> <br>
 +
<ol><font color="green"><tt> ! Defines a placeholder</tt></font> <br></ol>
 +
<font color="blue"><tt>Else If Scenario </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>DEV </tt></font> <font color="green"><tt>    ! Development scenario</tt></font> <br>
 +
<ol><font color="blue"><tt>Read GIS Mat </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_mat_M02_landscape_002_R </tt></font> <font color="green"><tt>        ! Sets material values according to attributes in the GIS layer</tt></font> <br></ol>
 +
<font color="blue"><tt>Else </tt></font> <font color="green"><tt>  ! Else statement</tt></font> <br>
 +
<ol><font color="blue"><tt>Pause </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>Error: Scenario Name Not Valid </tt></font> <font color="green"><tt>  ! Displays specified text if different scenario name is called </tt></font> <br></ol>
 +
<font color="blue"><tt>End If </tt></font> <font color="green"><tt>  ! End of if statement</tt></font> <br>
 +
 
<li>Save the TGC.
 
<li>Save the TGC.
 
</ol>
 
</ol>
Line 135: Line 170:
 
<li>Update the TGC reference: <br>
 
<li>Update the TGC reference: <br>
 
<font color="blue"><tt>Geometry Control File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\model\M08_002.tgc </tt></font> <font color="green"><tt>  ! Reference the TUFLOW Geometry Control File</tt></font> <br>
 
<font color="blue"><tt>Geometry Control File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\model\M08_002.tgc </tt></font> <font color="green"><tt>  ! Reference the TUFLOW Geometry Control File</tt></font> <br>
 +
<li>For GeoPackage users, update the Spatial Database reference: <br>
 +
<u>'''QGIS - GPKG'''</u><br>
 +
<font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\model\gis\M08_002.gpkg</tt></font> <font color="green"><tt>  ! Specify the location of the GeoPackage Spatial Database</tt></font> <br>
 
<li>Save the TCF.
 
<li>Save the TCF.
 
</ol>
 
</ol>
Line 142: Line 180:
 
<li>Open '''_run_M08_HPC.bat''' from the '''Module_08\TUFLOW\runs''' folder.
 
<li>Open '''_run_M08_HPC.bat''' from the '''Module_08\TUFLOW\runs''' folder.
 
<li>Update the batch file to reference the '''M08_~s1~_~s2~_002.tcf''' and in addition to cell size scenario switch (-s1) include second scenario switch (-s2) defining topography:<br>
 
<li>Update the batch file to reference the '''M08_~s1~_~s2~_002.tcf''' and in addition to cell size scenario switch (-s1) include second scenario switch (-s2) defining topography:<br>
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>exe</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\..\exe\2023-03-AA\TUFLOW_iSP_w64.exe"</tt></font> <br>
+
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>exe</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\..\exe\2023-03-AF\TUFLOW_iSP_w64.exe"</tt></font> <br>
 
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>run</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>start "TUFLOW" /wait</tt></font> <font color="orange"><tt> %exe%</tt></font> <font color="black"><tt> -b</tt></font> <br>
 
<font color="blue"><tt>'''set'''</tt></font> <font color="black"><tt>run</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>start "TUFLOW" /wait</tt></font> <font color="orange"><tt> %exe%</tt></font> <font color="black"><tt> -b</tt></font> <br>
 
<font color="orange"><tt>%run% </tt></font> <font color="black"><tt> -s1 2.5m -s2 EXG M08_~s1~_~s2~_002.tcf </tt></font> <br>
 
<font color="orange"><tt>%run% </tt></font> <font color="black"><tt> -s1 2.5m -s2 EXG M08_~s1~_~s2~_002.tcf </tt></font> <br>
Line 178: Line 216:
 
<li>Add the following commands. Indentation is important in batch files, insert tabs to match the below spacing:<br>
 
<li>Add the following commands. Indentation is important in batch files, insert tabs to match the below spacing:<br>
 
<font color="blue"><tt>echo </tt></font> <font color="black"><tt>off</tt></font><br>
 
<font color="blue"><tt>echo </tt></font> <font color="black"><tt>off</tt></font><br>
<font color="blue"><tt>set </tt></font> <font color="black"><tt>exe</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\..\exe\2023-03-AA\TUFLOW_iSP_w64.exe"</tt></font><br>
+
<font color="blue"><tt>set </tt></font> <font color="black"><tt>exe</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\..\exe\2023-03-AF\TUFLOW_iSP_w64.exe"</tt></font><br>
 
<font color="blue"><tt>set </tt></font> <font color="black"><tt>run</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>start "TUFLOW" /wait </tt></font><font color="orange"><tt>%exe%</tt></font><font color="black"><tt> -b</tt></font><br>
 
<font color="blue"><tt>set </tt></font> <font color="black"><tt>run</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>start "TUFLOW" /wait </tt></font><font color="orange"><tt>%exe%</tt></font><font color="black"><tt> -b</tt></font><br>
 
<br>
 
<br>

Latest revision as of 17:02, 19 September 2024

Introduction

In this module, scenario management is introduced. This is a powerful functionality running different simulations using a single set of control files rather than creating a new set of control files for every simulation. This makes the management of the model easier, ensures consistency between the simulations and better quality control. Without implementing scenario management, six TCFs and six TGC files are required to run this module, using scenario management, only one each is needed:

M08 ScenarioManagement 02.png

Scenarios are set up using an if scenario logic block - If Scenario command followed by Else If Scenario commands adding on different scenarios and terminated by End If.

The tutorial demonstrates two ways of using scenarios:

  • Part 1: Single Scenario - cell size.
  • Part 2: Multiple Scenarios - cell size and topography updates.

The GIS layers are:

  • TGC layers:
    1. 2d_zsh: A layer used to modify Zpt elevations using points, lines and polygons.
    2. 2d_mat: A layer used to define the land use (material) types within the developmental area.

Module 8 builds from the model created in Module 2. The completed Module 2 model is provided in the Module_08\TUFLOW folder.

Part 1 - Single Scenario

Use scenario management to run the model with a range of different cell sizes, initial timesteps and SGS sample frequency within a single TCF. These steps are often used to conduct a cell size convergence sensitivity testing.

Simulation Control Files

TUFLOW Geometry Control File (TGC)

  1. Save a copy of M02_001.tgc as M08_001.tgc in the Module_08\TUFLOW\model folder.
  2. Open the M08_001.tgc in a text editor.
  3. Comment out or delete the 'cell size' command and add the following if scenario logic block:
    ! Cell Size == 5 ! 2D cell size in metres
    If Scenario == 10m ! Beginning of if statement - 10m scenario
      Cell Size == 10 ! 2D cell size in metres - 10 metres

    Else If Scenario == 5m ! 5m scenario

      Cell Size == 5 ! 2D cell size in metres - 5 metres

    Else If Scenario == 2.5m ! 2.5m scenario

      Cell Size == 2.5 ! 2D cell size in metres - 2.5 metres

    Else ! Else statement

      Pause == Error: Scenario Name Not Valid ! Displays specified text if different scenario name is called

    End If ! End of if statement

  4. Save the TGC.

Note: The Pause command causes TUFLOW to stop every time it encounters it. In the example above, if a cell size was specified other than 10m, 5m, or 2.5m, 'Error: Scenario Name Not Valid' would be displayed. The simulation can then be continued or discontinued via a dialog window.

TUFLOW Control File (TCF)

  1. Save a copy of M02_5m_001.tcf as M08_~s1~_001.tcf in the Module_08\TUFLOW\runs folder.
  2. Open the file M08_~s1~_001.tcf in a text editor.
  3. Update the TGC reference:
    Geometry Control File == ..\model\M08_001.tgc ! Reference the TUFLOW Geometry Control File
  4. The Timestep is dependent on the model cell size. A general guide is to use 1/2 to 1/5 of the model cell size in metres. Comment out or delete the 'Timestep' command and add the following if scenario logic block:
    ! Timestep == 1 ! Specifies the first 2D computational timestep of 1 second
    If Scenario == 10m ! Beginning of if statement - 10m scenario
      Timestep == 2 ! Specifies the first 2D computational timestep of 2 seconds

    Else If Scenario == 5m ! 5m scenario

      Timestep == 1 ! Specifies the first 2D computational timestep of 1 second

    Else If Scenario == 2.5m ! 2.5m scenario

      Timestep == 0.5 ! Specifies the first 2D computational timestep of 0.5 seconds

    Else ! Else statement

      Pause == Error: Scenario Name Not Valid ! Displays specified text if different scenario name is called

    End If ! End of if statement

  5. Save the TCF.

Running the Simulation

  1. Save a copy of _run_M02_HPC.bat as _run_M08_HPC.bat in the Module_08\TUFLOW\runs folder.
  2. Update the batch file to reference the M08_~s1~_001.tcf and include a scenario switch (-s1) defining cell size:
    set exe="..\..\..\exe\2023-03-AF\TUFLOW_iSP_w64.exe"
    set run=start "TUFLOW" /wait %exe% -b
    %run% -s1 10m M08_~s1~_001.tcf
    %run% -s1 5m M08_~s1~_001.tcf
    %run% -s1 2.5m M08_~s1~_001.tcf
  3. Save the batch file and double click it in file explorer to run the simulation.

Troubleshooting

See tips on common mistakes and troubleshooting steps if the model doesn't run:

Check Files

While the model is running, review the added features are specified correctly:

Compare the model cell count:

  1. Navigate to the Module_08\TUFLOW\runs\log folder and open the following files in a text editor:
    • M08_10m_001.tlf
    • M08_5m_001.tlf
    • M08_2.5m_001.tlf
  2. Search for 'Number 2D Cells' and view the number of active cells for each model. This is the number of active cells as specified by the 2d_code layer. There are approximately 16 times more cells in the 2.5m model compared to the 10m model:
    • M08_10m_001: 5122
    • M08_5m_001: 20486
    • M08_2.5m_001: 81869

Results

When the model is finished, review the results:

Compare the model run times:

  1. Navigate to the Module_08\TUFLOW\runs folder and open the _TUFLOW Simulations.log in a text editor.
  2. The file shows the simulation times for all the simulations.
    M08 TUFLOW Simulations f.png


Part 2 - Multiple Scenarios

Use scenario management to run the model with a range of different cell sizes and topography changes within a single TCF. These steps are often used to conduct an impact assessment.

GIS Inputs

Create, import and view input data:

Simulation Control Files

TUFLOW Geometry Control File (TGC)

  1. Save a copy of M08_001.tgc as M08_002.tgc in the Module_08\TUFLOW\model folder.
  2. Open the M08_002.tgc in a text editor.
  3. Include the following if scenario logic block for existing and developed case after the 'Read GIS Z Shape' command:
    QGIS - SHP
    If Scenario == EXG ! Beginning of if statement - existing scenario
       ! Defines a placeholder

    Else If Scenario == DEV ! Development scenario

      Read GIS Z Shape == gis\2d_zsh_M02_landscape_002_R.shp | gis\2d_zsh_M02_landscape_002_L.shp | gis\2d_zsh_M02_landscape_002_P.shp ! Defines areas of complex landscaping

    Else ! Else statement

      Pause == Error: Scenario Name Not Valid ! Displays specified text if different scenario name is called

    End If ! End of if statement

    QGIS - GPKG
    If Scenario == EXG ! Beginning of if statement - existing scenario

       ! Defines a placeholder

    Else If Scenario == DEV ! Development scenario

      Read GIS Z Shape == 2d_zsh_M02_landscape_002_R | 2d_zsh_M02_landscape_002_L | 2d_zsh_M02_landscape_002_P ! Defines areas of complex landscaping

    Else ! Else statement

      Pause == Error: Scenario Name Not Valid ! Displays specified text if different scenario name is called

    End If ! End of if statement

  4. Include the following if scenario logic block for existing and developed case after the 'Read GIS Mat' command:
    QGIS - SHP
    If Scenario == EXG ! Beginning of if statement - existing scenario
       ! Defines a placeholder

    Else If Scenario == DEV ! Development scenario

      Read GIS Mat == gis\2d_mat_M02_landscape_002_R.shp ! Sets material values according to attributes in the GIS layer

    Else ! Else statement

      Pause == Error: Scenario Name Not Valid ! Displays specified text if different scenario name is called

    End If ! End of if statement

    QGIS - GPKG
    If Scenario == EXG ! Beginning of if statement - existing scenario

       ! Defines a placeholder

    Else If Scenario == DEV ! Development scenario

      Read GIS Mat == 2d_mat_M02_landscape_002_R ! Sets material values according to attributes in the GIS layer

    Else ! Else statement

      Pause == Error: Scenario Name Not Valid ! Displays specified text if different scenario name is called

    End If ! End of if statement

  5. Save the TGC.

TUFLOW Control File (TCF)

  1. Save a copy of M08_~s1~_001.tcf as M08_~s1~_~s2~_002.tcf in the Module_08\TUFLOW\runs folder.
  2. Open the file M08_~s1~_~s2~_002.tcf in a text editor.
  3. Update the TGC reference:
    Geometry Control File == ..\model\M08_002.tgc ! Reference the TUFLOW Geometry Control File
  4. For GeoPackage users, update the Spatial Database reference:
    QGIS - GPKG
    Spatial Database == ..\model\gis\M08_002.gpkg ! Specify the location of the GeoPackage Spatial Database
  5. Save the TCF.

Running the Simulation

  1. Open _run_M08_HPC.bat from the Module_08\TUFLOW\runs folder.
  2. Update the batch file to reference the M08_~s1~_~s2~_002.tcf and in addition to cell size scenario switch (-s1) include second scenario switch (-s2) defining topography:
    set exe="..\..\..\exe\2023-03-AF\TUFLOW_iSP_w64.exe"
    set run=start "TUFLOW" /wait %exe% -b
    %run% -s1 2.5m -s2 EXG M08_~s1~_~s2~_002.tcf
    %run% -s1 2.5m -s2 DEV M08_~s1~_~s2~_002.tcf
    %run% -s1 5m -s2 EXG M08_~s1~_~s2~_002.tcf
    %run% -s1 5m -s2 DEV M08_~s1~_~s2~_002.tcf
    %run% -s1 10m -s2 EXG M08_~s1~_~s2~_002.tcf
    %run% -s1 10m -s2 DEV M08_~s1~_~s2~_002.tcf
  3. Save the batch file and double click it in file explorer to run the simulation.

Troubleshooting

See tips on common mistakes and troubleshooting steps if the model doesn't run:

Check Files

While the model is running, review the added features are specified correctly:

Results

When the model is finished, review the results:


Conclusion

  • Single and multiple scenarios were set up and run with a range of cell sizes and designs.
  • Check files were assessed to view the changes based on each scenario.
  • Multiple scenario results were viewed using the TUFLOW Viewer.


Looping Batch File (Optional)

Looping batch file is a powerful tool running large number of simulations with the least amount of batch file text:

  1. Save a copy of _run_M08_HPC.bat as _run_M08_HPC_loop.bat in the Module_08\TUFLOW\runs folder.
  2. Add the following commands. Indentation is important in batch files, insert tabs to match the below spacing:
    echo off
    set exe="..\..\..\exe\2023-03-AF\TUFLOW_iSP_w64.exe"
    set run=start "TUFLOW" /wait %exe% -b

    set CSZ=10m 5m 2.5m
    set DES=EXG DEV

    for %%a in (%CSZ%) do (
      for %%b in (%DES%) do (
          echo Running %%a %%b
          %run% -s1 %%a -s2 %%b M08_~s1~_~s2~_002.tcf
      )
    )

    Note: The 'CSZ' and 'DES' are user defined batch file variables. The 'CSZ' refers to a cell size and 'DES' refers to a design scenario.

  3. Save the batch file and double click it in file explorer to run the simulation.


Up
Go-up.png Back to Tutorial Introduction Main Page