Skip to content

Commit

Permalink
Merge branch 'master' into rcanton/bump_ansys_grpc_dpf
Browse files Browse the repository at this point in the history
  • Loading branch information
rafacanton authored Jul 29, 2023
2 parents b6f85ac + b3896ab commit a3207df
Show file tree
Hide file tree
Showing 27 changed files with 2,058 additions and 703 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
os: ["windows-latest", "ubuntu-latest"]

steps:
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
ANSYS_VERSION: ["241"]
suffix: [".pre0"]
python-version: ["3.8", "3.9", "3.10"]
os: ["windows-latest", "ubuntu-latest"]

steps:
Expand All @@ -73,14 +75,14 @@ jobs:
uses: ansys/pydpf-actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
ANSYS_VERSION: '241'
ANSYS_VERSION: ${{ matrix.ANSYS_VERSION }}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
MODULE: ${{env.MODULE}}
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
install_extras: plotting
wheel: true
wheelhouse: true
standalone_suffix: ''
standalone_suffix: ${{ matrix.suffix }}

- name: "Prepare Testing Environment"
uses: ansys/pydpf-actions/[email protected]
Expand Down Expand Up @@ -191,14 +193,14 @@ jobs:
with:
ANSYS_VERSION: '241'
python_versions: '["3.10"]'
standalone_suffix: ''
standalone_suffix: '.pre0'
secrets: inherit

docs:
uses: ./.github/workflows/docs.yml
with:
ANSYS_VERSION: '241'
standalone_suffix: ''
standalone_suffix: '.pre0'
event_name: ${{ github.event_name }}
secrets: inherit

Expand Down
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ The Python `ansys-dpf-post` package provides a high-level, physics-oriented API
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.

The latest version of DPF supports Ansys solver result files for:

- MAPDL (`.rst`, `.mode`, `.rfrq`, `.rdsp`)
- LS-DYNA (`.d3plot`, `.binout`)
- Fluent (`.cas/dat.h5`, `.flprj`)
- CFX (`.cad/dat.cff`, `.flprj`)

See the `PyDPF-Core main page <https://dpf.docs.pyansys.com/version/stable/index.html>`_
for more information on compatibility.

This module leverages the PyDPF-Core project's ``ansys-dpf-core`` package, which is
available at [PyDPF-Core GitHub](https://github.com/ansys/pydpf-core).
Use the ``ansys-dpf-core`` package for building more advanced and customized workflows
Expand Down Expand Up @@ -41,10 +51,10 @@ pip install . --user

## Brief demo

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

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

```pycon
>>> from ansys.dpf import post
Expand All @@ -54,16 +64,16 @@ To load a simulation to extract and postprocess results, use this code:
>>> print(displacement)
```
```pycon
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
...
results U (m)
set_ids 3
node_ids components
4872 X -3.4137e-05
Y 1.5417e-03
Z -2.6398e-06
9005 X -5.5625e-05
Y 1.4448e-03
Z 5.3134e-06
... ... ...
```
```pycon
>>> displacement.plot()
Expand Down
Binary file modified docs/source/images/crankshaft_disp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/crankshaft_stress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ for postprocessing. Loading a simulation (defined by its result files) allows yo
to extract simulation metadata as well as results and then apply postprocessing
operations on it.

The latest version of DPF supports Ansys solver result files for:

- MAPDL (``.rst``, ``.mode``, ``.rfrq``, ``.rdsp``)
- LS-DYNA (``.d3plot``, ``.binout``)
- Fluent (``.cas/dat.h5``, ``.flprj``)
- CFX (``.cad/dat.cff``, ``.flprj``)

See the `PyDPF-Core main page <https://dpf.docs.pyansys.com/version/stable/index.html>`_
for more information on file support.

This module leverages the PyDPF-Core project's ``ansys-dpf-core`` package, which is
available at `PyDPF-Core GitHub <https://github.com/ansys/pydpf-core>`_.
Use the ``ansys-dpf-core`` package for building more advanced and customized
Expand Down
31 changes: 31 additions & 0 deletions docs/source/user_guide/known_issues_list.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. _ref_kil:

============
Known issues
============

This page gathers the known issues a user can experience for each version of DPF.

ansys-dpf-server-2023-2-pre1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~


ansys-dpf-server-2023-2-pre0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Pip install error with ``setuptools>=67.0.0``.


Ansys 2023R1
~~~~~~~~~~~~


Ansys 2022R2
~~~~~~~~~~~~


Ansys 2022R1
~~~~~~~~~~~~


Ansys 2021R2
~~~~~~~~~~~~
22 changes: 22 additions & 0 deletions docs/source/user_guide/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ Troubleshooting
This section explains how to resolve the most common issues encountered with PyDPF-Post.
It also includes suggestions for improving scripts.


Known issues list
~~~~~~~~~~~~~~~~~
Please refer to the :ref:`Known issues page <ref_kil>` for a list of known issues for each version of DPF.


Installation
~~~~~~~~~~~~
When pip installing older versions of the PyDPF libraries, an error might occur stating:

.. code-block:: shell-session
'python_requires' must be a string containing valid version specifiers; Invalid specifier: '>=3.7.*'
In this case, modify your Python environment to use a version of the ``setuptools`` library strictly
older than ``67.0.0`` using the command below:

.. code::
pip uninstall -y packaging; pip uninstall -y setuptools; pip install "setuptools<67.0.0"
Auto-completion
~~~~~~~~~~~~~~~
Depending on your scripting environment, auto-completion might not work correctly when using the
Expand Down
13 changes: 10 additions & 3 deletions examples/00-Different-analysis-types/05-fluid-simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@


###############################################################################
# Explore the available structure
# -------------------------------
# Explore the available metadata
# ------------------------------
# Check the available cell and face zones
# print(simulation.zones)
print(simulation.cell_zones)
print(simulation.face_zones)

###############################################################################
# The mesh metadata is available separately from the mesh
# as accessing the mesh means loading it.
# Use the mesh_info property to explore the mesh structure to define queries
print(simulation.mesh_info)

###############################################################################
# Check the available species
Expand Down
13 changes: 10 additions & 3 deletions examples/04-Fluid-Examples/00-explore-fluid-simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@


###############################################################################
# Explore the available structure
# -------------------------------
# Explore the available metadata
# ------------------------------
# Check the available cell and face zones
# print(simulation.zones)
print(simulation.cell_zones)
print(simulation.face_zones)

###############################################################################
# The mesh metadata is available separately from the mesh
# as accessing the mesh means loading it.
# Use the mesh_info property to explore the mesh structure to define queries
print(simulation.mesh_info)

###############################################################################
# Check the available species
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "ansys-dpf-post"
version = "0.4.1.dev0"
description = "PyDPF-Post Python library."
readme = "README.md"
requires-python = ">=3.7,<4.0"
requires-python = ">=3.8,<4.0"
license = {file = "LICENSE"}
authors = [
{name = "ANSYS, Inc.", email = "[email protected]"},
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements_docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pypandoc==1.10
imageio==2.31.0
numpydoc==1.4.0
imageio-ffmpeg==0.4.7
Sphinx==7.0.0
Sphinx==7.1.0
sphinx-autobuild==2021.3.14
sphinxcontrib-napoleon==0.7
sphinxcontrib-websupport==1.2.4
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coverage==7.2.7
pytest-cov==4.0.0
pytest-rerunfailures==11.0
pytest==7.3.1
pytest==7.4.0
pyvista==0.38.5
1 change: 0 additions & 1 deletion src/ansys/dpf/post/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
from ansys.dpf.post.transient_mechanical_simulation import ( # noqa: F401
TransientMechanicalSimulation,
)
from ansys.dpf.post.zone import Zone, Zones # noqa: F401

# this must be after some ansys.dpf.post import
__version__ = importlib_metadata.version("ansys-dpf-post")
Expand Down
4 changes: 4 additions & 0 deletions src/ansys/dpf/post/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,8 @@ def plot(self, shell_layer=shell_layers.top, **kwargs) -> Union[DpfPlotter, None
The interactive plotter object used for plotting.
"""
if len(self.index.mesh_index) == 0:
raise ValueError("Cannot plot a Dataframe with an empty mesh index.")
label_space = {}
if kwargs != {}:
axis_kwargs, kwargs = self._filter_arguments(arguments=kwargs)
Expand Down Expand Up @@ -772,6 +774,8 @@ def plot(self, shell_layer=shell_layers.top, **kwargs) -> Union[DpfPlotter, None
fc = self._fc
label_space = fc.get_label_space(0)

if len(fc) == 0:
raise ValueError("No data to plot.")
for field in fc:
# Treat multi-layer field
shell_layer_check = field.shell_layers
Expand Down
Loading

0 comments on commit a3207df

Please sign in to comment.