Arrays and Tables in APDL – A QuickReference
Many times when I want to push the bounds of what I can do in Mechanical, I need to use APDL. Now I happen to think that APDL is straightforward to use for most of the things that I do, provided I have the documentation open to the right place. The one thing that tends to stop me in my tracks, however, is arrays and tables in APDL. The information is spread out in multiple places in the help and it is just not something I do often enough to memorize. Yet arrays allow you to deal with vectors and matrices of data and are extremely useful for postprocessing. Tables allow you to apply varying loads and properties in many places where you would normally apply a constant. It is too powerful of a feature to be a road block each time and I thought I’d provide this rundown of everything you need to define arrays, all in one place.
Arrays are a good way to hold vector or matrix data. As shown above, you can define arrays with the *DIM command. This defines the overall dimensions of the array (you can actually have up to 5 dimensions using special forms of the *DIM command, refer to the documentation for more). You can fill arrays yourself as below but I typically have ANSYS fill in arrays for me for postprocessing purposes, using commands like *VGET (to fill arrays prior to writing a file with *VWRITE) and VGET (sends time/frequency history curves from POST26 to arrays).
Below are examples of a vector and a matrix complete definition in APDL:
Did you know you can apply a curve or contour instead of a constant in many places in ANSYS? These can vary based on position, time, temperature and more. Tables are how this is accomplished. Tables are like arrays but with labels on the rows and columns that are not just the row/column number.
As you can see, you can get some nice interpolation functionality very quickly. Just like arrays you can do this in up to 5 dimensions! Many times you will use a *DO loop to define arrays in terms of an expression as well.
The row/col/plane_var fields are for labeling your axis. If you intend to send a varying load or property later, this is where you tell it what it varies by. Check the *DIM command documentation for a list of what you can vary it by. For load or property commands like D and RMODIF, the documentation will need to say that you can pass a table and you do so by passing the table name enclosed in %’s as below. If you are using spatially varying loads, you probably will want to specify a custom coordinate system using the coord_sys_id field.
If you are like me, you may be slightly perturbed by the lack of units in the above plots. This is intentional. These commands are unitless, just like APDL. It is highly recommended that you set Analysis Settings -> Analysis Data Management -> Solver Units from Active System to the correct unit system for your APDL. Doing this will make sure that your unit system is consistent and will prevent several types of errors.
The list of available variables for tables is below:
|Primary Variable||Label for var1, var2, var3|
|Cyclic sector number||SECTOR|
|Amplitude of the rotational velocity vector||OMEGS|
If this was useful to you and you’d like to hear more, subscribe to our newsletter below: