What Every User Should Know About Tables in ANSYS Mechanical APDL

By: Eric Miller
– August 24, 2012
Categories:

I 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:

TIMETime
FREQFrequency
XX location of entity
Yy location of entity
Zz location of entity
TEMPTemperature
VELOCITYVelocity
PressurePRESSURE
SECTORCyclic 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

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: