Difference between revisions of "Tutorial Module10 Archive"

From Tuflow
Jump to navigation Jump to search
(Created page with "<ol> =Introduction= This module further develops the model created during <u>Module 01</u>. Please complete Module 01 before attempting this tutorial, it...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<ol>
 
<ol>
 
=Introduction=
 
=Introduction=
This module further develops the model created during <u>[[Tutorial_Module01|Module 01]]</u>. Please complete Module 01 before attempting this tutorial, it is the starting point for the model updates documented below.<br>
+
This module further develops the model created during <u>[[Tutorial_Module01_Archive|Module 01]]</u>. Please complete Module 01 before attempting this tutorial, it is the starting point for the model updates documented below.<br>
 
This tutorial focuses on demonstrating various Scenario and Event management options. In TUFLOW terminology:  
 
This tutorial focuses on demonstrating various Scenario and Event management options. In TUFLOW terminology:  
 
* Scenario = A topographic or model configuration feature. <br>
 
* Scenario = A topographic or model configuration feature. <br>
Line 104: Line 104:
  
 
==Run The Model and Review Results==
 
==Run The Model and Review Results==
Run '''M10_5m_~s1~_001.tcf''' using your preferred method, as described <u>[[Tutorial_Module01#Running_TUFLOW|here]]</u>.<br>
+
Run '''M10_5m_~s1~_001.tcf''' using your preferred method, as described in <u>[[Tutorial_Module01_Archive#Run_Simulation | Module 1]]</u>.<br>
  
 
The default scenario we have specified in the TCF using the <font color="blue"><tt> Model Scenarios </tt></font> command will be selected if you run the model from a text editor. Running the model from a batch file is more common for models using scenario logic. The scenario specified within the batch file will take precedence over the scenario specified with the TCF.
 
The default scenario we have specified in the TCF using the <font color="blue"><tt> Model Scenarios </tt></font> command will be selected if you run the model from a text editor. Running the model from a batch file is more common for models using scenario logic. The scenario specified within the batch file will take precedence over the scenario specified with the TCF.
Line 123: Line 123:
 
<li> Double click the batch file in Windows Explorer to run TUFLOW. Two simulations will be executed in series. The EXG scenario will run first, followed by the DEV scenario.
 
<li> Double click the batch file in Windows Explorer to run TUFLOW. Two simulations will be executed in series. The EXG scenario will run first, followed by the DEV scenario.
 
<li>Review the model results in your preferred result viewing program (i.e. SMS, WaterRIDE, QGIS, Blue Kenue).<br>
 
<li>Review the model results in your preferred result viewing program (i.e. SMS, WaterRIDE, QGIS, Blue Kenue).<br>
''Note: For useful tips how to compare simulation results, refer to the Compare Results section of <u>[[Tutorial_Module05#Compare_results |Module 05]]</u>.''
+
''Note: For useful tips how to compare simulation results, refer to the Compare Results section of <u>[[Tutorial_Module05_Archive#Compare_results |Module 05]]</u>.''
 
</ol>
 
</ol>
  
Line 376: Line 376:
 
<font color="blue"><tt>Set Variable <name> </tt></font> <font color="red"><tt>==</tt></font> <tt><value></tt><br>
 
<font color="blue"><tt>Set Variable <name> </tt></font> <font color="red"><tt>==</tt></font> <tt><value></tt><br>
 
The Variable can be used in any TUFLOW control file. The variable is called by bounding the variable name within "<<" and ">>" characters. <br>
 
The Variable can be used in any TUFLOW control file. The variable is called by bounding the variable name within "<<" and ">>" characters. <br>
''Tip: if you find that your Set Variables are becoming a large part of your TUFLOW control files, it can be beneficial to collate the variables within a TUFLOW <font color="blue"><tt>Read File</tt></font>. Refer to the TUFLOW manual for more details.''
+
''Tip: if you find that your Set Variables are becoming a large part of your TUFLOW control files, it can be beneficial to collate the variables within a TUFLOW <font color="blue"><tt>Read File</tt></font>. Refer to the <u>[https://docs.tuflow.com/classic-hpc/manual/latest/ TUFLOW Manual]</u> for more details.''
 
<br>
 
<br>
  
Line 532: Line 532:
 
= Advanced - HPC Solver (Optional) =
 
= Advanced - HPC Solver (Optional) =
 
This section introduces how to run the model using TUFLOW’s HPC (Heavily Parallelised Compute) solver with scenario control. It is much more convenient to select the model solver using scenario control than how it was done in other tutorials, because you only need to create one .tcf file for both the HPC and/or Classic simulations.  
 
This section introduces how to run the model using TUFLOW’s HPC (Heavily Parallelised Compute) solver with scenario control. It is much more convenient to select the model solver using scenario control than how it was done in other tutorials, because you only need to create one .tcf file for both the HPC and/or Classic simulations.  
 +
 +
Please see [[HPC_Features_Archive | HPC Features Archive]] for more information on TUFLOW HPC features supported in the 2017 release.
  
 
==Model Setup==
 
==Model Setup==
Line 590: Line 592:
  
 
==Results==
 
==Results==
Using the methods described above in the <u>[[Tutorial_Module01#Viewing_Results | Viewing Results]]</u> section of Module 1.  
+
Using the methods described above in the <u>[[Tutorial_Module01_Archive#Viewing_Results | Viewing Results]]</u> section of Module 1.  
 
* Check the simulation logs in the DOS window, .tlf and .hpc.tlf log files.
 
* Check the simulation logs in the DOS window, .tlf and .hpc.tlf log files.
 
* View the results in your preferred package.
 
* View the results in your preferred package.

Latest revision as of 11:57, 10 October 2024

    Introduction

    This module further develops the model created during Module 01. Please complete Module 01 before attempting this tutorial, it is the starting point for the model updates documented below.
    This tutorial focuses on demonstrating various Scenario and Event management options. In TUFLOW terminology:

    • Scenario = A topographic or model configuration feature.
    (eg. existing catchment topography, development scenario topography, cell size etc.)
    • Event = An input associated with a forcing boundary condition. Examples include:
    • Event magnitude: (eg. 10, 20, 50, 100 year ARI etc.)
    • Storm duration (eg. 1,2,3,6,12, 24, 36 hours etc.)
    • Design storm temporal pattern (eg. Australian Rainfall and Runoff 1 to 10)
    • Tail water condition (eg. high tide, low tide, storm tide, climate change etc.)

    In previous tutorials, new TUFLOW Control File (TCF), TUFLOW Geometry Control (TGC) file and ESTRY Control Files (ECF) were required each time a different model scenario or event was modelled. During complex modelling projects this has the potential to result in a large number of input files. This can become a project management challenge. TUFLOW incorporates scenario and event control logic to overcome these challenges, significantly reducing the number of simulation files required during a complex project. The figure below shows a project requiring over 30 simulations consolidated into a single TCF file.

    Tute M10 scenario management comparison.JPG

    This tutorial will outline how to incorporate the following simulation management features into a model:

    • Scenarios
    • Events
    • Variables

    Download Dataset

    Download the Tutorial Model dataset relevant to your GIS environment (ArcGIS, MapInfo or QGIS) from the TUFLOW website. GIS data for this module is available within the Module_Data\Module_10 folder. The provided files include:

    • 020yr1hr.csv
    • 020yr2hr.csv
    • 020yr3hr.csv
    • 050yr1hr.csv
    • 050yr2hr.csv
    • 050yr3hr.csv
    • 100yr1hr.csv
    • 100yr3hr.csv

    These are boundary condition input files for the event management portion of this tutorial. Save the csv files to your working TUFLOW\model\bc_dbase folder.

    This model uses a GIS file created during module 5. If you have not completed Module 5 you will need to copy a file from the "Complete_Model" dataset. Please note, this step is NOT necessary if Module 5 has been completed.

    MapInfo Users

    1. Import 2d_zsh_M05_development_001.mif from the Complete_Model\TUFLOW\model\mi folder.
    2. Save the file in the working TUFLOW\model\mi folder.
    3. Export 2d_zsh_M05_development_001.mif to the working folder.

    ArcGIS Users

    1. Import 2d_zsh_M05_development_001_R.shp from the Complete_Model\TUFLOW\model\gis folder.
    2. Save the file in the working TUFLOW\model\gis folder.

    Scenario Management (Simple)

    Modify Simulation Control Files

    For this tutorial we will run two different scenarios from a single TCF. The scenarios will be identified using the acronyms "EXG" and "DEV". "EXG" will represent the existing catchment conditions. "DEV" will represent a catchment state including a proposed development scenario. In this example, differences between both scenarios will be limited to changes in topography. All other model inputs will be identical.

    TUFLOW Control File (TCF)

    We will create a new TCF based on Tutorial Module 1: M01_5m_002.tcf from your working TUFLOW\runs folder. Please complete Module 1 before attempting this tutorial.

    1. Open M01_5m_002.tcf in your text editor and save as M10_5m_~s1~_001.tcf.
      Note: ~s1~ within the new filename is a wildcard. It will be replaced with either "EXG" or "DEV" in the result files depending on which scenario simulation we run. For example, the TUFLOW Log File (TLF) for the "EXG" scenario simulation will become M10_5m_EXG_001.tlf. Similarly, the TLF for the "DEV" scenario simulation will become M10_5m_DEV_001.tlf.
    2. Add a new Model Scenarios command below Tutorial Model == ON
      Model Scenarios == EXG ! Available Options = EXG DEV
      This command will set the default scenario selection if the model is not run from a batch file. This command will be ignored if the simulation is initialed from a batch file (i.e. the scenario selection in the batch file will prevail). We have included a comment listing the available scenario options to the right of the command. This is good modelling practice. This will be of particular benefit to modellers who use the model in the future, though weren't involved in the models original development.
    3. Update the Geometry Control File (TGC) reference in the TCF to M10_5m_001.tgc. We will create the new TGC file in the next section.
      Geometry Control File == ..\model\M10_5m_001.tgc
    4. Update the result folder location command.
      Output Folder == ..\results\M10\100y\2d
    5. Save the TCF file.

    TUFLOW Geometry Control File (TGC)

    1. Open the Geometry Control File (TGC) M01_5m_002.tgc from your working TUFLOW\model folder.
    2. Save a copy of the TGC as M10_5m_001.tgc.
    3. Update the elevation section of the TGC file by adding scenario logic below the Read GRID Zpts command. The elevation section should now look like this:
      MapInfo Users
      Set Zpts == 75
      Read GRID Zpts == grid\DEM_M01.asc
      If Scenario == DEV
      Read GIS Z Shape == mi\2d_zsh_M05_development_001.mif
      Else If Scenario == EXG

      Else
      Pause == Scenario not recognised
      End If

      QGIS or ArcGIS Users
      Set Zpts == 75
      Read GRID Zpts == grid\DEM_M01.asc
      If Scenario == DEV
      Read GIS Z Shape == gis\2d_zsh_M05_development_001_R.shp
      Else If Scenario == EXG

      Else
      Pause == Scenario not recognised
      End If

      The above logic commands will use the new 2d_zsh GIS layer when the DEV scenario is simulated. Otherwise, it will be omitted for the EXG scenario. The Pause command will stop the simulation and output the message Scenario not recognised if a scenario other than DEV or EXG is specified.
      Note: Indenting commands within each section of the logic block improves the legibility. This formatting approach is common in most coding.
    4. Save the TGC file.

    Run The Model and Review Results

    Run M10_5m_~s1~_001.tcf using your preferred method, as described in Module 1.

    The default scenario we have specified in the TCF using the Model Scenarios command will be selected if you run the model from a text editor. Running the model from a batch file is more common for models using scenario logic. The scenario specified within the batch file will take precedence over the scenario specified with the TCF.

    1. Open the batch file provided in the complete model dataset in your text editor: Complete_Model\TUFLOW\runs\_run all simulations.bat
    2. Save a copy of the batch file in your working TUFLOW\runs folder (i.e. the same location as your TCF). Rename the file _run_M10_001_simulations.bat.
    3. Update the text within the batch file:
      set TUFLOWEXE_iSP=..\exe\2017-09-AC\w64\TUFLOW_iSP_w64.exe
      set RUN_iSP=start "TUFLOW" /wait /low "%TUFLOWEXE_iSP%" -b 
      %RUN_iSP% -s1 EXG M10_5m_~s1~_001.tcf %RUN_iSP% -s1 DEV M10_5m_~s1~_001.tcf

      Note: If your TUFLOW executable is located in a different location to the path listed above, reference it instead. Be careful NOT to use a space on either side of "=" when setting the TUFLOWEXE_iSP and RUN_iSP variables in the header of the batch file.

    4. Save and close the batch file.
    5. Double click the batch file in Windows Explorer to run TUFLOW. Two simulations will be executed in series. The EXG scenario will run first, followed by the DEV scenario.
    6. Review the model results in your preferred result viewing program (i.e. SMS, WaterRIDE, QGIS, Blue Kenue).
      Note: For useful tips how to compare simulation results, refer to the Compare Results section of Module 05.

    Scenario Management (Advanced)

    In the previous section we used scenario logic to model the existing catchment state (EXG) and a proposed development condition (DEV). These scenarios involved changes to the topography. More advanced scenario management is possible using multiple logic blocks, or nested logic. Logic blocks are acceptable in any of the TUFLOW control files (TCF, TGC, TBC, ECF etc.). In this section we will demonstrate how multiple scenario blocks can be incorporated into a model. We will add an additional scenario for cell size sensitivity testing. It will require updates to the TCF and TGC file.

    Modify Simulation Control Files

    TUFLOW Control File (TCF)

    1. Open M10_5m_~s1~_001.tcf in your text editor and save it as M10_~s1~_~s2~_002.tcf.
    2. Update the Model Scenarios command:
      Model Scenarios == 5m | EXG ! Available Options = 2.5m 5m | EXG DEV
      This command will set the default scenario selection if the model is not run from a batch file. The default scenarios will be:
      • Grid resolution = 5m; and
      • Topography = existing case (EXG).
      Note: This command line will be ignored if the simulation is run from a batch file (i.e. the scenario selection in the batch file is prevail).
    3. Update the Geometry Control File (TGC) reference in the TCF to M10_Xm_002.tgc. We will create the new TGC in the next section. We will be including scenario logic for two cell size options.
      Geometry Control File == ..\model\M10_Xm_002.tgc
    4. Replace the model time step command (Timestep == 1.5) command with the following scenario logic:
      If Scenario == 5m
      Timestep == 1.5
      Else If Scenario == 2.5m
      Timestep == 0.5
      Else
      Pause == Scenario not recognised
      End If
    5. Save the TCF file.

    TUFLOW Geometry Control (TGC)

    1. Open the Geometry Control File (TGC) M10_5m_001.tgc from your working TUFLOW\model folder.
    2. Save a copy of the TGC as M10_Xm_002.tgc.
    3. Replace the cell size command (Cell Size == 5) with the scenario logic block shown below:
      If Scenario == 5m
      Cell Size == 5
      Else If Scenario == 2.5m
      Cell Size == 2.5
      Else
      Pause == Cell size scenario not recognised
      End If
    4. Save the TGC file.

    Run The Model and Review Results

    Run M10_~s1~_~s2~_002.tcf by updating the batchfile you created to run M10_5m_~s2~_001.tcf.

    1. Open the _run_M10_001_simulations.bat batch file in your text editor. The file will be located in your working TUFLOW\Runs folder.
    2. Save a copy of the file using the name _run_M10_002_simulations.bat.
    3. Update the simulation commands within the batch file:
      set TUFLOWEXE_iSP=..\exe\2017-09-AC\w64\TUFLOW_iSP_w64.exe
      set RUN_iSP=start "TUFLOW" /wait /low "%TUFLOWEXE_iSP%" -b 
      %RUN_iSP% -s1 5m -s2 EXG M10_~s1~_~s2~_002.tcf %RUN_iSP% -s1 5m -s2 DEV M10_~s1~_~s2~_002.tcf %RUN_iSP% -s1 2.5m -s2 EXG M10_~s1~_~s2~_002.tcf %RUN_iSP% -s1 2.5m -s2 DEV M10_~s1~_~s2~_002.tcf
    4. Save and close the batch file.
    5. Double click the new batch file in Windows Explorer to run TUFLOW. Four simulations will be executed in the following order:
      • 5m EXG Scenario
      • 5m DEV Scenario
      • 2.5m EXG Scenario
      • 2.5m DEV Scenario
    6. Review the model results in your preferred result viewing program (i.e. SMS, WaterRIDE, QGIS, Blue Kenue).

    Event Management

    Events are typically associated with the boundary condition inputs to a model. TUFLOW's event management options allow the development of a model framework so all possible event combinations can be managed from a single TCF and run using a batch file.

    For example, a study may require assessment of the 10, 20, 50, 100 and 200 year Average Recurrence Interval (ARI) events. Each of these events may need to be assessed for multiple storm durations and also various design temporal patterns. This can result in a large number of simulation files.

    • A deterministic framework will typically require 10 - 50 simulations.
    • An ensemble approach can require 100 - 500 simulations.
    • A Monte Carlo approach requires 1000's of simulations.

    TUFLOW's event options make the management of these simulations a simple process.

    Due to the potentially large number of simulations, there is significant value associated with pre-planning to define a logical, structured and well thought through naming convention for all possible scenario and events before starting a modelling project. This information should be documented within a modelling log. For example:

    Description Acronym
    Scenario 1 Grid Resolution 2.5m
    5m
    Scenario 2 Topography Changes EXG
    DEV1
    DEV2
    DEV3
    ...
    Event 1 ARI Event Magnitude 010yr
    020yr
    050yr
    100yr
    Event 1 Event Duration 1hr
    2hr
    3hr
    4hr
    TCF file name: M10_~s1~_~s2~_~e1~_~e2~_003.tcf
    Sample result file name: M10_2.5m_EXG_100yr_4hr_003.tlf

    TUFLOW's event management structure uses a variety of wildcard characters in the TCF file name and the boundary condition database for event inputs. The wildcards are replaced with user defined event specific acronyms when a simulation is run from a batch file. This model design significantly reduces the number of repetitive files required to execute a project. A TUFLOW event management flowchart is shown below. The model design associated with this structure, and the benefits associated with it will become apparent in the demonstration provided in following sections.
    Event Logic 000.JPG


    TUFLOW Control File (TCF)

    1. Save a copy of the TCF M10_~s1~_~s2~_002.tcf as M10_~s1~_~s2~_~e1~_~e2~_003.tcf.
      In the same way as ~s1~ and ~s2~ are wildcard characters for scenario management, ~e1~ and ~e2~ are wildcard characters for event management.
    2. Add a new Model Events command below Model Scenarios == 5m | Exg
      Model Events == 100y | 2hr ! Available Options = 100y 050y 020y | 1hr 2hr 3hr
    3. Update the following command within the 'MODEL INPUTS' section:
      BC Database == ..\bc_dbase\bc_dbase_M10.csv
    4. Add an Event File command as the last line at the bottom of the TCF:
      Event File == M10_event_definition_003.tef
      Commands specified within the TUFLOW Event File (TEF) will take preference over commands in the TCF and ECF if the file is located at the bottom of the TCF.
    5. Save the TCF file.

    BC Database

    1. Copy the csv files from the Module_Data\Module10\bc_dbase folder and save the files in the TUFLOW\bc_dbase folder.
    2. Open the boundary condition database bc_dbase.csv and save the file as bc_dbase_M10.csv.
    3. Open bc_dbase_M10.csv in Excel and update cell B2 and B3. Replace 100yr2hr.csv with ARIdurn.csv. ARI and durn are wildcard variables. They will be assigned within the TUFLOW Event File (TEF) to reference the boundary condition time series .csv files.
    4. Save bc_dbase_M10.csv.

    TUFLOW Event File (TEF)

    1. Within the TUFLOW\runs folder, create a blank text file and rename it M10_event_definition_003.tef.
    2. Open the M10_event_definition_003.tef in your preferred text editor and add the following commands:
      !! RAINFALL EVENTS !!
      Define Event == 020y
      BC Event Source == ARI | 020yr
      Output Folder == ..\results\M10\020y\2d
      End Define
      !-----------------------
      Define Event == 050y
      BC Event Source == ARI | 050yr
      Output Folder == ..\results\M10\050y\2d
      End Define
      !-----------------------
      Define Event == 100y
      BC Event Source == ARI | 100yr
      Output Folder == ..\results\M10\100y\2d
      End Define
      !-----------------------

      !! RAINFALL DURATIONS !!
      Define Event == 1hr
      BC Event Source == durn | 1hr
      End Time == 1
      End Define
      !-----------------------
      Define Event == 2hr
      BC Event Source == durn | 2hr
      End Time == 3
      End Define
      !-----------------------
      Define Event == 3hr
      BC Event Source == durn | 3hr
      End Time == 4
      End Define
      !-----------------------
    3. Save the TEF file.
    • The BC Event Source commands in the TEF define the text strings that replace the two wildcards used in bc_dbase_M10.csv (~AEP~ and ~durn~).
    • Output Folder and End Time commands have been assigned to the event magnitudes and rainfall duration definitions. These commands will take precedent over the commands assigned in the TCF.


    Run The Model and Review Results

    Run M10_~s1~_~s2~_~e1~_~e2~_003.tcf by updating the batchfile created to run M10_~s1~_~s2~_002.tcf.

    1. Open the _run_M10_002_simulations.bat batch file in your text editor. The file will be located in your working TUFLOW\Runs folder.
    2. Save the batch file as _run_M10_003_simulations.bat.
    3. Update the simulation commands within the batch file:
      set TUFLOWEXE_iSP=..\exe\2017-09-AC\w64\TUFLOW_iSP_w64.exe
      set RUN_iSP=start "TUFLOW" /wait /low "%TUFLOWEXE_iSP%" -b 
      %RUN_iSP% -s1 5m -s2 EXG -e1 020y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 020y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 020y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 050y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 050y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 050y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 100y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 100y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 100y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 020y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 020y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 020y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 050y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 050y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 050y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 100y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 100y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 100y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_003.tcf
    4. Save and close the batch file.
    5. Double click the batch file in Windows Explore to run TUFLOW. 18 simulations will be executed in the order specified within the batch file.We have not altered the Scenario 1 options in this batch file. A further 18 additional simulations could be added to the batch file if the same models were run at a 2.5m grid resolution.
      This example demonstrates how easy it is to configure, simulate and manage multiple scenarios and events in TUFLOW. We have only used 2 scenario and 2 event variables. TUFLOW allows the use of up to 9 different Scenarios and 9 different Events. The allowable number of options within each Scenario and Event is limited to 100.
    6. Review the model results in your preferred result viewing program (i.e. SMS, WaterRIDE, QGIS, Blue Kenue).

    Set Variable

    Set Variable is a command allowing specification of different values for the same variable. They are particularly useful for:

    1. Simplifying scenario and event logic commands in situations where updates are required in multiple locations within a model. The change in cell size is an example of this. Updating the cell size requires Scenario logic blocks in the TGC where the cell size is defined, and in the TCF where the time step is specified. Set Variable provides a way to consolidate these updates within a single logic block in the TCF.
    2. Efficient management of the result folder structure, avoiding the need to hardcode different event specific output folder commands in the TEF (as was done in the previous section).

    This tutorial will demonstrate both benefits. Variables are defined using the following command:
    Set Variable <name> == <value>
    The Variable can be used in any TUFLOW control file. The variable is called by bounding the variable name within "<<" and ">>" characters.
    Tip: if you find that your Set Variables are becoming a large part of your TUFLOW control files, it can be beneficial to collate the variables within a TUFLOW Read File. Refer to the TUFLOW Manual for more details.

    TUFLOW Control File (TCF)

    In this tutorial we will be updating the previous multiple scenario/event model with a variety of variables. This update aims to simplify the TUFLOW Control File structure. This will make the model easier to interpret for model reviewers or people who use the model in the future who weren't involved in it's original development:

    1. Save a copy of the TUFLOW Control File M10_~s1~_~s2~_~e1~_~e2~_003.tcf and rename as M10_~s1~_~s2~_~e1~_~e2~_004.tcf.
    2. Add a new section within the TCF above the 'MODEL INPUTS' section:
      ! MODEL VARIABLES
      If Scenario == 5m
      Set Variable 2D_Timestep == 1.5
      Set Variable 2D_CELL_SIZE == 5.0
      Else If Scenario == 2.5m
      Set Variable 2D_Timestep == 0.5
      Set Variable 2D_CELL_SIZE == 2.5
      Else
      Pause == Scenario not recognised
      End If
    3. Update the TGC command. Replace:
      Geometry Control File == ..\model\M10_Xm_002.tgc
      with
      Geometry Control File == ..\model\M10_Xm_004.tgc
    4. Replace the command lines associated with the time step scenario control logic:
      If Scenario == 5m
      Timestep == 1.5
      Else If Scenario == 2.5m
      Timestep == 0.5
      Else
      Pause == Scenario not recognised
      End If
      With a single command line:
      Timestep == <<2D_Timestep>>
      We have previously defined the <<2D_timestep>> variable value for the different cell sizes in the Model Variable section above. The 'SIMULATION TIME CONTROL' section should only include three command lines:
      Timestep == <<2D_Timestep>>
      Start Time == 0
      End Time == 3
    5. Update the Output Folder command within the 'OUTPUT CONTROL AND FORMAT COMMANDS' section:
      Output Folder == ..\results\M10\<<~e1~>>\2d
      This will define the output folder name based on the event associated with the simulation. Scenarios can also be used in this way. A similar approach can also be used for defining the location of check files.
    6. Update the Event File command at the bottom of the TCF. Increment the version number from 003 to 004:
      Event File == M10_Event_definition_004.tef
      We will amend the Event File by removing the reoccurring Output Folder commands associated with each AEP event. The commands are no longer required now we are using the <<~e1~>> variable in the TCF command.
    7. Save the TCF file.

    TUFLOW Event File (TEF)

    1. Open M10_event_definition_003.tef in your preferred text editor. The file is located in the TUFLOW\runs folder.
    2. Save the file as M10_event_definition_004.tef. Delete the Output Folder commands from each rain event block. The final result should look like this: ## RAINFALL EVENTS ##
      Define Event == 020y
      BC Event Source == ARI | 020yr
      End Define
      !-----------------------
      Define Event == 050y
      BC Event Source == ARI | 050yr
      End Define
      !-----------------------
      Define Event == 100y
      BC Event Source == ARI | 100yr
      End Define
      !-----------------------

      ## RAINFALL DURATIONS ##
      Define Event == 1hr
      BC Event Source == durn | 1hr
      End Time == 1
      End Define
      !-----------------------
      Define Event == 2hr
      BC Event Source == durn | 2hr
      End Time == 3
      End Define
      !-----------------------
      Define Event == 3hr
      BC Event Source == durn | 3hr
      End Time == 4
      End Define
      !-----------------------
    3. Save the TEF file.

    TUFLOW Geometry Control File (TGC)

    1. Open the Geometry Control File (TGC) M10_Xm_002.tgc from your working TUFLOW\model folder.
    2. Save a copy of the TGC as M10_Xm_003.tgc.
    3. Replace the command lines associated with the Cell Size scenario control logic:
      If Scenario == 5m
      Cell Size == 5
      Else If Scenario == 2.5m
      Cell Size == 2.5
      Else
      Pause == Cell size scenario not recognised
      End If
      With a single command line:
      Cell Size == <<2D_CELL_SIZE>>
    4. Save the TGC.

    Run The Model and Review Results

    Run M10_~s1~_~s2~_~e1~_~e2~_004.tcf by updating the batchfile created to run M10_~s1~_~s2~_003.tcf.

    1. Open the _run_M10_003_simulations.bat batch file in your text editor. The file will be located in your working TUFLOW\Runs folder.
    2. Save the batch file as _run_M10_004_simulations.bat.
    3. Update the TCF file reference within the batch file:
      set TUFLOWEXE_iSP=..\exe\2017-09-AC\w64\TUFLOW_iSP_w64.exe
      set RUN_iSP=start "TUFLOW" /wait /low "%TUFLOWEXE_iSP%" -b 
      %RUN_iSP% -s1 5m -s2 EXG -e1 020y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 020y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 020y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 050y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 050y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 050y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 100y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 100y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 EXG -e1 100y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 020y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 020y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 020y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 050y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 050y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 050y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 100y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 100y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf %RUN_iSP% -s1 5m -s2 DEV -e1 100y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_004.tcf
    4. Save and close the batch file.
    5. Double click the batch file in Windows Explore to run TUFLOW.
    6. Review the model results in your preferred result viewing program (i.e. SMS, WaterRIDE, QGIS, Blue Kenue).


    Advanced - HPC Solver (Optional)

    This section introduces how to run the model using TUFLOW’s HPC (Heavily Parallelised Compute) solver with scenario control. It is much more convenient to select the model solver using scenario control than how it was done in other tutorials, because you only need to create one .tcf file for both the HPC and/or Classic simulations.

    Please see HPC Features Archive for more information on TUFLOW HPC features supported in the 2017 release.

    Model Setup

    In order to use the HPC solver, we will need to perform the following steps:

    1. Save the TUFLOW runfile M10_~s1~_~s2~_~e1~_~e2~_004.tcf as M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf.
    2. Add the following command to the TCF file:
      If Scenario == HPC
      Solution Scheme == HPC ! Use HPC solver to run the model
      Else If Scenario == CLA
      Solution Scheme == Classic ! Use Classic solver to run the model
      Else
      Pause == Invalid solution scheme
      End If

      If you have a CUDA enabled NVIDIA GPU device, you can also add the "Hardware == GPU" command under the "Solution Scheme == HPC" command to run the HPC solver using GPU hardware. As such, the scenario logic should now look like this:
      If Scenario == HPC
      Solution Scheme == HPC ! Use HPC solver to run the model
      Hardware == GPU ! Run HPC solver on GPU
      Else If Scenario == CLA
      Solution Scheme == Classic ! Use Classic solver to run the model
      Else
      Pause == Invalid solution scheme
      End If
    3. Update the batch file as follows.
      set TUFLOWEXE_iSP=..\exe\2017-09-AC\w64\TUFLOW_iSP_w64.exe
      set RUN_iSP=start "TUFLOW" /wait /low "%TUFLOWEXE_iSP%" -b 
      %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 020y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 020y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 020y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 050y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 050y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 050y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 100y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 100y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 EXG -s3 HPC -e1 100y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 020y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 020y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 020y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 050y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 050y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 050y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 100y -e2 1hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 100y -e2 2hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf %RUN_iSP% -s1 5m -s2 DEV -s3 HPC -e1 100y -e2 3hr M10_~s1~_~s2~_~e1~_~e2~_~s3~_005.tcf

      Note: You can replace "HPC" with "CLA" in the above batch file to run these models using the TUFLOW Classic solver.

    4. run the simulations by double clicking the batch file from Windows Explorer.

    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