|
2 | 2 | PyDPF-Post |
3 | 3 | ========== |
4 | 4 |
|
5 | | -The Data Processing Framework (DPF) provides numerical simulation |
6 | | -users and engineers with a toolbox for accessing and transforming simulation |
7 | | -data. With DPF, you can perform complex preprocessing or postprocessing of |
8 | | -large amounts of simulation data within a simulation workflow. |
| 5 | +The Data Processing Framework (DPF) is designed to provide numerical |
| 6 | +simulation users/engineers with a toolbox for accessing and |
| 7 | +transforming simulation data. |
9 | 8 |
|
10 | | -DPF is an independent, physics-agnostic tool that you can plug into many |
11 | | -apps for both data input and data output, including visualization and |
12 | | -result plots. It can access data from solver result files and other neutral |
13 | | -formats, such as CSV, HDF5, and VTK files. |
| 9 | +The Python `ansys-dpf-post` package provides a high level, physics oriented API for postprocessing. |
| 10 | +Loading a simulation (defined by its result files) allows you to extract simulation metadata as well |
| 11 | +as results and apply postprocessing operations on it. |
14 | 12 |
|
15 | | -Using the many DPF operators that are available, you can manipulate and |
16 | | -transform this data. You can also chain operators together to create simple |
17 | | -or complex data-processing workflows that you can reuse for repeated or |
18 | | -future evaluations. |
19 | | - |
20 | | -The data in DPF is defined based on physics-agnostic mathematical quantities |
21 | | -described in self-sufficient entities called *fields*. This allows DPF to be |
22 | | -a modular and easy-to-use tool with a large range of capabilities. |
23 | | - |
24 | | -.. image:: images/dpf-flow.png |
25 | | - :width: 670 |
26 | | - :alt: DPF flow |
27 | | - |
28 | | -The ``ansys.dpf.post`` package leverages the ``ansys.dpf.core`` package, which |
29 | | -is available at `PyDPF-Core GitHub <https://github.com/pyansys/DPF-Core>`_. With |
30 | | -PyDPF-Core, you can build more advanced and customized DPF workflows. |
| 13 | +This module leverages the PyDPF-Core project's ``ansys-dpf-core`` package and can |
| 14 | +be found by visiting [PyDPF-Core GitHub](https://github.com/pyansys/pydpf-core). |
| 15 | +Use ``ansys-dpf-core`` for building more advanced and customized workflows using Ansys DPF. |
31 | 16 |
|
32 | 17 |
|
33 | 18 | Brief demo |
34 | 19 | ~~~~~~~~~~ |
35 | | -Here is how you open and plot a result file generated by Ansys Workbench or |
36 | | -MAPDL: |
| 20 | + |
| 21 | +Provided you have ANSYS 2023 R1 installed, a DPF server will start |
| 22 | +automatically once you start using PyDPF-Post. |
| 23 | +Loading a simulation for a MAPDL result file to extract and post-process results: |
37 | 24 |
|
38 | 25 | .. code:: python |
39 | 26 |
|
40 | 27 | >>> from ansys.dpf import post |
41 | 28 | >>> from ansys.dpf.post import examples |
42 | | - >>> solution = post.load_solution(examples.multishells_rst) |
43 | | - >>> stress = solution.stress() |
44 | | - >>> stress.xx.plot_contour(show_edges=False) |
| 29 | + >>> simulation = post.load_simulation(examples.download_crankshaft()) |
| 30 | + >>> displacement = simulation.displacement() |
| 31 | + >>> print(displacement) |
| 32 | +
|
| 33 | +
|
| 34 | +.. rst-class:: sphx-glr-script-out |
| 35 | + |
| 36 | + .. code-block:: none |
| 37 | +
|
| 38 | + results U |
| 39 | + set_id 3 |
| 40 | + node comp |
| 41 | + 4872 X -3.41e-05 |
| 42 | + Y 1.54e-03 |
| 43 | + Z -2.64e-06 |
| 44 | + 9005 X -5.56e-05 |
| 45 | + Y 1.44e-03 |
| 46 | + Z 5.31e-06 |
| 47 | + ... |
| 48 | +
|
| 49 | +.. code:: python |
45 | 50 |
|
| 51 | + >>> displacement.plot() |
46 | 52 |
|
47 | | -.. figure:: ./images/main_example.png |
| 53 | +
|
| 54 | +.. figure:: ./images/crankshaft_disp.png |
| 55 | + :width: 300pt |
| 56 | + |
| 57 | +.. code:: python |
| 58 | +
|
| 59 | + >>> stress_eqv = simulation.stress_eqv_von_mises_nodal() |
| 60 | + >>> stress_eqv.plot() |
| 61 | +
|
| 62 | +.. figure:: ./images/crankshaft_stress.png |
48 | 63 | :width: 300pt |
49 | 64 |
|
50 | | - Basic stress contour plot |
| 65 | +To run PyDPF-Post with Ansys versions starting from 2021 R1 to 2022 R2, use the following legacy PyDPF-Post |
| 66 | +tools: |
51 | 67 |
|
52 | | -Here is how you extract the raw data as a :class:`numpy.ndarray` array: |
53 | 68 | .. code:: python |
54 | 69 |
|
55 | | - >>> stress.xx.get_data_at_field(0) |
56 | | - array([-3.37871094e+10, -4.42471752e+10, -4.13249463e+10, ..., |
57 | | - 3.66408342e+10, 1.40736914e+11, 1.38633557e+11]) |
| 70 | + >>> from ansys.dpf import post |
| 71 | + >>> from ansys.dpf.post import examples |
| 72 | + >>> solution = post.load_solution(examples.download_crankshaft()) |
| 73 | + >>> stress = solution.stress() |
| 74 | + >>> stress.eqv.plot_contour(show_edges=False) |
| 75 | +
|
| 76 | +.. figure:: ./images/crankshaft_stress.png |
| 77 | + :width: 300pt |
58 | 78 |
|
59 | 79 |
|
60 | 80 | For comprehensive demos, see :ref:`gallery`. |
|
0 commit comments