移动体热源ANSYS命令流.docx
《移动体热源ANSYS命令流.docx》由会员分享,可在线阅读,更多相关《移动体热源ANSYS命令流.docx(25页珍藏版)》请在冰豆网上搜索。
![移动体热源ANSYS命令流.docx](https://file1.bdocx.com/fileroot1/2023-4/17/14726887-1d14-4914-9d2a-c5fc3a561a04/14726887-1d14-4914-9d2a-c5fc3a561a041.gif)
移动体热源ANSYS命令流
!
非线性材料求解成功GAUSS分布Z向扫描!
!
考虑了和基板对流情况下加载热流密度的热分析rb=
!
粉床,烧结区域
!
考虑粉床表面的辐射、对流
!
考虑粉末状、熔化状(液态)、凝固态的边界条件变化
!
考虑金属蒸发会带走一部分能量,故效率减半eff=
!
r=
FINISH
/CLEAR,START
/BATCH!
设置程序模式为“批处理”
/CWD,'d:
\Ansyswork\EBMFEMSimulationforMetals\3DTemperturedistribution'!
更改当前工作目录
/FILNAME,EBM_db,0
/TITLE,3DTemperturedistrbution
!
选择分析问题的类型:
热
/NOPR
/PMETH,OFF,0
KEYW,PR_SET,1
KEYW,PR_STRUC,0
KEYW,PR_THERM,1
KEYW,PR_FLUID,0
KEYW,PR_ELMAG,0
KEYW,MAGNOD,0
KEYW,MAGEDG,0
KEYW,MAGHFE,0
KEYW,MAGELC,0
KEYW,PR_MULTI,0
KEYW,PR_CFD,0
/GO
/UNITS,SI!
StandardUnits
!
*************************************************************************************************!
!
开始,进入前处理器,定义下列属性-
!
0参数定义
!
1定义单元类型
!
2实常数
!
3材料性能
!
4几何模型
!
5网格划分控制
!
6其他
!
*************************************************************************************************!
/PREP7
!
0参数定义
!
模型参数
!
几何模型尺寸me-3=mm
*SET,Block_x,
*SET,Block_x1,
*SET,Block_x2,
*SET,Block_y,
*SET,Block_y1,
*SET,Block_y2,
*SET,Block_z,
*SET,Block_z1,
!
划分网格的大小
*SET,LMeshx,3e-4!
line1
*SET,LMeshy,3e-4!
line4
*SET,LMeshz,3e-4!
line9
!
边界条件参数
*SET,Tinit,30!
初始温度
!
1定义单元类型
ET,1,SOLID70
ET,2,surf152!
表面效应单元
r,2
KEYOPT,2,4,1!
表面效应单元设置
KEYOPT,2,8,4
ET,3,SOLID87
!
2实常数
!
Nothing
!
3材料性能
MPTEMP
MPTEMP,1,25,400,1200,1600,2000,2500
MPDATA,DENS,1,1,3983,,,,6908,6331!
密度
MPDATA,KXX,1,1,,,,,,32!
热导率
MPDATA,c,1,1,472,535,679,859,945,1034!
比热
MPTEMP,,,,,,,,
MPTEMP,1,0,200,400,800,1200
MPTEMP,6,1400,1454,1800,2000
MPDATA,ENTH,1,1,0,+8,+9,+9,+9
MPDATA,ENTH,1,6,+9,+9,+9,+10!
热焓
MPTEMP,,,,,,,,
MPTEMP,1,20,300,600,900,1200,1500,1800,2000,3000,4000
MPDATA,HF,1,1,6,50,120,200,250,378,700,850,1746,3799!
对流系数
MPTEMP,,,,,,,,
MPTEMP,1,20,200,400,600,800,900,1000,1100,1200,1420,1460
MPDATA,DENS,2,1,7966,7893,7814,7724,7630,7583,7535,7486,7436,7320,7320
MPDATA,KXX,2,1,,,,,,,,,,,32!
热导率
mpdata,c,2,1,470,508,550,592,634,655,676,698,719,765,765
MPTEMP,,,,,,,,
MPTEMP,1,0,200,400,800,1200
MPTEMP,6,1400,1454,1800,2000
MPDATA,ENTH,2,1,0,+8,+9,+9,+9
MPDATA,ENTH,2,6,+9,+9,+9,+10
!
4几何模型
BLOCK,0,Block_x,0,Block_y,0,Block_z,
BLOCK,Block_x1,Block_x2,Block_y1,Block_y2,0,Block_z,
vsel,all
VOVLAP,all
BLOCK,0,Block_x,0,Block_y,0,-Block_z1,
vglue,all
numcmp,all
!
划分网格
lesize,8,LMeshx
lesize,5,LMeshy
lesize,13,LMeshz
vsel,s,,,1
type,1
mat,1
mshkey,1
vmesh,all
allsel
esize,
mshkey,0
mshape,1,3d
vsel,s,,,2
type,3
mat,2
vmesh,all
allsel
esize,
mshkey,0
mshape,1,3d
vsel,s,,,3
type,3
mat,1
vmesh,all
allsel
!
成形件轨迹单元质心排序
width=Block_y2-Block_y1
!
wpoffs,Block_x1,Block_y1,0
!
local,11,1,Block_x1,Block_y1,0
ALLSEL,ALL
*GET,EMAX,ELEM,,COUNT,MAX
VSEL,S,,,1
ESLV,S
*GET,AEMAX,ELEM,,COUNT1,MAX
*DIM,ANE,ARRAY,AEMAX,
*DIM,ANE1,ARRAY,AEMAX,
*DIM,ANE2,ARRAY,AEMAX,
*DIM,ANE3,ARRAY,AEMAX,
*DIM,ANE4,ARRAY,AEMAX,
*DIM,ANE5,ARRAY,AEMAX,
*DIM,ANEX,ARRAY,AEMAX
*DIM,ANEY,ARRAY,AEMAX
*DIM,ANEZ,ARRAY,AEMAX
*DIM,ANEORDER,ARRAY,AEMAX,,1
!
形心排序
VSEL,S,,,1
ESLV,S
*GET,ANSEL,ELEM,,COUNT1
II=0
*DO,I,1,AEMAX
*IF,ESEL(I),EQ,1,THEN
II=II+1
ANE(II)=I
*ENDIF
*ENDDO
*DO,I,1,ANSEL
*GET,ANEZ(I),ELEM,ANE(I),CENT,Z
*GET,ANEY(I),ELEM,ANE(I),CENT,Y
*GET,ANEX(I),ELEM,ANE(I),CENT,X
*ENDDO
e=0
*do,i,1,AEMAX
*if,ANEY(I),ge,4*width/5+Block_y1,then
e=e+1
ANE5(e)=ANE(i)
*endif
*enddo
d=0
*do,i,1,AEMAX
*if,ANEY(I),ge,3*width/5+Block_y1,then
*if,ANEY(I),lt,4*width/5+Block_y1,then
d=d+1
ANE4(d)=ANE(i)
*endif
*endif
*enddo
c=0
*do,i,1,AEMAX
*if,ANEY(I),ge,2*width/5+Block_y1,then
*if,ANEY(I),lt,3*width/5+Block_y1,then
c=c+1
ANE3(c)=ANE(i)
*endif
*endif
*enddo
b=0
*do,i,1,AEMAX
*if,ANEY(I),ge,width/5+Block_y1,then
*if,ANEY(I),lt,2*width/5+Block_y1,then
b=b+1
ANE2(b)=ANE(i)
*endif
*endif
*enddo
a=0
*do,i,1,AEMAX
*if,ANEY(I),lt,width/5+Block_y1,then
a=a+1
ANE1(a)=ANE(i)
*endif
*enddo
!
*************************对1道焊缝区的单元按质心X坐标进行从低到高排序****************************
esel,none
*do,i,1,a
*if,ANE1(i),NE,0,then
esel,a,elem,,ANE1(i)
*endif
*enddo
MINE=0
*DIM,ANEX1,ARRAY,a
*DIM,ANEY1,ARRAY,a
*DIM,ANEZ1,ARRAY,a
*DO,I1,1,a
esel,u,elem,,mine
*GET,ANSEL1,ELEM,,COUNT1
II=0
*DO,I,1,AEMAX
*IF,ESEL(I),EQ,1,THEN
II=II+1
ANE1(II)=I
*ENDIF
*ENDDO
*DO,I,1,ANSEL1
*GET,ANEZ1(I),ELEM,ANE1(I),CENT,Z
*GET,ANEY1(I),ELEM,ANE1(I),CENT,Y
*GET,ANEX1(I),ELEM,ANE1(I),CENT,X
*ENDDO
MINZ=1E20
MINY=1E20
MINX=1E20
*DO,I,1,ANSEL1
*IF,ANEZ1(I),LT,MINZ,THEN
MINZ=ANEZ1(I)
MINY=ANEY1(I)
MINX=ANEX1(I)
MINE=ANE1(I)
*ELSE
*IF,ANEZ1(I),EQ,MINZ,THEN
*IF,ANEY1(I),LT,MINY,THEN
MINZ=ANEZ1(I)
MINY=ANEY1(I)
MINX=ANEX1(I)
MINE=ANE1(I)
*ELSE
*IF,ANEY1(I),EQ,MINY,THEN
*IF,ANEX1(I),LT,MINX,THEN
MINZ=ANEZ1(I)
MINY=ANEY1(I)
MINX=ANEX1(I)
MINE=ANE1(I)
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDDO
ANEORDER(I1)=MINE
*ENDDO
!
*************************对2道焊缝区的单元按质心X坐标进行从高到低排序****************************
MAXE=1
esel,none
*do,j,1,b
*if,ANE2(j),NE,0,then
esel,a,elem,,ANE2(j)
*endif
*enddo
*DIM,ANEX2,ARRAY,b
*DIM,ANEY2,ARRAY,b
*DIM,ANEZ2,ARRAY,b
*DO,J1,1,b
esel,u,elem,,MAXE
*GET,ANSEL2,ELEM,,COUNT1
JJ=0
*DO,J,1,AEMAX
*IF,ESEL(I),EQ,1,THEN
JJ=JJ+1
ANE2(JJ)=J
*ENDIF
*ENDDO
*DO,J,1,ANSEL2
*GET,ANEZ2(J),ELEM,ANE2(J),CENT,Z
*GET,ANEY2(J),ELEM,ANE2(J),CENT,Y
*GET,ANEX2(J),ELEM,ANE2(J),CENT,X
*ENDDO
MAXZ=1E20
MAXY=1E20
MAXX=-1E20
*DO,J,1,ANSEL2
*IF,ANEZ2(J),LT,MAXZ,THEN
MAXZ=ANEZ2(J)
MAXY=ANEY2(J)
MAXX=ANEX2(J)
MAXE=ANE2(J)
*ELSE
*IF,ANEZ2(J),EQ,MAXZ,THEN
*IF,ANEY2(J),LT,MAXY,THEN
MAXZ=ANEZ2(J)
MAXY=ANEY2(J)
MAXX=ANEX2(J)
MAXE=ANE2(J)
*ELSE
*IF,ANEY2(J),EQ,MAXY,THEN
*IF,ANEX2(J),GT,MAXX,THEN
MAXZ=ANEZ2(J)
MAXY=ANEY2(J)
MAXX=ANEX2(J)
MAXE=ANE2(J)
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDDO
ANEORDER(J1+a)=MAXE
*ENDDO
!
*************************对3道焊缝区的单元按质心X坐标进行从低到高排序****************************
MINE=1
esel,none
*do,k,1,c
*if,ANE3(k),NE,0,then
esel,a,elem,,ANE3(k)
*endif
*enddo
*DIM,ANEX3,ARRAY,c
*DIM,ANEY3,ARRAY,c
*DIM,ANEZ3,ARRAY,c
*DO,K1,1,c
esel,u,elem,,mine
*GET,ANSEL3,ELEM,,COUNT1
KK=0
*DO,K,1,AEMAX
*IF,ESEL(K),EQ,1,THEN
KK=KK+1
ANE3(KK)=K
*ENDIF
*ENDDO
*DO,K,1,ANSEL3
*GET,ANEZ3(K),ELEM,ANE3(K),CENT,Z
*GET,ANEY3(K),ELEM,ANE3(K),CENT,Y
*GET,ANEX3(K),ELEM,ANE3(K),CENT,X
*ENDDO
MINZ=1E20
MINY=1E20
MINX=1E20
*DO,K,1,ANSEL3
*IF,ANEZ3(K),LT,MINZ,THEN
MINZ=ANEZ3(K)
MINY=ANEY3(K)
MINX=ANEX3(K)
MINE=ANE3(K)
*ELSE
*IF,ANEZ3(K),EQ,MINZ,THEN
*IF,ANEY3(K),LT,MINY,THEN
MINZ=ANEZ3(K)
MINY=ANEY3(K)
MINX=ANEX3(K)
MINE=ANE3(K)
*ELSE
*IF,ANEY3(K),EQ,MINY,THEN
*IF,ANEX3(K),LT,MINX,THEN
MINZ=ANEZ3(K)
MINY=ANEY3(K)
MINX=ANEX3(K)
MINE=ANE3(K)
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDDO
ANEORDER(K1+a+b)=MINE
*ENDDO
!
*************************对4道焊缝区的单元按质心X坐标进行从高到低排序****************************
MAXE=1
esel,none
*do,j,1,d
*if,ANE4(j),NE,0,then
esel,a,elem,,ANE4(j)
*endif
*enddo
*DIM,ANEX4,ARRAY,d
*DIM,ANEY4,ARRAY,d
*DIM,ANEZ4,ARRAY,d
*DO,J1,1,d
esel,u,elem,,MAXE
*GET,ANSEL4,ELEM,,COUNT1
JJ=0
*DO,J,1,AEMAX
*IF,ESEL(I),EQ,1,THEN
JJ=JJ+1
ANE2(JJ)=J
*ENDIF
*ENDDO
*DO,J,1,ANSEL4
*GET,ANEZ4(J),ELEM,ANE4(J),CENT,Z
*GET,ANEY4(J),ELEM,ANE4(J),CENT,Y
*GET,ANEX4(J),ELEM,ANE4(J),CENT,X
*ENDDO
MAXZ=1E20
MAXY=1E20
MAXX=-1E20
*DO,J,1,ANSEL4
*IF,ANEZ4(J),LT,MAXZ,THEN
MAXZ=ANEZ4(J)
MAXY=ANEY4(J)
MAXX=ANEX4(J)
MAXE=ANE4(J)
*ELSE
*IF,ANEZ4(J),EQ,MAXZ,THEN
*IF,ANEY4(J),LT,MAXY,THEN
MAXZ=ANEZ4(J)
MAXY=ANEY4(J)
MAXX=ANEX4(J)
MAXE=ANE4(J)
*ELSE
*IF,ANEY4(J),EQ,MAXY,THEN
*IF,ANEX4(J),GT,MAXX,THEN
MAXZ=ANEZ4(J)
MAXY=ANEY4(J)
MAXX=ANEX4(J)
MAXE=ANE4(J)
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDDO
ANEORDER(J1+a+b+c)=MAXE
*ENDDO
!
*************************对5道焊缝区的单元按质心X坐标进行从低到高排序****************************
esel,none
*do,i,1,e
*if,ANE5(i),NE,0,then
esel,a,elem,,ANE5(i)
*endif
*enddo
MINE=1
*DIM,ANEX5,ARRAY,e
*DIM,ANEY5,ARRAY,e
*DIM,ANEZ5,ARRAY,e
*DO,I1,1,e
esel,u,elem,,mine
*GET,ANSEL5,ELEM,,COUNT1
II=0
*DO,I,1,AEMAX
*IF,ESEL(I),EQ,1,THEN
II=II+1
ANE5(II)=I
*ENDIF
*ENDDO
*DO,I,1,ANSEL5
*GET,ANEZ5(I),ELEM,ANE5(I),CENT,Z
*GET,ANEY5(I),ELEM,ANE5(I),CENT,Y
*GET,ANEX5(I),ELEM,ANE5(I),CENT,X
*ENDDO
MINZ=1E20
MINY=1E20
MINX=1E20
*DO,I,1,ANSEL1
*IF,ANEZ5(I),LT,MINZ,THEN
MINZ=ANEZ5(I)
MINY=ANEY5(I)
MINX=ANEX5(I)
MINE=ANE5(I)
*ELSE
*IF,ANEZ5(I),EQ,MINZ,THEN
*IF,ANEY5(I),LT,MINY,THEN
MINZ=ANEZ5(I)
MINY=ANEY5(I)
MINX=ANEX5(I)
MINE=ANE5(I)
*ELSE
*IF,ANEY5(I),EQ,MINY,THEN
*IF,ANEX5(I),LT,MINX,THEN
MINZ=ANEZ5(I)
MINY=ANEY5(I)
MINX=ANEX5(I)
MINE=ANE5(I)
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDIF
*ENDDO
ANEORDER(I1+a+b+c+d)=MINE
*ENDDO
!
成形件轨迹单元质心排序
FINISH
!
*********************体热源加载求解**************************************
/SOL
ANTYPE,4!
瞬态分析
TRNOPT,FULL!
指定瞬态分析选项
eqslv!
指定求解器
solcontrol,on!
求解控制(用优化求解器)
ESEL,ALL
EPLOT
/AUTO,1
/REPLOT
allsel,all
outres,all,all
TOFFST,273
tunif,24
kbc,1
timint,on
nsub1=2
nsub2=20
asel,s,loc,z,Block_z!
加对流条件
asel,a,loc,x,0
asel,a,loc,x,Block_x
asel,a,loc,y,0
asel,a,loc,y,Block_y
nsla
sf,all,conv,-1,24
allsel
dt=3e-2!
定义每次成形所需要的时间
tim=0
!
生死单元控制
!
*DO,I1,1,AEMAX
!
ESEL,S,,,ANEORDER(I1)
!
EKILL,ALL
!
ESEL,S,LIVE
!
EPLOT
!
*enddo
j=aemax!
j小于AEmax
*DO,I1,1,j
nsubst,,,,1
esel,s,,,ANEORDER(I1)
!
EALIVE,ANEORDER(I1-1)
!
ESEL,S,LIVE
EPLOT
!
*ENDIF
esel,all
EPLOT
!
***************体载荷加载*********
tim=tim+dt
time,tim
!
bfe,ANEORDER(I1),hgen,1,
bfe,ANEORDER(I1),hgen,1,*!
T_end=300
!
*************************************
SOLVE
bfedele,ANEORDER(I1),hgen
*ENDDO
/solu
ANTYPE,,rest
bfedele,all,hgen
time,4!
step101开始完全冷却
NSUBST,15,30,5
solve