PyAnsys DPF-Core#

The Data Processing Framework (DPF) provides numerical simulation users/engineers with a toolbox for accessing and transforming simulation data. It is used to handle complex pre- or post-processing of simulation data within a simulation workflow.

DPF is an independent, physics-agnostic tool that can be plugged into many applications for both data input and data output (result plots, visualization, and so on).

DPF can access data from solver result files and other neutral formats (for example, CSV, HDF5, and VTK). Various operators are available, allowing you to manipulate and transform this data. You can chain operators together to create simple or complex data-processing workflows that can be reused for repeated or future evaluations.

The data in DPF is defined based on physics-agnostic mathematical quantities described in self-sufficient entities called fields. This allows DPF to be a modular and easy-to-use tool with a large range of capabilities. It is designed to handle large amounts of data.

DPF FLow

The module ansys.dpf.core provides a Python interface to the powerful DPF framework, enabling rapid postprocessing of a variety of Ansys file formats and physics solutions without ever leaving the Python environment.

Brief Demo#

Opening a result file generated from MAPDL (or another ANSYS solver) and extracting results from it is easy:

from ansys.dpf.core import Model
from ansys.dpf.core import examples
model = Model(examples.simple_bar)
print(model)

Out:

DPF Model
------------------------------
Static analysis
Unit system: Metric (m, kg, N, s, V, A)
Physics Type: Mecanic
Available results:
     -  displacement: Nodal Displacement
     -  element_nodal_forces: ElementalNodal Element nodal Forces
     -  elemental_volume: Elemental Volume
     -  stiffness_matrix_energy: Elemental Energy-stiffness matrix
     -  artificial_hourglass_energy: Elemental Hourglass Energy
     -  thermal_dissipation_energy: Elemental thermal dissipation energy
     -  kinetic_energy: Elemental Kinetic Energy
     -  co_energy: Elemental co-energy
     -  incremental_energy: Elemental incremental energy
     -  structural_temperature: ElementalNodal Temperature
------------------------------
DPF  Meshed Region:
  3751 nodes
  3000 elements
  Unit: m
  With solid (3D) elements
------------------------------
DPF  Time/Freq Support:
  Number of sets: 1
Cumulative     Time (s)       LoadStep       Substep
1              1.000000       1              1
disp = model.results.displacement().X()
model.metadata.meshed_region.plot(disp.outputs.fields_container())

Out:

_images/simple_example.png

See the Examples for detailed examples.

Key Features#

Computation Efficiency

DPF is a modern framework based on new hardware architectures. Thanks to continued development, new capabilities are frequently added.

Generic Interface

DPF is physics-agnostic, which means that its use is not limited to a particular field, physics solution, or file format.

Extensibility and Customization

DPF is developed around two core entities:

  • Data represented as a field

  • An operator to act upon this data

Each DPF capability is developed through operators that allow for componentization of the framework. Because DPF is plugin-based, new features or formats can be easily added.