ANSYS目標優化實例
作者:張應遷
問題描述:
一個設計笨重的鋼盤,如圖1所示,承受50 MPa 的拉伸載荷,需要進行優化,以減小重量而能承受最大von-mises 150 MPa為限。可以允許改變厚度 t1 和過渡圓角半徑fil。
問題參數:
分析中使用如下材料特性:
E = 2.07e5 MPa
Thickness = 10 mm
u= 0.3
分析中使用如下幾何特性:
厚度 t1變化范圍=20.5到40mm (初始值為30)
過渡圓角半徑fil變化范圍=5到15mm(初始值為10)
圖1 模型示意圖
下面分別是利用菜單操作和命令流方式進行有限元分析的方法
一、GUI菜單操作如下:
第一步,清除內存準備分析
1) 清除內存:
GUI:Utility Menu>File>Clear& Start New
2) 更換工作文件名:
GUI:Utility Menu>File>ChangeJobname,輸入hexplate
3) 定義標題:
GUI:Utility Menu>File>ChangeTitle,輸入 theanalysis of a hexplate under tension
第二步,創建有限元模型
1) 進入前處理器:
GUI:Main Menu>Preprocessor
2) 定義單元類型并設置單元選項:
GUI:Main Menu>Preprocessor>Element Type>Add/Edit/Delete,選擇單元PLANE82;單擊Element Types對話框的Options按鈕,彈出對話框,在K3后面的下拉列表中選擇Plane strs w/thk
3) 定義厚度(實常數):
GUI:Main Menu>Preprocessor>Real Constants>Add/Edit/Delete,彈出對話框,點擊Add按鈕,彈出對話框,在THK值域輸入10
4) 定義材料:
GUI:Main Menu>Preprocessor>Material Props>Material Models,彈出對話框,在右側窗口中連續雙擊選擇Structural>linear>Elastic>Isotropic,彈出窗口,在值域EX處輸入2.07e5,在值域PRXY處輸入0.3,單擊OK按鈕
5) 創建圓環:
? 定義inrad、t1和fil三個參數GUI:Utility Menu>Parameters>
Angular Units*AFUN對應的項從下拉列表選擇為Degrees DEG;Utility Menu>
Parameters>Scalar Parameters,在Selection輸入框輸入inrad=200*cos(30)-20
$t1=30$fil=10
? 分別創建三個環GUI:MainMenu>Preprocessor>Modeling>Create>Areas>Circle>Partial Annulus,彈出對話框,在WP X對應的值域輸入-200,在WP Y對應的值域輸入0,在Rad-1值域輸入inrad,在Theta-1值域輸入-30,在Rad-2值域輸入inrad+t1,在Theta-2值域輸入30,單擊Apply按鈕確定。同樣的方法建立另外兩個圓環。其尺寸參數見表1所示。
圓環編號 |
WP X |
WP Y |
Rad-1 |
Theta-1 |
Rad-2 |
Theta-2 |
2 |
200*cos(60) |
200*sin(60) |
inrad |
-90 |
inrad+t1 |
-150 |
3 |
200*cos(60) |
200*sin(-60) |
inrad |
90 |
inrad+t1 |
150 |
表1 另外兩個圓環的尺寸參數
6) 執行面的布爾運算然后刪該面但保留線:
GUI:Main Menu>Preprocessor>Modeling>Operate>Booleans>Add>Areas,彈出對話框,點擊Pick All按鈕;MainMenu>Preprocessor>Modeling>Delete>Areas Only,彈出對話框,點擊Pick All按鈕
7) 對三內角倒角:
GUI:Main Menu>Preprocessor>Modeling>Create>Lines>LineFillet,彈出對話框,選一對內線,單擊Apply按鈕,彈出對話框,在RAD值域輸入fil;依次選擇第二對內線、第三對內線方法同第一對內線,完成對三對內線的倒角,最后的結果如圖2所示

圖2 倒角以后的示意圖
8) 切除并只保留 0-60°內的區域,將用兩次由工作平面分割線段的操作:
GUI:Utility Menu>WorkPlane>OffsetWP by Increments,彈出對話框,在XY,YZ, ZX值域依次輸入0,90,0;MainMenu>Preprocessor>Modeling>Operate>Booleans>Divide>
Line by WrkPlane,彈出對話框,單擊Pick All;然后沿Y軸旋轉WP 60,XY, YZ, ZX值域依次輸入0,0,60;MainMenu>Preprocessor>Modeling>Operate>Booleans>Divide>
Line by WrkPlane,彈出對話框,單擊Pick All;UtilityMenu>WorkPlane>Display Working Plane,將其狀態由on切換到off;最后刪除所有的從 60°到 360°的線,其結果如圖3所示。為了變換花樣,也可采用命令,命令如下:
csys,1
lsel,s,loc,y,60,360
ldele,all,,,1
lsel,all
csys,0
lplot
圖3 1/6模型(線)
9) 完成 1/6 對稱模型后,創建缺少的線段,然后再建面:
GUI:MainMenu>Preprocessor>Modeling>Create>Lines>Lines>Straight Line,彈出對話框,分別拾取最下邊兩關鍵點以及沿 60°對稱邊的關鍵點;MainMenu>Preprocessor>Modeling
>Operate>Booleans>Add>Lines,彈出對話框,拾取最右邊的兩條線段,點擊OK按鈕,接著彈出的對話框中點擊OK按鈕;MainMenu>Preprocessor>Modeling>Create>Areas>Arbitrary>
By Lines,彈出對話框,選 Loop 選項,點選任何一個線段,應見一封閉線段,點擊OK按鈕,如圖4所示
圖4 1/6模型(面)
10) 劃分網格:
GUI:Main Menu>Preprocessor>Meshing,點擊Mesh Tool,彈出對話框,設定smart size 級別為3,點擊Mesh按鈕,彈出對話框,點擊Pick All按鈕,最后的網格圖如圖5所示
圖5 網格圖
第三步,靜力學分析
1) 進入求解器:
GUI:Main Menu>Solution
2) 選擇分析類型:
GUI:Main Menu>Solution-Analysis Type- New analysis,選中Static
3) 施加對稱邊界條件:
GUI:Main Menu>Solution>DefineLoads>Apply>Structural>Displacement>Symmetry B.C.>On Lines,彈出對話框,選擇最底邊以及左邊60°的對稱邊兩條線段
4) 施加壓力載荷:
GUI:Main Menu>Solution>DefineLoads>Apply>Structural>Pressure>On Lines,彈出對話框,選擇最右邊的線段,然后單擊OK,接著彈出對話框,在value欄里輸入-50
5) 執行求解:
GUI:Main Menu>Solution>-Solve-Current LS
6) 退出求解器:
GUI:Main Menu>Finish
7) 保存結果:點擊SAVE_DB工具條。
第四步,執行后處理
1) 進入后處理器:
GUI:Main Menu>Solution>General Postproc
2) 觀察結果:
GUI:Main Menu>Solution>General Postproc>Plot Results>ContourPlot-Nodal Solu,彈出對話框,選擇vonMises stress。如圖6所示
圖6 Von Mises應力云圖
3) 獲得最大等效應力 SMAX 和總體積 VTOT:通過命令流獲得最大等效應力和總體積,
具體命令流如下:
nsort,s,eqv
*get,smax,sort,,max
etable,evol,volu
ssum
*get,vtot,ssum,,item,evol
4) 創建一個分析文件,此文件可用于以后的設計優化或to explore 設計域:
GUI:Utility Menu>File>Write DB Log File,寫數據庫日志到文件hexplate.lgw,注意選擇最下邊的下拉列表為Write essentialcommans only
第五步,優化設計
1) 執行第一次分析:
GUI:Utility Menu>File>Read Input from,選擇hexplate.lgw文件
2) 調用優化程序并確定分析文件:
GUI:Main Menu>Design Opt>Analysis File>Assign,彈出對話框選擇hexplate.lgw文件
3) 確定優化變量:
GUI:Main Menu>Design Opt>Design Variables,彈出對話框,點擊ADD按鈕,依次點擊t1和fil,確保t1的min=20.5,max=40;fil的min=5,max=15
4) 確定狀態變量:
GUI:Main Menu>Design Opt>State Variables,彈出對話框,點擊ADD按鈕,點擊SMAX,確保max=150
5) 確定目標函數:
GUI:Main Menu>Design Opt>Objective,彈出對話框,在變量列表欄內選中VTOT
6) 運行時控制:
GUI:Main Menu>Design Opt>Controls,彈出對話框,將[OPKEEP]設置為“Save”
7) 優化方法的選擇:
GUI:Main Menu>Design Opt>Method/Tool,彈出對話框,復選框選擇Sub-Problem,接著彈出的對話框,參數采用系統缺省的值
8) 保存OPT數據庫:
GUI:Main Menu>Design Opt>OptDatabase>Save,彈出對話框,在Filneame處輸入hexplate.opt0
9) 執行優化:
GUI:Main Menu>Design Opt>Run,點擊OK按鈕執行優化
10) 列出設計集:
GUI:Main Menu>Design Opt>DesignSets>List,彈出對話框,List option選擇ALL Sets,LKEY選擇Only opt params,點擊OK按鈕,彈出優化結果,注意左右帶*的就是最優解,如圖7所示
圖7優化結果列表
11) 曲線顯示體積VTOT與優化序列號之間的關系:
GUI:Main Menu>Design Opt>DesignSets>Graphs/Tables,彈出對話框,X-variable parameter設置為Set number,Y-variableparams(<11)設置為VTOT,Graphor List Table設置為Graph PLVAR,圖形窗口顯示結果如圖8所示。
圖8 VTOT-Set number曲線圖
12) 曲線顯示體SMAX與優化序列號之間的關系:
GUI:Main Menu>Design Opt>DesignSets>Graphs/Tables,彈出Graph/List Tables of Design SetParameters的對話框,X-variable parameter設置為Set number,Y-variableparams(<11)設置為SMAX,Graphor List Table設置為Graph PLVAR,圖形窗口顯示結果如圖9所示
圖9 SMAX-Set number曲線圖
13) 保存最優結果:
GUI:Main Menu>Design Opt>OptDatabase>Save,彈出對話框,在Filneame處輸入hexplate.opt1,點擊OK按鈕確定。在命令窗口輸入如下命令流:
resume,hexplate,bdb
/post1
file,hexplate,brst
14) 查看最優結果的von Mises應力云圖:
GUI:Main Menu>General Postproc>ReadResults>First Set;Main Menu>Solution>General Postproc>Plot Results>ContourPlot-Nodal Solu,彈出對話框,選擇vonMises stress,如圖10所示。
圖10 顯示最優結果的von Mises應力云圖
15) 退出分析:點擊工具條QUIT,選擇No Save退出ANSYS
二、命令流如下:
/clear,start
/title,the analysis of a hexplate under tension
/filname,hexplate
/prep7
et,1,82
keyopt,1,3,3
r,1,10
mp,ex,1,2.07e5
mp,nuxy,1,.3
*afun,deg
inrad=200*cos(30)-20
t1=30
fil=10
cyl4,-200,0,inrad,-30,inrad+t1,30
cyl4,200*cos(60),200*sin(60),inrad,-90,inrad+t1,-150
cyl4,200*cos(60),200*sin(-60),inrad,90,inrad+t1,150
aadd,all
adele,all
lfillt,22,23,fil
lfillt,23,24,fil
lfillt,24,22,fil
wprota,,90
lsbw,all
wprota,,,60
lsbw,all
csys,1
lsel,s,loc,y,60,360
ldele,all,,,1
lsel,all
csys,0
lplot
l,23,25
l,28,27
al,all
smrt,3
amesh,all
fini
/solu
dl,1,,symm
dl,2,,symm
sfl,9,pres,-50
sfl,21,pres,-50
solve
fini
save
/post1
plnsol,s,eqv
nsort,s,eqv
*get,smax,sort,,max
etable,evol,volu
ssum
*get,vtot,ssum,,item,evol
lgwrite,'hexplate','lgw','G:\db\',remove
fini
/clear,start
/filname,hexplate
/INPUT,'hexplate','lgw','G:\db\',, 0
fini
/opt
opanl,'hexplate','lgw',' '
opvar,t1,dv,20.5,40, ,
opvar,fil,dv,5,15, ,
opvar,smax,sv, ,150, ,
opvar,vtot,obj, , ,1.0,
opkeep,on
optype,subp
opsave,' hexplate','opt0',' '
opexe
oplist,all,0
plvaropt,vtot
plvaropt,smax
opsave,' hexplate','opt1',' '
fini
resume,hexplate,bdb
/post1
file,hexplate,brst
lplot
plnsol,s,eqv
注:新版軟件遇到上述部分命令無法識別時請自行做相應修改。
工程師必備
- 項目客服
- 培訓客服
- 平臺客服
TOP




















