Вы находитесь на странице: 1из 76

ANSYS Release 10.

0 Documentation / APDL Programmer's Guide

.. (cyberkolbasa)
, . ,
, . -
, ,
http://cyberkolbasa.com1.ru e-mail cyberkolbasa@mail.ru.

APDL

....................................................................................................................................................... 1
1. APDL ......................................................................................................................................... 3
1.1. APDL? .................................................................................................................................. 3
2. ................................................................................................................. 4
2.1. ..................................................................................... 4
2.2. ....................................................................................................... 4
2.2.1. : .................................................................5
2.2.2. ................................................................................5
2.3. ............................................................................... 6
3. ......................................................................................................................... 6
3.1. ............................................................................................................................................. 6
3.2. ............................................................................... 7
3.2.1. *STATUS ...........................................................................................8
3.3. ..................................................................................................................... 8
3.3.1. .............................................................8
3.3.2. .........................................................................9
3.3.3. ANSYS .............................9
3.3.3.1. *GET ........................................................................................9
3.3.3.2. get-...........................................................................................10
3.3.4. ...................................................................................................................10
3.4. ......................................................................................................................... 11
3.5. ......................................................................................... 11
3.6. ................................................................................................................ 12
3.6.1. ...........................................................................................................12
3.6.2. ..............................................................................12
3.6.2.1. ..................................................................................................12
3.6.2.2. , .............................................13
3.6.2.3. ..........................................................................14
3.7. .......................................................... 14
3.8. ............................................................................................................ 15
3.9. , ......................................................................... 17
3.10. ............................................................................................................................................ 17
3.10.1. ..................................................................................................19
3.10.2. ...................................................................................................................20
3.10.3. TABLE..............................................................................................21
3.10.4. ...........................................................................................22
3.10.5. ...........................................................................23
3.10.5.1. ................................................................24
3.10.5.2. ......................................................................................25
3.10.5.3. .................................................25
3.10.5.4. *VREAD ......................................26
3.10.5.5. *TREAD ..................27
3.10.5.6. ................................................................................................31
http://cyberkolbasa.com1.ru

. 1 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

3.10.5.7. .............................................................32
3.10.5.8. ............................................................................................................33
3.10.6. ...............................................................................................................34
3.10.6.1. ..........................................................................................34
3.10.7. ........................................................................................................36
3.10.7.1. .....................................................................................................36
3.10.7.3. .................................................................................................39
3.10.7.3. .......................................41
3.10.8. ...........................................................................44
3.10.9. .........................................................................................................47
4. APDL ................................................................................................................................. 48
4.1. ............................................................................................................................... 49
4.1.1. .............................................................................................49
4.1.2. .........................................................................................................50
4.1.3. ANSYS .........................................................................................51
4.1.3.1. *CREATE ..............................................................................51
4.1.3.2. *CFWRITE ............................................................................52
4.1.3.3. /TEE .......................................................................................52
4.1.3.4. Utility Menu> Macro> Create Macro ..........................................52
4.1.4. ...............................................................................53
4.1.5. ........................................................................................54
4.2. ....................................................................................... 55
4.3. ..................................................................................................................... 56
4.3.1. .................................................................................................56
4.3.2. ...........................................................................56
4.3.3. .......................................................................................57
4.4. APDL .............................................................. 57
4.4.1. : .................................57
4.4.2. : Goto ......................................................................................................58
4.4.3. : *IF...............................................................................................58
4.4.4. .................................................................................................................60
4.4.5. : Do-Loops........................................................................................................................60
4.4.6. Do Loops..........................................................................................................61
4.4.7. : Do-While.............................................................................................61
4.5. ...................................................................................... 61
4.6. _STATUS _RETURN .................................................... 63
4.7. .............................................. 65
4.8. ............................................................................................................................. 65
5. GUI ........................................................................................................................................ 67
5.1. ............................................................. 67
5.2. ....................................................................................... 68
5.3. .............................. 71
5.4. ..................................................................... 72
5.5. ..................................................................................... 74
5.6. ................................................................................................. 74
6. .............................................................................................................................. 74
6.1. ................................................................................................ 74
6.2. ................................................................................................. 75
6.3. ............................................................................................ 76

http://cyberkolbasa.com1.ru

. 2 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

1. APDL
1.1. APDL?
APDL ANSYS (ANSYS Parametric
Design Language), , ,
(). APDL , , , "--", ,
, .
APDL - ,
, ,
. - ; ; , ; - .
, , APDL .
:
: ANSYS ANSYS, ,
( ) ANSYS,
{} GUI, -{}.
: - APDL (
Fortran). ANSYS
: .
APDL - : ANSYS - ( ). , , , ANSYS.
ANSYS, {} GUI
.
GUI: ANSYS, ANSYS GUI ( , , *ASK, ..).
: ANSYS , "".
.
( ASCII) , ANSYS
.
. APDL, , APDL Commands
Reference.

http://cyberkolbasa.com1.ru

. 3 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

2.
2.1.
ANSYS,
ANSYS ( , 4 APDL ). , . - ( ) ANSYS, GUI, . ,
MATPROP , , SAVE_DB - , QUIT -
Fnc_/EXIT ( ANSYS).
ANSYS . ( , , ..), . ANSYS GUI,
, ANSYS.
, . 2.1, ,
.

. 2.1. .
, SAVE_DB, , , , . 100 ( ""
, ). ; ,

ANSYS.

2.2.
*ABBR Utility Menu
> Macro > Edit Abbreviations Utility Menu > MenuCtrls > Edit Toolbar. :
1. OK ( *ABBR, Utility Menu > MenuCtrls > Update
Toolbar, ).
2. .
*ABBR :
*ABBR, Abbr, String
Abbr

, . .
String
, Abbr. String - ,
- . , . 4 APDL -.
String (picking menu)
( UIDL), Fnc_string. ,
http://cyberkolbasa.com1.ru

. 4 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

QUIT POWRGRPH, , Fnc_/QUIT Fnc_/GRAPHICS - UIDL,


, QUIT POWRGRPH .
UIDL .
. String 60 ,
: $; C***, /COM, /GOPR,
/NOPR, /QUIT, /UI, *END.
ANSYS :
*ABBR,
*ABBR,
*ABBR,
*ABBR,

SAVE_DB, SAVE
RESUM_DB, RESUME
QUIT, Fnc_/EXIT
POWRGRPH, Fnc_/GRAPHICS

2.2.1. :
, , - mymacro.mac, , . 2.2.,
Utility Menu > MenuCtrls > Edit Toolbar.

. 2.2. .
. 2.3.

. 2.3. .

2.2.2.
ANSYS ; , ,
RESUME () .
, Utility
Menu > MenuCtrls > Save Toolbar ( ABBSAV)
http://cyberkolbasa.com1.ru

. 5 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, Utility Menu > MenuCtrls > Restore Toolbar ( ABBRES).


.
.
- ,
ABBSAV .
APDL, ,
. , , .
, ,
.
/NOPR
*ABB,SAVE_DB ,SAVE
*ABB,RESUM_DB,RESUME
*ABB,QUIT ,Fnc_/EXIT
*ABB,POWRGRPH,Fnc_/GRAPHICS
/GO

*ABB ( *ABBR) . /NOPR log- ( log- ),


/GO ( log-).

2.3.
, , . , (
, ).
, ,
. ,
PREP_ABR, prep.abbr.
*ABBR,PREP_ABR,ABBRES,,PREP,ABBR

PREP_ABR .
, prep.abbr.
, ,
,
ANSYS. , . , , , return , .

3.
3.1.
- APDL (
). . ( ) (64-
). , , , , 2-100. , A A=B, B , A .
http://cyberkolbasa.com1.ru

. 6 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

ANSYS : .
, . , .
( ) ,
. APDL : , , ( , ).
( ) ANSYS; , . , 2.7 AA

N,12,AA,4

ANSYS
N,12,2.7,4

( 12 X=2.7 Y=4).

, ,
, ( ),
. , ANSYS , ,
. ANSYS ,
*IF, *IF.

3.2.
:
;
, , ;
32 .
.
:
ABC
PI
X_OR_Y

:
MY_PARAMETER_NAME_LONGER_THAN_32_CHARACTERS ( 32 )
2CF3 ( )
M&E ( "&")

, ANSYS, :

(DOF, TEMP, UX, PRES, ..)

Convenience labels (ALL, PICK, STAT, ..)

http://cyberkolbasa.com1.ru

. 7 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

(
ETABLE)

( CHAR, ARRAY, TABLE, ..)

ARG1 ARG9, AR10 AR99 . . "" .

, *ABBR.

( _ ). , GUI ANSYS .

APDL, ( _ ).
, *STATUS *DEL.

3.2.1. *STATUS
Listing Parameters *STATUS.
, "" *STATUS.
, ( _ )
*STATUS.
, APDL
. ,
, ANSYS -
.

3.3.
,
. , .
, ANSYS, . ,
ANSYS, *GET, get-.
.

3.3.1.
*SET, .
:
*SET,ABC,-24
*SET,QR,2.07E11
*SET,XORY,ABC
*SET,CPARM,'CASE1'

"=" ( -
). - = , , ,
- , .
- .
:
http://cyberkolbasa.com1.ru

. 8 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

ABC=-24
QR=2.07E11
XORY=ABC
CPARM='CASE1'

GUI, "=" ANSYS


"Selection" Scalar Parameter ( Utility Menu> Parameters> Scalar Parameters).

3.3.2.
ANSYS . ANSYS ( ), . ,
parm1 parm2 89.3 -0.1:
ansys90 -parm1 89.3 -parm2 -0.1

,
ANSYS.

, UNIX
- . , UNIX , (\) .
, 'filename' '200'.
ansys90 -cparm1 \'filename\' -cparm2 \'200\'

ANSYS Launcher, ANSYS, Customization ( -Name Value,


).
, start90.ans
, /INPUT .

3.3.3.
ANSYS
ANSYS , :

*GET,
.

get-, . get- .

3.3.3.1. *GET
*GET (Utility Menu> Parameters> Get Scalar Data)
(, , , ..) . , ,
. , *GET,A,ELEM,5,CENT,X
- 5 A.
*GET:
http://cyberkolbasa.com1.ru

. 9 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*GET, Par, Entity, ENTNUM, Item1, IT1NUM, Item2, IT2NUM

Par - .

Entity - , . -

- NODE, ELEM, KP, LINE, AREA, VOLU, .. . *GET.

ENTNUM - ( ).

Item1 - . , Entity ELEM,


Item1 NUM ( -

) COUNT ( ).
Item1 . *GET.
*GET .
*GET.
( ) 97 BCD:
*GET,BCD,ELEM,97,ATTR,MAT
*GET,V37,ELEM,37,VOLU
*GET,EL52,ELEM,52,HGEN

! BCD = 97
! V37 = 37
! EL52 = -

*GET,OPER,ELEM,102,HCOE,2
2
*GET,TMP,ELEM,16,TBULK,3
3
*GET,NMAX,NODE,,NUM,MAX

*GET,HNOD,NODE,12,HGEN
*GET,COORD,ACTIVE,,CSYS

! OPER = 102

52

! TMP = 16
! NMAX = ! HNOD = 12
! COORD =

3.3.3.2. get-
x- . *GET :
*GET,L1,NODE,1,LOC,X
*GET,L2,NODE,2,LOC,X
MID=(L1+L2)/2

! L1 - 1
! 2
!

get- :
MID=(NX(1)+NX(2))/2

! NX(n) get- - n-

Get- get-. ,
NELEM (ENUM, NPOS) NPOS ENUM. NX(n) -
NX(NELEM (ENUM, NPOS)).
get- (Appendix B)
ANSYS.

3.3.4.
*STATUS .
http://cyberkolbasa.com1.ru

. 10 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*STATUS
PARAMETER STATUS(
NAME
VALUE
ABC
-24.0000000
HEIGHT
57.0000000
QR
2.070000000E+11
X_OR_Y
-24.0000000
CPARM
CASE1

5 PARAMETERS DEFINED)
TYPE
DIMENSIONS
SCALAR
SCALAR
SCALAR
SCALAR
CHARACTER

GUI: Utility Menu> List> Other>


Parameters Utility Menu> List> Status> Parameters> All Parameters.

*STATUS
(_).
ANSYS 5000 ,
5000 - GUI - ANSYS. , ( ) *STATUS. *GET, Par,PARM,,MAX .

3.4.
:

"=" . ,
QR :
QR=

*SET (Utility Menu> Parameters> Scalar Parameters),


. , QR
*SET :
*SET,QR,

, . , ( ) ,
.

3.5.
, , . ,
. ( Ext ). , ,
- "" .

, .
.

( , - ),

http://cyberkolbasa.com1.ru

. 11 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*USE (Utility Menu> Macro> Execute Data


Block),
NAME='MACRO'
*USE,NAME

! MACRO
! MACRO

*USE " " . - :


ABC='SX'
*USE,NAME,ABC

*USE,NAME,'SX'
DEF='SY'
NEWMACRO,DEF

! NEWMACRO.MAC

NEWMACRO,'SY'

3.6.
, , .
( , ), (2-100), .

, , " "
. ( /TITLE, /STITLE, *ABBR,
/TLABEL. :
Y=0
X=2.7
N,1,X,Y
Y=3.5

! Node 1 at (2.7,0)
! Redefining parameter Y now does not update node 1

3.6.1.
,
() , 'XYZ'. ; , .
, , ,
, (%). ,
/TITLE, TEMPERATURE CONTOURS AT TIME=%TM%

, . , , .

3.6.2.
- . .
3.6.2.1.
,
, . http://cyberkolbasa.com1.ru

. 12 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

(%). :

/TITLE ( Title).
.

/STITLE ( Title). . ( GUI.)

/TLABEL ( Text). .

*ABBR ( Abbr). .

.
, /FILNAME, RESUME, /INPUT, /OUTPUT, FILE. ( .)

32 : - . ( .)

. " "
1. :
R='RESUME'
%R%,MODEL,DB

.
A='TEST'
B='.RST'
C='/ANSYS'
D='/MODELS/'
/STITLE,,RESULTS FROM FILE %C%%D%%A%%B%
SUBTITLE 1 =
RESULTS FROM FILE /ANSYS/MODELS/TEST.RST
/POST1
FILE,A,RST,%C%%D%
! /ANSYS/MODELS/TEST.RST

3.6.2.2. ,
, , ,
. , .
*ASK
- ( ,
), . ( *ASK GUI.)
*CFWRITE
ANSYS ,
*CFOPEN. ,
. , *CFWRITE, B = 'FILE' . (
*CFWRITE *CFOPEN GUI.)
*IF *ELSEIF
http://cyberkolbasa.com1.ru

. 13 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

VAL1 VAL2
. Oper, EQ () NE ( )
. ( *IF *ELSEIF
GUI.) :
CPARM='NO'
*IF,CPARM,NE,'YES',THEN

*MSG
VAL1 VAL8. %C , - (
*MSG). %C A8.
( *MSG GUI.)
PARSAV PARRES
( PARSAV Utility Menu> Parameters> Save Parameters),
(PARRES Utility Menu> Parameters> Restore Parameters).
*VREAD
(Utility Menu> Parameters> Array Parameters> Read from File) , -
. (A) , *VREAD.
*VWRITE
(Utility Menu> Parameters> Array Parameters> Write to File),
, . (A) , *VWRITE.
3.6.2.3.

, , .

Par *SET,
*GET, *DIM, *STATUS.

(*VEDIT)
.

, *VOPER, *VSCFUN, *VFUN, *VFILL,


*VGET, *VITRP, .

, *VMASK *VLEN
*VWRITE *VREAD.

,
, , , ..

3.7.
: /TITLE,
/STITLE, *ABBR, /AN3D, /TLABEL.
http://cyberkolbasa.com1.ru

. 14 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, , , .
:
XYZ='CASE 1'
/TITLE,This is %XYZ%
APLOT

"This is CASE 1", .


XYZ, , /TITLE.
XYZ='CASE 2'

" This is CASE 2", .

3.8.
,
, , , . :
X=A+B
P=(R2+R1)/2
D=-B+(E**2)-(4*A*C)
XYZ=(A<B)+Y**2

! D = -B + E2 - 4AC
! XYZ=A+Y2 A<B;
! XYZ = B+Y2

INC=A1+(31.4/9)
M=((X2-X1)**2-(Y2-Y1)**2)/2

APDL:

+
*
/
**
<
>

,
"" , . , ANSYS
, :
1. ( )
2. ( )
3. ( )
4. ( +A -A)
5. ( )
6. ( )
, Y2=A+B ** C/D*E
: B ** C, /D, *E , +A. ,
.
, http://cyberkolbasa.com1.ru

. 15 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. . *,
( *)
. ( ; (!) .)
ABS(x)
SIGN(x,y)
EXP(x)
LOG(x)
LOG10(x)
SQRT(x)
NINT(x)
MOD(x,y)
RAND(x,y)
GDIS(x,y)
SIN(x),
COS(x),
TAN(x)
SINH(x),
COSH(x),
TANH(x)
ASIN(x),
ACOS(x),
ATAN(x)

ATAN2(y,x)

VALCHR (CPARM)
CHRVAL (PARM)
UPCASE CPARM
LWCASE (CPARM)

x.
x y. y=0
.
x (ex).
x (ln (x)).
x (log10(x)).
x.
x.
x/y. y=0 (0).
( x y (x = , y = ).
( ) .
, , .
*AFUN.
, .

, x. x -1.0
and +1.0 ASIN ACOS.
, *AFUN. -pi/2 +pi/2 ASIN ATAN, 0
pi ACOS.
y/x .
,
*AFUN. -pi +pi.
CPARM ( CPARM ,
0.0).
PARM. .
CPARM.
CPARM.

:
PI=ACOS(-1) ! PI = -1, PI
Z3=COS(2*THETA)-Z1**2
R2=SQRT(ABS(R1-3))
X=RAND(-24,R2)
! X = -24 R2
*AFUN,DEG

http://cyberkolbasa.com1.ru

. 16 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

THETA=ATAN(SQRT(3))

! THETA 60

PHI=ATAN2(-SQRT(3),-1)
*AFUN,RAD

! PHI -120
!

X249=NX(249)
SLOPE=(KY(2)-KY(1))/(KX(2)-KX(1))
CHNUM=CHRVAL(X)
UPPER=UPCASE(LABEL)

! X- 249
! 1 2

! CHNUM = X
! UPPER =
! LABEL

3.9. ,
ANSYS, ()
. ,
( , ).
, PARSAV (Utility Menu>
Parameters> Save Parameters).
- ASCII, APDL *SET, .
.
/NOPR
*SET,A,10.00000000000
*SET,B,254.3948750000
*SET,C,'string'
*SET,_RETURN,0.0000000000000E+00
*SET,_STATUS,1.000000000000
*SET,_ZX,' '
/GO

PARRES (Utility Menu>


Parameters> Restore Parameters).
, , .
, , , .. , *VWRITE
(Utility Menu> Parameters> Array Parameters> Write to File).

3.10.
( ), ( ). ANSYS :

1-D ( )
2-D ( )
3-D (, )
4-D (, , )
5-D (, , , )

http://cyberkolbasa.com1.ru

. 17 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

ANSYS :
ARRAY
77 , . , ,
, - , . .
CHAR
- , , , . , ,
- , .
TABLE
- , ANSYS
( ) , . ,
, , ( ).
.
, TABLE-,
, .
STRING
*DIM, STRING
. - ,
1. . .
*DIM .
2**31-1 . ,
- 8 ,
- (2** 31-1)/8.

:


TABLE





http://cyberkolbasa.com1.ru

. 18 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

3.10.1.
(ARRAY CHAR) . m
n ; , m:n.
i, 1 m, j, 1 n. , . (i, j), i - , j - .

. 3.1. .
,
m- , n- p- .
k, 1 p.
(i, j, k). .

. 3.2. .

http://cyberkolbasa.com1.ru

. 19 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. 3.3. .

3.10.2.
ARRAY ,
. .

http://cyberkolbasa.com1.ru

. 20 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

NTEMP ; NTEMP(1) =
-47.6 27, NTEMP(2) = -5.2 43,
. EVOLUM , COMPSTRS
, ( X, Y, Z, XY, YZ, XZ).
CHAR ARRAY, , - ( ). :

3.10.3. TABLE
TABEL (-
), , ARRAY. ,
.

ANSYS ( )
.
,
, , .
, ( ) .
, "
" (7.888609052E-31).

*TAXIS.
0, 0 .
TABLE
. , .

http://cyberkolbasa.com1.ru

. 21 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. 3.4. (TABLE).
, ,

0,0.
0-
1.
1.
, .
0-
1.
1.
, .

3.10.4.
, , *DIM (Utility Menu> Parameters> Array Parameters>
Define/Edit).
*DIM, ,
:
*DIM,AA,,4

! ARRAY , 4[x1x1]

http://cyberkolbasa.com1.ru

. 22 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*DIM,XYZ,ARRAY,12
*DIM,FORCE,TABLE,5
*DIM,T2,,4,3
*DIM,CPARR1,CHAR,5

!
!
!
!

ARRAY, 12[x1x1]
TABLE, 5[x1x1]
4x3[x1]
CHAR, 5[x1x1]

ARRAY TABLE 0 (
0- TABLE, ).
CHAR .
, 5- . 1- , 5- .
*TAXIS, .
*dim,xval,array,X1
*dim,yval,array,Y1
yval(1)=0,20
*dim,zval,array,10
zval(1)=10,20,30,40,50,60,70,80,90,100
*dim,tval,array,5
tval(1)=1,.90,.80,.70,.60
*dim,tevl,array,5
tevl(1)=1,1.20,1.30,1.60,1.80
*dim,ccc,tab5,X1,Y1,Z1,D4,D5,X,Y,Z,TIME,TEMP
*taxis,ccc(1,1,1,1,1),1,0,wid
!!! X-Dim
*taxis,ccc(1,1,1,1,1),2,0,hth
!!! Y-Dim
*taxis,ccc(1,1,1,1,1),3,1,2,3,4,5,6,7,8,9,10
!!! Z-Dim
*taxis,ccc(1,1,1,1,1),4,0,10,20,30,40
!!! Time
*taxis,ccc(1,1,1,1,1),5,0,50,100,150,200
!!! Temp
*do,ii,1,2
*do,jj,1,2
*do,kk,1,10
*do,ll,1,5
*do,mm,1,5
ccc(ii,jj,kk,ll,mm)=(xval(ii)+yval(jj)+zval(kk))*tval(ll)*tevl(mm)
*enddo
*enddo
*enddo
*enddo
*enddo

3.10.5.

*SET "=".
() ( *VFILL).

*VEDIT.
ASCII ( *VREAD *TREAD).

4- 5- . *VEDIT, *VREAD *TREAD .


http://cyberkolbasa.com1.ru

. 23 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

3.10.5.1.
*SET "=".
, , ( "="). ,
XYZ 12x1 (12 1 ), "=". ,
:
XYZ(1)=59.5,42.494,-9.01,-8.98,-8.98,9.01,-30.6,51
XYZ(9)=-51.9,14.88,10.8,-10.8

,
(1 9 ).
,
T2 4x3,
*DIM:
T2(1,1)=.6,2,-1.8,4
T2(1,2)=7,5,9.1,62.5
T2(1,3)=2E-4,-3.5,22,.01

! - (1,1),(2,1),(3,1),(4,1)
! - (1,2),(2,2),(3,2),(4,2)
! - (1,3),(2,3),(3,3),(4,3)

FORCE (TABLE), .
FORCE(1)=0,560,560,238.5,0
FORCE(1,0)=1E-6,.8,7.2,8.5,9.3

= FORCE . = .
http://cyberkolbasa.com1.ru

. 24 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

,
"=". . :
*DIM,RESULT,CHAR,3
! (3,1,1)
RESULT(1)='SX','SY','SZ' ! RESULT

, , , ( ,
1).

CHAR , CHAR *DIM. ANSYS


, CHAR, CHAR
*DIM.
3.10.5.2.
*VFILL (Utility Menu> Parameters> Array
Parameters> Fill), "" ARRAY () TABLE.
*VFILL .
ANSYS. *VFILL.
*DIM,DTAB,ARRAY,4,3
*VFILL,DTAB(1,1),DATA,-3,8,-12,57

! 4x3
!
! 1
*VFILL,DTAB(1,2),RAMP,2.54,2.54 ! 2
! 2.54 2.54
*VFILL,DTAB(1,3),RAND,1.5,10 ! 3
! 1.5 10.
! - .

3.10.5.3.
*VEDIT (Utility Menu> Parameters> Array Parameters> Define/Edit),
, , , ARRAY TABLE
( CHAR). :
http://cyberkolbasa.com1.ru

. 25 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

.
, .
, ( ARRAY).
, ,
( ARRAY).


Help .

4- 5- ARRAY TABLE
.

. 3.4. *VEDIT ARRAY.

. 3.4. *VEDIT TABLE.


3.10.5.4. *VREAD
, *VREAD
(Utility Menu> Parameters> Array Parameters> Read from File). ASCII , ,
.
http://cyberkolbasa.com1.ru

. 26 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. *VREAD. . .
, , .
dataval:
1.5
15.6

7.8
-45.6

12.3
42.5

EXAMPLE, , 2x3,

*DIM,EXAMPLE,,2,3
*VREAD,EXAMPLE(1,1),dataval,,,JIK,3,2
(3F6.1)


EXAMPLE=

1.5
15.6

7.8
-45.6

12.3
42.5

*VREAD . , Utility Menu> Parameters> Array Parameters> Read from File


.

4- 5- , *VREAD.
3.10.5.5.
*TREAD
, , , TABLE: ,
,
.
, TABLE, , , , .
ASCII, ,
*TREAD (Utility Menu> Parameters> Array Parameters> Read from File). ,
, (NSKIP) .
, :

,
( Microsoft Excel), ASCII
, ANSYS.
ANSYS,
(0,0).
, ; ANSYS , . , ,
, . -

http://cyberkolbasa.com1.ru

. 27 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, ANSYS
, , . , , ANSYS ,
.
1- , 2- , 3- , . , , .

4- 5- TABLE,
*TREAD.
1: 1- .
, 1- , (
, , ..)
. , "Tdata"
. ASCII :
Time Temperature Table
Time
Temp
0
20
1
30
2
70
4
75
ANSYS TABLE "Tt",
*DIM (Utility Menu> Parameters> Array Parameters> Define/Edit). 4
1 , Time Temp. ,
, , , ( - TIME - ). TABLE , , 2- ANSYS :

. 3.7. 1- .

http://cyberkolbasa.com1.ru

. 28 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, ,
:
*DIM,Tt,table,4,1,1,TIME,TEMP
*TREAD,Tt,tdata,txt,,2

2: 2-
, ( ) 2 "T2data",
x- TABLE "Ttx".
ASCII :

Time
0
0
1
2
4

0
10
15
20
30

Temp (time-X-coord) Table


X-coordinate
.3
.5
.7
15
20
25
20
25
35
25
35
55
40
70
90

.9
30
40
60
100

ANSYS, TABLE "Ttx" *DIM (Utility Menu> Parameters> Array Parameters> Define/Edit). 4 , 5 , 1 , Time X-coord. ,
, , ,
. , 2 . ANSYS
:

. 3.8. 2- .
, ,
:
*DIM,Ttx,table,4,5,,time,X-COORD
*TREAD,Ttx,t2data,txt,,2
http://cyberkolbasa.com1.ru

. 29 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

3: 3-
, 3- "T3data",
, x- y-
TABLE "Ttxy". ASCII :

Time
0
0
1
2
4
1.5
0
1
2
4

0
10
15
20
30
0
20
25
30
40

Temp (time-X-coord) Table


X-coordinate
.3
.5
15
20
20
25
25
35
40
70
.3
.5
25
30
30
35
35
45
50
80

.7
25
35
55
90
.7
35
45
65
100

.9
30
40
60
100
.9
40
50
70
120

, ( (0,0,Z))
. , ,
.
. , .
ANSYS, TABLE "Ttxy" *DIM (Utility Menu> Parameters> Array Parameters> Define/Edit). 3- ,
, , . (Time) - , - . 4 , 5 , 2 , Time,
X-COORD Y-COORD. , , , , .
, 2 . TABLE
(Y=1.5) ANSYS , :

. 3.9. 3- .
http://cyberkolbasa.com1.ru

. 30 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, ,
:
*DIM,Ttxy,table,4,5,2,TIME,X-COORD,Y-COORD
*TREAD,Ttxy,t3data,txt,,2

3.10.5.6.
, ANSYS
.
, ANSYS TABLE, :

, A - TABLE, ANSYS
(1) (2),

(1.5) 20.0 ( 12.0 28.0)


(1.75) 24.0
(1.9) 26.4

, PQ - TABLE

PQ (1.5, 1) 3.4 ( 2.8 -9.6)


PQ (1, 1.5) 3.5 ( 2.8 4.2)
PQ (3.5, 1.3) 14.88

, y=f(x),
TABLE. j=0 x
j=1 y. , ,
.

. 3.10. .
http://cyberkolbasa.com1.ru

. 31 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

TABLE, - , 1 5 - 0.0 9.3.


:

ANSYS ( ) FORCE. , ANSYS 89.4375 FORCE(9).


, , / . , ANSYS 560.0 FORCE(5,2) 0.0 FORCE(12)
, TABLE
.
, , -, , B-H
, .. , TABLE
, ARRAY.
3.10.5.7.
*VGET (Utility Menu> Parameters> Get Array
Data), *GET, .

, *VGET. KLOOP . , *VGET,A(1),ELEM,5,CENT,X 5
A. 6, 7, . , KLOOP = 4, X, Y, Z.
, *VPUT
(Utility Menu> Parameters> Array Operations> Put Array Data).
*VPUT *VGET ( ), . *VPUT . ANSYS.
ANSYS "" - . *VPUT ,
. , , . , .

, . *VPUT , *VGET, ANSYS .


http://cyberkolbasa.com1.ru

. 32 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

3.10.5.8.
, *STATUS,
.
*STATUS:
*STATUS
ABBREVIATION STATUSABBREV
SAVE_DB
RESUM_DB
QUIT
POWRGRPH
ANSYSWEB

STRING
SAVE
RESUME
Fnc_/EXIT
Fnc_/GRAPHICS
Fnc_HomePage

PARAMETER STATUS(
(INCLUDING
NAME
MYCHAR
MYPAR
MYPAR1

VALUE
hi
.987350000

*STATUS,XYZ(1),5,9
PARAMETER STATUS- XYZ
LOCATION
5
1
6
1
7
1
8
1
9
1

1
1
1
1
1

*STATUS,T2(1,1)

! XYZ 5 9
(
4 PARAMETERS DEFINED)

4 PARAMETERS DEFINED)

VALUE
0.000000000E+00
0.800000000
7.20000000
8.50000000
9.30000000
0.000000000E+00
560.000000
560.000000
238.500000
0.000000000E+00
! T2

PARAMETER STATUS- T2
LOCATION
1
1
2
1
3
1
4
1
1
2
2
2
3
2
4
2

DIMENSIONS

! FORCE, j=0

PARAMETER STATUS- FORCE


1
1
1
1
1
1
1
1
1
1

TYPE
CHARACTER
ARRAY
SCALAR

VALUE
-8.98000000
9.01000000
-30.6000000
51.0000000
-51.9000000

*STATUS,FORCE(1),,,0

LOCATION
1
0
2
0
3
0
4
0
5
0
1
1
2
1
3
1
4
1
5
1

5 PARAMETERS DEFINED)
2 INTERNAL PARAMETERS)

1
1
1
1
1
1
1
1

4 PARAMETERS DEFINED)

VALUE
0.600000000
2.00000000
-1.80000000
4.00000000
7.00000000
5.00000000
9.10000000
62.5000000

http://cyberkolbasa.com1.ru

. 33 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

1
2
3
4

3
3
3
3

*STATUS,RESULT(1)

1
1
1
1

2.000000000E-04
-3.50000000
22.0000000
1.000000000E-02
! RESULT

PARAMETER STATUS- RESULT


LOCATION
1
1
2
1
3
1

( 4 PARAMETERS DEFINED)

VALUE
1
SX(CHAR)
1
SY(CHAR)
1
SZ(CHAR)

3.10.6.
( ) , , *VWRITE. 10
,
( *CFOPEN). 77 *VWRITE
(, *VWRITE ANSYS.)
(
MYARRAY (1,2,1)). , . SEQU
, .
()
. . FORMAT . , ; ,
list directed .
3.10.6.1.
,
. 77.
,
*VWRITE. , F ( ) . F
Fw.d

w .
d .

, , 10
, :
F10.8

, .

Aw
http://cyberkolbasa.com1.ru

. 34 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

w .

, , 8 ,
:
A8

*VWRITE .
MYDATA
:

- X
25 vector ( *CFOPEN). *VWRITE , . ,
SEQU, . , , , ,
, .
.
x=25
*cfopen,vector
*vwrite,SEQU,mydata(1,1,1),mydata(1,2,1),mydata(1,3,1),10.2,x,mydata(1,1,1)+3
(F3.0,' ',F8.4,' ',F8.1,' 'F8.6,' ',F4.1,' 'F4.0,' 'F8.1)
cfclos

:
1.
2.
3.
4.
5.
6.

2.1522
2.3049
2.0105
2.3683
2.8491
2.2280

3.9
4.0
3.4
3.3
4.8
3.5

5.286370
5.409196
5.936638
5.632203
5.978024
5.546851

10.2
10.2
10.2
10.2
10.2
10.2

25.
25.
25.
25.
25.
25.

5.2
5.2
5.2
5.2
5.2
5.2

*VWRITE:
http://cyberkolbasa.com1.ru

. 35 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*vwrite,SEQU,mydata(1,1),mydata(1,2),(mydata1(1,1)+mydata1(1,2))
(' Row',F3.0,' contains ',2F7.3,'. Is their sum ',F7.3,' ?')


Row 1. contains
Row 2. contains
Row 3. contains

10.000 50.000.
20.000 60.000.
30.000 70.000.

Is their sum
Is their sum
Is their sum

60.000 ?
60.000 ?
60.000 ?

3.10.7.

,
. : (), (), . ,
.
3.10.7.1.
, ,
, , , , .. -
. ( ), ,
, - *VOPER, *VFUN, *VSCFUN, *VITRP,
*VFILL, *VREAD, *VGET. , *VREAD
*VWRITE .
, ARRAY TABLE
( *DIM).
*VFILL, *VREAD, *VGET, *VWRITE, *DIM
. , ,
*VOPER Utility Menu> Parameters> Array Operations> Vector Operations
.
*VFUN Utility Menu> Parameters> Array Operations> Vector Functions

.
*VSCFUN Utility Menu> Parameters> Array Operations> Vector-Scalar Func
.
*VITRP Utility Menu> Parameters> Array Operations> VectorInterpolate
( ARRAY), ( TABLE) .
,
. ANSYS . , ( ARRAY) X, Y, THETA,
.
http://cyberkolbasa.com1.ru

. 36 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

(Z1) . *VOPER 2- X 1-
Y, , Z1. , ( )
.
.
*DIM,Z1,ARRAY,4
*VOPER,Z1(1),X(1,2),ADD,Y(1,1)

(Z2) . *VOPER X (
2) Y ( 1)
Z2 ( 1).
*DIM,Z2,ARRAY,3
*VOPER,Z2(1),X(2,1),MULT,Y(1,4)

(Z4) . *VOPER ,
X Y. i, j, k - 1, 2, 3
X 2, 3, 4 Y. Z4,
i, j, k - 1, 2, 3.
*DIM,Z4,ARRAY,4,3
http://cyberkolbasa.com1.ru

. 37 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*VOPER,Z4(1,1),X(1,1),CROSS,Y(1,2)

(A3) . *VFUN 2 X 2 A3.


*DIM,A3,ARRAY,4
*VFUN,A3(1),PWR,X(1,2),2

, (A4).
*VFUN THETA
A4 .
, A4 , 90 , ( x, y, z
). 1.0 x-y
z = 2.0.
*DIM,A4,ARRAY,7,3
*AFUN,DEG
*VFUN,A4(1,1),COS,THETA(1)
*VFUN,A4(1,2),SIN,THETA(1)
A4(1,3)=2,2,2,2,2,2,2

*VOPER, (GATH)
(SCAT),
. . , , , . B1 B3
( , B2). , ,
B3 0, ( ) .
http://cyberkolbasa.com1.ru

. 38 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*DIM,B1,,4
*DIM,B2,,3
*DIM,B3,,4
B1(1)=10,20,30,40
B2(1)=2,4,1
*VOPER,B3(1),B1(1),GATH,B2(1)

3.10.7.3.
,
, .
, , :
*MOPER Utility Menu> Parameters> Array Operations> Matrix Operations
() . :



( )

*MFUN Utility Menu> Parameters> Array Operations> Matrix Functions


(
).
*MFOURI Utility Menu> Parameters> Array Operations> Matrix Fourier
.
. ANSYS .
*MOPER.
, , (SORTDATA) :

OLDORDER .
*MOPER
http://cyberkolbasa.com1.ru

. 39 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

OLDORDER. *MOPER SORTDATA ,


1,1 .
*dim,oldorder,,5
*moper,oldorder(1),sortdata(1,1),sort,sortdata(1,1)

*MOPER :

SORTDATA , :
*moper,oldorder(1),sortdata(1,1),sort,oldorder(1,1)

, *MOPER . :

*MOPER .

an1X1 + an2X2 + , . . . , + annXn = bn
, *MOPER
:
2X1 + 4X2 + 3X3 +2X4 = 2
3X1 + 6X2 + 5X3 + 2X4 = 2
2X1 + 5X2 + 2X3 - 3X4 =3
4X1 + 5X2 +14X3 + 14X4 = 11
, (C) . *MOPER ,
B .
*DIM,C,,4
*MOPER,C(1),A(1,1),SOLV,B(1)

C .

http://cyberkolbasa.com1.ru

. 40 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*MFUN, . , (DATA) :

, (DATATRAN) , *MFUN DATATRAN.


*DIM,DATATRAN,,2,3
*MFUN,DATATRAN(1,1),TRAN,DATA(1,1)

DATATRAN:

3.10.7.3.
:
*VCUM, *VABS, *VFACT, *VLEN, *VCOL, *VMASK. ( *VLEN *VMASK, *VREAD *VWRITE, .)
*VSTAT. ( GUI)
. .
*VSTAT, GUI, Utility Menu> Parameters>
Array Operations> Operation Settings.
:
.
*VCUM
, ( ). ParR, ,
.
- , , ParR .
*VABS
, . () .
http://cyberkolbasa.com1.ru

. 41 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*VFACT
, . - 1.0 ( ).
*VCOL
.
.
*VSTAT
.
*VLEN Utility Menu> Parameters> Array Operations> Operation Settings
, .
*VMASK Utility Menu> Parameters> Array Operations> Operation Settings
.
,
, .

*MFOURI
*MFUN
*MOPER
*VFILL
*VFUN
*VGET
*VITRP
*VOPER
VPLOT
*VPUT
*VREAD
*VSCFUN
*VWRITE

*VABS *VFACT *VCUM


No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
N/A
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
N/A

*VCOL *VLENNROW,NINC
No
No
No
No
Yes
No
No
Yes
No
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes
N/A
Yes
Yes

*VMASK
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

. ANSYS .
(CMPR).
*VFUN, *VMASK *VLEN,
CMPR. *VFUN COMP EXPA.
*DIM,CMPR,ARRAY,4,4
*VLEN,4,2
! *V-
! ,
!
*VFUN,CMPR(1,2),COMP,Y(1,1)
http://cyberkolbasa.com1.ru

. 42 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*VMASK,X(1,3)

! 3 X
! *V-
*VFUN,CMPR(1,3),COMP,Y(1,2)

*VFACT ,
NUMDP ( 2 ). NUMDATA :

numdp=2
*vfact,10**numdp
*vfun,numdata(1),copy,numdata(1)
*vfun,numdata(1),nint,numdata(1)
*vfact,10**(-numdp)
*vfun,numdata(1),copy,numdata(1)

,
numdp=2
*vfact,10**numdp
*vfun,numdata(1),copy,numdata(1)
*vfact,10**(-numdp)
*vfun,numdata(1),nint,numdata(1)

NUMDATA :

*VLEN *VMASK,
100. , MASKVECT, , 1.0, ,
0.0, , .
, ,
, 1 1.0
, . *VLEN , FACTOR. *VFILL , . FACTOR x 2, : FACTOR x 2,
x 3, x 4, ..
http://cyberkolbasa.com1.ru

. 43 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*dim,maskvect,,100
*vfill,maskvect(2),ramp,1
*do,factor,2,10,1
*vlen,,factor
*vfill,maskvect(factor*2),ramp,0
*enddo
*vmask,maskvect(1)
*dim,numbers,,100
*vfill,numbers(1),ramp,1,1
*status,numbers(1),1,10

*STATUS, 10
NUMBERS:
PARAMETER STATUS- NUMBERS
(
(INCLUDING
LOCATION
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
1
10
1

1
1
1
1
1
1
1
1
1
1

5 PARAMETERS DEFINED)
2 INTERNAL PARAMETERS)

VALUE
0.000000000E+00
2.00000000
3.00000000
0.000000000E+00
5.00000000
0.000000000E+00
7.00000000
0.000000000E+00
0.000000000E+00
0.000000000E+00

3.10.8.
,
*VPLOT.

*VPLOT. , TABLE (TABLEVAL TABLE2)
:

*VPLOT. ,
, ARRAY ,
; TABLE .

http://cyberkolbasa.com1.ru

. 44 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

.
*vplot,,arrayval(1,1),2

. 3.11. .
.
*vplot,,tableval(1,1),2

. 3.12. .
http://cyberkolbasa.com1.ru

. 45 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

.
*vplot,table2(1),tableval(1,1),2

. 3.13. .
() .
*vplot,tableval(1,0),tableval(1,1),2

. 3.14. .
http://cyberkolbasa.com1.ru

. 46 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

3.10.9.
*VPLOT, ,
. , 1 COL 1, 2 COL 2
; , . /GCOLUMN, ( ).
/GCOLUMN ,
string01 string02 .
/gcol,1,string01
/gcol,2,string02
*dim,xxx,array,10
*dim,yyy,array,10,2
xxx( 1,1)
xxx( 2,1)
xxx( 3,1)
xxx( 4,1)
xxx( 5,1)
xxx( 6,1)
xxx( 7,1)
xxx( 8,1)
xxx( 9,1)
xxx(10,1)

=1e6
= 1e6
= 1e6
= 1e6
= 1e6
= 1e6
= 1e6
= 1e6
= 1e6
= 1e6

yyy( 1,1)
yyy( 2,1)
yyy( 3,1)
yyy( 4,1)
yyy( 5,1)
yyy( 6,1)
yyy( 7,1)
yyy( 8,1)
yyy( 9,1)
yyy(10,1)

=
=
=
=
=
=
=
=
=
=

1
4
9
16
25
36
49
64
81
100

yyy( 1,2)
yyy( 2,2)
yyy( 3,2)
yyy( 4,2)
yyy( 5,2)
yyy( 6,2)
yyy( 7,2)
yyy( 8,2)
yyy( 9,2)
yyy(10,2)

=
=
=
=
=
=
=
=
=
=

1
2
3
4
5
6
7
8
9
10

+
+
+
+
+
+
+
+
+

1e5
2e5
3e5
4e5
5e5
6e5
7e5
8e5
9e5

*vplo,xxx(1,1), yyy(1,1) ,2

http://cyberkolbasa.com1.ru

. 47 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. 3.15. .
(COL 1 COL 2), /GCOLUMN STRING.
/gcol,1
/gcol,2

4. APDL
ANSYS
( ). , , ANSYS. ,
,
ANSYS . , , ,
. ANSYS,
GUI .
. ,
, , .
20 , , /INPUT. , , ANSYS -.
. ,
4, 3 2, 1.
.
/prep7
/view,,-1,-2,-3
block,,4,,3,,2
sphere,1
vsbv,1,2
finish
http://cyberkolbasa.com1.ru

. 48 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

mymacro.mac, ANSYS
*use,mymacro

( .mac)
mymacro

,
.
, , .
APDL .
:




APDL

_STATUS _RETURN

4.1.
ANSYS c ( emacs, vi, wordpad).
, ANSYS .
, . ,
log- ANSYS .
ANSYS
log- . , .
:



ANSYS

4.1.1.
- ANSYS, .
ANSYS, ANSYS, ANSYS http://cyberkolbasa.com1.ru

. 49 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. :

32 .
.
( ANSYS, .mac.)
.

, ,
UNIX Windows.

, ANSYS,
, ANSYS,
. ANSYS , , ,
.
, . (
- ,
ANSYS; , .)

. 4.1. ANSYS .
.mac ANSYS
. .MAC, ANSYS.

4.1.2.
ANSYS ( .mac)
:
1. /ansys_inc/v100/ansys/apdl.
2. ( ) ANSYS_MACROLIB
( ) () . The ANSYS Environment ANSYS Operations
Guide.
3. , $HOME.
4. .
. , http://cyberkolbasa.com1.ru

. 50 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, /ansys_inc/v100/ansys/apdl , ANSYS_MACROLIB.
Windows: " " - ( ) ,
.
, " ". , .

4.1.3. ANSYS
ANSYS:

*CREATE input window. .


*CFOPEN, *CFWRITE, *CFCLOS.
.
/TEE input window.
, . ANSYS,
. , , , , .
Utility Menu> Macro> Create Macro.
, , .
.
.

4.1.3.1. *CREATE
*CREATE input window , . *END. , , ANSYS
.
, , , matprop.mac,
. ,
input window , :
*CREATE,matprop,mac,macros
MP,EX,1,2.07E11
MP,NUXY,1,.27
MP,DENS,1,7835
MP,KXX,1,42
*END

*CREATE , , ( , ).
*CREATE, , , ( ).
*CREATE DO.

http://cyberkolbasa.com1.ru

. 51 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

4.1.3.2. *CFWRITE
,
, *CFWRITE. *CREATE, *CFWRITE ;
*CFOPEN. ANSYS,
*CFWRITE, ; , input window . *CREATE, *CFOPEN , , . BLOCK
.
*cfwrite,block,,a,,b,,c

,
BLOCK. ( ) .
, , ,
*cfwrite,block,,4,,2.5,,2

, *CFCLOS.

,
(*CFOPEN, *CFWRITE, *CFCLOS) ,
ANSYS .
4.1.3.3. /TEE
/TEE,NEW /TEE, APPEND
ANSYS, input window , , . ,
/TEE,END.
, , ANSYS . ,
/TEE,NEW /TEE, APPEND.
Label ( NEW, APPEND,
END), /TEE ,
.
ANSYS, . , , , ( ). ,
, PARSAV.
4.1.3.4. Utility Menu> Macro> Create Macro
ANSYS,
, .
;
*CREATE,
.

http://cyberkolbasa.com1.ru

. 52 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. 4.2. .
*CREATE, , . , *END.

4.1.4.
,
. ASCII. ,
ANSYS UNIX
Windows, ( , ),

.
, ,
*CREATE *END.
http://cyberkolbasa.com1.ru

. 53 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. 4.3. .

4.1.5.
ANSYS , .
*CREATE . ,
(), , .

.
:
MACRONAME1
.
.
.
/EOF
MACRONAME2
.
.
.
/EOF
MACRONAME3
.
.
.
./EOF

, :
mybloc
/prep7
/view,,-1,-2,-3
block,,4,,3,,2
finish
/EOF
mysphere
/prep7
/view,,-1,-2,-3
sphere,1
finish
/EOF

, ( ), /EOF.
- ,
. ,
.
http://cyberkolbasa.com1.ru

. 54 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

4.2.
, *USE. ,
MYMACRO ( ) -
,
*use,mymacro

. MYMACRO.MACRO /myaccount/macros,
*use,/myaccount/macros/mymacro.macro

, *USE
.
.mac , , ANSYS,
. , mymacro.mac

mymacro

.mac Utility
Menu> Macro> Execute Macro.
(. 4.3.1.
),
mymacro,4,3,2,1.5

*use,mymacro.mac,4,3,2,1.5

Utility Menu> Macro> Execute Macro


.
, ,
. , *ULIB.
, , mymacros.mlib,
/myaccount/macros,
:
*ulib,mymacros,mlib,/myaccount/macros/

, , , *USE. , ,
*USE.

*ULIB *USE,
, .

http://cyberkolbasa.com1.ru

. 55 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

4.3.
APDL ,
.

,
.
, .
, ,
.

4.3.1.
19 , ,
.
; , . ARG1 AR19
:

- ( )

ARG1 AR18
*USE. ,
ANSYS ( .mac),
ARG1 AR19.
, ARG1, ARG2,
ARG3, ARG4:
/prep7
/view,,-1,-2,-3
block,,arg1,,arg2,,arg3
sphere,arg4
vsbv,1,2
finish

,
mymacro,4,3,2.2,1

4.3.2.
79 , ( AR20 AR99). ,
, .
, ( ).
http://cyberkolbasa.com1.ru

. 56 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, /INPUT, , .

4.3.3.
ANSYS ARG1 AR99, , , . ,
ARG1 ARG99
, .

4.4. APDL
, ANSYS ; , . , APDL ,
.

( ).
.
, , .
, .
() .

:
: Goto
: *IF

: Do-Loops
Do Loops
: Do-While

4.4.1. :
APDL 20 .
19 , , , . ,
MYSTART,
MYSPHERE, .
mystart
/prep7
/view,,-1,-2,-3
mysphere,1.2
finish
/eof
mysphere
sphere,arg1
/eof
http://cyberkolbasa.com1.ru

. 57 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

4.4.2. : Goto
, , *GO,
, .
.
*GO,:BRANCH1
--! ( )
--:BRANCH1
-----

, *GO ( : )
, .
.

*GO
. .
.

4.4.3. : *IF
APDL ,
.
( , ).
*IF
*IF, VAL1, Oper, VAL2, Base

VAL1 - ( ) .
Oper - .
VAL2 - ( ) .
Base - , , .
APDL ,
*IF. :
EQ ( VAL1 = VAL2).
NE ( VAL1 VAL2).
LT ( VAL1 < VAL2).
GT ( VAL1 > VAL2).
LE ( VAL1 VAL2).
GE ( VAL1 VAL2).
ABLT VAL1 VAL2 <.
ABGT VAL1 VAL2 >.
Base THEN, *IF "--".

*IF,
*ELSEIF
*ELSE
*ENDIF, .

http://cyberkolbasa.com1.ru

. 58 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

, *IF , , , Base. ( , *IF CASE


.) if-then-else do-loop. - *IF, ANSYS . ( UNIX "kill" Windows).
STOP Base, ANSYS .
if-then-else
*ENDIF (
"Continue").
*IF,A,EQ,1,THEN
! Block1
.
.
*ENDIF
! Continue

. ,
.
, *ELSE.

. 4.4. if-then-else.

/CLEAR if-then-else.
/CLEAR *IF *IF .
*ENDIF . , , /CLEAR , , , .
, , PARSAV /CLEAR, /CLEAR PARRES.

http://cyberkolbasa.com1.ru

. 59 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

4.4.4.
*REPEAT, , .
E,1,2
*REPEAT,5,0,1

1 2, *REPEAT
, E ( E), . - 1-2, 1-3, 14, 1-5, 1-6.

, (/) (*),
, " ," . , , , . , *REPEAT , , , .

4.4.5. : Do-Loops
.
*DO *ENDDO . *DO :
( 1 5), .
*DO,I,1,5
LSREAD,I
OUTPR,ALL,NONE
ERESX,NO
LSWRITE,I
*ENDDO

! I = 1 5:
! I
!
! I

*IF, *EXIT *CYCLE.


, .

:Label *IF *GO.


:Label . if-then-else-endif.

. /GOPR /GO ,
.
, /CLEAR . /CLEAR , , *DO.
, PARSAV
/CLEAR, , /CLEAR PARRES.

http://cyberkolbasa.com1.ru

. 60 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

4.4.6. Do Loops
(). , . :
(x:y:z)

z 1, . :
n,(1:6),(2:12:2)

:
n,1,2
n,2,4
n,3,6
.
.
.
n,6,12

, . ,
n,(1:7),(2:12:2)

.
, (:),
.
, . , , ,
.
,
. (x:y:z) .

4.4.7. : Do-While
, , . *DOWHILE
:
*DOWHILE,Parm
Parm .
Parm ( 0.0), .
*CYCLE *EXIT *DOWHILE.

4.5.
APDL,
.
, ANSYS.

http://cyberkolbasa.com1.ru

. 61 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

APDL
*DO

*ENDDO

*CYCLE

*EXIT

.
*IF.
*DO
( ANSYS 20
*ENDDO) , ,
.
/INPUT, *USE, ""
, , .
*DO, *ENDDO, *CYCLE, *EXIT
.
.
, /CLEAR .
/CLEAR , , *DO.

,
PARSAV /CLEAR, , /CLEAR PARRES.

*ENDDO
.
.
*ENDDO *DO
.
, ANSYS
- ( *IF). *CYCLE
*CYCLE *DO
*ENDDO, ( *ENDDO.
) .
.
*ENDDO.
*EXIT *DO
. ( *IF).

http://cyberkolbasa.com1.ru

. 62 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

APDL
*IF

*ENDIF
*ELSE

*ELSEIF

10
*IF .

"if-then-else"
:label,
:label .
/CLEAR
"if-then-else".
/CLEAR *IF *IF
. *ENDIF
.
/CLEAR ,
, , . ,
, PARSAV
/CLEAR, /CLEAR PARRES.
*IF *ENDIF
"if-then-else".
.
*ELSE *IF
.
"if-then-else".
, Oper = EQ NE, VAL1 VAL2

(
- ) . *IF
"if-then-else".
*ELSEIF
.

4.6. _STATUS _RETURN


ANSYS , _STATUS _RETURN,
. , _STATUS _RETURN if-then-else, , , ANSYS.
_RETURN,
.
_RETURN :
4.1. _RETURN

K
KL

http://cyberkolbasa.com1.ru


_RETURN


. 63 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide


_RETURN


KNODE
KBETW
KCENTER

BSPLIN
CIRCLE
L
L2ANG
LANG
LARC
LAREA
LCOMB
LDIV
LDRAG
LFILLT
LROTAT
LSTR
LTAN
SPLINE

A
ACCAT
ADRAG
AFILLT
AL
ALPFILL
AOFFST
AROTAT
ASKIN
ASUB

V
VA
VDRAG
VEXT
VOFFST
VROTAT

ANSYS ,
_STATUS. :

http://cyberkolbasa.com1.ru

. 64 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

1
2
3

4.7.
,
, : , ,
, , .
.
.
,
.
. , , motor
STATOR, PERMMAG, ROTOR, WINDINGS.
, , .
. ANSYS. . Selecting and Components ANSYS Basic Analysis
Guide.

CMDELE
CMEDIT

.
.
. ANSYS
,
.
.
, , .
, .
.

CMGRP
CMLIST
CMSEL

4.8.
. , offset.mac, PREP7. , NGEN.
!
!
!

PREP7
: offset.mac ( )
: offset,dx,dy,dz

/nop

*get,nnode,node,,num,max

*dim,x,,nnode
*dim,y,,nnode
*dim,z,,nnode

*dim,sel,,nnode

*vget,x(1),node,1,loc,x

http://cyberkolbasa.com1.ru

. 65 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*vget,y(1),node,1,loc,y
*vget,z(1),node,1,loc,z
*vget,sel(1),node,1,nsel

*voper,x(1),x(1),add,arg1 !
*voper,y(1),y(1),add,arg2
*voper,z(1),z(1),add,arg3
! *do,i,1,nnode
! *if,sel(i),gt,0,then
!
n,i,x(i),y(i),z(i)
! *endif
! *enddo

!
! 98 . 100000

*vmask,sel(1)
! 3 . 100000
n,(1:NNODE),x(1:NNODE),y(1:NNODE),z(1:NNODE)
x(1) =
y(1) =
z(1) =
sel(1) =
i=
nnode=

/go

, bilinear.mac,
. , . 1 - 2 - .
ARG1 - ( - 2).
/nop
_niter = arg1
*if,_niter,lt,2,then
_Niter = 2
*endif
*do,iter,1,_niter
/post1
set,1,1
*get,ar11,elem,,num,maxd
*dim,_s1,,ar11
*dim,_s3,,ar11
etable,sigmax,s,1
etable,sigmin,s,3
*vget,_s1(1),elem,1,etab,sigmax
*vget,_s3(1),elem,1,etab,sigmin
*dim,_mask,,ar11
*voper,_mask(1),_s1(1),lt,0
*vcum,1
*vabs,0,1
*voper,_mask(1),_s3(1),gt,_s1(1)
finish

!
!
!
!
!
!
!
!
!
!
!
!
!


s1
s3
s1 is in element table sigmax
s3 is in element table sigmin
get element maximum stress in s1
get element minimum stress in s3
array for mask vector
true if max. stress &lt; 0
accumulate compression elements
absolute value of s3
true if abs(minstr) > maxstr

/prep7
mat,1
emod,all

! go to prep7 for element material mods


! set all materials to tension properties

*vput,_mask(1),elem,1,esel
mat,2
emod,all

! select compression elements


! change selected elements to compression

http://cyberkolbasa.com1.ru

. 66 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

call
finish

! select all elements

_s1(1)=
_s3(1)=
_mask(1)=

! clean up all vectors (set to zero)

/solve
solve
finish

! rerun the analysis

*enddo

! end of iterations

_niter=
_iter=
/gop

! clean up iteration counters

5. GUI
ANSYS, ANSYS (GUI):

ANSYS (
2.1.).
*ASK, .
, .
*MSG, .
.

.
.
:

5.1.
*ASK , .
*ASK
*ASK, Par,Query,DVAL

Par - - , .

http://cyberkolbasa.com1.ru

. 67 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

Query - , ANSYS , . 54 . , , "$" "!".


DVAL - , , ( ).
( )
. , .

*ASK Query .
, ANSYS . ( .) , , , ,
. , , PARM1 ,
.
*ask,parm1,'username (enclose the username in single quotes)'

. 5.1. *ASC.
*ASK , ANSYS File.LOG .

5.2.
MULTIPRO , 10 . UIDL
*CSET, ,
. , , MULTIPRO UIDL. MULTIPRO DO Loop.
MULTIPRO :

*CSET
*CSET, .

:
MULTIPRO,'start',Prompt_Num
http://cyberkolbasa.com1.ru

. 68 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

*CSET,Strt_Loc,End_Loc,Param_Name,'Prompt_String',Def_Value
MULTIPRO,'end'

'start'
, , MULTIPRO. .
Prompt_Num
Def_Value *CSET, Def_Value 0. Prompt_Num
*CSET.
Strt_Loc,End_Loc
Strt_Loc *CSET = 1, End_Loc = Strt_Loc+2 (= 3 *CSET).
Strt_Loc = End_Loc+1.
Param_Name
,
, , Def_Value.
'Prompt_String'
, 32 ,
. .
Def_Value
, . ,
APDL. .
'end'
,
MULTIPRO.
MULTIPRO.
multipro,'start',3
*cset,1,3,beamW,'Enter the overall beam width',12.5
*cset,4,6,beamH,'Enter the beam height',23.345
*cset,7,9,beamL,'Enter the beam length',50.0
multipro,'end'

*CSET , 64 . , .
*CSET.
*CSET,61,62,'Help_String','Help_String'
*CSET,63,64,'Help_String','Help_String'
http://cyberkolbasa.com1.ru

. 69 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

'Help_String'
, 32 .
32, Help_String.
MULTIPRO
. , Help_String,
32 .
multipro,'start',3
*cset,1,3,dx,'Enter DX Value',0.0
*cset,4,6,dy,'Enter DY Value',0.0
*cset,7,9,dz,'Enter DZ Value',0.0
*cset,61,62,'The MYOFSET macro offsets the',' selected nodes along each'
*cset,63,64,'of the three axes. Fill in the ',' fields accordingly.'
multipro,'end'

. 5.2. .
, _BUTTON.
:

_BUTTON = 0 , OK.
_BUTTON = 1 , Cancel.
, .

http://cyberkolbasa.com1.ru

. 70 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

5.3.
*MSG ,
ANSYS. :
*MSG,Lab,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8
Lab - :
INFO
NOTE
WARN
ERROR

FATAL
UI

( ).
"NOTE".
"WARNING",
Jobname.ERR.
"ERROR",
Jobname.ERR. ANSYS,

.
"FATAL ERROR",
Jobname.ERR. ANSYS.
""
.

VAL1 VAL8 - , . . (64- ).


*MSG.
80 , " " , - .
() :

%i, .
%g,
%c, -
%/,

- I9, 1PG16.9, A8 . . ( ) .
*MSG *IF, *ENDIF, *ELSE
*ELSEIF. (&), ANSYS .
10 ( ),
.

http://cyberkolbasa.com1.ru

. 71 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

. 10 72 (
%/).
*MSG, :
*MSG, INFO, 4Inner4 ,25,1.2,148
Radius ( %C) = %I, Thick = %G, Length = %I

:
Radius (Inner) = 25, Thick = 1.2, Length = 148

, GUI:
*MSG,UI,Vcoilrms,THTAv,Icoilrms,THTAi,Papprnt,Pelec,PF,indctnc
Coil RMS voltage, RMS current, apparent pwr, actual pwr, pwr factor: %/&
Vcoil = %G V (electrical angle = %G DEG) %/&
Icoil = %G A (electrical angle = %G DEG) %/&
APPARENT POWER = %G W %/&
ACTUAL POWER = %G W %/&
Power factor: %G %/&
Inductance = %G %/&
VALUES ARE FOR ENTIRE COIL (NOT JUST THE MODELED SECTOR)

/UIS,MSGPOP , GUI .

5.4.
,
ANSYS, , ,
STOP, , , .
:
*ABSET,Title40,Item

Title40 , . 40 .
Item :
BAR
STOP
KILL
STOP
BOTH
STOP

, *ABCHECK,Percent,
NewTitle.

Percent - 0 100. .
NewTitle 40 , . NewTitle,
Title40 *ABSET.

http://cyberkolbasa.com1.ru

. 72 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

KILL BOTH, _RETURN *ABCHECK,


STOP .
ANSYS GUI, *ABFINI.
( STOP). , , . , _RETURN , STOP , "We are
stopped...... ".
fini
/clear,nost
/prep7
n,1,1
n,1000,1000
fill
*abset,'This is a Status Bar',BOTH
myparam = 0
*do,i,1,20
j = 5*i
*abcheck,j
*if,_return,gt,0,then
myparam = 1
*endif
*if,myparam,gt,0,exit
/ang,,j
nplot,1
*if,_return,gt,0,then
myparam = 1
*endif
*if,myparam,gt,0,exit
nlist,all
*if,_return,gt,0,then
myparam = 1
*endif
*if,myparam,gt,0,exit
*enddo
*if,myparam,gt,0,then
*msg,ui
We are stopped.........
*endif
*abfinish
Fini

*ABCHECK 20 .

. 5.3. .

http://cyberkolbasa.com1.ru

. 73 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

5.5.
ANSYS ,
GUI .
. ANSYS ( K,,P) "P"
, . ANSYS , OK Cancel, .
, ANSYS,
.

GUI, /PMACRO
. (log-). , , /PMACRO,
ANSYS , ANSYS.

5.6.
ANSYS UIDL
( Fnc_UIMP_Iso), . ANSYS,
. , .
, ,
, ANSYS
. , , , ,
, OK Apply.

GUI, /PMACRO
. (log-). , , /PMACRO,
ANSYS , ANSYS.

6.
ANSYS ,
"". , . ( ASCII) ,
ANSYS .
:

6.1.
, .
,
. .
http://cyberkolbasa.com1.ru

. 74 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

/ENCRYPT . /ENCRYPT :
/ENCRYPT,Encryption_key,File_name,File_ext,Directory_Path/

Encryption_key - .
File_name - .
File_ext - . , ""
, .mac.
Directory_Path/- ,
60 ; ,
"" .

/ENCRYPT :
/encrypt,mypasswd,myenfile,mac,macros/
/nopr
/prep7
/view,,-1,-2,-3
block,,arg1,,arg2,,arg3
sphere,arg4
vsbv,1,2
/gopr
finish
/encrypt

/ENCRYPT ANSYS
"mypasswd" . ANSYS myenfile.mac
/macros . /ENCRYPT
ANSYS .

/NOPR , ANSYS . , ,
(log-). , /GOPR /ENCRYPT.

6.2.
/ENCRYPT , . , ANSYS. ANSYS , /ENCRYPT .
:
/DECRYPT,mypasswd
013^Z,^%
02x^0Se|Lv(yT.6>?
03J3]Q_LuXd3-6=m+*f$k]?eB
http://cyberkolbasa.com1.ru

. 75 76

ANSYS Release 10.0 Documentation / APDL Programmer's Guide

04:^VY7S#S>c>
05daV;u(yY
06T]3WjZ
/DECRYPT

, , /DECRYPT.
/DECRYPT.

6.3.
, ;
. ,
" " ANSYS.
,
/DECRYPT PASSWORD. , :
/DECRYPT,PASSWORD

ANSYS,
ANSYS:
/DECRYPT,PASSWORD,Encryption_Key

Encryption_Key - , .
. , ANSYS:
/DECRYPT,PASSWORD,OFF

http://cyberkolbasa.com1.ru

. 76 76

Оценить