How to use APDL Command Snippets in your ANSYS Mechanical Model

By: Ziad Melham
– July 8, 2019
Categories:

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

What is a Snippet/Command Object?

How do you add Snippets to your ANSYS Mechanical Model?

What else do you need to know before you dive in?

Item Snippets

Pre-Processing Snippets

Post Processing Snippets

Suggestions, Resources, and Final Thoughts

Categories

Certified Elite Channel Partner

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

Product Development
Diamond Partner

Technical Expertise to Enable your Addictive 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: Phoenix Analysis and Design Technologies, 7755 S. Research Dr., Tempe, AZ, 85284, https://www.padtinc.com. 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:

Share on twitter
Share on facebook
Share on linkedin
Share on pinterest

Upcoming Events

05/19/2022

RAPID + tct 2022

05/19/2022

Venture Cafe Roundtable: AI & Healthcare

05/18/2022

Tucson after5 Tech Mixer: World View

05/18/2022

RAPID + tct 2022

More Info

05/18/2022

Signal & Power Integrity Updates in Ansys 2022 R1 - Webinar

05/18/2022

Simulation World 2022

05/17/2022

RAPID + tct 2022

05/11/2022

Experience Stratasys Manufacturing Virtual Event

05/04/2022

Mechanical Meshing Updates in Ansys 2022 R1 - Webinar

04/27/2022

04/22/2022

12TH ANNUAL TUCSON GOLF TOURNAMENT

04/21/2022

04/20/2022

Additional Fluids Updates in Ansys 2022 R1

04/20/2022

Experience Stratasys Tour – Tempe Arizona

04/18/2022

Experience Stratasys Tour - Flagstaff Arizona

04/14/2022

D&M West | MD&M West

04/13/2022

D&M West | MD&M West

04/13/2022

Experience Stratasys Tour - Albuquerque New Mexico

04/12/2022

D&M West | MD&M West

04/12/2022

Experience Stratasys Tour - Los Alamos New Mexico

04/12/2022

Optimizing Engineering Workflows f​​​​or Propulsion System Design

04/07/2022

Experience Stratasys Tour - Austin Texas

04/07/2022

37th Space Symposium - Arizona Space Industry

04/06/2022

Transforming Digital Engineering with Ansys Discovery 2022 R1

04/06/2022

37th Space Symposium - Arizona Space Industry

04/05/2022

37th Space Symposium - Arizona Space Industry

04/04/2022

37th Space Symposium - Arizona Space Industry

03/30/2022

Simulation Best Practices for Vehicle Engineering - Webinar

03/23/2022

03/23/2022

High & Low Frequency Electromagnetics Updates in Ansys 2022 R1

02/24/2022

Arizona Technology Council After 5 Tech Mixer "Pandemic Pivot Pizza Pa

02/23/2022

SciTech Festival: Spend an Hour with 3D Printing Experts

02/11/2022

Webinar: Mechanical overview for Ansys 2022 R1

More Info

02/09/2022

Webinar: Product Development 101 (FAKE)

02/08/2022

Webinar: Navigating the Additive Landscape

01/27/2022

Arizona Technology Council 1st Quarter VIP Tech Mixer

More Info

01/26/2022

Simulation Best Practices for Gas Turbine Design & Development - Webin

More Info

01/19/2022

Arizona Photonics Days

More Info

11/04/2021

ExperienceIT, New Mexico

More Info

11/03/2021

Additive Manufacturing & Structural Optimization in Ansys 2021 R2 - We

More Info

11/03/2021

Optics Valley Technical Series: The Future of Simulation in the Optics

More Info

11/02/2021

SBIR Liftoff AZTC Virtual Breakfast Series

More Info

10/10/2021

Stratasys Mobile Truck Stop - Tucson Arizona

More Info

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: