Ansys Common Fluids API
Last update: 16.07.2025Introduction
The Ansys Common Fluids Data Models have been implemented as CFF Restart or CFF Post files. Each file contains data associated with a specifc point solution.
When a set of point solutions exist, a set of files will exist and those files may be sequenced using a Project file. A Project file should be read or written using the Project API.
The Ansys Common Fluids Application Programers Interface (CFF API or API) provides several classes, functions, and enumerated types that provide methods to read, write, and modify a number of data models. Data models exist for Mesh, Topology, Physics, and Solution data.
During the setup phase, typically you will set up data within the Mesh, Topology, and Physics data models. This document refers to the combination of these three models as a Case.
A solver will typically extract the data stored with the Case, solve the simulation, and store output data in the Solution data model. Within this document we also refer to this as the Results.
A post-processor will typically need access to both the Case and the Solution models.
APIs are provided to obtain an instance of the API for:
- Reading mesh, topology, physics, settings, and solution
- Writing mesh, topology, physics, settings, and solution
Once obtained, the object returned can be used to:
- Read Case or Results data
or
- Write Case or Results data
Background to Using the Common Fluids API
The API is implemented in 'C++'. Familiarity with with C++ and the Standard Template Library (STL) will enable you to quickly use the CFF API to access data in a CFF file within your application.
Additional 'C' wrappers have been provided but they do not fully implement all the functionality in the C++ API.
The API consists of a number of classes, functions, and enumerated types. These all exist within the ansys C++ namespace. You must use the namespace name when using functionality in the API.
- ansys::CffBase
- ansys::CffProvider and ansys::CffFileProvider
- ansys::CffConsumer
- ansys::CffLocationModel
- ansys::getDataProvider
- ansys::getDataConsumer
- Enumerations
- Typedefs
- ansys::CffVersion
APIs are provided to write the Case and Results to independent files, which allows a single instance of the Case file to be used with multiple Results files. Similarly, APIs exist to read back the data from any file written.
For example, ansys::CffFileProvider is a subclass of ansys::CffProvider and simply provides some additional file access functionality.
Using the Common Fluids Format API
The API is provided as a number of dynamically linked library / shared objects and a number of header files within the Ansys Common Fluids Format SDK.
You must include the header files and link the libraries into your program during compilation.
Opening Files for Read
Before you can open a file, you must have an instance of ansys::CffFileProvider. Refer to Obtaining an Object to Read a CFF File, which details how to obtain an instance from the Factory methods.
Once you have an object you will be able to open case and results files for read.
Opening Case (cas) and Results (dat) Files for Read
Having obtained an instance of ansys::CffFileProvider, you will now need to start reading from the appropriate files. The following code shows how this is done.
- Note
- In order to read the dat file successfuly it is always necessary to start reading the correct cas file first.