General Mechanical

General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

Python script for signed Von Mises Stress

    • Emmanuel Lecomte
      Subscriber

      Hello,

      In an old 2018 post, we were explained how to calculate a signed Von Mises stress using this formula in a user defined result:

      seqv*(sx+sy+sz+1e-6)/abs(sx+sy+sz+1e-6)

      What could be the python script to put in ANSYS 2023 R1 ?

      Thanks,

      E.L.

    • Erik Kostson
      Ansys Employee

       

      Hi

      Can you explain more what you want to do – what is the python script for signed VM, is very generic.

      The above post is about user defined reusult using that expresssion which is defined by the user manually. So do you want to automate this, say by having a mechanical script that generates this user defined result ? Then the command to do this is:

      ExtAPI.DataModel.Project.Model.Analyses[0].Solution.AddUserDefinedResult()

      Or perhaps the question is not the above then explain much more.

      All the best

      Erik

       

    • Emmanuel Lecomte
      Subscriber

      Hi,

      To be more clear, I want to write a python script which calculated the signed Von Mises stress.

      My simulation have 3 times steps. For each time step, I want to collect :

      - the Von Mises stress,

      - the SX, SY and SZ stresses,

      then I want to calculate the signed Von Mises according to the formula presented in my first post.

      I just want to write a python script which will give same result than user defined result. 

      (it will be used after in a more complex python script).

      Thanks.

    • Erik Kostson
      Ansys Employee

      Hi

       

      See this post on how to extract stresses and uses them as needed.
      https://forum.ansys.com/forums/topic/getting-stress-values-by-act-scripting/

      Also look on the the python result object (same post above)

      All the best

      Erik

    • Emmanuel Lecomte
      Subscriber

      Hi,

      It's interesting, I'm on the right way but not yet arrived.

      Now I can collect the SX, SY, SZ and Von Mises stresses, script the first part of my equation, but I dont' know how to script the "abs(sx+sy+sz+1e-6)".

      Any idea ?

      Thanks

      E.L.

       

Viewing 4 reply threads
  • You must be logged in to reply to this topic.