Execution of a loop in a CFD-Post session file be stopped

  • 130 Views
  • Last Post 17 October 2017
admin posted this 27 September 2017

How can the execution of a loop in a CFD-Post session file be stopped?

admin posted this 17 October 2017

Often loops are used in session files and sometimes these session files can take tens of minutes to run. A session file cannot be stopped with the CFD-Post “Stop” button, however having a method to break the loop in the session file can save time. The following Perl code can be inserted into the loop in the session file which will exit the loop if a specified file is detected. If the user wishes to stop the execution of the loop in the session file, they need to create that specified file. In the example below if the user creates the file “stop.txt” in “D:\”, the loop will be exited. Note that the file does not need to contain any data and can be empty. ! if (-f "Dstop.txt") {#if the file “D:\stop.txt” is found then… ! last;#last command will exit the loop !}

Close