Chapter 1: Introducing APDL

APDL stands for Ansys Parametric Design Language, a scripting language that you can use to automate common tasks or even build your model in terms of parameters (variables). While all Mechanical APDL commands can be used as part of the scripting language, the APDL commands discussed here are the true scripting commands and encompass a wide range of other features such as repeating a command, macros, if-then-else branching, do-loops, and scalar, vector and matrix operations.

While APDL is the foundation for sophisticated features, it also offers many conveniences that you can use in your day-to-day analyses. In this guide we'll introduce you to the basic features - parameters; macros; branching, looping, and repeating; and array parameters - and show you some simple examples. As you become more adept at the language, you will begin to recognize applications for APDL in your own environment.

This guide covers the following topics:

  • Working with the toolbar: You can add frequently used Mechanical APDL functions or macros to the Mechanical APDL toolbar by defining abbreviations, which are aliases (up to eight characters long) for a Mechanical APDL command, GUI function name, or macro name.

  • Using parameters: Parameters are APDL variables (they are more similar to FORTRAN variables than to FORTRAN parameters). Mechanical APDL uses two types of parameters: scalar and array.

  • Using APDL Math for matrix manipulations: APDL Math gives you access to matrix manipulation routines, including fast and efficient solvers. APDL Math provides access to matrices and vectors on the .full, .emat, .mode and .sub files, as well as other sources, so that you can read them in, manipulate them, and write them back out or solve them directly. Both dense matrices and sparse matrices can be manipulated using APDL Math.

  • Understanding APDL as a macro language, including creating a macro: You can record a frequently used sequence of Mechanical APDL commands in a macro file (these are sometimes called command files). Creating a macro enables you to, in effect, create your own custom Mechanical APDL command. In addition to executing a series of Mechanical APDL commands, a macro can call GUI functions or pass values into arguments.

  • Interfacing with the GUI: Within a Mechanical APDL macro, you have several ways to access components of the Mechanical APDL GUI (toolbar, dialog box, *ASK command, etc.).

  • Encrypting macros: Mechanical APDL provides the ability to encrypt macro files so that the source is not "human-readable." Encrypted macros require an encryption key to run. You can either place the encryption key explicitly (in readable ASCII) in the macro or you can set it in Mechanical APDL as a global encryption key.

See APDL Commands in the Command Reference for a complete list of all APDL commands.