19.5. Executing Commands at a User-Specified Iteration or Time Step

You can make modifications at a particular point during a simulation with the Execute command only once? command. This command gives you a choice to execute commands:

  • at the beginning of a particular iteration, or

  • at the end of a particular time step.

The purpose of this option is to give you greater control over when modifications are applied; changes are made at a specified iteration or time step even if you halt the run and write the files. The Execute command only once? command is available through the text user interface (TUI) console.

To activate this feature, enable beta feature access (Introduction) and set the scheme session variable execute-command-at? to true:

> (set! execute-command-at? #t)

19.5.1. Executing a Command at a Particular Iteration

The following example demonstrates how to execute a command at the beginning of a given iteration:

/solve/execute-commands> add-edit
Name of the command [command-1] command-1
Adding command-1
Execute command only once? [no] yes


Options: "iteration" 
When ["iteration"] "iteration"
iteration no. [1] 5
Command [""] "display close-window 1"

Note:  This is available for both transient and steady-state cases.


19.5.2. Executing a Command at a Particular Time Step

The following example demonstrates how to execute a command at the end of a particular time step:

/solve/execute-commands> add-edit
Name of the command [command-1] command-2
Adding command-2
Execute command only once? [no] yes


Options: "iteration" "time-step"
When ["iteration"] "time-step"
time-step no. [1] 5
Command [""] "display close-window 1"

Note:  This is available only for transient cases.