array parameters module 2. training manual october 30, 2001 inventory #001571 2-2 2. array...

20
Array Parameters Module 2

Upload: breana-horry

Post on 15-Dec-2015

223 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

Array Parameters

Module 2

Page 2: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual2. Array Parameters

• Array Parameters are parameters that can take on multiple values.

• They can be 1-D, 2-D, or 3-D.

– 1-D: m rows x 1 column

– 2-D: m rows x n columns

– 3-D: m rows x n columns x k planes

17.1

-47.6

-5.2

25.0

107.9

814 17 386

1057 -47 704

1033 -52 348

7141 25 -66

622 107 111

5x1 array 5x3 array mxnx3 array

AA = BB = CC =

Page 3: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-3

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual...Array Parameters

• In this chapter, we will discuss how to define array parameters and how to perform operations among them.

• Topics covered:

A. Types of Array Parameters

B. How to Define

C. Retrieving Database Information

D. Array Operations

E. Workshop

Page 4: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-4

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

A. Types of Array Parameters

• There are three types of array parameters:

– Array

– Table

– Character

• Type array is a standard 1-D, 2-D, or 3-D matrix of numeric values, such as BB shown here.

– BB(2,3) = 704

– BB(3,1) = 1033

– etc.

814 17 386

1057 -47 704

1033 -52 348

7141 25 -66

622 107 111

5x3 array

BB =

Page 5: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-5

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...Types of Array Parameters

• Type table is similar to array, except that its row, column, and plane indices can be real numbers, allowing you to interpolate values.

– Requires the “zeroth” row, column, and plane to be filled with numbers.

– Useful to define time-dependent loads and other similar functions.

– Primary variables include X, Y, Z, temperature, velocity, pressure and time.

– For example, the table array FORCE could represent a force-vs-time function, with the zeroth column representing time values.

• FORCE(0.4) = 279.9996

• FORCE(6.5) = 560.0

• FORCE(8.9) = 119.25• etc.

Page 6: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-6

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...Types of Array Parameters

• A character array is a 1-D, 2-D, or 3-D matrix of alphanumeric strings.

– Useful for storing file names, DOF labels, etc.

– Each string can have up to eight characters.

JOB1

JOB2

JOB3

JOB4

JOB5

jobs =

UX

UY

UZ

ROTY

ROTZ

dofs =

Page 7: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-7

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

B. How to Define

Two steps to define an array parameter:

1. Specify name, type and dimension.

– Utility Menu > Parameters > Array Parameters > Define/Edit > Add

– or *DIM command. Example:

*dim,aa,array,4 ! 4x1x1 array

*dim,force,table,5 ! 5x1x1 table

*dim,bb,array,5,3 ! 5x3x1 array

*dim,dofs,char,6 ! 6x1x1 character array

– parameter name can not exceed 32 characters

Page 8: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-8

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...How to Define

2. Fill in the array values.

– Utility Menu > Parameters > Array Parameters > Define/Edit > Edit

– Or *VEDIT command

– Or “=”command. Example:

bb(1,1)=11,21,31,41,51

bb(1,2)=12,22,32,42,52

bb(1,3)=13,23,33,43,53

Page 9: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-9

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...How to Define

• For table type arrays, you must fill in values for the zeroth locations. Otherwise, their values will default to the “tiny” number 7.8886E-31.

– For example:

force(1,1)=0,560,560,238.5,0

force(1,0)=1E-6,0.8,7.2,8.5,9.3

force(0,1)=0

Page 10: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-10

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...How to Define

• For character arrays, there is no graphical way to fill in the strings.

– Use the “=”command to type in the values, then use *STAT to list them.

– Each string must be enclosed in single quotes.

– Example:

dofs(1) = ‘ux’, ‘uy’, ‘uz’, ‘rotx’, ‘roty’, ‘rotz’

*stat,dofs

Page 11: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-11

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...How to Define

• There are many other ways to fill arrays:

– Predefined functions in *VFILL command (Utility Menu > Parameters > Array Parameters > Fill)

• ramp function

• random function

• etc.

– Read data from a file:

• *VREAD for arrays

• *TREAD for tables

• Or Utility Menu > Parameters > Read from File

– Retrieve data from the database (discussed next).

Page 12: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-12

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

C. Retrieving Database Information

• Just as *GET retrieves scalar data from the database, you can use *VGET to retrieve array information.

– Or Utility Menu > Parameters > Get Array Data

• First dimension the array, then retrieve the data.

• Example:

*dim,dispval,array,20,3 ! 20x3 array

*vget,dispval(1,1),node,1,u,x ! UX of nodes 1-20 in column 1

*vget,dispval(1,2),node,1,u,y ! UY in column 2

*vget,dispval(1,3),node,1,u,z ! UZ in column 3

Page 13: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-13

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

…Retrieving Database Information

• Other types of array information you can retrieve:

– nodal and keypoint coordinates (in the active CSYS)

– attributes of elements, volumes, areas, etc.

– select status of entities (1 if selected, 0 if not selected)

– nodal stresses, strains, thermal gradients, thermal flux, etc.

– element table data

– and so on…

Page 14: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-14

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

D. Array Operations

• Once you have defined array parameters, you can perform a variety of operations among them.

– Utility Menu > Parameters > Array Operations

– Or *VFUN, *VOPER, *VSCFUN, *VWRITE, etc.

Page 15: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-15

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...Array Operations

• *VFUN operates on a single array parameter.

– *vfun,b(1),sin,a(1) will result in b(j)=sin(a(j))

– Other operations include:

• natural log, common log, exponential

• Square root, sort, copy

• Conversion from local to global coordinates and vice-versa

• Tangent and normal vectors to a path

• etc.

Page 16: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-16

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...Array Operations

• *VOPER operates on two array parameters.

– *voper,c(1),a(1),sub,b(1) will result in c(k)=a(k)-b(k)

– Other operations include:

• addition, subtraction, multiplication, division

• min, max, logical operations

• derivatives, integrals

• dot and cross products

Page 17: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-17

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...Array Operations

• *VSCFUN determines properties of an array parameter.

– *vscfun,maxval,max,a(1) will result in a scalar parameter maxval = max(a(i))

– Other operations include:

• sum of all the elements of an array

• statistical quantities such as mean, median, standard deviation, variance and rms

• min/max, index location of min/max

• index locations of first and last non-zero entry

Page 18: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-18

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...Array Operations

• *VWRITE writes data to a file in a formatted sequence.

– Utility Menu > Parameters > Array Parameters > Write to File

– Example:

*cfopen,wing,dat*vwrite(/,3x,’Node Number’,4x,’Temperature’,/)*vwrite,nnum(1),tval(1)(5x,f6.0,6x,e14.8)*cfclose

will create a file called wing.dat with the nnum and tval arrays written in specified format.

Page 19: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-19

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

...Array Operations

• There are many, many more array operations available.

• Please refer to your APDL Programmer’s Guide for details.

Page 20: Array Parameters Module 2. Training Manual October 30, 2001 Inventory #001571 2-2 2. Array Parameters Array Parameters are parameters that can take on

October 30, 2001

Inventory #001571

2-20

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

INTR

OD

UC

TIO

N T

O A

NS

YS

6.0

- Part 2

Training Manual

Array Parameters

E. Workshop

• Refer to your Workshop Supplement for instructions on:

W1. Axisymmetric Wheel