- !下面的命令流进行的是一个简单的二维焊接分析, 利用ANSYS单元生死和热-结构耦合分析功能进
- !行焊接过程仿真, 计算焊接过程中的温度分布和应力分布以及冷却后的焊缝残余应力。
-
- /title,Weld Analysis by "Element Birth and Death"
- /prep7
- /unit,si ! 采用国际单位制
- !
- et,1,13,4 ! 13号二维耦合单元, 同时具有温度和位移自由度
- et,2,13,4
- !
- ! 1号材料是钢
- ! 2号材料是铝
- ! 3号材料是铜
- ! 铝是本次分析中的焊料, 它将钢结构部分和铜结构部分焊接起来
- ! 下面是在几个温度点下, 各材料的弹性模量
- mptemp,1,20,500,1000,1500,2000
- mpdata,ex,1,1,1.93e11,1.50e11,0.70e11,0.10e11,0.01e11
- mpdata,ex,2,1,1.02e11,0.50e11,0.08e11,0.001e11,0.0001e11
- mpdata,ex,3,1,1.17e11,0.90e11,0.30e11,0.05e11,0.005e11
- !
- ! 假设各材料都是双线性随动硬化弹塑性本构关系
- ! 下面是各材料在各温度点下的屈服应力和屈服后的弹性模量
- tb,bkin,1,5
- tbtemp,20,1
- tbdata,1,1200e6,0.193e11
- tbtemp,500,2
- tbdata,1, 933e6,0.150e11
- tbtemp,1000,3
- tbdata,1, 435e6,0.070e11
- tbtemp,1500,4
- tbdata,1, 70e6,0.010e11
- tbtemp,2000,5
- tbdata,1, 7e6,0.001e11
- !
- tb,bkin,2,5
- tbtemp,20,1
- tbdata,1,800e6,0.102e11
- tbtemp,500,2
- tbdata,1,400e6,0.050e11
- tbtemp,1000,3
- tbdata,1, 70e6,0.008e11
- tbtemp,1500,4
- tbdata,1, 1e6,0.0001e11
- tbtemp,2000,5
- tbdata,1,0.1e6,0.00001e11
- !
- tb,bkin,3,5
- tbtemp,20,1
- tbdata,1,900e6,0.117e11
- tbtemp,500,2
- tbdata,1,700e6,0.090e11
- tbtemp,1000,3
- tbdata,1,230e6,0.030e11
- tbtemp,1500,4
- tbdata,1, 40e6,0.005e11
- tbtemp,2000,5
- tbdata,1, 4e6,0.0005e11
- !
- ! 材料密度(假设为常值)
- mp,dens,1,8030
- mp,dens,2,4850
- mp,dens,3,8900
- ! 热膨胀系数(假设为常值)
- mp,alpx,1,1.78e-5
- mp,alpx,2,9.36e-6
- mp,alpx,3,1.66e-5
- ! 泊松比(假设为常值)
- mp,nuxy,1,0.29
- mp,nuxy,2,0.30
- mp,nuxy,3,0.30
- ! 热传导系数(假设为常值)
- mp,kxx,1,16.3
- mp,kxx,2,7.44
- mp,kxx,3,393
- ! 比热(假设为常值)
- mp,c,1,502
- mp,c,2,544
- mp,c,3,385
- ! 热膨胀系数(假设为常值)
- ! 由于该13号单元还有磁自由度, 此处假设一磁特性, 但并不影响我们所关心的结果
- mp,murx,1,1
- mp,murx,2,1
- mp,murx,3,1
- ! 假设焊料(铝)焊上去后的初始温度是1500℃
- mp,reft,1,20
- mp,reft,2,1500
- mp,reft,3,20
- !
- ! 下面建立几何模型
- csys,0
- k,1,0,0,0
- k,2,0.5,0,0
- k,3,1,0,0
- k,4,0,0.3,0
- k,5,0.35,0.3,0
- k,6,0.65,0.3,0
- k,7,1,0.3,0
- a,1,2,5,4
- a,2,6,5
- a,2,3,7,6
- ! 划分单元
- esize,0.025
- type,2
- mat,2
- amesh,2
- esize,0.05
- type,1
- mat,1
- amesh,1
- mat,3
- amesh,3
- eplot
- !
- /solu
- antype,4 ! 瞬态分析
- trnopt,full
- !
- ! 在模型的左边界加位移约束
- nsel,all
- *get,minx,node,,mnloc,x
- nsel,s,loc,x,minx
- d,all,ux,0
- *get,miny,node,,mnloc,y
- nsel,r,loc,y,miny
- d,all,uy,0
- !
- ! 假设在模型的左右边界处温度始终保持在20℃, 其它边界条件如对流、辐射等都可
- ! 施加,此处因只是示意而已,故只施加恒温边界条件。
- nsel,all
- *get,minx,node,,mnloc,x
- nsel,s,loc,x,minx
- d,all,temp,20
- nsel,all
- *get,maxx,node,,mxloc,x
- nsel,s,loc,x,maxx
- d,all,temp,20
- !
- ! 由于第二个面是焊料所在区域,因此,首先将该区域的单元"死"掉
- nna=2
- esel,all
- *get,emax,elem,,num,max
- asel,s,area,,nna
- esla
- *get,nse,elem,,count
- *dim,ne,,nse
- *dim,nex,,nse
- *dim,ney,,nse
- *dim,neorder,,nse
- mine=0
- ! 下面的DO循环用于将焊料区的单元按其形心Y坐标排序,以便后面
- ! 模拟焊料由下向上逐步"生长"的过程
- *do,i1,1,nse
- esel,u,elem,,mine
- *get,nse1,elem,,count
- ii=0
- *do,i,1,emax
- *if,esel(i),eq,1,then
- ii=ii+1
- ne(ii)=i
- *endif
- *enddo
- *do,i,1,nse1
- *get,ney(i),elem,ne(i),cent,y
- *get,nex(i),elem,ne(i),cent,x
- *enddo
- miny=1e20
- minx=1e20
- *do,i,1,nse1
- *if,ney(i),lt,miny,then
- miny=ney(i)
- minx=nex(i)
- mine=ne(i)
- *else
- *if,ney(i),eq,miny,then
- *if,nex(i),lt,minx,then
- miny=ney(i)
- minx=nex(i)
- mine=ne(i)
- *endif
- *endif
- *endif
- *enddo
- neorder(i1)=mine
- *enddo
- !
- max_tem=1500 ! 按照前面假设,焊料的初始温度为1500℃
- dt1=1e-3 ! 用于建立初始条件的一个很小的时间段
- dt=5 ! 焊接一个单元所需的时间
- t=0 ! 起始时间
- esel,all
- eplot
- /auto,1
- /replot
- *do,i,1,nse
- ekill,neorder(i)
- esel,s,live
- eplot
- *enddo
- allsel,all
- outres,all,all
- ic,all,temp,20
- kbc,1
- timint,0,struct
- timint,1,therm
- timint,0,mag
- tintp,0.005,,,1,0.5,0.2
- !
- !
- nsub1=2
- nsub2=40
- *do,i,1,nse
- ealive,neorder(i)
- esel,s,live
- eplot
- esel,all
- ! 下面的求解用于建立温度的初始条件
- t=t+dt1
- time,t
- nsubst,1
- *do,j,1,4
- d,nelem(neorder(i),j),temp,max_tem
- *enddo
- solve
- ! 下面的求解用于保证初始的升温速度为零
- t=t+dt1
- time,t
- solve
- ! 下面的步骤用于求解温度分布
- *do,j,1,4
- ddele,nelem(neorder(i),j),temp
- *enddo
- t=t+dt-2*dt1
- time,t
- nsubst,nsub1
- solve
- *enddo
- t=t+50000
- time,t
- nsubst,nsub2
- solve
- finish
-
- /post1
-
- ! 下面的一系列命令用于生成应力的动画文件
-
- /seg,dele
- /cont,1,15,0,1200e6/16,1200e6
- /dscale,1,1.0
- avprin,0,0
- avres,1
- /seg,multi,stress,0.1
- esel,all
- *do,i,1,nse
- esel,u,elem,,neorder(i)
- *enddo
- *do,i,1,nse
- esel,a,elem,,neorder(i)
- set,(i-1)*3+1,1
- plnsol,s,eqv
- *do,j,1,nsub1
- set,(i-1)*3+3,j
- plnsol,s,eqv
- *enddo
- *enddo
- *do,i,1,nsub2
- set,(nse-1)*3+4,i
- plnsol,s,eqv
- *enddo
- /seg,off,stress,0.1
- /anfile,save,stress,avi
-
- ! 下面的一系列命令用于生成温度的动画文件
-
- /seg,dele
- /cont,1,15,0,1500/16,1500
- /dscale,1,1.0
- avprin,0,0
- avres,1
- /seg,multi,temp,0.1
- esel,all
- *do,i,1,nse
- esel,u,elem,,neorder(i)
- *enddo
- *do,i,1,nse
- esel,a,elem,,neorder(i)
- set,(i-1)*3+1,1
- plnsol,temp
- *do,j,1,nsub1
- set,(i-1)*3+3,j
- plnsol,temp
- *enddo
- *enddo
- *do,i,1,nsub2
- set,(nse-1)*3+4,i
- plnsol,temp
- *enddo
- /seg,off,temp,0.1
- /anfile,save,temp,avi
-
- finish
复制代码 |