written by changhyun, son chapter 2. parameters - 1 chapter 2 parameters

20
Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 CHAPTER 2 Parameters Parameters

Upload: millicent-jennings

Post on 02-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 1

CHAPTER 2CHAPTER 2

ParametersParameters

Page 2: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 2

Categories of ParametersCategories of Parameters

There are two categories of parameters; There are two categories of parameters; scalarscalar and and arrayarray. During an ANSYS run, . During an ANSYS run,

there may be there may be up to 400 parametersup to 400 parameters active at any point. active at any point.

Scalar parameters represent a single real value and are referenced by name.Scalar parameters represent a single real value and are referenced by name.

Array parameters are 1, 2, or 3 dimensional and can hold many real values. A vArray parameters are 1, 2, or 3 dimensional and can hold many real values. A v

alue in an array parameter is referenced by name and a subscript, where the subalue in an array parameter is referenced by name and a subscript, where the sub

script specifies the location of interest within the array.script specifies the location of interest within the array.

Page 3: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 3

Defining ParametersDefining Parameters

To define a parameter, use the formatTo define a parameter, use the format

Name = ValueName = Value

Can be typed in the input window or in the Can be typed in the input window or in the

Scalar Parameters dialogScalar Parameters dialog

Utility Menu:Parameters > Scalar Utility Menu:Parameters > Scalar

Parameters...Parameters...

Name is the parameter name, eight Name is the parameter name, eight

alphanumeric characters or less.alphanumeric characters or less.

Value may be a number, a previously defined Value may be a number, a previously defined

parameter, a mathematical function, a parameter, a mathematical function, a

parametric expression, or a character string.parametric expression, or a character string.

Page 4: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 4

Defining Parameters - ExamplesDefining Parameters - Examples

inrad=2.5inrad=2.5

outrad=8.2outrad=8.2

numholes=4numholes=4

thick=outrad-inradthick=outrad-inrad

elastic=2.7e6elastic=2.7e6

density=0.283density=0.283

bb=cos(30)bb=cos(30)

pi=acos(-1)pi=acos(-1)

g=386g=386

massdens=density/gmassdens=density/g

circumf=2*pi*radcircumf=2*pi*rad

area=pi*r**2area=pi*r**2

dist=sqrt((y2-y1)**2+(x2-x1)**2)dist=sqrt((y2-y1)**2+(x2-x1)**2)

slope=(y2-y1)/(x2-x1)slope=(y2-y1)/(x2-x1)

theta=atan(slope)theta=atan(slope)

jobname=‘proj1’jobname=‘proj1’

Page 5: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 5

Naming RulesNaming Rules

Parameter names must be eight characters or less, beginning with a letter.Parameter names must be eight characters or less, beginning with a letter.

Only letters, numbers, and the underscore character ‘_’ are allowed.Only letters, numbers, and the underscore character ‘_’ are allowed.

Avoid underscore ‘_’ as starting character… reserved for ANSYS use.Avoid underscore ‘_’ as starting character… reserved for ANSYS use.

Names are Names are notnot case-sensitive, i.e, “ case-sensitive, i.e, “RADRAD” and “” and “RadRad” are the same. All param” are the same. All param

eters are internally stored in capital letters.eters are internally stored in capital letters.

Avoid common ANSYS labels such as STAT, DEFA, and ALL.Avoid common ANSYS labels such as STAT, DEFA, and ALL.

Page 6: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 6

jobname=‘proj1’jobname=‘proj1’

/filnam,jobname/filnam,jobname ! Jobname! Jobname

/prep7/prep7

elastic=30e6elastic=30e6

mp,ex,1,elasticmp,ex,1,elastic ! Young’s modulus! Young’s modulus

force=500force=500

fk,2,fy,-forcefk,2,fy,-force ! Force at KP 2! Force at KP 2

fk,6,fx,force/2fk,6,fx,force/2 ! Force at KP 6! Force at KP 6

Using ParametersUsing Parameters

Page 7: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 7

Types of ANSYS ArraysTypes of ANSYS Arrays

There are two types of ANSYS array parameters:There are two types of ANSYS array parameters:

arrayarray type used to define type used to define discretediscrete functions functions

tabletable type used to define type used to define continuouscontinuous functions via linear functions via linear

interpolation between tables entriesinterpolation between tables entries

Array typeArray type Table typeTable type

Page 8: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 8

Types of ANSYS ArraysTypes of ANSYS Arrays

Arrays can be one, two or three-dimensional.Arrays can be one, two or three-dimensional.

A two-dimensional array has m rows and n columns;A two-dimensional array has m rows and n columns;

rows are identified by a row index number I, which varies from 1 to rows are identified by a row index number I, which varies from 1 to mm

columns are identified by a column index number J, which varies from columns are identified by a column index number J, which varies from

1 to 1 to nn..

The quantities that make up the array are called array elements. The quantities that make up the array are called array elements.

Each array element is identified by indices (I,J) where I is its row Each array element is identified by indices (I,J) where I is its row

number and J is its column number.number and J is its column number.

Page 9: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 9

Definitions of ANSYS ArraysDefinitions of ANSYS Arrays

Using the GUI, in the

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

Using command :

*DIM, array_name, array_type, I_max, j_max, k_max

Page 10: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 10

Importing ValuesImporting Values

*VREAD, ParR, Fname, Ext, Dir*VREAD, ParR, Fname, Ext, Dir

(*VREAD Format Line)(*VREAD Format Line)

DescriptorDescriptor

Ex.yEx.y

Fx.yFx.y

Gx.yGx.y

‘‘text’text’

HH

TT

//

Used forUsed for

DATADATA

DATADATA

DATADATA

LITERALLITERAL

LITERALLITERAL

POSITIONPOSITION

POSITIONPOSITION

SampleSample

E9.2E9.2

F9.2F9.2

G9.2G9.2

‘‘SAMPLE TEXT’SAMPLE TEXT’

6HSAMPLE6HSAMPLE

T6T6

//

DescriptionDescription

begin a new linebegin a new line

*DIM,DAT,,3*DIM,DAT,,3

*VREAD,DAT(1),VREAD,DAT*VREAD,DAT(1),VREAD,DAT

(3F6.1)(3F6.1)

VREAD.DATVREAD.DAT

----+----+----+----+----+----+----+----+----+----+

1.5 7.8 12.31.5 7.8 12.3

Page 11: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 11

To retrieve information from the database and assign it to a parameter, use the To retrieve information from the database and assign it to a parameter, use the

*GET*GET command or command or Utility Menu : Parameters > Get Scalar Data...Utility Menu : Parameters > Get Scalar Data...

A vast amount of information is available, including model and results data. A vast amount of information is available, including model and results data.

Refer to the *GET command description for details.Refer to the *GET command description for details.

Retrieving Database InformationRetrieving Database Information

Page 12: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 12

*get,x1,node,1,loc,x*get,x1,node,1,loc,x ! x1 = X coordinate of node 1 [CSYS]*! x1 = X coordinate of node 1 [CSYS]*

/post1/post1

*get,sx25,node,25,s,x*get,sx25,node,25,s,x ! sx25 = X stress at node 25 [RSYS]*! sx25 = X stress at node 25 [RSYS]*

*get,uz44,node,44,u,z*get,uz44,node,44,u,z ! uz44 = UZ displacement at node 44 [RSY! uz44 = UZ displacement at node 44 [RSY

S]*S]*

nsort,s,eqvnsort,s,eqv ! Sort nodes by von Mises stress! Sort nodes by von Mises stress

*get,smax,sort,,max*get,smax,sort,,max ! smax = maximum of last sort! smax = maximum of last sort

etable,vol,voluetable,vol,volu ! Store element volumes as vol! Store element volumes as vol

ssumssum ! Sum all element table columns! Sum all element table columns

*get,totvol,ssum,,vol*get,totvol,ssum,,vol ! totvol = sum of vol column! totvol = sum of vol column

Retrieving Database Information Retrieving Database Information - Examples -- Examples -

Page 13: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 13

*GET,kx1,KP,1,LOC,X

*GET,ky1,KP,1,LOC,Y

*GET,kz1,KP,1,LOC,Z

*GET,kx2,KP,2,LOC,X

*GET,ky2,KP,2,LOC,Y

*GET,kz2,KP,2,LOC,Z

DIST=SQRT((KX2-KX1)**2+(KY2-KY1)**2+(KZ2-KZ1)**2)

Retrieving into Array ParametersRetrieving into Array Parameters

*DIM,NODEX,,100

*VGET,NODEX(1),NODE,1,LOC,X

*VGET, array_name(1), . . . . .

Page 14: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 14

Scalar and Vector Parameter OperationsScalar and Vector Parameter Operations

NEW=A+4NEW=A+4

XX=(((A+B)*C**2)XX=(((A+B)*C**2)

A=A+2A=A+2

C(1)=A(1)+B(1)C(1)=A(1)+B(1)

C(2)=A(2)+B(2)C(2)=A(2)+B(2)

C(3)=A(3)+B(3)C(3)=A(3)+B(3)

C(4)=A(4)+B(4)C(4)=A(4)+B(4)

*VOPER,C(1),A(1),ADD,B(1)*VOPER,C(1),A(1),ADD,B(1)

*VOPER, ParR, Par1, Operator, Par2*VOPER, ParR, Par1, Operator, Par2

ADD, SUB, MULT, DIV, MIN, MAX, LE, LT, EQ, DOT, CROSS, ...ADD, SUB, MULT, DIV, MIN, MAX, LE, LT, EQ, DOT, CROSS, ...

Page 15: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 15

Scalar Parametric FunctionsScalar Parametric Functions

TrigonometricTrigonometric

SIN, COS, TAN, ASIN, ACOS, ATAN, …SIN, COS, TAN, ASIN, ACOS, ATAN, …

LogarithmicLogarithmic

LOG, EXP, LOG10, …LOG, EXP, LOG10, …

HyperbolicHyperbolic

SINH, COSH, TANH, …SINH, COSH, TANH, …

Random NumberRandom Number

RAND, GDIS, …RAND, GDIS, …

OtherOther

ABS, NINT, SQRT, …ABS, NINT, SQRT, …

Page 16: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 16

Viewing Parameter ValuesViewing Parameter Values

*VEDIT*VEDIT

*STATUS, Par, IMIN, IMAX, JMIN, JMAX, KMIN, KMAX *STATUS, Par, IMIN, IMAX, JMIN, JMAX, KMIN, KMAX

*STATUS,DAT(1,1),2,3,2,3*STATUS,DAT(1,1),2,3,2,3

*VPLOT, ParX, ParY, Y2, Y3, …, Y8*VPLOT, ParX, ParY, Y2, Y3, …, Y8

ARRAY TABLE

Page 17: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 17

Tabular OutputTabular Output

*CFOPEN, Filename,Ext, Dir*CFOPEN, Filename,Ext, Dir

*VWRITE, Par1, Par2, ..., Par10*VWRITE, Par1, Par2, ..., Par10

(*VWRITE Format Line)(*VWRITE Format Line)

VALUE1=0.56VALUE1=0.56

VALUE2=1.2VALUE2=1.2

*CFOPEN,OUTPUT,DAT*CFOPEN,OUTPUT,DAT

*VWRITE,VALUE1,VALUE2,VALUE1+VALUE2*VWRITE,VALUE1,VALUE2,VALUE1+VALUE2

(F5.2, ‘ + ‘, F5.2, ‘ = ‘, F5.2)(F5.2, ‘ + ‘, F5.2, ‘ = ‘, F5.2)

0.56 + 1.20 = 1.760.56 + 1.20 = 1.76

Result OutputResult Output

Page 18: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 18

ExerciseExercise

300N200N3

100N300N2

200N100N1

FF22FF11Load StepLoad Step

11

22 33 44 55

66

FF11 FF22

1 m1 m 1 m1 m 1 m1 m 1 m1 m 1 m1 m

A = 0.01 mA = 0.01 m22

I = 8.3E-6 mI = 8.3E-6 m44

H = 0.1 mH = 0.1 mE = 210 GPaE = 210 GPa Load Step

Data File

Results Data File(UY3, UY5)

ANSYS

Page 19: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 19

/prep7

et,1,3

r,1,0.01,8.33e-6,0.1

ex,1,210e9

n

,6,5

fill

e,1,2

egen,5,1,1

d,1,ux,,,,,uy

d,6,uy

*dim,force,,3,2

*vread,force(1,1),force,dat

(f4.0)

*vread,force(1,2),force,dat

(t5,f4.0)

100 200

300 100

200 300

force.dat

Input FileInput File

Page 20: Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters

Written by Changhyun, SON Chapter 2. Parameters - 20

/solu

*do,i,1,3

f,2,fy,force(i,1)

f,4,fy,force(i,2)

lswrite,i

*enddo

lssolve,1,i

/post1

*dim,disp,,3,3

*do,i,1,3

set,i

disp(i,1)=i

*get,disp(i,2),node,3,u,y

*get,disp(i,3),node,5,u,y

*enddo

*cfopen,disp,res

*vwrite,disp(1,1),disp(1,2),disp(1,3)

('LoadStep', f2.0, ' : ', 'UY3 = ', f10.8, ', ', 'UY5 = ', f10.8)

LoadStep1. : UY3 = 0.00034490, UY5 = 0.00021532

LoadStep2. : UY3 = 0.00038682, UY5 = 0.00021723

LoadStep3. : UY3 = 0.00056022, UY5 = 0.00034490

disp.res