ansys中如何将已经得到的结构刚度矩阵写入txt文件,算例命令流如下
浏览:67072 回答:2
以下是命令流,刚度矩阵数值已经存储在变量smatr中,不知该怎样输出,请高手指点,感激不尽
finish
/clear
/filname,hbfile
/prep7
et,1,beam3
mp,ex,1,2e5
r,1,1e-2,32e-5,0.5
n,1
n,2,0,4
n,3,4,4
n,4,4,0
en,1,2,3
en,2,1,2
en,3,4,3
f,2,fx,5
sfbeam,1,1,pres,10,,,,2,-1
sfbam,2,1,pres,3
/solu
wrfull,1
solve
finish
/aux2
file,hbfile,full
hbmat,hbfile,txt,,ascii,stiff,yes
finish
!以下从hbmat.txt读入数据,并还原为满矩阵存储
*dim,contline,,5
*vread,contline(1),hbfile,txt,,,5,,,1
(5f14.0)
ptrcrd=contline(2)
indcrd=contline(3)
valcrd=contline(4)
rhscrd=contline(5)
*vread,contline(1),hbfile,txt,,,4,,,2
(A3,11X,4F14.0)
nrow=contline(2)
ncol=contline(3)
strline=
contline=
*if,rhscrd,eq,0,then
ls0=4
*else
ls0=5
*endif
*dim,pointr,,ptrcrd
*dim,rowind,,indcrd
*dim,values,,valcrd
*dim,rhsval,,rhscrd
*vread,pointr(1),hbfile,txt,,,ptrcrd,,,ls0
(F14.0)
*vread,rowind(1),hbfile,txt,,,indcrd,,,ls0+ptrcrd
(F14.0)
*vread,values(1),hbfile,txt,,,valcrd,,,ls0+ptrcrd+indcrd
(d25.15)
*vread,rhsval(1),hbfile,txt,,,rhscrd,,,ls0+ptrcrd+indcrd+valcrd
(d25.15)
*dim,smatr,,nrow,ncol
*do,icol,1,ncol
stacol=pointr(icol)
endcol=pointr(ivol+1)
*do,irow,stacol,endcol-1
truerow=rowind(irow)
smatr(truerow,icol)=values(irow)
*enddo
*enddo
*do,irow,1,nrow
*do,icol,1,ncol
smatr(irow,icol)=smatr(icol,irow)
*enddo
*enddo
finish
/clear
/filname,hbfile
/prep7
et,1,beam3
mp,ex,1,2e5
r,1,1e-2,32e-5,0.5
n,1
n,2,0,4
n,3,4,4
n,4,4,0
en,1,2,3
en,2,1,2
en,3,4,3
f,2,fx,5
sfbeam,1,1,pres,10,,,,2,-1
sfbam,2,1,pres,3
/solu
wrfull,1
solve
finish
/aux2
file,hbfile,full
hbmat,hbfile,txt,,ascii,stiff,yes
finish
!以下从hbmat.txt读入数据,并还原为满矩阵存储
*dim,contline,,5
*vread,contline(1),hbfile,txt,,,5,,,1
(5f14.0)
ptrcrd=contline(2)
indcrd=contline(3)
valcrd=contline(4)
rhscrd=contline(5)
*vread,contline(1),hbfile,txt,,,4,,,2
(A3,11X,4F14.0)
nrow=contline(2)
ncol=contline(3)
strline=
contline=
*if,rhscrd,eq,0,then
ls0=4
*else
ls0=5
*endif
*dim,pointr,,ptrcrd
*dim,rowind,,indcrd
*dim,values,,valcrd
*dim,rhsval,,rhscrd
*vread,pointr(1),hbfile,txt,,,ptrcrd,,,ls0
(F14.0)
*vread,rowind(1),hbfile,txt,,,indcrd,,,ls0+ptrcrd
(F14.0)
*vread,values(1),hbfile,txt,,,valcrd,,,ls0+ptrcrd+indcrd
(d25.15)
*vread,rhsval(1),hbfile,txt,,,rhscrd,,,ls0+ptrcrd+indcrd+valcrd
(d25.15)
*dim,smatr,,nrow,ncol
*do,icol,1,ncol
stacol=pointr(icol)
endcol=pointr(ivol+1)
*do,irow,stacol,endcol-1
truerow=rowind(irow)
smatr(truerow,icol)=values(irow)
*enddo
*enddo
*do,irow,1,nrow
*do,icol,1,ncol
smatr(irow,icol)=smatr(icol,irow)
*enddo
*enddo