pyMechanical stability

PierreLCV
PierreLCV Member Posts: 35
10 Comments Name Dropper
**

Dear all,
I am currently working on a script to automate my Ansys Mechanical thermal simulation. For that, i am using pyMechanical to export Ansys Mechanical capabilities in a script. It works ! That's the good news ! However, i have more than 2000 simulations to do and the script never go above 100 calculations and crash before...
You will find attached the code (I do not how add code on this forum...)
Sorry my comments are in French but it is quite straightforward.

I have been finally able to use exactly this code in Ansys Mechanical Scripting using CPython (beta) and replacing Quantity by the full link attached to this last function and it works very well without crash...
So i think the code is not so bad (of course not very great, i am a very young developper, and even not developper...) but it appears that work with Ansys Mechanical Scripting (so with the graphical interface open) is a bit smaller than pyMechanical. So, it could be interesting to make this code working...
I am using Spyder 5.5.0 and python 3.8.10 as development environnement.
Generally speaking, when it crashes, two types of message appear (not at the same time!):

  • fatal python error: aborted (then a reference to the Python kernel)
  • windows fatal exception: access violation

Thank you for your help !
Pierre

Comments

  • PierreLCV
    PierreLCV Member Posts: 35
    10 Comments Name Dropper
    **
    edited January 26

    Hello,
    Working on this topic it appears that i have a lot of error message during the calculations process (before it crashs!):

    Does anyone knows what does it mean ? I specify that 1, 2, 3, 4... is a counter that tells me when a calculation has been completed, so I can keep track of it...

    Thank you for your help !

    Best regards,
    Pierre

  • PierreLCV
    PierreLCV Member Posts: 35
    10 Comments Name Dropper
    **

    Hello,
    My simulations crashed again but this time I have an error message:

    Maybe someone will be able to guide me on this !

    Thank you
    Pierre

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee, GitHub-issue-creator Posts: 319
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    Hi Pierre,
    You are using embedded PyMechanical, which loads all of Mechanical into Python's memory. My best guess is that you are overwhelming the memory requirements of Python. Could you perhaps use remote pyMechanical instead?

    @mohamed-koubaa , Any insights?

  • PierreLCV
    PierreLCV Member Posts: 35
    10 Comments Name Dropper
    **

    Dear Landon,
    Indeed, this script is using PyMechanical embedded.
    I started by using remote pyMechanical but honestly i do not see any advantages to use this as we can use Python directly in Ansys Mechanical... More precisely, my main concern about remote pyMechanical was the necessity to send to Mechanical only IronPython compatible commands.
    In short, in my case, executing the script directly in Ansys Mechanical using CPython as needed is more efficient than using pyMechanical embedded (stability problem presented before) or pyMechanical remote which do not offers more possibility as Mechanical Scripting...

    Thank you very much for your help !
    Pierre

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭

    @PierreLCV , if the code works in standard Mechanical but crashes in PyMechanical, please open an issue in Github to let the PyMechanical dev team know. https://github.com/ansys/pymechanical/issues Many thanks.