Verifying A Stiffness Matrix from Ansys Mechanical in Ansys Scripting with python
The most popular posts in 2022 were Part 1 and Part 2 of Alex’s Grishin’s “Using Ansys Scripting with pyMAPDL, pyDPF-Post, and More” series. And he is starting 2023 off with Part 3, where he gets into looking at and solving a stiffness matrix in python.
In Part 1, he shared how 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
In Part 2 of his series, he goes through the following steps:
- Build models in Ansys Mechanical
- Programmatically control solving the model in Python
- Look at the Degree of Freedom ordering in the Ansys solver
- Post-process the displacement and stress solution in Python
In this post, Part 3, he covers:
- How to export the stiffness matrix and loads from an Ansys Mechanical model
- Reading the matrix into python
- Verify the matrix with your own Finite Element (FE) solver
- Looks at the ill-conditioned nature of the test problem matrix he discovered in Part 2.
- How to create stress and displacement plots
The point of this last bit of scripting is to provide a tool that lets you double-check and better understand the stiffness matrix and solution from the Ansys solvers using your own FE code. But at the same time, it does show you how to do your own FEA solver in python, which is pretty cool.
The tutorial uses the same NAFEMS challenge problem and the same Ansys mechanical model.
Here is the PDF for the tutorial:
Here is a zip file with all the scripts:
Here is a zip file with the Ansys Mechanical Database:
We hope that you find these three 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.
You must be logged in to post a comment.