[ANSYS, Inc. Logo] return to home search
next up previous contents index

26.14.1 Defining Macros

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:

1.   In the Execute Commands dialog box, click the Define Macro... button to open the Define Macro dialog box (Figure  26.14.2). Since this is a "modal'' dialog box, the solver will not allow you to do anything else until you perform step 2, below.

Figure 26.14.2: The Define Macro Dialog Box
figure

2.   In the Define Macro dialog box, specify a Name for the macro (e.g., adapt1) and click OK. (The Define Macro... button in the Execute Commands dialog box will become the End Macro button.)

3.   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 Adapt to perform the adaption.

figure   

If the command to be executed involves saving a file, see Section  26.14.2 for important information.

4.   When you have completed the steps you wish the macro to perform, click the End Macro 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 window 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.

figure   

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, etc. that are used by the macro have been properly defined when you (or ANSYS FLUENT) invoke the macro.


next up previous contents index Previous: 26.14 Executing Commands During
Up: 26.14 Executing Commands During
Next: 26.14.2 Saving Files During
Release 12.0 © ANSYS, Inc. 2009-01-29