Using the Ansys Scripting API to Execute an Ansys MAPDL Solve and Post Process the Results in Python
PADT’s Alex Grishin has been busy doing some cool Multiphysics optimization work. As part of that effort, he used Ansys scripting to:
- Build models in Ansys Mechanical
- Programmatically control solving the model in Ansys MAPDL
- Extract the stiffness matrix and load vectors
- Post-process the displacement and stress solution in Python
First, he shares how to install pyansys from github.com. Then Alex uses a NAFEMS challenge problem to show how to do all of this, including increasingly more accurate ways to script the post-processing. Along the way he uses Ansys API tools pyMAPDL to access the Ansys MAPDL solver, and pyDPF to interface with the Ansys toolset, including extracting the results.
Please find a PDF of his tutorial here:
And here is a zip file with the Scripts and the Ansys Mechanical database archive he used:
Alex is working on some additional tutorials on scripting in Python with this incredibly powerful Ansys API. And don’t forget, if you are interested in having PADT help your Ansys scripting, contact us and let’s talk.