Macros that you define for automatic execution during the calculation can also be used interactively by you during the problem setup or postprocessing. For example, if you define a macro that performs a certain type of adaption after each iteration, you can also use the macro to perform this adaption interactively.
Definition of a macro is accomplished as follows:
In the Execute Commands Dialog Box, click the button to open the Define Macro Dialog Box (Figure 28.37: The Define Macro Dialog Box). Since this is a “modal” dialog box, the solver will not allow you to do anything else until you perform step 2, below.
In the Define Macro dialog box,
specify a Name for the macro (for example, adapt1) and click . (The Define Macro... button in the Execute Commands dialog box will become the End Macro button.)
Perform the steps that you want the macro to perform. For example, if you want the macro to perform gradient adaption, open the Gradient Adaption dialog box, specify the appropriate adaption function and parameters, and click to perform the adaption.
Important: If the command to be executed involves saving a file, see Saving Files During the Calculation for important information.
When you have completed the steps you want the macro to perform, click the button in the Execute Commands dialog box.
As noted above, once you have defined a macro for execution
during the calculation, you can use it at any time. If you defined
the macro called adapt1 to adapt based on
pressure gradient, you can simply type adapt1 in the console to perform this adaption. This macro is independent
of any text menus, so you need not move to a different text menu to
use it. Macros can be saved to and read from files. To save all macros
that are currently defined, use the file/write-macros text command. To read all the macros in a macro file, use the file/read-macros text command.
Important: A macro, like a journal file, is a simple record/playback function. It will therefore know nothing about the state in which it was recorded or the state in which it is being played back. You must be careful not to change directories while defining a macro. Also, you must be careful that all surfaces, variables, and so on, that are used by the macro have been properly defined when you (or ANSYS Fluent) invoke the macro.