Introduction to the Application Programming Interface (API) in Altair Flow Simulator


The Flow Simulator (FS) API allows users to create a main control program to load the FS solver DLL to perform basic functions such as loading and running a model. The API can be used to couple a FS model with another solver (ex: a thermal solver for 2D or 3D parts)
The following features are currently available in FS DLL:
- Run steady-state or transient
- Allow for exchange of data between multiple FS models in co-simulation cases
- Update model inputs before running (Ex. chamber boundary conditions, element geometry, orifice Cd)
- Extract results after running (Ex. internal chamber pressure and temperature, element flowrates)
The functions available in the API are based on C/C++ and Fortran.
Functions available in DLL:
General Discussion on these Functions:
FS_LOAD_MODEL_C(model_name)
- Model_name can be absolute or relative path to the model file (.flo).
FS_RUN_MODEL_C(coupling_time)
- Runs the Flow Simulator Solver
- coupling_time is only needed for transient or quasi steady state analysis and it is 0.0 for steady state runs
- coupling_time is the time step for printing the result file and returning control to calling program
FS_SET/GET_C (itemtype_str, itemnum, locat1_str, locat2_str, locat3_str, prop_str, unit_str, setval, status)
- Utilizes FS controller logic to set or get almost anything in the model.
- These are mainly used for setting boundary conditions or getting results.
- These functions can also be used for data exchange in co-simulation.
- More information on the inputs of these functions can be found in {Installation_Folder}\Resources\misc_solver_files\ FS_coupling.dat
FS_END_C():
- Clears the data related to the model but does not unload the DLL.
- It releases the Altair License. Therefore, it is very important to call this function before the program is terminated.
Simple API Example
We are running a basic pipe model. To keep it simple, we would just set one boundary condition using the API and retrieve one result after running the model.
In this example, a C++ main control program is being used. A header file known as DLL_class.h is interfacing with the FS DLL and retrieving the address to the functions available in it. The idea is to provide this header file to the users who can either create their own interface to DLL or build on top of this class. This class is just for ease of use and provides a few basic functionalities such as loading/unloading the DLL and calling routines in the DLL.
The following are some snippets of the code showcasing the workflow for this simple pipe example:
The example along with a guide to run this model in VS environment is included in the attached file.
Contact the Flow Simulator developers for help with the API.