200 likes | 461 Vues
CHAPTER 2 Parameters. Categories of Parameters. There are two categories of parameters; scalar and array . During an ANSYS run, there may be up to 400 parameters active at any point. Scalar parameters represent a single real value and are referenced by name.
E N D
CHAPTER 2 Parameters Written by Changhyun, SON
Categories of Parameters There are two categories of parameters; scalar and array. During an ANSYS run, there may be up to 400 parameters active at any point. 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 value in an array parameter is referenced by name and a subscript, where the subscript specifies the location of interest within the array. Written by Changhyun, SON
Defining Parameters To define a parameter, use the format Name = Value • Can be typed in the input window or in the Scalar Parameters dialog Utility Menu:Parameters > Scalar Parameters... • Name is the parameter name, eight alphanumeric characters or less. • Value may be a number, a previously defined parameter, a mathematical function, a parametric expression, or a character string. Written by Changhyun, SON
Defining Parameters - Examples inrad=2.5 outrad=8.2 numholes=4 thick=outrad-inrad elastic=2.7e6 density=0.283 bb=cos(30) pi=acos(-1) g=386 massdens=density/g circumf=2*pi*rad area=pi*r**2 dist=sqrt((y2-y1)**2+(x2-x1)**2) slope=(y2-y1)/(x2-x1) theta=atan(slope) jobname=‘proj1’ Written by Changhyun, SON
Naming Rules • Parameter names must be eight characters or less, beginning with a letter. • Only letters, numbers, and the underscore character ‘_’ are allowed. • Avoid underscore ‘_’ as starting character… reserved for ANSYS use. • Names are not case-sensitive, i.e, “RAD” and “Rad” are the same. All parameters are internally stored in capital letters. • Avoid common ANSYS labels such as STAT, DEFA, and ALL. Written by Changhyun, SON
Using Parameters jobname=‘proj1’ /filnam,jobname ! Jobname /prep7 elastic=30e6 mp,ex,1,elastic ! Young’s modulus force=500 fk,2,fy,-force ! Force at KP 2 fk,6,fx,force/2 ! Force at KP 6 Written by Changhyun, SON
Types of ANSYS Arrays • There are two types of ANSYS array parameters: • array type used to define discrete functions • table type used to define continuous functions via linear interpolation between tables entries Array type Table type Written by Changhyun, SON
Types of ANSYS Arrays • Arrays can be one, two or three-dimensional. • A two-dimensional array has m rows and n columns;rows are identified by a row index number I, which varies from 1 to m columns are identified by a column index number J, which varies from 1 to n. • 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 number and J is its column number. Written by Changhyun, SON
Definitions 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 Written by Changhyun, SON
Descriptor Ex.y Fx.y Gx.y ‘text’ H T / Used for DATA DATA DATA LITERAL LITERAL POSITION POSITION Sample E9.2 F9.2 G9.2 ‘SAMPLE TEXT’ 6HSAMPLE T6 / Description begin a new line Importing Values *VREAD, ParR, Fname, Ext, Dir (*VREAD Format Line) VREAD.DAT ----+----+----+----+----+ 1.5 7.8 12.3 *DIM,DAT,,3 *VREAD,DAT(1),VREAD,DAT (3F6.1) Written by Changhyun, SON
Retrieving Database Information To retrieve information from the database and assign it to a parameter, use the *GET command or Utility Menu : Parameters > Get Scalar Data... A vast amount of information is available, including model and results data. Refer to the *GET command description for details. Written by Changhyun, SON
Retrieving Database Information - Examples - *get,x1,node,1,loc,x ! x1 = X coordinate of node 1 [CSYS]* /post1 *get,sx25,node,25,s,x ! sx25 = X stress at node 25 [RSYS]* *get,uz44,node,44,u,z ! uz44 = UZ displacement at node 44 [RSYS]* nsort,s,eqv ! Sort nodes by von Mises stress *get,smax,sort,,max ! smax = maximum of last sort etable,vol,volu ! Store element volumes as vol ssum ! Sum all element table columns *get,totvol,ssum,,vol ! totvol = sum of vol column Written by Changhyun, SON
Retrieving into Array Parameters *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) *VGET, array_name(1), . . . . . *DIM,NODEX,,100 *VGET,NODEX(1),NODE,1,LOC,X Written by Changhyun, SON
Scalar and Vector Parameter Operations NEW=A+4 XX=(((A+B)*C**2) A=A+2 *VOPER, ParR, Par1, Operator, Par2 C(1)=A(1)+B(1) C(2)=A(2)+B(2) C(3)=A(3)+B(3) C(4)=A(4)+B(4) *VOPER,C(1),A(1),ADD,B(1) ADD, SUB, MULT, DIV, MIN, MAX, LE, LT, EQ, DOT, CROSS, ... Written by Changhyun, SON
Scalar Parametric Functions Trigonometric SIN, COS, TAN, ASIN, ACOS, ATAN, … Logarithmic LOG, EXP, LOG10, … Hyperbolic SINH, COSH, TANH, … Random Number RAND, GDIS, … Other ABS, NINT, SQRT, … Written by Changhyun, SON
Viewing Parameter Values *VEDIT *STATUS, Par, IMIN, IMAX, JMIN, JMAX, KMIN, KMAX *STATUS,DAT(1,1),2,3,2,3 *VPLOT, ParX, ParY, Y2, Y3, …, Y8 TABLE ARRAY Written by Changhyun, SON
Tabular Output *CFOPEN, Filename,Ext, Dir *VWRITE, Par1, Par2, ..., Par10 (*VWRITE Format Line) VALUE1=0.56 VALUE2=1.2 *CFOPEN,OUTPUT,DAT *VWRITE,VALUE1,VALUE2,VALUE1+VALUE2 (F5.2, ‘ + ‘, F5.2, ‘ = ‘, F5.2) Result Output 0.56 + 1.20 = 1.76 Written by Changhyun, SON
F1 F2 Load Step F1 F2 1 100N 200N 1 6 2 3 4 5 2 300N 100N 1 m 1 m 1 m 1 m 1 m 3 200N 300N Exercise A = 0.01 m2 I = 8.3E-6 m4 H = 0.1 m E = 210 GPa Load Step Data File ANSYS Results Data File (UY3, UY5) Written by Changhyun, SON
Input File /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) force.dat 100 200 300 100 200 300 Written by Changhyun, SON
/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) disp.res LoadStep1. : UY3 = 0.00034490, UY5 = 0.00021532 LoadStep2. : UY3 = 0.00038682, UY5 = 0.00021723 LoadStep3. : UY3 = 0.00056022, UY5 = 0.00034490 Written by Changhyun, SON