One of the most powerful features in ANSYS Mechanical is the fact that it leverages the ANSYS Mechanical APDL solver. This modern and ever-improving interface allows users to create, run, and post-process models with power and ease. But it also allows users to access the power of the underlying solver through the native language it uses, APDL. You can have your cake and eat it too.
A lot has changed since we did our last seminar on this topic, back in May of 2011. ANSYS Mechanical has grown and scores of features have been added, removing the need for a lot of the functions and features that people needed APDL scripts for. But again and again our tech support people find that users push the envelope with their tools and to do what they need to do, they need to get inside the solver tool using the APDL scripting language.
That is why we decided to update that seminar as a blog article, making it more searchable while we bring it up to date. There is a lot to cover, so get comfortable.
Background and Foundations
If you have never used ANSYS Mechanical APDL a lot of what we are going to talk about may sound like another language. That is because it is. The key thing to remember is that when you click Solve in ANSYS Mechanical, it generates an input file that is then read into ANSYS Mechanical APDL in batch mode.
This is the original ANSYS product that Johns Swanson wrote in the early 70’s. It was released in 1971. (if you want to learn more about the history of ANSYS, please check out our interview with Dr. Swanson.) Over the following decades, the program grew to become a fully featured FEA program that could do almost anything. However, the user interface, and especially the embedded geometry tool, could not keep up and much of the pre- and post-processing was replaced by ANSYS Mechanical. But all of those capabilities are still there and accessible to the user.
Before we go further, let’s talk about the simple model we will be using for this post. It is what we call a “Towers of Test” model. Two beams held at their base that are loaded in various ways. Small, fast, and a great way to experiment with new fet
What is APDL and why do we need it?
APDL stands for ANSYS Parametric Design Language. One of the key breakthroughs that ANSYS introduced in the late 80’s was converting their input file from a formatted text file that simply specified the model being solved with a simple text command language that could also define the model fully. In addition, it allowed:
- Every user-supplied value in the file, numbers or text, to become a parameter. The parameters can be numbers, strings, or multi-dimensional arrays of numbers or strings.
- Flow control of the text file by introducing if-then-else statements and do-loops.
- Functions to interrogate the database at any point during the model creation, solve, or post-processing. The values returned by the function could be stored as parameters.
- Operators to modify the parameters. This includes math operators, common numerical functions, and string tools.
If you have only used fully interactive engineering software, then the power of these capabilities may not be apparent. But as you add small snippets to ANSYS mechanical, the openness full capability of the ANSYS Mechanical APDL solver will become apparent.
To see the APDL that ANSYS Mechanical write out, just look in the ds.dat file. That is the “Input File” that the program generates and sends to the solver.
You can find it with the “File” viewer on the project page.
Or you can write out the file wherever you want from within ANSYS Mechanical by selecting what you want to solve, and click the Environment > Tools > Write Input File command. >>>>>>> NOT WORKING