General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

how to do parametric simulation with scripting?

    • Gary Wang
      Subscriber

      Hi there,

      I am doing a parametric study with an indenter pressing a piece of rubber. The parameter is the indenter positions. Currently, I am using scripting in Automation to create coordinates and transform the indenter to those coordinates. I choose this because I need to do some exporting within Scripting, such as force, and strain of interested nodes. However, this is a sequential method the latter cases only start after the former finish. 

      I know that Ansys itself has a Parametric module, which can get use of multiple cores and parallel computing. Provided that I have hundreds of cases, it would be beneficial to leverage parallel computing.

      Can I also run my scripting in Ansys Parametric to export results for each case? Or can I leverage parallel computing in Automation Scripting?

      Thanks a lot.

    • Gary Wang
      Subscriber

      adding a picture to show the details.  Help wanted

      • Aniket
        Forum Moderator

         

        Hi Gary,

        You can combine native parametric analysis capability along with Python using the Python code object in Mechanical to achieve what you want (i.e. exporting files after each solution):

        Using Python Code (ansys.com)

        Now coming to your parallel processing query, with the above-suggested approach, each design point is run after previous finishes. If you want multiple parallel instants, you will need multiple licenses to start separate mechanical sessions.

        -Aniket

        How to access Ansys help links

        Guidelines for Posting on Ansys Learning Forum

         

    • Ashish Khemka
      Forum Moderator

      Hi Gary,

      Please see if the following links are of use to you:

      Access the Power of Ansys from the Python World

      How to automate Ansys Mechanical using Python?

      Regards,

      Ashish Khemka

    • Gary Wang
      Subscriber

       

      Hi Aniket and Ashish,

      thanks for your input. I have added Python Code object into Mechanical. And my previous Scripting texts did proceed to finish the exporting files. A big thumb up! However, I need to export all UserDefined results at each timestep. So I looped to set the result.DisplayTime. In scripting, I used [result.EvaluateAllResults()] to update the result after I set the timestep. While in Python Code object, it has no property of [result.EvaluateAllResults()]. So how can I re-evaluate the results in Python Code object?

      The link I followed to do the Python Code: https://developer.ansys.com/blog/script-tip-friday-python-code-object-mechanical

      Thanks a lot

       

    • Gary Wang
      Subscriber

      And I also tried this method from the link below, it didn't work either.

       

      https://www.linkedin.com/pulse/script-tip-friday-communicate-project-page-from-within-/

    • Ashish Khemka
      Forum Moderator

      Hi Gary, I do not have any additional comments. Let us see if other members have something else to suggest.

      Regards,

      Ashish Kumar

Viewing 5 reply threads
  • The topic ‘how to do parametric simulation with scripting?’ is closed to new replies.