结构矩阵源程序.docx

上传人:b****7 文档编号:10468517 上传时间:2023-02-13 格式:DOCX 页数:19 大小:17.29KB
下载 相关 举报
结构矩阵源程序.docx_第1页
第1页 / 共19页
结构矩阵源程序.docx_第2页
第2页 / 共19页
结构矩阵源程序.docx_第3页
第3页 / 共19页
结构矩阵源程序.docx_第4页
第4页 / 共19页
结构矩阵源程序.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

结构矩阵源程序.docx

《结构矩阵源程序.docx》由会员分享,可在线阅读,更多相关《结构矩阵源程序.docx(19页珍藏版)》请在冰豆网上搜索。

结构矩阵源程序.docx

结构矩阵源程序

'========================

'StructuralAnalysisProgramForPlaneFrame

'========================

OptionExplicit

DimnnAsInteger,neAsInteger,ndAsInteger,ndfAsInteger

DimnfAsInteger,npjAsInteger,npeAsInteger,nAsInteger

Dima1(50)AsDouble,t(6,6)AsDouble,x(40)AsDouble,y(40)AsDouble

Dimj1(50)AsInteger,jr(50)AsInteger,ea(50)AsDouble,ei(50)AsDouble

Dimc(6,6)AsDouble,r(120,120)AsDouble,p(120)AsDouble,pe(120)AsDouble

Dimibd(20)AsInteger,ii(6)AsInteger,bd(20)AsDouble,ff(6)AsDouble

Dimmj(20)AsInteger,qj(20,3)AsDouble,f(6)AsDouble,dis(6)AsDouble

Dimmf(30)AsInteger,ind(30)AsInteger,aq(30)AsDouble,bq(30)AsDouble

Dimq1(30)AsDouble,q2(30)AsDouble

'========================

'MainProgram

'========================

Subframe()

Open"D:

\mydata\fr.txt"ForInputAs#1

Open"D:

\mydata\fw.txt"ForOutputAs#2

Callinput1

Callwstiff

Callload

Callbound

Callgauss

Callnqm

Close1

Close2

EndSub

'========================

'SUB-1ReadandPrintInitialData

'========================

Subinput1()

DimintiAsInteger,intjAsInteger,iAsInteger,jAsInteger,kAsInteger

Dimdx,dyAsDouble

Print#2,"planeframestructuralanalysis"

Print#2,"********************************"

Print#2,"InputData"

Print#2,"====="

Print#2,

Print#2,"StructuralControlData"

Print#2,"_______________________"

Print#2,"nn";Spc(3);"ne";Spc(3);"nf";Spc(3);"nd";Spc(3);"ndf";Spc

(2);"npj";Spc

(2);"npe";Spc(3);"n"

Input#1,nn,ne,nf,nd,ndf,npj,npe

n=3*(nn-nf)

Print#2,nn;Spc

(2);ne;Spc

(2);nf;Spc

(2);nd;Spc

(2);ndf;Spc

(2);npj;Spc

(2);npe;Spc

(2);n

Print#2,

Print#2,"NodalCoordinates"

Print#2,"____________________"

Print#2,"Node";Spc

(2);"x";Spc(5);"y"

i=nn

Forinti=1Toi

Input#1,inti,x(inti),y(inti)

Print#2,inti;Spc

(2);x(inti);Spc(3);y(inti)

Nextinti

Print#2,

Print#2,"ElementInformation"

Print#2,"_____________________"

Print#2,"Ele.No.";Spc

(2);"j1";Spc

(2);"jr";Spc(5);"ea";Spc(7);"ei";Spc(5);"a1"

i=ne

Forinti=1Toi

Input#1,inti,j1(inti),jr(inti),ea(inti),ei(inti)

Nextinti

Forinti=1Toi

Ifj1(inti)>=jr(inti)ThenStop

Nextinti

Forinti=1Toi

j=j1(inti)

k=jr(inti)

dx=x(k)-x(j)

dy=y(k)-y(j)

a1(inti)=Sqr(dx*dx+dy*dy)

Print#2,Spc(3);inti;Spc(4);j1(inti);Spc(3);jr(inti);Spc

(2);ea(inti);Spc

(2);ei(inti);Spc

(2);a1(inti)

Nextinti

Print#2,

k=npj

Ifk<>0Then

Print#2,"NodalLoad"

Print#2,"____________"

Print#2,"i";Spc(3);"mj";Spc

(2);"xd";Spc

(2);"yd";Spc

(2);"md"

Forinti=1Tok

Input#1,inti,mj(inti),qj(inti,1),qj(inti,2),qj(inti,3)

Print#2,inti;Spc

(2);mj(inti);Spc

(2);qj(inti,1);Spc

(2);qj(inti,2);Spc

(2);qj(inti,3)

Nextinti

EndIf

Print#2,

i=npe

Ifi<>0Then

Print#2,"ElementLoads"

Print#2,"________________"

Print#2,"i";Spc(3);"mf";Spc

(2);"ind";Spc

(2);"aq";Spc

(2);"bq";Spc

(2);"q1";Spc(3);"q2"

Forinti=1Toi

Input#1,inti,mf(inti),ind(inti),aq(inti),bq(inti),q1(inti),q2(inti)

Print#2,inti;Spc

(2);mf(inti);Spc(3);ind(inti);Spc

(2);aq(inti);Spc

(2);bq(inti);Spc

(2);q1(inti);Spc

(2);q2(inti)

Nextinti

EndIf

Print#2,

j=ndf

Ifj<>0Then

Print#2,"BoundaryConditions"

Print#2,"___________________"

Print#2,"i";Spc(3);"ibd";Spc(3);"bd"

Forinti=1Toj

Input#1,inti,ibd(inti),bd(inti)

Print#2,inti;Spc(3);ibd(inti);Spc(3);bd(inti)

Nextinti

EndIf

EndSub

'========================

'SUB-2AssembleSturcturalStiffnessMatrix{R}

'========================

Subwstiff()

DimiAsInteger,jAsInteger,ieAsInteger,k1AsInteger,k2AsInteger

Fori=1Ton

Forj=1Ton

r(i,j)=0

Nextj

Nexti

ie=1

DoWhileie<=ne

Callstiff(ie)

Calllocat(ie)

Fork1=1To6

i=ii(k1)

Ifi<=nThen

Fork2=k1To6

j=ii(k2)

Ifj<=nThen

r(i,j)=r(i,j)+c(k1,k2)

EndIf

Nextk2

EndIf

Nextk1

ie=ie+1

Loop

Fori=2Ton

Forj=1To(i-1)

r(i,j)=r(j,i)

Nextj

Nexti

EndSub

'========================

'Sub-3SetUpStiffnessMatrix[C](GlobalCoordinatSystem)

'========================

Substiff(ie)

DimiAsInteger,jAsInteger

DimcxAsDouble,cyAsDouble,b1AsDouble,b2AsDouble,b3AsDouble,b4AsDouble

Dims1AsDouble,s2AsDouble,s3AsDouble,s4AsDouble,s5AsDouble,s6AsDouble

i=j1(ie)

j=jr(ie)

cx=(x(j)-x(i))/a1(ie)

cy=(y(j)-y(i))/a1(ie)

b1=ea(ie)/a1(ie)

b2=12#*ei(ie)/a1(ie)^3

b3=6#*ei(ie)/a1(ie)^2

b4=2#*ei(ie)/a1(ie)

s1=b1*cx^2+b2*cy^2

s2=(b1-b2)*cx*cy

s3=b3*cy

s4=b1*cy^2+b2*cx^2

s5=b3*cx

s6=b4

c(1,1)=s1

c(1,2)=s2

c(1,3)=s3

c(1,4)=-s1

c(1,5)=-s2

c(1,6)=s3

c(2,2)=s4

c(2,3)=-s5

c(2,4)=-s2

c(2,5)=-s4

c(2,6)=-s5

c(3,3)=2#*s6

c(3,4)=-s3

c(3,5)=s5

c(3,6)=s6

c(4,4)=s1

c(4,5)=s2

c(4,6)=-s3

c(5,5)=s4

c(5,6)=s5

c(6,6)=2#*s6

Fori=2To6

Forj=1To(i-1)

c(i,j)=c(j,i)

Nextj

Nexti

EndSub

'====================

'SUB-4SetUpElementLocationVector{II}

'====================

Sublocat(ie)

DimiAsInteger,jAsInteger

i=j1(ie)

j=jr(ie)

ii

(1)=3*i-2

ii

(2)=3*i-1

ii(3)=3*i

ii(4)=3*j-2

ii(5)=3*j-1

ii(6)=3*j

EndSub

'====================

'SUB-5SetUptotalnodalVector{p}

'====================

Subload()

DimiAsInteger,jAsInteger,kAsInteger

i=1

DoWhilei<=n

p(i)=0#

i=i+1

Loop

Ifnpj>0Then

Fori=1Tonpj

k=mj(i)

p(3*k-2)=qj(i,1)

p(3*k-1)=qj(i,2)

p(3*k)=qj(i,3)

Nexti

EndIf

Ifnpe<>0Then

Calleload

i=1

DoWhilei<=n

p(i)=p(i)+pe(i)

i=i+1

Loop

EndIf

EndSub

'====================

'SUB-6SetUpelementeffectiveload

'====================

Subeload()

DimiAsInteger,jAsInteger,kAsInteger,k1AsInteger,k2AsInteger,k3AsInteger

i=1

DoWhilei<=n

pe(i)=0#

i=i+1

Loop

j=1

DoWhilej<=npe

k=mf(j)

Calltrans(k)

Calllocat(k)

Callefix(j)

Fork1=1To6

f(k1)=0#

Fork2=1To6

f(k1)=f(k1)+t(k2,k1)*ff(k2)

Nextk2

Nextk1

Fork3=1To6

i=ii(k3)

Ifi<=nThen

pe(i)=pe(i)-f(k3)

EndIf

Nextk3

j=j+1

Loop

EndSub

'====================

'SUB-7SetUpfixed-endforceofelement

'====================

Subefix(i)

DimjAsInteger,kAsInteger

Dims1AsDouble,aAsDouble,bAsDouble,p1AsDouble,p2AsDouble

Dimb1AsDouble,b2AsDouble,b3AsDouble,c1AsDouble,c2AsDouble,c3AsDouble

Dimd1AsDouble,d2AsDouble

Forj=1To6

ff(j)=0#

Nextj

k=mf(i)

s1=a1(k)

a=aq(i)

b=bq(i)

p1=q1(i)

p2=q2(i)

b1=s1-(a+b)/2#

b2=b-a

b3=(a+b)/2#

c1=s1-(2#*b+a)/3#

c2=b2

c3=(2#*b+a)/3#

d1=b^3-a^3

d2=b*b-a*a

SelectCaseind(i)

Case1

ff

(2)=-p1*(s1-a)^2*(1#+2#*a/s1)/s1^2

ff(3)=p1*a*(s1-a)^2/s1^2

ff(5)=-p1-ff

(2)

ff(6)=-p1*a^2*(s1-a)/s1^2

Case2

ff

(2)=-p1*b2*(12#*b1^2*s1-8#*b1^3+b2^2*s1-2#*b1*b2^2)/(4#*s1^3)

ff(3)=p1*b2*(12#*b3*b1^2-3*b1*b2^2+b2^2*s1)/12#/s1^2

ff(5)=-p1*b2-ff

(2)

ff(6)=-p1*b2*(12#*b3^2*b1+3#*b1*b2^2-2#*b2^2*s1)/12#/s1^2

Case3

ff

(2)=-p2*c2*(18*c1^2*s1-12*c1^3+c2^2*s1-2*c1*c2^2-4*c2^3/45)/12/s1^3

ff(3)=p2*c2*(18#*c3*c1^2-3#*c1*c2^2+c2^2*s1-2#*c2^3/15#)/36#/s1^2

ff(5)=-0.5*p2*c2-ff

(2)

ff(6)=-p2*c2*(18#*c3^2*c1+3*c1*c2^2-2*c2^2*s1+2*c2^3/15#)/36#/s1^2

Case4

ff

(2)=-6#*p1*a*(s1-a)/s1^3

ff(3)=p1*(s1-a)*(3#*a-s1)/s1^2

ff(5)=-ff

(2)

ff(6)=p1*a*(2#*s1-3#*a)/s1^2

Case5

ff

(2)=-p1*(3#*s1*d2-2#*d1)/s1^3

ff(3)=p1*(2#*d2+(b-a)*s1-d1/s1)/s1

ff(5)=-ff

(2)

ff(6)=p1*(d2-d1/s1)/s1

Case6

ff

(1)=-p1*(1#-a/s1)

ff(4)=-p1*a/s1

Case7

ff

(1)=-p1*(b-a)*(1#-(b+a)/(2#*s1))

ff(4)=-p1*d2/2#/s1

Case8

ff(3)=-a*(p1-p2)*ei(k)/b

ff(6)=-ff(3)

EndSelect

EndSub

'=========================

'SUB-8SetUpCoordinateTransferMatrix[T]

'=========================

Subtrans(ie)

DimiAsInteger,jAsInteger

DimcxAsDouble,cyAsDouble

i=j1(ie)

j=jr(ie)

cx=(x(j)-x(i))/a1(ie)

cy=(y(j)-y(i))/a1(ie)

Fori=1To6

Forj=1To6

t(i,j)=0#

Nextj

Nexti

Fori=1To4Step3

t(i,i)=cx

t(i,i+1)=cy

t(i+1,i)=-cy

t(i+1,i+1)=cx

t(i+2,i+2)=1#

Nexti

EndSub

'=========================

'SUB-9IntroduceSupportConditions

'=========================

Subbound()

DimiAsInteger,jAsInteger,kAsInteger

DimaAsDouble

Ifndf<>0Then

Forj=1Tondf

a=1E+20

Fori=1Tondf

k=ibd(i)

r(k,k)=a

p(k)=a*bd(i)

Nexti

Nextj

EndIf

EndSub

'===

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 管理学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1