! 变截面悬臂梁的外形形状优化
*CREATE,SCRATCH
TK16=6.35
TK27=6.35
TK38=6.35
TK49=6.35
! (2)在前处理模块中,设置分析类型,单元类型和材料参数
/PREP7
SMRT,OFF
/TITLE,EX11.1, SHAPE OPTIMIZATION OF A CANTILEVER BEAM
/COM, REF. B. PRASAD AND R.T.HAFTKA
/COM, OPT. STRUCT. DESIGN WITH PLATE FINITE ELEMENTS
/COM, ASCE JOURNAL OF THE STRUCT. DIVISION
/COM, VOL. 105 (ST11) 1979 PP2367-2382
ANTYPE,STATIC
ET,1,PLANE42
MP,EX,1,68952
MP,NUXY,1,0.3
! (3) 定义关键点
K,1
K,5,254
KFILL
K,6,,TK16
K,7,63.5,TK27
K,8,127,TK38
K,9,190.5,TK49
K,10,254,3.81
SPLINE,6,7,8,9,10
L,1,6
*REPEAT,5,1,1
LSEL,S,LINE,,5,9
LESIZE,ALL,,,1
LSEL,ALL
A,1,2,7,6
*REPEAT,4,1,1,1,1
ESIZE,,4
AMESH,ALL
! (4) 选择边界节点,施加位移约束
NSEL,S,LOC,Y
DSYM,SYMM,X
NSEL,S,LOC,X
DSYM,ASYM,Y
NSEL,ALL
FK,10,FX,262.7
DK,1,ALL,0
FINISH
! (5) 在求解模块求解
/SOLU
SOLVE
FINISH
! (6) 在后处理模块显示计算结果
/POST1
SET,LAST
ETABLE,VOLU,VOLU
PRNSOL,S,PRIN
NSORT,S,1
NSEL,S,LOC,X,0,228.6
*GET,STRS,SORT,,MAX
NSEL,ALL
SSUM
*GET,TVOL,SSUM,,ITEM,VOLU
TVOL=TVOL*2
NSEL,S,LOC,X,253,255
PRNSOL,U,Y
NSORT,U,Y,,1
PRNSOL,U,Y
*GET,DEFL,SORT,,MAX
*STATUS,PARM
DEFL=ABS(DEFL)
! (7) 定义状态变量
/COM DEFINE STATE VARIABLES TO ENSURE CONSISTENT TAPER
DIF1=TK16-TK27
DIF2=TK27-TK38
DIF3=TK38-TK49
FINISH
*END
! (8) 进入优化设计模块,设置目标函数和优化变量
FINISH
/CLEAR, NOSTART
/FILENAME,EX11.3
*USE,SCRATCH
/OPT
OPANL,SCRATCH
OPVAR,TVOL,OBJ,,,0.25
OPVAR,STRS,SV,,207
OPVAR,DEFL,SV,,12.7
OPVAR,DIF1,SV,0,2.54
OPVAR,DIF2,SV,0,2.54
OPVAR,DIF3,SV,0,2.54
OPVAR,TK16,DV,3.81,6.86,0.0254
OPVAR,TK27,DV,3.81,6.86,0.0254
OPVAR,TK38,DV,3.81,6.86,0.0254
OPVAR,TK49,DV,3.81,6.86,0.0254
OPSAVE,INITIAL,OPT
OPTYPE,SUBP
OPSUBP,30
! (9) 用子模型近似优化设计方法开始优化设计的计算
OPEXE
VR1=TVOL
VR2=DEFL
VR3=STRS
PARSAV,,RSET1
OPLIST,ALL,,1
/TITLE,EX11.3, SHAPE OPTIMIZATION OF A CANTILEVER BEAM (SubP Method)
/AXLAB,Y,VOLUME (TVOL)
PLVAROPT,TVOL
STATUS,PARM
! (10) 设置一阶方法进行优化设计的参数
OPRESU,INITIAL,OPT
OPVAR,DIF1,DEL
OPVAR,DIF2,DEL
OPVAR,DIF3,DEL
OPTYPE,FIRST
OPFRST,20
! (11) 用一阶方法执行优化设计
OPEXE
VR4=TVOL
VR5=DEFL
VR6=STRS
OPLIST,ALL,,1
/TITLE,EX11.3, SHAPE OPTIMIZATION OF A CANTILEVER BEAM (1st Method)
/AXLAB,Y,VOLUME (TVOL)
PLVAROPT,TVOL
STATUS,PARM
FINISH
! (12) 定义数组变量,将结果保存到这些数组变量
PARRES,CHANGE,RSET1
*DIM,LABEL1,CHAR,3
*DIM,LABEL2,CHAR,3
*DIM,VALUE1,,3,3
*DIM,VALUE2,,3,3
LABEL1(1) = 'TVOL ','DEFL ','STRS '
LABEL2(1) = 'TVOL ','DEFL ','STRS '
*VFILL,VALUE1(1,1),DATA,2323,12.7,207
*VFILL,VALUE1(1,2),DATA,VR1,VR2,VR3
*VFILL,VALUE1(1,3),DATA,(VR1/2323),(VR2/12.7),(VR3/207)
*VFILL,VALUE2(1,1),DATA,2323,12.7,207
*VFILL,VALUE2(1,2),DATA,VR4,VR5,VR6
*VFILL,VALUE2(1,3),DATA,(VR4/2323),(VR5/12.7),(VR6/207)
/OUT,EX11_1,out
/COM
/COM,------------------- EX11.1 RESULTS COMPARISON ---------------------
/COM,
/COM, | TARGET | ANSYS | RATIO
/COM,
/COM, SUBPROBLEM APPROX. METHOD
/COM,
*VWRITE,LABEL1(1),VALUE1(1,1),VALUE1(1,2),VALUE1(1,3)
(1X,A8,' ',F10.2,' ',F10.2,' ',1F5.3)
/COM,
/COM, FIRST ORDER METHOD
/COM.
*VWRITE,LABEL2(1),VALUE2(1,1),VALUE2(1,2),VALUE2(1,3)
(1X,A8,' ',F10.2,' ',F10.2,' ',1F5.3)
/COM,----------------------------------------------------------------
/OUT
/DELETE,INITIAL,OPT
/DELETE,SCRATCH
*LIST,EX11_1,out |