ansys / pydpf-core

Data Processing Framework - Python Core
http://dpf.docs.pyansys.com/
MIT License
68 stars 25 forks source link

EPPL_EQV - equivalent plastic strain operator not working #1141

Closed BPlochocki closed 1 year ago

BPlochocki commented 1 year ago

Before submitting the issue

Description of the bug

Result operator "plastic_strain_eqv" is not working. Script produces following error: _ansys.dpf.gate.errors.DPFServerException: EPPL_EQV:6<-Source operator "mapdl::rst::EPPLEQV" not found Identical script works for "stress_von_mises" operator.

Plastic strains are within tested RST file. Curious thing is, when going through RST metadata, plastic strain are refered as: {'name': 'eqv', 'operator name': 'EPPL_eqv', 'description': ' nodal / elemental Mises equivalent'} (EPPL_eqv nor EPPL_EQV) When creating operator using: op = dpf.Operator('EPPL_eqv') different error KeyError: "The operator EPPL_eqv doesn't exist in the registry. Check its spelling in the documentation or verify its availability in your Context (Entry/Premium) and in your loaded plugins."

Steps To Reproduce

  1. Connect to RST file
  2. Create equivalent plastic strain operator
  3. Get values for a set of nodes
from ansys.dpf.core import Model, operators
from ansys.dpf import core as dpf
from os.path import abspath
from numpy import concatenate

rst = Model(rstFile)
time = rst.metadata.time_freq_support.time_frequencies
_source = rst.metadata.data_sources

# Result operator
op = operators.result.plastic_strain_eqv()
#op = dpf.Operator('EPPL_EQV')
#op = operators.result.stress_von_mises()

# Connects operator to RST file
op.inputs.data_sources.connect(_source)

# Set up time scoping
op.inputs.time_scoping.connect(4)

# Set up ElementalNodal results 
op.inputs.requested_location.connect('ElementalNodal')

f0 = op.outputs.fields_container()[0]
pointers = concatenate([f0._get_data_pointer(), [f0.elementary_data_count]]).astype(int)
eids = f0.scoping.ids
data = [f0.data[pointers[p]:pointers[p+1]] for p in range(len(pointers)-1)]

RESULT = {eid: data[idx] for idx, eid in enumerate(eids)}

Which Operating System causes the issue?

Windows

Which DPF/Ansys version are you using?

Ansys 2023 R1

Which Python version causes the issue?

3.9

Installed packages

aiohttp==3.8.3 aiosignal==1.3.1 ansys-api-mapdl==0.5.1 ansys-api-mechanical==0.1.0 ansys-api-meshing-prime==0.1.1 ansys-api-platform-instancemanagement==1.0.0b3 ansys-dpf-core==0.8.1 ansys-dpf-gate==0.3.1 ansys-dpf-gatebin==0.3.1 ansys-dpf-post==0.4.0 ansys-grpc-dpf==0.7.1 ansys-mapdl-core==0.63.3 ansys-mapdl-reader==0.52.3 ansys-mechanical-core==0.9.0 ansys-meshing-prime==0.3.2 ansys-platform-instancemanagement==1.0.2 ansys-pythonnet==3.1.0rc1 ansys-tools-path==0.2.4 appdirs==1.4.4 asttokens==2.2.1 async-timeout==4.0.2 attrs==22.1.0 backcall==0.2.0 cachetools==5.3.0 certifi==2022.9.24 cffi==1.15.1 charset-normalizer==2.1.1 clr-loader==0.2.5 colorama==0.4.6 comm==0.1.3 contourpy==1.0.6 cycler==0.11.0 debugpy==1.6.7 decorator==5.1.1 et-xmlfile==1.1.0 executing==1.2.0 fonttools==4.38.0 frozenlist==1.3.3 geomdl==5.3.1 google-api-core==2.11.0 google-api-python-client==2.86.0 google-auth-httplib2==0.1.0 google-auth==2.17.3 googleapis-common-protos==1.57.0 grpcio==1.51.1 httplib2==0.22.0 idna==3.4 imageio==2.22.4 importlib-metadata==5.1.0 install==1.3.5 ipykernel==6.23.0 ipython==8.13.2 jedi==0.18.2 jupyter-client==8.2.0 jupyter-core==5.3.0 kiwisolver==1.4.4 matplotlib-inline==0.1.6 matplotlib==3.6.2 multidict==6.0.2 nest-asyncio==1.5.6 numpy==1.23.3 openpyxl==3.0.10 packaging==21.3 pandas==1.5.1 parso==0.8.3 pickleshare==0.7.5 pillow==9.3.0 pip==23.1.2 platformdirs==3.5.0 pooch==1.6.0 prompt-toolkit==3.0.38 protobuf==3.20.3 protoc-gen-swagger==0.1.0 psutil==5.9.5 pure-eval==0.2.2 pyasn1-modules==0.3.0 pyasn1==0.5.0 pycparser==2.21 pygments==2.15.1 pyiges==0.2.1 pyparsing==3.0.9 python-dateutil==2.8.2 pytz==2022.6 pyvista==0.37.0 pywin32==306 pyzmq==25.0.2 requests==2.28.1 rsa==4.9 scipy==1.9.3 scooby==0.7.0 setuptools==58.1.0 six==1.16.0 stack-data==0.6.2 tornado==6.3.1 tqdm==4.64.1 traitlets==5.9.0 typing-extensions==4.5.0 uritemplate==4.1.1 urllib3==1.26.13 vtk==9.2.2 wcwidth==0.2.6 wslink==1.9.1 yarl==1.8.1 zipp==3.11.0

PProfizi commented 1 year ago

Hi @BPlochocki, The issue here is that the EPPL_EQV operator, despite being present in Ansys 2023 R1, was then limited to LS-Dyna results. The EPPL_EQV operator apparently started supporting MAPDL results starting with Ansys 2023 R2. I checked that using the following script which gives the list of available operators:

from ansys.dpf import core as dpf
server = dpf.start_local_server()
print(dpf.dpf_operator.available_operator_names(server=server))

It shows the generic EPPL_EQV in the list for Ansys 2023 R1, but only with its variant lsdyna::d3plot::EPPL_EQV.

The way for you to know which operators are really available is to use the version of the documentation from the minimal required version of ansys-dpf-core for your Ansys version. Here for example, since you are using Ansys 2023 R1, a look at the compatibility table here shows that ansys-dpf-core==0.6.0 is the one which was released with DPF 5.0 in Ansys 2023 R1. Thus, selecting 0.6 as the documentation version on the top-right dropping list will give you access to the doc at the time of release. Then, looking in the operators documentation you will notice that plastic_strain_equivalent is not in there.

We are thinking of a system of tags to mention for each operator its release version and supported file types to prevent this kind of issue.

PS: I checked and everything does work when using Ansys 2023 R2.