Skip to main content
This case study shows how to use Ansys Fluent’s Python API (PyFluent) to extract simulation data and export it to the OpenUSD format. It walks you through each step, from importing libraries to exporting the final USD file. For those new to Universal Scene Descriptions (USDs), the following guides are available as well.

Download example files

Download the example Fluent case and data files required for the simulation. These files are used to demonstrate the workflow.

Load case and data files

Load the case and data files into the Fluent solver session to access simulation results.

Retrieve field data

Retrieve the field data object from the solver session. This object provides access to surface and field information needed for export.
Define helper functions to print the names of all available surfaces and scalar fields in the loaded Fluent case. This helps identify what data can be exported.
Print the names of all surfaces present in the simulation.
Print the names of all scalar fields available for export.
Define and call a function to print all solution variables available in the solver session. You can export these variables to USD files.

Collect data for export

Collect the names of solution variables, surfaces, scalar fields, and vector fields. Also, set the path to export the USD file to.

Define export constants

Define constants for scaling between Fluent and Omniverse units. Also define tokens used in the USD export process.

Sanitize USD paths

Define a helper function to sanitize names for use as USD paths, ensuring compatibility with USD naming conventions.

Export mesh surfaces to USD

Define a function to export mesh surfaces from Fluent to USD. This includes geometry and optionally field data for each surface.

Export volume points to USD

Define a function to export volume points (centroids) and associated solution variables from Fluent to USD.

Set up and export USD scene

Bring all previous steps together to set up the USD scene, then export mesh surfaces and volume points, and save the USD file.

Run the export process

Call the setup function to run the export process and generate the USD file from the Fluent simulation data.

Exit Fluent session

After the export is complete, exit the Fluent solver session.

Run in Omniverse Python script environment

  1. Open the Omniverse Kit.
  2. Select Window > Script Editor to open the Script Editor.
  3. Paste and run the Python script. Make sure to update the paths for the USD file and MDL material as needed. The script assigns the FieldToColor MDL material and rainbow colormap to /Fluent.
  4. Load the USD file in Omniverse to visualize the temperature field mapped to the colormap.
The following code shows how to postprocess and visualize the USD file using Omniverse’s MDL and texture capabilities.