Other Stuff Every User Should Know about Tables in ANSYS Mechanical APDL: Nesting and 4 or 5 Dimension Tables

Categories:

complicated table design

About a month ago we published an article on “What Every User Should Know About Tables in ANSYS Mechanical APDL”  At the end of that article we had a section on “Other Stuff”  and expressed our hope to cover those subjects in the future. The future is now.  If you are not very familiar with table arrays, make sure you review the previous article before delving into nesting and 4/5 dimension tables in this article.

By the way, the funky table at the end of the article got a lot of good feedback, so I’ve googled around and found some other interesting tables. The one here at the top is what you get if you google “complicated table”

Artistic And Creative Design Table IdeaNested Tables

As you will remember from memorizing the previous article, a common use for tables is the set them up to give you a value for a given “primary variable” that is determined by the solver at a given point in the solution.  Possible primary variables are: TIME, FREQ, X, Y, Z, TEMP, VELOCITY, PRESSURE and SECTOR. But what if you want to use one of those primary variables to look up a value, then use that value to then interpolate a second value?

A good example is that you have a piece of rotating equipment and the value of the heat transfer coefficient (HF) is a function of RPM and the radius of a given element face.  But RPM varies over time.  What you can do is make the HF table point to and RPM table that is based on the primary variable time:

*DIM,MYCNV,TABLE,3,3,,RPM,X,,1
*taxis,mycnv(1,1),1,0,1000,20.01e6
*taxis,mycnv(1,1),2,0,1,2
mycnv(1,1) = .25,4,10
mycnv(1,2) = .35,7,15
mycnv(1,3) = .45,10,28

*DIM,RPM,TABLE,4,1,1,TIME
RPM(1,0)=0.0,10.0,40.0,60.0
RPM(1,1)=0.0,5.0,20.0,30.0

wrttbl,'mycnv','foo4.txt'
wrttbl, 'rpm','foo5.txt'

SF,ALL,CONV,%mycnv%

This macro is missing stuff, like a model and selecting the nodes to apply the SF command to.

The tables look like this:

Table: mycnv    RPM      vs X       

          | 0.000     1.000     2.000    
          |------------------------------
 0.000    |0.2500    0.3500    0.4500    
 1000.    | 4.000     7.000     10.00    
0.2001E+08| 10.00     15.00     28.00

and

Table: rpm      TIME     vs         

          |0.7889E-30
          |----------
 0.000    | 0.000    
 10.00    | 5.000    
 40.00    | 20.00    
 60.00    | 30.00

(We’ll cover the wrttbl macro below.)

So at a given substep, the program will take time and figure out what RPM needs to be.  Then it will use RPM and the radius (X in CSYS 1) to figure out the convection coefficient for each node.

As you can imagine, you can get pretty sophisticated with this. The key is that the name of the table you use for the calculated value is input into the variables to interpolate on for the second table, using the *DIM command.

Another common use is scaling tables based on some value. Let say you have a pressure table and the total pressure is scaled over time, based on time.  You would make a pressure table that is dependent on say X and y. It would have two planes. One with 0 values and one with the max values. Then you would make a scale table that scales from 0 to 1 based on time.  It would look like this:

*DIM,pscl,table,5,,,time    !Row label is CPTAB, the table of Cps
*taxis,pscl(1,1),1,0,1,5,10,30        
pscl(1,1) = .25,.5,1,1,.333

*DIM,ptab,TABLE,4,4,2,X,Y,pscl
*taxis,ptab(1,1),1,0,1.35,2.75
*taxis,ptab(1,1),2,-7.2,-3.2,6.5,10.6
*taxis,ptab(1,1),3,0,1
ptab(1,1,1) = 0,0,0,0
ptab(1,2,1) = 0,0,0,0
ptab(1,3,1) = 0,0,0,0
ptab(1,4,1) = 0,0,0,0
ptab(1,1,2) = 72,48,97,123
ptab(1,2,2) = 53,48,88,98
ptab(1,3,2) = 43,38,77,88
ptab(1,4,2) = 33,28,55,77

SF,ALL,PRESS,%ptab%

As always with tables, double check things and make sure you have your  rows and columns correct.  Start simple, and then add more detail. Testing out on a 2×2 or 3×3 tables is a good way to start.

Bent Guitar Tables By Phil Daniels4 and 5 Dimension Arrays and Tables

This section applies to both arrays and tables, so it is a bit beyond the scope of the title, but I hope you will forgive me.

Most users will simply use a one, two, or even three dimension array or table (row, column, plane). However, both arrays and tables support two more dimensions: books and shelves. Because this capability is a later addition to the program, it behaves a little differently. You need to add values for the size of the book (KMAX) and the shelf (MMAX) as well as variable names for each: VAR4 and VAR5

The first difference is in the *DIM command. For normal arrays and tables you use:

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

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

For 4 dimension arrays or tables you use:

*DIM,Par,ARR4,IMAX,JMAX,KMAX,LMAX,Var1,Var2,Var3,Var4,CSYSID
*DIM,Par,TAB4,IMAX,JMAX,KMAX,LMAX,Var1,Var2,Var3,Var4,CSYSID

For 5 dimension arrays or tables you use:

*DIM,Par,ARR5,IMAX,JMAX,KMAX,LMAX,MMAX,Var1,Var2,Var3,Var4,Var5,CSYSID
*DIM,Par,TAB5,IMAX,JMAX,KMAX,LMAX,MMAX,Var1,Var2,Var3,Var4,Var5,CSYSID

It is important to be aware of this because if you look at the manual entry for *DIM it only lists the 3 dimension version of the command, and these variations are covered in the notes.

Once the array or table is defined you have to fill it using APDL commands, this size is not supported in the user interface. The same commands are used, but instead of supplying one, two or three indices values, you supply four or five.

The following is an example of defining a table in terms of location (X,Y,Z), Time, and Temperature. This is the most common usage of a five dimension table:

*dim,ldval,tab5,3,3,3,3,3,X,Y,Z,TIME,TEMP    ! table
*taxis,ldval(1,1,1,1,1),1,-2.3,0,3.4      ! X Range
*taxis,ldval(1,1,1,1,1),2,-1.2,0,1.8      ! Y Range
*taxis,ldval(1,1,1,1,1),3,-3.6,0,4.5      ! Z Range
*taxis,ldval(1,1,1,1,1),4,0,5,10          ! Time Range
*taxis,ldval(1,1,1,1,1),5,32,320,500      ! Temp Range

*do,ii,1,3
  *do,jj,1,3
    *do,kk,1,3
      *do,ll,1,3
        *do,mm,1,3
          !silly made up equation to fill the table with
          ldval(ii,jj,kk,ll,mm) = ii*.123+jj/.2+ll*kk+mm*JJ*JJ
        *enddo
      *enddo
    *enddo
  *enddo
*enddo

sancal-elipse-floating-coffee-table-rafa-garcia-11Writing a Table to a File

For simple 2D tables with up to 10 columns, I use a cheesy macro I wrote called wrttbl.mac. It was used above.  It is a bit of a brute force method, because it has code blocks for from 0 to 10 columns.  A more general approach would build the actual *VWRITE commands with *VWRITES… It should also be expanded to do Planes.  Maybe for a future article.

Anyhow, here it is, maybe you will find it useful.

ttbl = arg1
fname = arg2     
*get,nrw,parm,%ttbl%,dim,X
*get,ncl,parm,%ttbl%,dim,Y
*get,xax,parm,%ttbl%,var,1
*get,yax,parm,%ttbl%,var,2

nmcl = nint((ncl*10)/2)
nmrw = nint(nrw/2)

*cfopen,%fname%

*vwrite,ttbl,xax,yax
('Table: ',A,' ',A,' vs ',A) 
*vwrite,
(x)
*if,ncl,eq,1,then
    *vlen,1
    *vwrite,%ttbl%(0,1)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',10('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii  ,1)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,2,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',20('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,3,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',30('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,4,then
    /gopr
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3),%ttbl%(0,4)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',40('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3),%ttbl%(ii,4)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,5,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3),%ttbl%(0,4),%ttbl%(0,5)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',50('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3),%ttbl%(ii,4),%ttbl%(ii,5)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,6,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3),%ttbl%(0,4),%ttbl%(0,5),%ttbl%(0,6)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',60('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3),%ttbl%(ii,4),%ttbl%(ii,5),%ttbl%(ii,6)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,7,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3),%ttbl%(0,4),%ttbl%(0,5),%ttbl%(0,6),%ttbl%(0,7)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',70('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3),%ttbl%(ii,4),%ttbl%(ii,5),%ttbl%(ii,6),%ttbl%(ii,7)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,8,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3),%ttbl%(0,4),%ttbl%(0,5),%ttbl%(0,6),%ttbl%(0,7),%ttbl%(0,8)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',80('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3),%ttbl%(ii,4),%ttbl%(ii,5),%ttbl%(ii,6),%ttbl%(ii,7),%ttbl%(ii,8)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,9,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3),%ttbl%(0,4),%ttbl%(0,5),%ttbl%(0,6),%ttbl%(0,7),%ttbl%(0,8),%ttbl%(0,9)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',90('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3),%ttbl%(ii,4),%ttbl%(ii,5),%ttbl%(ii,6),%ttbl%(ii,7),%ttbl%(ii,8),%ttbl%(ii,9)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*if,ncl,eq,10,then
    *vlen,1
    *vwrite,%ttbl%(0,1),%ttbl%(0,2),%ttbl%(0,3),%ttbl%(0,4),%ttbl%(0,5),%ttbl%(0,6),%ttbl%(0,7),%ttbl%(0,8),%ttbl%(0,9),%ttbl%(0,10)
    (10x,'|',10g10.4)
    *vwrite
    (10x,'|',100('-'))          |
    *do,ii,1,nrw
        *vlen,1
        *vwrite,%ttbl%(ii,0),%ttbl%(ii,1),%ttbl%(ii,2),%ttbl%(ii,3),%ttbl%(ii,4),%ttbl%(ii,5),%ttbl%(ii,6),%ttbl%(ii,7),%ttbl%(ii,8),%ttbl%(ii,9),%ttbl%(ii,10)
        (g10.4,'|',10g10.4) 
    *enddo
*endif
*cfclose

And with that, I think we have beaten the table topic to death.

naturalistic-curved-wood-table-design-z

Categories

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

Technical Expertise to Enable your Addictive Manufacturing Success.

PADT Pulse Newsletter Screen Grab from March 2023

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

05/31/2023

Driving Automotive Innovation with Additive - Webinar

05/24/2023

Hill Air Force Base Tech Expo

05/24/2023

Structural Updates in Ansys 2023 R1 (3) – Structural Optimization & Ex

05/23/2023

CROSSTALK 2023: Emerging Opportunities for Advanced Manufacturing Smal

05/10/2023

Signal & Power Integrity Updates in Ansys 2023 R1 - Webinar

04/26/2023

Additive Manufacturing Updates in Ansys 2023 R1 - Webinar

04/20/2023

38th Space Symposium Arizona Space Industry

More Info

04/19/2023

38th Space Symposium
Arizona Space Industry

04/19/2023

Additive Aids for Manufacturing - Webinar

04/18/2023

38th Space Symposium
Arizona Space Industry

04/17/2023

38th Space Symposium

04/13/2023

Venture Madness 2023

04/12/2023

Fluid Meshing & GPU-Solver Updates in Ansys 2023 R1 - Webinar

03/29/2023

8th Thermal and Fluids Engineering Conference

03/29/2023

Structural Updates in Ansys 2023 R1 - Composites, Fracture & MAPDL

03/28/2023

8th Thermal and Fluids Engineering Conference

03/27/2023

8th Thermal and Fluids Engineering Conference

03/26/2023

8TH Thermal and Fluids Engineering Conference

03/24/2023

Arizona BioPreneur Conference | Spring 2023

03/22/2023

2023 Arizona MedTech Conference

03/22/2023

Optimize Jigs & Fixtures with Additive - Webinar

03/15/2023

3D Design Updates in Ansys 2023 R1 - Webinar

03/08/2023

Competitive Advantages of 1D/3D Coupled Simulation - Webinar

03/01/2023

High Frequency Updates in Ansys 2023 R1 - Webinar

02/22/2023

Additive Advantages in Aerospace - Webinar

02/15/2023

Structural Updates in Ansys 2023 R1 (1) - Webinar

02/09/2023

IME 2023: MD&M | WestPack | ATX | D&M | Plastek

02/08/2023

IME 2023 MD&M | WestPack | ATX | D&M | Plastek

02/07/2023

IME 2023 MD&M | WestPack | ATX | D&M | Plastek

01/27/2023

Arizona Photonics Days, 2023

01/26/2023

Arizona Photonics Days, 2023

01/26/2023

TIPE 3D Printing | 2023

01/26/2023

Venture Cafe Phoenix Talent Night - Job Fari

01/26/2023

VFS 2023 Autonomous/Electric VTOL Symposium

01/25/2023

Arizona Photonics Days, 2023

01/25/2023

Building A.M.- Utah: Kickoff!

01/25/2023

TIPE 3D Printing | 2023

01/25/2023

VFS 2023 Autonomous/Electric VTOL Symposium

01/24/2023

VFS 2023 Autonomous/Electric VTOL Symposium

01/24/2023

TIPE 3D Printing | 2023

01/18/2023

2023 AZ Tech Council Golf Tournament

12/21/2022

Simulation Best Practices for 5G Technology - Webinar

12/14/2022

Digital Twins Updates in Ansys 2022 R2 - Webinar

12/08/2022

Tech the Halls - AZ Tech Council Holiday Mixer

12/07/2022

Electric Vehicle and Other Infrastructure Update Panel

11/30/2022

SPEOS Updates in Ansys 2022 R2 - Webinar

11/23/2022

Simulation Best Practices for Electronics Reliability - Webinar

11/16/2022

Discovery Updates in Ansys 2022 R2

11/10/2022

VentureCafe Phoenix Panel: Venture Capital in AZ

11/08/2022

2022 GOVERNOR’S CELEBRATION OF INNOVATION AWARDS + TECH SHOWCASE

11/03/2022

VentureCafe Phoenix Panel: Angel Investment in AZ

11/02/2022

High & Low Frequency Electromagnetics Updates in Ansys 2022 R2

10/26/2022

Simulation Best Practices For Chip-Package-System Design & Development

10/20/2022

Nerdtoberfest 2022

10/19/2022

2022 Southern Arizona Tech + Business Expo

10/19/2022

LS-DYNA Updates in Ansys 2022 R2 - Webinar

10/17/2022

Experience Stratasys Truck Tour - Clearfield Utah

10/14/2022

ASU School of Manufacturing Systems and Networks - Formal Opening Cele

10/14/2022

Experience Stratasys Truck Tour - Midvale Utah

10/12/2022

Experience Stratasys Truck Tour - Littleton Colorado

10/06/2022

Fluids Updates in Ansys 2022 R2 - Webinar

10/05/2022

Experience Stratasys Truck Tour - Colorado Springs

09/29/2022

White Hat Life Science Investor Conference - 2022

09/28/2022

2022 AZBio Awards

09/28/2022

Simulation Best Practices for Rotating Machinery Design & Development

09/21/2022

ExperienceIT NM 2022

09/21/2022

Additive Updates in Ansys 2022 R2 - Webinar

09/14/2022

Rocky Mountain Life Sciences Investor & Partnering Conference

09/08/2022

Ansys Optics Simulation User Group Meeting - Virtual

09/08/2022

Ansys Optics Simulation User Group Meeting

09/07/2022

SI & PI Updates in Ansys 2022 R2 - Webinar

08/31/2022

Simulation Best Practices for Developing Medical Devices - Webinar

08/24/2022

Mechanical Updates in Ansys 2022 R2 - Webinar

08/10/2022

Tucson after5 Tech Mixer: Ruda-Cardinal

08/05/2022

Flagstaff Tech Tour, 2022

08/02/2022

2022 CEO Leadership Retreat

08/01/2022

2022 CEO Leadership Retreat

07/27/2022

Thermal Integrity Updates in Ansys 2022 R1 - Webinar

07/20/2022

Simulation Best Practices for the Pharmaceutical Industry - Webinar

07/14/2022

NCMS Technology Showcase: Corpus Christi Army Depot

07/13/2022

NCMS Technology Showcase: Corpus Christi Army Depot

07/13/2022

Additive & Structural Optimization Updates in Ansys 2022 R1 - Webinar

07/07/2022

Arizona AADM Conference, 2022

06/29/2022

LS-DYNA Updates & Advancements in Ansys 2022 R1 - Webinar

06/23/2022

Simulation Best Practices for Wind Turbine Design - Webinar

06/15/2022

MAPDL Updates & Advancements in Ansys 2022 R1 - Webinar

06/01/2022

Mechanical Updates in Ansys 2022 R1 - pt. 2 Webinar

05/26/2022

Modelling liquid cryogenic rocket engines in Flownex - Webinar

05/25/2022

SMR & Advanced Reactor 2022

05/25/2022

05/24/2022

SMR & Advanced Reactor 2022

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

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: