Using Ansys Scripting with pyMAPDL, pyDPF-Post, and More – PART 1: Running and Post-Processing an Ansys Model Outside Ansys

Using Ansys Scripting with pyMAPDL, pyDPF-Post, and More - PART 1: Running and Post-Processing an Ansys Model Outside Ansys
Categories:
One of the Python scripts created using Ansys Scripting

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:

  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

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.

The Results on the Left Were Created with Ansys Scripting in Python
The Results on the Left Were Created with Ansys Scripting in Python

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.

The Two Results on the Left Were Created with Ansys Scripting in Python
The Two Results on the Left Were Created with Ansys Scripting in Python

Join PADT and the global Ansys user community for this year’s online conference.

Multiple Tracks | Every Physics & Every Industry

Hear from Ansys Leadership | Presentations from Customers on How They Use Ansys

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

Technical Expertise to Enable your Additive Manufacturing Success.

Share this post:

Upcoming Events

May 29
, 2025
Applying Digital Engineering across Space Mission Analysis and Design: Payload - Webinar
Jun 03
, 2025
Experience Stratasys Truck Tour - Denver Colorado
Jun 03
, 2025
Accelerate Electronics Thermal Workflows with Ansys Discovery and Ansys Icepak - Webinar
Jun 03
, 2025
Smart Manufacturing and Operations Enabled by Simulation - Webinar
Jun 04
, 2025
Composites & Structural Optimization Updates in Ansys 2025 R1 - Webinar
Jun 05
, 2025
Using Digital Engineering for a Structural, Thermal, and Optical Performance Workflow - Webinar
Jun 09
- Jun 11
, 2025
TechConnect World 2025
Jun 12
, 2025
Design and Test: Critical Links for Mission Success - Webinar
Jun 17
, 2025
Ansys Virtual Workshop - Fatigue & Durability Workflows with Ansys Mechanical & nCode
Jun 18
, 2025
Fluent CPU - UI & UX Updates in Ansys 2025 R1 - Webinar
Jun 16
- Jun 20
, 2025
Turbo Expo
Jun 24
, 2025
Cardiovascular Digital Twins: From Bench to Bedside - Webinar
Jun 25
, 2025
E-Mobility and Clean Energy Summit
Jul 02
, 2025
Electric Machine & Consumer Electronics Updates in Ansys 2025 R1 - Webinar
Jul 11
, 2025
2025 Aerospace, Aviation, Defense and Manufacturing Conference
Jul 16
, 2025
HFSS Updates in Ansys 2025 R1 - Webinar
Jul 16
- Jul 17
, 2025
Ansys Simulation World 2025
Aug 10
- Aug 13
, 2025
SmallSat 2025

Search the 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: