Written by Changhyun, SON Chapter 2. Parameters - 1 CHAPTER 2 Parameters
Written by Changhyun, SON Chapter 2. Parameters - 2 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. 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. 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. 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 Chapter 2. Parameters - 3 Defining Parameters To define a parameter, use the format Name = Value l Can be typed in the input window or in the Scalar Parameters dialog Utility Menu:Parameters > Scalar Parameters... l Name is the parameter name, eight alphanumeric characters or less. l Value may be a number, a previously defined parameter, a mathematical function, a parametric expression, or a character string.
Written by Changhyun, SON Chapter 2. Parameters - 4 Defining Parameters - Examples inrad=2.5outrad=8.2numholes=4thick=outrad-inradelastic=2.7e6density=0.283bb=cos(30)pi=acos(-1)g=386massdens=density/gcircumf=2*pi*radarea=pi*r**2dist=sqrt((y2-y1)**2+(x2-x1)**2)slope=(y2-y1)/(x2-x1)theta=atan(slope)jobname=‘proj1’
Written by Changhyun, SON Chapter 2. Parameters - 5 Naming Rules l Parameter names must be eight characters or less, beginning with a letter. l Only letters, numbers, and the underscore character ‘_’ are allowed. l Avoid underscore ‘_’ as starting character… reserved for ANSYS use. l Names are not case-sensitive, i.e, “RAD” and “Rad” are the same. All parameters are internally stored in capital letters. l Avoid common ANSYS labels such as STAT, DEFA, and ALL.
Written by Changhyun, SON Chapter 2. Parameters - 6 jobname=‘proj1’ /filnam,jobname! Jobname /prep7elastic=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 Using Parameters
Written by Changhyun, SON Chapter 2. Parameters - 7 Types of ANSYS Arrays l There are two types of ANSYS array parameters: u array type used to define discrete functions u table type used to define continuous functions via linear interpolation between tables entries Array type Table type
Written by Changhyun, SON Chapter 2. Parameters - 8 Types of ANSYS Arrays l Arrays can be one, two or three-dimensional. l 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. l 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 Chapter 2. Parameters - 9 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 Chapter 2. Parameters - 10 Importing Values *VREAD, ParR, Fname, Ext, Dir (*VREAD Format Line) DescriptorEx.yFx.yGx.y‘text’HT/ Used for DATADATADATALITERALLITERALPOSITIONPOSITIONSampleE9.2F9.2G9.2 ‘SAMPLE TEXT’ 6HSAMPLET6/Description begin a new line *DIM,DAT,,3*VREAD,DAT(1),VREAD,DAT(3F6.1)VREAD.DAT
Written by Changhyun, SON Chapter 2. Parameters - 11 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. Retrieving Database Information
Written by Changhyun, SON Chapter 2. Parameters - 12 *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 Retrieving Database Information - Examples -
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 Parameters *DIM,NODEX,,100 *VGET,NODEX(1),NODE,1,LOC,X *VGET, array_name(1),.....
Written by Changhyun, SON Chapter 2. Parameters - 14 Scalar and Vector Parameter Operations NEW=A+4XX=(((A+B)*C**2)A=A+2 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) *VOPER, ParR, Par1, Operator, Par2 ADD, SUB, MULT, DIV, MIN, MAX, LE, LT, EQ, DOT, CROSS,...
Written by Changhyun, SON Chapter 2. Parameters - 15 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 Chapter 2. Parameters - 16 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 ARRAY TABLE
Written by Changhyun, SON Chapter 2. Parameters - 17 Tabular Output *CFOPEN, Filename,Ext, Dir *VWRITE, Par1, Par2,..., Par10 (*VWRITE Format Line) VALUE1=0.56VALUE2=1.2*CFOPEN,OUTPUT,DAT*VWRITE,VALUE1,VALUE2,VALUE1+VALUE2 (F5.2, ‘ + ‘, F5.2, ‘ = ‘, F5.2) = = 1.76 Result Output
Written by Changhyun, SON Chapter 2. Parameters - 18 Exercise 300N200N3 100N300N2 200N100N1 F2F2F2F2 F1F1F1F1 Load Step F1F1F1F1 F2F2F2F2 1 m A = 0.01 m 2 I = 8.3E-6 m 4 H = 0.1 m E = 210 GPa Load Step Data File Results Data File (UY 3, UY 5 ) ANSYS
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) force.dat Input File
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 = , UY5 = LoadStep2. : UY3 = , UY5 = LoadStep3. : UY3 = , UY5 = disp.res