The following features in Ansys Fluent make reading and writing files convenient:
Automatic appending or detection of default file name suffixes
Binary file reading and writing
Automatic detection of file format (text/binary)
Recent file list
Reading and writing of compressed files
Tilde expansion
Automatic numbering of files
Ability to disable the overwrite confirmation prompt
Standard toolbar buttons for reading and writing files
For additional information, see the following sections:
Each type of file read or written in Ansys Fluent has a default file
suffix associated with it. When you specify the first part of the file name (the prefix) for
the commonly used files, Fluent automatically appends or detects an appropriate suffix.
For example, to write a case file named myfile.cas.h5
with the
default settings, just specify the prefix myfile
in the
Select File dialog box (Figure 3.1: The Select File Dialog Box) and
.cas.h5
is automatically appended. Similarly, to read the case
file named myfile.cas.h5
into Fluent, you can just specify
myfile
and Ansys Fluent automatically searches for a file of
that name with the suffix .cas.h5
.
The default file suffix for case and data files, PDF (Probability
Density Function) files, DTRM ray files, profiles, scheme files, journal files, and so on,
are automatically detected and appended. The appropriate default file suffix appears in the
Select File dialog box for each type of file. Note that for case,
data, and mesh files, you can use the Files of type drop-down menu in
the Select File dialog box to specify whether you want to read / write
only the default CFF files or all formats (that is, both CFF and the legacy format); you can
also change the order in which Fluent prioritizes these formats through the
Default Format for I/O drop-down in the
Preferences dialog box or through the
file/cff-files?
text command (for further details, see Reading and Writing Files in the Legacy Format and Reading Mesh Files).
When you write a case, data, or ray file, a binary file is saved by default. Binary files take up less memory than text files and can be read and written by Ansys Fluent more quickly.
Note: You cannot read and edit a binary file, as you can do for a text file.
To save a text file, turn off the Write Binary Files option in the Select File dialog box when you are writing the file. Note that by default your case and data files will always be binary; if you require a text file for a case or data file, you must write it in the legacy format (Reading and Writing Files in the Legacy Format).
When you read a case, data, mesh, PDF, or ray file, Fluent automatically determines whether it is a text (formatted) or binary file.
At the bottom of the File/Read ribbon tab submenu there is a list of four Ansys Fluent case files that you most recently read or wrote. To read one of these files into Ansys Fluent, select it in the list. This allows you to read a recently used file without selecting it in the Select File dialog box. If you want to change the number of recent files listed, you can change the Number of files recently used setting in the Preferences dialog box, which you can access by selecting Preferences... from the File ribbon tab.
Note that the files listed in this submenu may not be appropriate for
your current session (for example, a 3D case file can be listed even if you are running a 2D
version of Ansys Fluent). Also, if you read a case file using this shortcut, the corresponding
data file is read only if it has the same base name as the case file (for example,
file1.cas.h5
and file1.dat.h5
)
and it was read/written with the case file the last time the case
file was read/written.
Note: Reading a case file from the Recent Files list in the Fluent Launcher will only load a case file and not the associated data file, even if the data file has the same base name and is stored in the same directory as the case file.
For more information, see the following sections:
You can use the Select File dialog box to read
files (such as legacy mesh, case, and data files) that have been compressed using
compress
or gzip
. If you select a
compressed file with a .Z
extension, Ansys Fluent automatically
opens zcat
to import the file. If you select a compressed file
with a .gz
extension, Fluent opens
gunzip
to import the file.
For example, if you select a file named flow.msh.gz
, Fluent reports the following message indicating that the result
of the gunzip
is imported into Ansys Fluent via
an operating system pipe.
Reading "\"| gunzip -c \"Y:\flow.msh.gz\"\""...
Note: In addition to .gz
and .Z
compression, Ansys Fluent can also handle .bz2
compressed files.
Important:
For Windows systems, only files that were compressed with
gzip
(that is, files with a.gz
extension) can be read. Files that were compressed withcompress
cannot be read into Ansys Fluent on a Windows machine.Do not read a compressed ray file; Ansys Fluent cannot access the ray tracing information properly from a compressed ray file.
You can use the Select File dialog box to write a compressed file
by appending a .Z
or .gz
extension onto
the file name.
For example, if you enter flow.gz
as
the name for a legacy case file, Fluent reports the following message:
Writing "| gzip -cfv > Y:\flow.cas.gz"...
The status message indicates that the case file information is being piped into the
gzip
command, and that the output of the compression command is
being redirected to the file with the specified name. In this particular example, the
.cas
extension is added automatically.
Note: In addition to .gz
and .Z
compression, Ansys Fluent can also handle .bz2
compressed
files.
Important:
For case and data files, such compression is not applied for the default Common Fluids Format (CFF), but instead the
.Z
or.gz
extension is simply incorporated into the name (such as.gz.cas.h5
). This compression is only used for the legacy format (such as when you have entered the following text command:file/cff-files? no
).For Windows systems, such compression can be performed only with
gzip
. That is, you can write a compressed file by appending.gz
to the name, but appending.Z
does not compress the file.Do not write a compressed ray file; Ansys Fluent cannot access the ray tracing information properly from a compressed ray file.
On Linux systems, if you specify ~/
as the
first two characters of a file name, the ~
is expanded as your home
directory. Similarly, you can start a file name with ~username/
,
and the ~username
is expanded to the home directory of
“username”. If you specify ~/file
as the case file to
be written, Ansys Fluent saves the file file.cas.h5
in your home
directory. You can specify a subdirectory of your home directory as well: if you enter
~/cases/file.cas.h5
, Ansys Fluent saves the file
file.cas.h5
in the cases
subdirectory.
There are several special characters that you can include in a file name. Using one of these character strings in your file name provides a shortcut for numbering the files based on various parameters (that is, iteration number, time step number, or total number of files saved so far), because you need not enter a new file name each time you save a file. (See also Automatic Saving of Case and Data Files for information about saving and numbering case and data files automatically.)
For transient calculations, you can save files with names that reflect the time step number at which they are saved by including the character string
%t
in the file name. For example, you can specifycontours-%t.ps
for the file name, and Fluent saves a file with the appropriate name (for example,contours-0001.ps
if the solution is at the first time step).This automatic saving of files with the time step number should not be used for steady-state cases, since the time step number will always remain zero.
For transient calculations, you can save files with names that reflect the flow-time at which they are saved by including the character string
%f
in the file name. The usage is similar to%t
. For example, when you specifyfilename-%f.ps
for the file name, Fluent will save a file with the appropriate name (for example,filename-005.000000.ps
for a solution at a flow-time of 5 seconds). By default, the flow-time that is included in the file name will have a field width of 10 and 6 decimal places. To modify this format, use the character string%
x.
yf
, where x and y are the preferred field width and number of decimal places, respectively. Ansys Fluent will automatically add zeros to the beginning of the flow-time to achieve the prescribed field width. To eliminate these zeros and left align the flow-time, use the character string%-
x.
yf
instead.This automatic saving of files with flow-time should not be used for steady-state cases, since the flow-time will always remain zero.
To save a file with a name that reflects the iteration at which it is saved, use the character string
%i
in the file name. For example, you can specifycontours-%i.ps
for the file name, and Fluent saves a file with the appropriate name (for example,contours-0010.ps
if the solution is at the 10th iteration).To save a picture file with a name that reflects the total number of picture files saved so far in the current Fluent session, use the character string
%n
in the file name. This option can be used only for picture files.
The default field width for %i
, %t
, and %n
formats is 4. You
can change the field width by using %
x
i
, %
x
t
, and %
x
n
in
the file name, where x is the preferred field
width.
By default, if you ask Ansys Fluent to write a file with the same name as an existing file in
that folder, it will ask you to confirm that it is “OK to overwrite” the
existing file. If you do not want Fluent to ask you for confirmation before it overwrites
existing files, you can use the Batch Options dialog box (for details,
see Batch Execution Options in the Getting Started part of this manual). Alternatively, enter the
file/confirm-overwrite?
text command and answer
no
(see Text User Interface (TUI) for the text user
interface commands).