XPSWMM to TUFLOW-SWMM: Difference between revisions

Content deleted Content added
Line 505:
'''Note:''' For this demonstration, all commands will reference the datasets in the provided conversion model. Please update these references with the filenames sued in your model.<br>
<br>
 
=== Optional: Format TUFLOW Control Files ===
In the process of converting a model, the <u>[[Convert_TUFLOW_Model_GIS_Format |Convert TUFLOW Model GIS Format]]</u> processing tool adds commands to the TUFLOW control files created by XPSWMM. While these control files contain most of the essential commands, they typically lack sufficient information to enable the mode to run smoothly.
 
In the sections above, we removed unnecessary commands from the TUFLOW control files and introduced additional commands to ensure the TUFLOW SWMM model runs smoothly. In this section, we will format and organize the TUFLOW control files to enhance readability, thereby improving the overall functionality of the model. This can be done by:
:* Using relative file paths to specify the location of various files and layers in the model.
:* Including a title at the beginning of each control file. For example, <font color="green"><tt>! TUFLOW CONTROL FILE (.TCF) defines the model simulation parameters and directs input from other data sources</tt></font>.
:* Adding headings to sections of the control file. For example, <font color="green"><tt>! MODEL INITIALIZATION</tt></font> could be used as a header for the commands required to initialize the TUFLOW SWMM model.
:* Utilizing comments to explain the purpose of commands. For example, <font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\gis\1D2D_Urban_001.gpkg </tt></font> <font color="green"><tt> ! Specify the location of the GeoPackage Spatial Database</tt></font>.<br>
 
 
 
=== Clean TUFLOW Control Files ===
Line 576 ⟶ 565:
<li>
</ol>
 
Additionally, these files are often not neatly structured. To ensure a functional and easily readable mode, it is recommended to 'clean up' the TUFLOW control files. This can be done by:
:* Adding in commands required to execute the model. For example, <font color="blue"><tt>Solution Scheme </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> HPC </tt></font> <font color="green"><tt> ! Heavily Parallelised Compute, uses adaptive timestepping</tt></font>.<br>
:* Removing unnecessary commands.
:* Using relative file paths to specify the location of various files and layers in the model.
:* Including a title at the beginning of each control file. For example, <font color="green"><tt>! TUFLOW CONTROL FILE (.TCF) defines the model simulation parameters and directs input from other data sources</tt></font>.
:* Adding headings to sections of the control file. For example, <font color="green"><tt>! MODEL INITIALIZATION</tt></font> could be used as a header for the commands required to initialize the TUFLOW SWMM model.
:* Using comments to explain the purpose of commands. For example, <font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\gis\1D2D_Urban_001.gpkg </tt></font> <font color="green"><tt> ! Specify the location of the GeoPackage Spatial Database</tt></font>.<br>
<br>
 
The process below demonstrates how to clean up a TCF, using the provided model conversion dataset.
<ol>
<li> In Windows File Explorer, navigate to the '''TUFLOW\runs''' folder and open the TCF into a Text Editor (Notepad++ is recommended).
<li> Add control file title and section headings: <br>
<font color="green"><tt>! TUFLOW CONTROL FILE (.TCF) defines the model simulation parameters and directs input from other data sources<br>
! MODEL INITIALIZATION <br>
! SOLUTION SCHEME <br>
! MODEL INPUTS <br>
! TIME CONTROL <br>
! OUTPUT FOLDERS <br>
! OUTPUT SETTINGS <br>
! TIME SERIES PLOT OUTPUT</tt></font>
<li> Organize the commands into these section headings. <br>
<font color="green"><tt>! MODEL INITIALIZATION</tt></font><br>
<font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\gis\1D2D_Urban_001.gpkg </tt></font> <br>
<font color="blue"><tt>GPKG Projection </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ??? </tt></font> <br>
<font color="blue"><tt>TIF Projection </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\grid\1D2D_Urban_Grid.tif </tt></font> <br>
<font color="green"><tt>! MODEL INPUTS</tt></font><br>
<font color="blue"><tt>Geometry Control File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\1D2D_Urban_001.tgc </tt></font> <br>
<font color="blue"><tt>BC Control File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\1D2D_Urban_001.tbc </tt></font> <br>
<font color="blue"><tt>BC Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\bc_dbase\1D2D_Urban_001_2d_bc_db.csv </tt></font> <br>
<font color="blue"><tt>Read Materials File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\1D2D_Urban_001_Mat.csv </tt></font> <br>
<font color="blue"><tt>Read Soils File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\1D2D_Urban_001.tsoilf </tt></font> <br>
<font color="green"><tt>! TIME CONTROL</tt></font><br>
<font color="blue"><tt>Timestep </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 1.000000 </tt></font> <br>
<font color="green"><tt>! OUTPUT SETTINGS</tt></font><br>
<font color="blue"><tt>Map Output Data Types </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> q V d h Z0 </tt></font> <br>
<font color="blue"><tt>Map Output Interval (s) </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 60.000000 </tt></font> <br>
<font color="green"><tt>! TIME SERIES PLOT OUTPUT</tt></font><br>
<font color="blue"><tt>Read GIS PO </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 1D2D_Urban_001_2d_po_P </tt></font> <br>
<font color="blue"><tt>Read GIS PO </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 1D2D_Urban_001_2d_po_L </tt></font> <br>
<font color="blue"><tt>Time Series Output Interval (s) </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 60.000000 </tt></font> <br>
<li> In the 'Model Initialization' and 'Solution Scheme' sections, add in the commands required to run the TUFLOW model: <br>
<font color="green"><tt>! MODEL INITIALIZATION</tt></font><br>
<font color="blue"><tt>Tutorial Model </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ON </tt></font> <br>
<font color="blue"><tt>GIS Format </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt> GPKG </tt></font> <br>
<font color="green"><tt>! SOLUTION SCHEME</tt></font><br>
<font color="blue"><tt>Solution Scheme </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt> HPC </tt></font> <br>
<font color="blue"><tt>Hardware </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt> GPU </tt></font> <br>
<li> Set the start and end time of the model:<br>
<font color="green"><tt>! TIME CONTROL</tt></font><br>
<font color="blue"><tt>Start Time </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 0</tt></font> <br>
<font color="blue"><tt>End Time </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 3 </tt></font> <br>
<li> Set the model output folders:<br>
<font color="green"><tt>! OUTPUT FOLDERS</tt></font><br>
<font color="blue"><tt>Log Folder </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> log </tt></font> <br>
<font color="blue"><tt>Output Folder </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\results\ </tt></font> <br>
<font color="blue"><tt>Write Check Files </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\check\ </tt></font> <br>
<li> Add the following commands to the 'Output Settings' section:<br>
<font color="blue"><tt>Map Output Format </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt> XMDF TIF </tt></font> <br>
<font color="blue"><tt>TIF Map Output Interval </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> 0 </tt></font> <br>
<li> Add comments to explain the commands.
<li> Remove all commands not included in the headings above, they are unnecessary for a TUFLOW SWMM model.
<li> If using the provided model conversion dataset, the final TCF should look like this:
<br><br>
[[File:XPSWMM_to_TUFLOW_clean_up_TCF_01b.png]]
<br>
</ol>
<br>
 
=== TUFLOW Control File (TCF) ===
Line 660 ⟶ 580:
<ol>
<li> In Windows File Explorer, navigate to the '''TUFLOW\model''' folder and create a new blank text file with the extension .tscf.
<li> Open the TSCF into a Text Editor (Notepad++ is recommended) and add the following commands. These filenames are examples, reference your model SWMM INP files.<br>
<font color="blue"><tt>Read SWMM </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\swmm\1D2D_Urban_HDR_001.inp </tt></font> <font color="green"><tt> ! 1D SWMM Pipe Network input file</tt></font><br>
<font color="blue"><tt>Read SWMM </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\swmm\1D2D_Urban_RNF_001.inp </tt></font> <font color="green"><tt> ! 1D SWMM Hydrology input file</tt></font><br>
Line 674 ⟶ 594:
<ol>
<li> In Windows File Explorer, navigate to the '''TUFLOW\model''' folder and open the TBC into a text editor (Notepad++ is recommended).
<li> Remove the reference to the 2d_bc points layer. This layer was removed from the model GeoPackage in the <u>[[#Export_1D_EPA_SWMM_Pipe_Network_Data_from_XPSWMM |Export 1D EPA SWMM Pipe Network Data from XPSWMM]]</u> section.
<li> Add the following command to reference the link between the 1D SWMM culverts and the 2D TUFLOW domain.<br>
<li> The TBC should reference the 2D boundary condition layer and the 1D/2D connection layer. In this case, they are both included in the 2d_bc connections layer. <br>
<font color="blue"><tt>Read GIS BC </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_bc_Culvert_Connections_001_L </tt></font> <font color="green"><tt> ! Links 1D SWMM culverts to the 2D TUFLOW domain</tt></font><br>
<font color="blue"><tt>Read GIS BC </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>1D2D_Urban_001_2d_bc_L </tt></font> <font color="green"><tt> ! Reads in 2D boundaries and links 1D SWMM culverts to the 2D TUFLOW domain</tt></font><br>
<br>
'''<font color="red">Video</font>'''
Line 687 ⟶ 608:
:* Bed material type or flow resistance value.
<br>
Once theThe TGC has been 'cleaned up',requires no further updates; should be necessary. Howeverhowever, it is recommended to review the TGC before running the simulation to ensure all commands are correct.
<br><br>
 
=== TUFLOW Control File (TCF) ===
The TCF file references all the control files, specifies time and output controls.<br>
 
In the <u>[[#Convert_XPSWMM_Model_to_Recommended_TUFLOW_Structure | Convert XPSWMM Model to Recommended TUFLOW Structure]]</u> section, the <u>[[Convert_TUFLOW_Model_GIS_Format |Convert TUFLOW Model GIS Format]]</u> processing tool utilizes the TUFLOW control files generated by XPSWMM to construct the TUFLOW SWMM model control files. During this process, the tool updates the commands within the TUFLOW control files to align with the requirements of a TUFLOW SWMM model. However, since the original control files were intended for use with XPSWMM, they lack the commands required to execute a TUFLOW simulation. Additionally, these files often contain unnecessary and/or outdated commands.<br>
 
In the section above, the TBC was edited to reflect the model updates implemented during the conversion process, while no updates were necessary for the TGC. However, the TCF requires updating to ensure the TUFLOW SWMM model runs smoothly.
<ol>
<li> Remove or comment out the commands listed below.
{|
|style="width: 50%"| <font color="blue"><tt>Check MI Save Date </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>Mass Balance Output Interval (s) </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>MI Projection </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>CSV Time </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>MI Projection Check </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>Viscosity Formulation </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>Timestep (s) </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>Viscosity Coefficient </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>Cell Wet/Dry Depth </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>SX ZC Check </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>Read GIS XP Nodes </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>SX Storage Approach </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>Simulations Log Folder </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>HX ZC Check </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>Store Maximums and Minimums </tt></font> <font color="red"><tt>== </tt></font>
|<font color="blue"><tt>Mass Balance Corrector </tt></font> <font color="red"><tt>== </tt></font>
|-
|<font color="blue"><tt>Mass Balance Output </tt></font> <font color="red"><tt>== </tt></font>
|}
 
<li> Make the following updates:
{|class="wikitable"
! Original Command
! Updated Command
|-
|<font color="blue"><tt>GPKG Projection </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>1D2D_Urban_001_proj</tt></font>
|<font color="blue"><tt>GPKG Projection </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>??</tt></font>
|-
|<font color="blue"><tt>Write Check Files </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>OFF</tt></font>
|<font color="blue"><tt>Write Check Files </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\check\</tt></font>
|-
|<font color="blue"><tt>Output Folder </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\results\Output </tt></font>
|<font color="blue"><tt>Output Folder </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\results\</tt></font>
|-
|<font color="blue"><tt>Log Folder </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>log\Log </tt></font>
|<font color="blue"><tt>Output Folder </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt>log</tt></font>
|-
|<font color="blue"><tt>Map Output Data Types </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>qVdhZ0 </tt></font>
|<font color="blue"><tt>Map Output Data Types </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>q V d h Z0</tt></font>
|-
|<font color="blue"><tt>Map Output Format </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt>XMDF </tt></font>
|<font color="blue"><tt>Map Output Format </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt>XMDF TIF</tt></font>
|}
 
<li> Add the following commands:<br>
<font color="blue"><tt>Tutorial Model </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt>ON </tt></font> <font color="green"><tt> ! Required command to run this tutorial model licence free</tt></font><br>
<font color="blue"><tt>GIS Format </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt>GPKG </tt></font> <font color="green"><tt> ! Specify GPKG as the output format for all GIS files</tt></font><br>
<font color="blue"><tt>Solution Scheme </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt>HPC </tt></font> <font color="green"><tt> ! Heavily Parallelised Compute, uses adaptive timestepping</tt></font><br>
<font color="blue"><tt>Hardware </tt></font> <font color="red"><tt>== </tt></font> <font color="blue"><tt>CPU </tt></font> <font color="green"><tt> ! Replace with "Hardware == GPU" if GPU available </tt></font><br>
<font color="blue"><tt>Start Time </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>0 </tt></font> <font color="green"><tt> ! Specifies the simulation start time (0 hours) </tt></font><br>
<font color="blue"><tt>End Time </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>3 </tt></font> <font color="green"><tt> ! Specifies the simulation end time (3 hours)</tt></font><br>
 
<li> Add the following command to reference the TUFLOW SWMM Control File (TSCF):<br>
<font color="blue"><tt>SWMM Control File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\model\1D2D_Urban_001.tscf</tt></font>
</ol>
 
 
=== Optional: Format TUFLOW Control Files ===
In the sections above, we removed unnecessary commands from the TUFLOW control files and introduced additional commands to ensure the TUFLOW SWMM model runs smoothly. In this section, we will format and organize the TUFLOW control files to enhance readability, thereby improving the overall functionality of the model. This can be done by:
:* Using relative file paths to specify the location of various files and layers in the model.
:* Including a title at the beginning of each control file. For example, <font color="green"><tt>! TUFLOW CONTROL FILE (.TCF) defines the model simulation parameters and directs input from other data sources</tt></font>.
:* Adding headings to sections of the control file. For example, <font color="green"><tt>! MODEL INITIALIZATION</tt></font> could be used as a header for the commands required to initialize the TUFLOW SWMM model.
:* Utilizing comments to explain the purpose of commands. For example, <font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\gis\1D2D_Urban_001.gpkg </tt></font> <font color="green"><tt> ! Specify the location of the GeoPackage Spatial Database</tt></font>.<br>
<br>
If using the provided model conversion dataset, the final Control files should look like this:<br>
'''<font color="red"> insert images when dataset finalised </font>'''
<br>
 
=Converted Dataset=