/pydpf-post

Data Processing Framework - Post Processing Module

Primary LanguagePythonMIT LicenseMIT

PyDPF-Post - Ansys Data PostProcessing Framework

PyAnsys Python pypi MIT

The Ansys Data Processing Framework (DPF) is designed to provide numerical simulation users and engineers with a toolbox for accessing and transforming simulation data.

The Python ansys-dpf-post package provides a high-level, physics-oriented API for postprocessing. Loading a simulation (defined by its result files) allows you to extract simulation metadata as well as results and then apply postprocessing operations on it.

This module leverages the PyDPF-Core project's ansys-dpf-core package, which is available at PyDPF-Core GitHub. Use the ansys-dpf-core package for building more advanced and customized workflows using Ansys DPF.

Documentation

For comprehensive information on this package, see the PyDPF-Post Documentation, For detailed how-to information, see the Examples in the PyDPF-Post documentation.

Installation

To install this package, use this command:

pip install ansys-dpf-post

You can also clone and install this package with this code:

git clone https://github.com/pyansys/pydpf-post
cd pydpf-post
pip install . --user

Brief demo

Provided you have Ansys 2023 R1 installed, a DPF server starts automatically once you start using PyDPF-Post.

To load a simulation to extract and postprocess results, use this code:

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> simulation = post.load_simulation(examples.download_crankshaft())
>>> displacement = simulation.displacement()
>>> print(displacement)
             results         U
              set_id         3
      node      comp          
      4872         X -3.41e-05
                   Y  1.54e-03
                   Z -2.64e-06
      9005         X -5.56e-05
                   Y  1.44e-03
                   Z  5.31e-06
       ...
>>> displacement.plot()

Example Displacement plot Crankshaft

>>> stress_eqv = simulation.stress_eqv_von_mises_nodal()
>>> stress_eqv.plot()

Example Stress plot Crankshaft

To run PyDPF-Post with Ansys versions 2021 R1 and 2022 R2, use this code to start the legacy PyDPF-Post tools::

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> solution = post.load_solution(examples.download_crankshaft())
>>> stress = solution.stress()
>>> stress.eqv.plot_contour(show_edges=False)

Example Stress plot Crankshaft

License

PyDPF-Post is licensed under the MIT license. For more information, see the LICENSE.