ansys / pydpf-post

Data Processing Framework - Post Processing Module
https://post.docs.pyansys.com
MIT License
43 stars 10 forks source link

Error when using simulation.displacement() to get displacement from modal simulation #341

Open MDemenois opened 1 year ago

MDemenois commented 1 year ago

I am trying to extract the displacement from a modal analysis for specific modes.

I am using the following code from the examples:

from ansys.dpf import post resultFile = 'pathToMyResultFile simulation = post.load_simulation(resultFile) displacelementMode5 = simulation.displacement(modes=[5])

This code gives me the following error: DpfVersionNotSupported: called from connect_with

I am using Python 3.10.9 in a virtual environment on Windows with 2021R2, ansys-dpf-core 0.7.4 and ansys-dpf-post 0.3.0.

I also tried: displacementEveryModes = simulation.displacement()

Or: displacementNamedSelection = simulation.displacement(named_selections=['namedSelection'])

And I got the same error. I also have the same error when trying: stressMode5 = simulation.stress(modes = [5])

Thank you

PProfizi commented 1 year ago

Hello @MDemenois, Thank you for bringing up this issue. I think I may know what the problem is. I have added a fix to something similar, which will be in the next release I plan by end-of -week. In the meantime, just to be sure, could you please share the whole error message including the code lines where the error occurred? (the stack trace)

MDemenois commented 1 year ago

Hello @PProfizi, please find a screen grab of the complete error message obtained with the 4 lines of code presented in my initial message.

ErrorMessage

Thank you.

PProfizi commented 1 year ago

@MDemenois, thank you, now I see the error is about retro-compatibility with Ansys 2021R2. This can be fixed in a next version (I will make an Issue), but in the meantime if you have access to Ansys 2022R1 or later, this problem should not occur.

Another option is to use DPF as a standalone product, as shown here, which is now the recommended way of using DPF if you would prefer more regular updates.