Ansys Fluent can be used interactively, with input from and display to your computer screen, or it can be used in a batch or background mode in which inputs are obtained from and outputs are stored in files. Generally you will perform problem setup, initial calculations, and postprocessing of results in an interactive mode. However, when you are ready to perform a large number of iterative calculations, you may want to run Ansys Fluent in batch or background mode. This allows the computer resources to be prioritized, enables you to control the process from a file (eliminating the need for you to be present during the calculation), and also provides a record of the calculation history (residuals) in an output file. While the procedures for running Ansys Fluent in a batch mode differ depending on your computer operating system, Background Execution on Linux Systems provides guidance for running in batch/background on Linux systems, and Background Execution on Windows Systems provides guidance for running in batch/background on Windows systems.
For additional information, see the following sections:
To run Ansys Fluent in the background in a C-shell (csh) on a Linux system, type a command of the following form at the system-level prompt:
fluent 2d -g < inputfile > & outputfile &
or in a Bourne/Korn-shell, type:
fluent 2d -g < inputfile > outputfile 2>&1 &
In these examples,
fluent
is the command you type to run Ansys Fluent interactively.-g
indicates that the program is to be run without the GUI or graphics (see Starting Ansys Fluent).inputfile
is a file of Ansys Fluent commands that are identical to those that you would type interactively.outputfile
is a file that the background job will create, which will contain the output that Ansys Fluent would normally print to the screen (for example, the menu prompts and residual reports).&
tells the Linux system to perform this task in background and to send all standard system errors (if any) tooutputfile
.
The file inputfile
can be a journal file created in an earlier
Ansys Fluent session, or it can be a file that you have created using a text editor. In either
case, the file must consist only of text interface commands (since the GUI is disabled during
batch execution). A typical inputfile
is shown below:
; Read case file rc example.cas ; Initialize the solution /solve/initialize/initialize-flow ; Calculate 50 iterations it 50 ; Write data file wd example50.dat ; Calculate another 50 iterations it 50 ; Write another data file wd example100.dat ; Exit Fluent exit yes
This example file reads a case file example.cas
, initializes the
solution, and performs 100 iterations in two groups of 50, saving a new data file after each 50
iterations. The final line of the file terminates the session. Note that the example input file
makes use of the standard aliases for reading and writing case and data files and for iterating.
(it
is the alias for /solve/iterate
,
rc
is the alias for /file/read-case
,
wd
is the alias for /file/write-data
, etc.)
These predefined aliases allow you to execute commonly used commands without entering the text
menu in which they are found. In general, Ansys Fluent assumes that input beginning with a
/
starts in the top-level text menu, so if you use any text commands
for which aliases do not exist, you must be sure to type in the complete name of the command
(for example, /solve/initialize/initialize-flow
). Note also that you
can include comments in the file. As in the example above, comment lines must begin with a
;
(semicolon).
An alternate strategy for submitting your batch run, as follows, has the advantage that the
outputfile
will contain a record of the commands in the
inputfile
. In this approach, you would submit the batch job in a
C-shell using:
fluent 2d -g -i inputfile >& outputfile &
or in a Bourne/Korn-shell using:
fluent 2d -g -i inputfile > outputfile 2>&1 &
To run Ansys Fluent in the background on a Windows system, the following commands can be used:
fluent 3d -g -i journal
fluent 3d -g -wait -i journal
fluent 3d -hidden -i journal
In these examples,
fluent
is the command you type to run Ansys Fluent interactively.-g
indicates that the program is to be run minimized in the task bar.-i journal
reads the specified journal file.-wait
is the command you type in a DOS batch file or some other script in a situation where the script must wait until Ansys Fluent has completed its run.-hidden
is similar to the-wait
command, but also runs Ansys Fluent completely hidden and non-interactively.
To get an output (or transcript) file while running Ansys Fluent in the background on a Windows system, the journal file must contain the following command to write a transcript file:
; start transcript file /file/start-transcript outputfile.trn
where the outputfile
is a file that the background job will
create, which will contain the output that Ansys Fluent would normally print to the
screen (for example, the menu prompts and residual reports).
See Creating and Reading Journal Files for details about journal files. See Creating Transcript Files for details about transcript files.
During a typical session, Ansys Fluent may require feedback from you in the event of a problem it encounters. Ansys Fluent usually communicates problems or questions through the use of Error dialog boxes, Warning dialog boxes, or Question dialog boxes. While executing Ansys Fluent in batch mode, you may want to suppress this type of interaction in order to, for example, create journal files more easily.
There are three common batch configuration options available to you when running Ansys Fluent in batch mode. You can access these options using the Batch Options dialog box (Figure 4.6: The Batch Options Dialog Box).
File → Batch Options...
The Batch Options dialog box contains the following items:
- Confirm File Overwrite
determines whether Ansys Fluent confirms a file overwrite. This option is turned on by default.
- Hide Questions
allows you to hide Question dialog boxes. This option is turned off by default.
- Exit on Error
allows you to automatically exit from batch mode when an error occurs. This option is disabled by default.
When run in batch mode through the command prompt or a journal file with Exit on Error enabled, Fluent will exit under the following circumstances:
Normal run termination upon reaching the end of a journal (return value
0
)Error returned during scripted text command execution (return value
1
)Unexpected input (wrong type) to text command (return value
1
)Licensing error (return value
2
)
If an invalid text command is entered, Fluent will not exit, but proceed to the next text input.
Note that in Windows you must start Fluent with the
-wait
command line option.
file
→ set-batch-options
Any combination of these options can be turned on or off at any given time prior to running in batch mode.
Important: Batch option settings are not saved with case files. They are meant to apply for the duration of the current Ansys Fluent session only. If you read in additional mesh or case files during this session, the batch option settings will not be altered. As batch options are not saved with case files, journal files developed for use in batch mode should begin by enabling the desired batch option settings (if different from the default settings).