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