Using Ansys Scripting with pyMAPDL, pyDPF-Post, and More – PART 2: Solving and post-processing ANSYS models in Python

Categories:

A few months ago, PADT’s Alex Grishin posted an article about using the ever-improving Ansys scripting capabilities for Ansys Mechanical with Python using a tutorial to solve in Ansys MAPDL and then post-process in Python. The post covered how to:

  1. Build models in Ansys Mechanical
  2. Programmatically control solving the model in Ansys MAPDL
  3. Extract the stiffness matrix and load vectors
  4. Post-process the displacement and stress solution in Python

Now, in part 2 of his series, he goes through the following steps:

  1. Build models in Ansys Mechanical
  2. Programmatically control solving the model in Python
  3. Look at the Degree of Freedom ordering in the Ansys solver
  4. Post-process the displacement and stress solution in Python

The big difference is using Ansys scripting for solving in Python rather than Ansys Mechanical APDL. But there is a lot more in the tutorial. Things important to Ansys scripting, like DOF ordering, dealing with higher order elements, and who to figure out how Ansys stores the matrix information.

Now we are getting into the nitty gritty of FEA solving, and even if you never have a need to solve your models outside of the Ansys solver, knowing how to do it in Python will help you understand how everything works under the hood. And if you do need to get fancy and do your own solving in Python or prep your matrices for a different solver with Python, this article should help. It also helps the reader understand the mechanics of post-processing for higher-order elements.

In the middle of running this standard NAFEMS challenge problem, Alex uncovered some issues involving an inherent numerical issue worth understanding. He also introduces a new Python library for results plotting, Matplotlib.

As Alex mentions in his final notes, after reading and understanding this content, you should:

  1. Know how to read the Ansys .full file with for use in Python
  2. Understand how element contour plots are rendered.

Tutorial on Using Ansys Scripting to Solve and Post Process and Ansys Mechanical Model in Python

Please find the PDF of the tutorial here:

And here is a zip file with the Ansys Mechanical Database

We hope that you find these two tutorials useful and can use them to explore your own applications using Ansys scripting or to understand the math behind FEA better. And don’t forget, if you are interested in having PADT help you with Ansys scripting, contact us and let’s talk.

Categories

Get Your Ansys Products & Support from the Engineers who Contribute to this Blog.

Technical Expertise to Enable your Additive Manufacturing Success.

PADT’s Pulse Newsletter

Keep up to date on what is going on at PADT by subscribing to our newsletter.


By submitting this form, you are consenting to receive marketing emails from: . You can revoke your consent to receive emails at any time by using the SafeUnsubscribe® link, found at the bottom of every email. Emails are serviced by Constant Contact

Share this post:

Upcoming Events

04/22/2024

Experience Stratasys Truck Tour: Houston, TX

04/24/2024

Structures Updates in Ansys 2024 R1 (2)

04/24/2024

Experience Stratasys Truck Tour: Houston, TX

05/07/2024

Experience Stratasys Truck Tour: Albuquerque, NM

05/07/2024

Dynamic Simulation for Rocket Propellant Systems! - Webinar

05/08/2024

Fluent Materials Processing Updates in Ansys 2024 R1 - Webinar

05/13/2024

Experience Stratasys Truck Tour: Tempe, AZ

05/14/2024

Simulation World 2024

05/15/2024

Simulation World 2024

05/16/2024

Simulation World 2024

05/22/2024

Optics Updates in Ansys 2024 R1 - Webinar

06/12/2024

Connect Updates in Ansys 2024 R1 - Webinar

06/26/2024

Structures Updates in Ansys 2024 R1 (3) - Webinar

06/27/2024

E-Mobility and Clean Energy Summit

07/10/2024

Fluids Updates in Ansys 2024 R1 - Webinar

08/05/2024

2024 CEO Leadership Retreat

10/23/2024

PADT30 | Nerdtoberfest 2024

Search in PADT site

Contact Us

Most of our customers receive their support over the phone or via email. Customers who are close by can also set up a face-to-face appointment with one of our engineers.

For most locations, simply contact us: