What Every User Should Know About Tables in ANSYS Mechanical APDL

Categories:

lots%20of%20tablesI was having a discussion with a user who is very experienced with a FEA tool other than ANSYS. He wanted to define some properties with respect to time and his rotational speed and wanted to know how hard it would be to write a custom routine in ANSYS to do that.  I immediately explained that it was not that hard, as long as you have the right compiler. Then I realized that you did not need to compile any code. Unlike that other software, we have tables in ANSYS and you can use those to interpolate data relative to some other value.  And, now that it is Friday morning and we still do not have a FOCUS article for the week, I thought it would be a good time to review the basics of Tables in APDL.

ANSYS Mechanical (Workbench) users, do not leave and go back to reading TMZ.  This is useful to you as well because you can use code snippets in ANSYS Mechanical to define some very sophisticated loads without ever getting into Mechanical APDL.  One of those cool powerful things you can do in Mechanical. In fact, if you look at the input file that ANSYS Mechanical sends to the solver, it is often full of tables that ANSYS Mechanical makes.

This article will just touch on the simple aspects of tables that every user should know. There is a lot more you can do with tables, but we will save that for future articles.

The Basics

The APDL language has three type of parameters: variables (single numbers or 8 character strings), arrays, and tables.  variables and arrays are just like variables and arrays in most programming languages.  But tables are unique in that the indices are real numbers rather than integers.  And when you refer to a value in a table the program does a linear interpolation between the numbers you supply to get the value at that location. Think of it as a graph where instead of points you have a line:

image

What makes it even better, is that the table can be multiple dimensions. So you can make a value dependent on a location in 3D space, val(x,y,z), space and time, val(x,y,z,t), or even some input you need to use, val(x,y,z,t,myVal). 

You get an interpolated value by simply using it in a formula:

x = 2.4
y = 1.66
z = 23.5
frc = frc_tbl(x,y,z)

Also, many commands in ANSYS Mechanical APDL take a table as an argument. And the solver will input proper index values at solve time.  The simples example of this is a nodal force using the F command:

f,47,fx,%frc_tbl%

For each substep, the solver will interpolate a force value for node 47 in the X direction based the value of things like time, frequency, position, temp, and such for the current substep. More on how to define what values to use as an index below.

One other key thing to know about tables before we get into the details is the way they work.  What ANSYS does is take an actual array, and add a 0 column, row or plane to the array. So instead of going from 1 to 10, the array goes from 0 to 10.  And the index values are stored in this 0 row, column, or plane.  So to see the values using the *STATUS command, you have to tell it to start listing at 0 with the IMIN, JMIN, or KMIN arguments:

*stat,frc_tbl,,,0

Another good way to look at a table is using the *VEDIT (Parameters->Array Parameters->Define/Edit->Edit.)

image

Defining a Table

The hardest part of defining a table is defining the index and values.  Arrays are simple, you just define you r size with a *DIM and then supply a value for each integer index value:

*dim,val,,7
val(1) = 12.4,15.6,18.5,12.4,12.4,5,3.2

Produces:

image

and:

image

For tables, you need three steps: define the table with *DIM, define the indices (the axes), then provide the values.

*dim,val,table,7  
*taxis,val(1),1,1.3,2.4,3.1,4.6,5.2,5.9,7.0
val(1) = 12.4,15.6,18.5,12.4,12.4,5,3.2

Note that in the *DIM command, you have to specify that this is a table with TABLE.  For array’s you can say ARRAY or leave it blank, because ARRAY is the default. 

The next command, *TAXIS, is the important one. It does not call several cabs to pick you up.  It defines the Table AXIS… get it, TAXIS.  The first argument is the name of the table you want to fill, with the index put in for the row you want to start on, and the second is the index you want to fill.  Then you give the actual values.

Finally we supply the actual values just like in an array, but each value corresponds to the index values specified in the *TAXIS command.

The above example results in:

image

and

image

This example is for a 1D table. A 3D table works the same, you just need to define 3 axes and 3 columns of values.  Note that the first argument on the *TAXIS command is the column number that the axis refers to.

*dim,temptab,table,3,3,3
*taxis,temptab(1,1,1),1,0,5,10
*taxis,temptab(1,1,1),2,0,5,10
*taxis,temptab(1,1,1),3,0,5,10
temptab(1,1,1) = 10,100,10
temptab(1,2,1) = 12,150,10
temptab(1,3,1) = 10,90,7
temptab(1,1,2) = 12,120,12
temptab(1,2,2) = 15,180,15
temptab(1,3,2) = 17,90,12
temptab(1,1,3) = 20,200,20
temptab(1,2,3) = 22,250,20
temptab(1,3,3) = 20,290,27

This will produce:

image

If you find the code a bit confusing, we recommend that you use Parameters->Array Parameters->Define/Edit->Add… to create your tables, then look at the log file to get the commands.

Using Tables with Loads

The real value of tables is their use with commands that accept a table as a value, and this is usually some sort of load.  The help for a given command will tell you if it takes a table as an argument. If it does not, simply put the command in a *do-loop.

When you specify a table, you need to tell the command interpreter that it is a table and not variable or a string by placing the command in side percent signs:  f,frc_nodes ,fx ,%fx_load%.

But how do you tell the solver what solver values your indices refer to?  If you want the force applied based on the X,Y,Z position of the nodes in the component frc_nodes, you need to say which column in your table is X, Y, and Z.  You do that with the *DIM command:

*DIM, Par, Type, IMAX, JMAX, KMAX, Var1, Var2, Var3, CSYSID

Var1, Var2, and Var3 are predefined keywords that are called Primary Variables.  The possible values are:

TIME Time
FREQ Frequency
X X location of entity
Y y location of entity
Z z location of entity
TEMP Temperature
VELOCITY Velocity
Pressure PRESSURE
SECTOR Cyclic sector number

So to define loads that vary with Z position and time you would do:

*dim,val,table,3,3,,Z,TIME
*taxis,val(1),1,0,37,25.4
*taxis,val(1),2,0,.04,1
val(1,1) = 12.4,17,10.5
val(1,2) =8.3,7.4,12.8
val(1,3)=15.3,10.2,9.4
f,frcnds,fx,%val%

At each substep the program will go through each node in FRCNDS and get its Z location and the current time and interpolate a force and apply it to that node.  I do not know about you, but I think that is pretty slick.

The obvious next question is how do I deal with a different coordinate system?  The last argument on *DIM is CSYSID. You supply a local coordinate system number here and the program will use that coordinate system to figure out the position of the entity it is applying a load to.

Other Stuff

We strongly recommend you look at the *DIM and *TAXIS commands in the help. Also read section 3.10 of the ANSYS Parametric Design Language Guide, specifically the section on Table Type Array Parameters.

Some other things you can do with tables that we hope to cover in the future, but that you can also figure out on you own using the help are:

  • You can create 4 and 5 dimension tables using TAB4 and TAB5 for TYPE in the *DIM command.  Other things need to be done as well, it gets complicated. You can find an example at:

    // Basic Analysis Guide // 2. Loading // 2.5. Applying Loads

  • You can nest tables inside tables.  So you can have one table calculate a value based on primary values (X,Y,Z, FREQ, TIME, etc) then use the result of that interpolation to interpolate from another table.   One use of this would be if a load varies with rotational velocity, and rotational velocity varies with time.  So you define an RPM table that is dependent on TIME, then use the table to get a load.  (maybe that will be next weeks article…)

And we will finish with a picture of a really cool table and bench I found on line:  I want to get this for my patio.

smooth 4 660x396

Categories

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

Technical Expertise to Enable your Additive 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: . 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:

Upcoming Events

03/27/2024

2024 Arizona Space Summit

03/28/2024

SAF Blue Carpet Event

03/28/2024

2024 Arizona Space Summit

04/03/2024

Low Frequency Updates in Ansys 2024 R1 - Webinar

04/03/2024

Venture Madness Conference Reception + Expo

04/03/2024

Stratasys F3300: Game Changing Throughput - Webinar

04/08/2024

39th Space Symposium

04/09/2024

39th Space Symposium

04/10/2024

Discovery Updates in Ansys 2024 R1 - Webinar

04/10/2024

39th Space Symposium

04/11/2024

39th Space Symposium

04/22/2024

Experience Stratasys Truck Tour: Houston, TX

04/24/2024

Structures Updates in Ansys 2024 R1 (2)

04/24/2024

Experience Stratasys Truck Tour: Houston, TX

05/07/2024

Experience Stratasys Truck Tour: Albuquerque, NM

05/08/2024

Fluent Materials Processing Updates in Ansys 2024 R1 - Webinar

05/09/2024

Experience Stratasys Truck Tour: Los Alamos, NM

05/14/2024

Simulation World 2024

05/15/2024

Simulation World 2024

05/16/2024

Simulation World 2024

05/22/2024

Optics Updates in Ansys 2024 R1 - Webinar

06/12/2024

Connect Updates in Ansys 2024 R1 - Webinar

06/26/2024

Structures Updates in Ansys 2024 R1 (3) - Webinar

06/27/2024

E-Mobility and Clean Energy Summit

07/10/2024

Fluids Updates in Ansys 2024 R1 - Webinar

08/05/2024

2024 CEO Leadership Retreat

10/23/2024

PADT30 | Nerdtoberfest 2024

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: