Skip to main content
Now that you know how DPF represents data internally, you need to understand where that data comes from. Data in DPF can come from two main sources:
  • Result files: Importing simulation results from supported file formats
  • Direct user input: Creating DPF data structures programmatically from scratch
Whether data comes from files or direct input, it is represented using the same DPF structures you learned about in the previous section (Fields, FieldsContainers, MeshedRegions, etc.).

Import data from result files

What file formats are supported

DPF supports result files from multiple ANSYS solvers: For the official list of supported file formats and versions, see the DPF Framework documentation. Why this matters: DPF provides a unified interface for all these formats. The same code can extract displacement from a MAPDL .rst file or temperature from a Fluent .cas.h5 file.

How to access result files: DataSources

A DataSources is an object that references result file locations and manages access to their data. It stores file paths and provides this information to DPF operators that need to read the files. What it does: Points to where your result files are located What it doesn’t do: It doesn’t load or parse the data itself (that’s done by operators) Example with a single file:
Example with multiple files (common for Fluent/CFX):
What this shows: DataSources can manage single files or multiple related files (like Fluent’s .cas and .dat pair).

When to use streams: StreamsContainer

A StreamsContainer is an object that keeps result files open and caches data to improve performance for repeated access. When to use it:
  • Working with large files where repeated file opening is slow
  • Running multiple operations on the same data
  • Performance is critical
When not needed:
  • Single-pass operations
  • Small files
  • Quick data exploration
Example:
What this shows: Streams act as a performance optimization layer between files and reader operators.
Streams keep files open
A StreamsContainer holds open file handles for every file it references, for as long as it exists. This means the associated files cannot be moved, deleted, or written to by another process while the streams are open. Streams are closed automatically when the StreamsContainer Python object is deleted (garbage collected). If you need to release the files earlier, close the streams explicitly:

Exploring data with Model

A Model is a helper object that provides high-level access to result file contents. It automatically reads file metadata and creates convenient methods to extract results, mesh, and analysis information. What Model provides:
  • Automatic detection of available results
  • Easy access to mesh information
  • Analysis metadata (units, analysis type, time steps)
  • Simplified syntax for common operations
  • Automatic creation and management of streams
Why use Model: It handles the complexity of setting up operators and provides a more user-friendly interface than working directly with DataSources and operators. When NOT to use Model: Model’s convenience comes with overhead. It automatically reads metadata, creates multiple operators, and performs setup work behind the scenes. For performance-critical applications or when you need explicit control over data access patterns, working directly with DataSources/Streams and operators gives you fine-grained control and avoids unnecessary operations. Creating a Model:
What’s inside a Model:
Expected output:
What each part means:
  • Analysis type: Static, transient, modal, etc.
  • Unit system: How values are measured (includes length, mass, force, time, voltage, current)
  • Available results: Shows result name, location (Nodal/Elemental/ElementalNodal), and physical description
  • Meshed Region: Node and element counts with spatial units
  • Time/Freq Support: Information about time steps or frequencies in the analysis
Accessing data through Model:
What this shows: Model provides a clean, documented interface without needing to work directly with DataSources and operators.

Quick reference: When to use what

Recommended approach:
  • Model: Use for interactive data exploration, prototyping, and common analysis tasks where convenience is prioritized over performance.
  • DataSources + operators: Use for single-pass workflows or during workflow development when explicit control over data flow is required without implicit caching or optimizations.
  • DataSources + Streams + operators: Use for production workflows requiring optimal performance through file caching and repeated data access.

Import data from user input

To create DPF data structures from scratch (without result files), you build fields, scopings, and supports programmatically. This allows you to use DPF for custom data or non-ANSYS sources. When you’d do this:
  • Importing experimental data
  • Custom simulations outside ANSYS
  • Synthetic test data
  • Combining data from multiple sources
This process requires understanding how DPF represents data internally, which was covered in the previous section.

Exercise: Import and explore a result file

Task: Use examples.download_transient_result() to get a transient mechanical result file, then practice creating a DataSources, a StreamsContainer, and a Model. Explore the model contents and extract key metadata.
  1. Import the necessary modules
  2. Get the result file path using examples.download_transient_result()
  3. Create a DataSources pointing to the file and print it
  4. Create a StreamsContainer from the DataSources
  5. Create a Model from the DataSources and print it
  6. Print the number of nodes in the mesh and the number of time steps
In the next section, you’ll learn how to interact with that data using operators and workflows.