Information related to the Ansys Fluent simulation is stored in both the case file and the data file. The commands for reading and writing these files are described in the following sections, along with commands for the automatic saving of case and data at specified intervals.
By default (that is, when the file/cff-file?
text command is set to yes
), the case and data files are written in
the Common Fluids Format (CFF), which is built on the Hierarchical Data Format (HDF5). CFF
files are always binary and make use of built-in compression. Thus, they cannot be viewed in a
text editor. However, third-party tools are available that allow you to open and explore the
contents of files saved in CFF / HDF.
You can specify the I/O mode and/or the CFF compression level through text commands:
>file/cff-options/compression-level
compression-level [0-9]? [1]4
>file/cffio-options/io-mode
CFF I/O Modes: 1. HOST 2. NODE0 3. PARALLEL INDEPENDENT 4. PARALLEL COLLECTIVE Enter Mode Number: [1]2
NODE0 mode selected.
The compression level can be set from 0 (no compression; fastest) to 9 (maximum compression; slowest); the default level is 1. Note that increasing the compression level may not necessarily yield a corresponding decrease in file size.
The available I/O modes are:
1. HOST : I/O is done serially by the host process. This is the
default mode when the file path is not accessible to compute-node 0. |
2. NODE0 : I/O is done serially by the node 0 process. This is the
default mode when the file path is accessible to compute-node 0. |
3. PARALLEL INDEPENDENT : I/O is done in a parallel file system
using the independent mode of MPI I/O. |
4. PARALLEL COLLECTIVE : I/O is done in a parallel file system
using the collective mode of MPI I/O. |
Note:
The Parallel I/O modes do not support compression. If you have specified a non-zero level for compression and you switch to one of the parallel modes, the compression will be set to 0.
For information on the supported parallel file systems (as well as specific configuration and usage issues), contact your Ansys Fluent support engineer.
When using the double-precision solver, you can specify that the data written in CFF data files is single precision (and thus sacrifice some precision in order to reduce the size of the files) by using the following text command prior to writing:
file
→ cffio-options
→
single-precision-data?
Important:
If you adapt the mesh, you must save a new case file as well as a data file. Otherwise, the new data file will not correspond to the case file (for example, they will have different numbers of cells). If you have not saved the latest case or data file, Ansys Fluent will warn you when you try to exit the program.
Note that if you define the time step size for a transient simulation and then subsequently read a data file that has a different value, the time step size will be overwritten with the value from the data file.
For additional information, see the following sections:
Case files contain the mesh, boundary and cell zone conditions, and solution parameters for a problem. It also contains the information about the user interface and graphics environment. The commands used for reading case files can also be used to read native-format mesh files (as described in Reading Mesh Files) because the mesh information is a subset of the case information.
Note: Prior to reading in a case file, you can review some of the case properties to help ensure you are loading the intended file. The available summary includes the Fluent version that last saved the case, case precision and dimension, and the total number of cells, faces, and nodes. To preview the case information:
From the Fluent Launcher: Select the case file and click
.From a running Fluent session: Use the File>Read>Case/Mesh Info... menu option and select the desired case file.
Select the File/Read/Case... ribbon tab item to open the Select File dialog box.
File → Read → Case...
Read a case file using the Select File dialog box. Note that the Display Mesh After Reading option in the Select File dialog box allows you to have the mesh displayed automatically after it is read.
Select the File/Write/Case... ribbon tab item to open the Select File dialog box.
File → Write → Case...
Write a case file using the Select File dialog box.
Note: The working directory is automatically updated to the directory where the case file is
written, when the writing is initiated from within the graphical user interface (writing
using the file/write-case
text command does not update the
working directory). You can determine the present working directory by entering
pwd
in the Console.
When Ansys Fluent reads a case file, it first looks for a file
with the exact name you typed. If a file with that name is not found, it searches for the
same file with different extensions, prioritizing CFF files by default. When
Ansys Fluent writes a case file, .cas.h5
is added by default to
the name you type.
In the single-precision version of Ansys Fluent, nodal coordinates are written by default in double precision, in order to ensure that there is no loss of precision if the case file is read back into the meshing mode. You can reduce the precision and case file size by using the following text command prior to writing:
file
→
single-precision-coordinates?
Data files contain the values of the specified flow field quantities in each mesh element and the convergence history (residuals) for that flow field.
After reading a mesh or case file, select the File/Read/Data... ribbon tab item to open the Select File dialog box.
File → Read → Data...
Read a data file using the Select File dialog box.
After generating data for a case file, select the File/Write/Data... ribbon tab item to open the Select File dialog box.
File → Write → Data...
Write a data file using the Select File dialog box.
When Ansys Fluent reads a data file, it first looks for a file with
the exact name you typed. If a file with that name is not found, it searches for the same
file with different extensions, prioritizing CFF files by default. When Ansys Fluent writes
a data file, .dat.h5
is added by default to the name you
type.
A case file and a data file together contain all the information required to restart a solution. Case files contain the mesh, boundary and cell zone conditions, and solution parameters. Data files contain the values of the flow field in each mesh element and the convergence history (residuals) for that flow field.
You can read a case file and a data file together by using the
Select File dialog box opened by selecting the
File/Read/Case & Data... ribbon tab item. To read both files,
select the appropriate case file, and the corresponding data file (same name with
.dat.h5
suffix) is also read. Note that the Display
Mesh After Reading option in the Select File dialog box
allows you to have the mesh displayed automatically after it is read.
File → Read → Case & Data...
To write a case file and a data file, select the File/Write/Case & Data... ribbon tab item.
File → Write → Case & Data...
When reading and writing case and data files, you can optionally use the legacy format
(.cas
and .dat
, respectively), which was
the default format prior to Release 2020 R1. To read or write legacy case/data files in the
current session only, enter the following text command prior to reading or writing:
>file/cff-files? no
To read or write legacy files in both the current session and future sessions, open the General tab of the Preferences dialog box, select Legacy from the Default Format for I/O drop-down list, and click .
File → Preferences...
Ansys Fluent can read and write either text or binary case and data files in the legacy format. Binary files require less storage space and are faster to read and write. By default, Ansys Fluent writes files in binary format. To write a text file, disable the Write Binary Files check button in the Select File dialog box. In addition, you can read and write either text or binary files in compressed formats (For details, see Reading and Writing Compressed Files). Ansys Fluent automatically detects the file type when reading.
Important: Computed values for walls, symmetry boundaries, and other surfaces where the results are interpolated from cell centers to the surface, are not retained when you save to the legacy format. This causes issues when legacy case and data files are read into postprocessing applications (such as Ansys EnSight) that do not have an integrated solver, because these applications cannot accurately interpolate the values back to these surfaces. This issue is resolved if you save case and data files in HDF format.
For legacy data files, you can output additional quantities for postprocessing in other applications using the Data File Quantities dialog box (see Setting Data File Quantities).
For information about the format of legacy case and data files, see Legacy Case and Data File Formats.
You can request Ansys Fluent to automatically save case and data files at specified intervals during a calculation. This is especially useful for time-dependent calculations, since it allows you to save the results at different time steps, flow times, or crank angles (for in-cylinder simulations) without stopping the calculation and performing the save manually. You can also use the autosave feature for steady-state problems, and thus examine the solution at different stages in the iteration history.
Automatic saving is specified using the Autosave Dialog Box (Figure 3.2: The Autosave Dialog Box), which is opened by clicking the button next to the Autosave Every text box in the Calculation Activities task page.
Calculation Activities
Specify how often you would like to save your modified files by entering the frequency in the Save Data File Every number-entry field. Save Data File Every is set to zero by default, indicating that no automatic saving is performed.
For transient in-cylinder simulations, specify whether you want to save the data by Time Steps or Crank Angles.
If you choose to save the case file only if it is modified, then select Only if Modified under Save Associated Case Files. Note that the case file will be saved whether you make a manual change, or if Ansys Fluent makes a change internally during the calculation. If you choose to save the case file every time the data file is saved, then select Each Time.
Important: To save only the data files, use the following TUI option:
file
→ auto-save
→
case-frequency
→
if-mesh-is-modified
This will result in the options in the Save Associated Case Files group box being disabled in the Autosave dialog box. In essence, this TUI command forces Ansys Fluent to the save case file only when the mesh is modified. It does not disable case file saving, but reduces it to an absolute minimum. This is necessary to do so since you cannot read a data file without a case file containing a matching mesh.
For steady-state solutions, specify the frequency in iterations. For transient solutions, specify it in time steps (unless you are using the explicit time stepping formulation, in which case specify the frequency in iterations). For transient in-cylinder solutions, you can choose to specify the frequency in crank angles. If you define a frequency of 5, for example, a case file is saved every 5 iterations, time steps, or crank angles.
If you have limited disk space, restrict the number of files saved by Ansys Fluent by selecting the Retain Only the Most Recent Files option. When selected, enter the Maximum Number of Data Files you would like to retain. Note that the case and data files are treated separately with regard to the maximum number of files saved when overwriting. For example, if the value of Maximum Number of Data Files is set to five, Ansys Fluent saves a maximum of five case and five data files, irrespective of the frequency. After the maximum limit of files has been saved, Ansys Fluent begins overwriting the earliest existing file.
Note: When the Retain only the Most Recent Files option is selected, the solution history currently in memory will be discarded and the solution history reset.
If you have requested the writing of files in the legacy format (see Reading and Writing Files in the Legacy Format), you may need to specify that additional data quantities are written if you want to postprocess in alternative applications. When you have generated data—either by initializing the solution or running the calculation—you can view the list of standard quantities that will be written to the legacy data file as a result of the autosave, and select additional quantities. Click the button to open the Data File Quantities dialog box, and make any necessary selections. For details, see Setting Data File Quantities.
Enter a root name for the autosave files in the File
Name text box. When the files are saved, a number will be appended to this root
name to indicate the point at which it was saved during the calculation: for steady-state
solutions, this will be the iteration number, whereas for transient solutions it will be
either the time step number, flow time, or crank angle (depending on your selection in the
step that follows). An extension will also be automatically added to the root name
(.cas.h5
or .dat.h5
, by default). If the
specified File Name ends in .gz
or
.Z
and you have requested the reading and writing of files in the
legacy format, appropriate file compression is performed; for details about file
compression, see Reading and Writing Compressed Files.
For transient calculations, make a selection from the Append File Name with drop-down list to indicate whether you want the root file name to be appended with the time-step, flow-time or crank-angle (see Figure 3.2: The Autosave Dialog Box). If you select either of the latter two, you can set the Decimal Places in File Name to determine the ultimate width of the file name.
Consider a transient case for which you want to save your case and data files at known
time steps. The procedure you would follow is to first set the frequency in the
Save Data File Every text box. Select Each Time
if you want both case and data files saved at the same interval. Then enter
my_file
for the File Name. Finally, select
time-step from the Append File Name with
drop-down list. An example of the resulting files saved would be
my_file-0005.cas.h5
my_file-0005.dat.h5
indicating that these files were saved at the fifth time step.
You can revise the instructions for the previous example to instead save case and data files at known flow times, by selecting flow-time from the Append File Name with drop-down list. The default Decimal Places in File Name will be six. An example of the resulting files saved would be
my_file-0.500000.cas.h5
my_file-0.500000.dat.h5
indicating that these files were saved at a flow time of 0.5 seconds.
For steady-state and transient cases, you have the option of automatically numbering the
files (as described in Automatic Numbering of Files), and thereby
include further information about when the files were saved. This involves the addition of
special characters to the File Name. For example, you may want the file
names to convey the flow times with their corresponding time step numbers (transient cases
only). Select time-step from the Append File Name
with, and enter a File Name that ends with
-%f
to automatically number the files with the flow time. Thus,
entering a File Name of filename-%f
could
result in a saved case file named filename-000.500000-0010.cas.h5
.
The conventions used in this example can be explained as follows:
filename-
is the file name you entered when autosaving your solution.000.500000
is the result of the special character%f
added to the file name, and is the flow time. This flow time has a field width of ten characters, which allows for six decimal places (as discussed in Automatic Numbering of Files).-0010
is the appended time-step, as designated by the selection in the Append File Name with drop-down list..cas.h5
is the file extension automatically added when using the autosave option.
In addition to the case and data files, a single project file
(.flprj
) is also written during the calculation; it is
recommended that you read this file whenever possible when postprocessing in CFD-Post and
EnSight, as it contains metadata such as the time values for files exported from transient
simulations. Note that if the root name of the autosave files is the same as that used for
exporting Common Fluids Format - Post files during a transient calculation (using the
Automatic Export dialog box) and Fluent is set up to save files in
the default Common Fluids Format (CFF), then the metadata from both operations will be
written to the same project file.
All of the autosave inputs are stored in memory when you click Autosave dialog box, and can then be saved with the case file.
in theImportant: The default path is ./<filename>
indicating that the
autosaved files will be saved in the working directory of the current Fluent session. If
you hard code a directory, then the files will always be saved at that location,
regardless of the working directory of the current Fluent session.