Run TUFLOW From a Batch-file: Difference between revisions
Content deleted Content added
No edit summary |
Ellis Symons (talk | contribs) No edit summary |
||
| (9 intermediate revisions by 4 users not shown) | |||
Line 23:
===Pause===
A second line with the text "pause" can be added, this will prompt the user to press a key at the end of the batch file. This is useful if the
<pre>"C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe" "M01_5m_001.tcf"
pause</pre>
Line 62:
==No Console Option==
Using the -nc switch will run a simulation without opening a
<pre>Start "TUFLOW" /wait /min "C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe" -nc M01_5m_001.tcf
Start "TUFLOW" /wait /min "C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe" -nc M01_2.5m_001.tcf</pre>
It is possible to get a text output of the console using:
<pre>Start "TUFLOW" /wait /min "C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe" -nc M01_5m_001.tcf > M01_5m_001.txt
Start "TUFLOW" /wait /min "C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe" -nc M01_2.5m_001.tcf > M01_2.5m_001.txt</pre>
== TUFLOW switches in a batch file==
Line 101 ⟶ 105:
;* “p” (path); and<br>
: The addition of the “p” flag (e.g. -cp) allows the user to specify an alternate path in which to copy the model. Without this flag, the location defaults to the .tcf’s location. For example, specifying the following, will place a copy of the model into a folder C:\put_model_here:<br>
;* “ncf” (no check files)<br>
: The addition of the “ncf” flag (e.g. -cncf) copies the essential input files and excludes all check files.<br>
Line 144 ⟶ 148:
: The addition of the “L” flag (e.g. -pmL) list the files to be copied into an output file, but don’t copy.<br>
;* “ini” (file.ini)<br>
: The addition of the “ini” flag (e.g. -pmini) provides a .ini file with user defined options. A .ini file can be used to overwrite the default base and destination folders, and specify events/scenarios for models with events/scenarios in filenames.
Combinations of the above are also valid, with the order of the optional switches not being important (-pmAllL would be treated the same as -pmLAll).<br>
Line 163 ⟶ 167:
An example of package model that copies all files with specified .ini file (-pmAllini) is:<br>
<pre>start "TUFLOW" "C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe" -pmAllini package.ini "C:\TUFLOW\Tutorial_Wiki\TUFLOW\runs\M01_5m_001.tcf"</pre>
An example of .ini file to overwrite the default base and destination folders, and specify events/scenarios for models with events/scenarios in filenames:<br>▼
====INI files with Events and Scenarios====
▲An example of .ini file to overwrite the default base and destination folders, and specify events/scenarios for models with events/scenarios in filenames
The model scenario and event options are required only if there are files that use the event or scenario variables in file names. This option does not limit the files that TUFLOW will package by scenario or event.
E.g. you may have the following command to read in either a base or development TIF grid:
<pre>
Read GRID Zpts == ..\model\grid\DEM_<<~s1~>>.tif
</pre>
In this example, we can assume that the <tt><<~s1~>></tt> variable could be replaced with either <tt>"Base"</tt> or <tt>"Dev"</tt>. The example ini file below shows how to ensure that TUFLOW will package both the "Base" and "Dev" files correctly. The same concept applies for event variables, noting that events defined in the event file (TEF) and their associated boundary files are not required to use this. It is only required if the event variable is used i.e. <tt><<~e1~>></tt>.
<pre>
Base Folder ==
Copy Destination ==
Model Scenario ~
Model Event ~
</pre>
Line 279 ⟶ 291:
<pre>set TUFLOWEXE="C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe"
set RUN=start "TUFLOW" /wait
%RUN% MR_H99_C25_Q100.tcf
%RUN% MR_H99_C25_Q050.tcf
%RUN% MR_H99_C25_Q020.tcf</pre>
The advantage of using variables is if the path to the TUFLOW exe changes, or to run a different version of TUFLOW, it is just a simple change in the .bat file. In the above, note the use of quotes
===Looping in a batch file===
Line 309 ⟶ 321:
With the following line:<br>
<tt><u>echo</u> start "TUFLOW" /wait "C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe" -b -e1 %%a -e2 %%b filename.tcf</tt><br>
By using the echo in the command line, rather than starting the simulations the command line will be displayed in the
[[File:DOS nested batch output.png|frame|none]]
Line 408 ⟶ 420:
REM ______________SET RUN VARIABLES_____________
set TUFLOWEXE="C:\TUFLOW\Releases\2020-10-AE\TUFLOW_iSP_w64.exe"
set RUN=start "TUFLOW" /low
set /a CPU_Cores=5
Line 458 ⟶ 470:
@echo off
set TUFLOWEXE_iSP="C:\Releases\2023-03-AF\TUFLOW_iSP_w64.exe"
set RUN_iSP=start "TUFLOW" /wait
set A=5m 2.5m
| |||