资源描述:
《圣维南方程组程序.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、圣维南方程程序OptionExplicitOptionBase1ConstnsrAsInteger=200Privatect,p,v,dttAsSinglePrivateibAsIntegerPrivateDXX(nsr),CNO(nsr),ZZ(nsr),QQ(nsr),PP(nsr),VV(nsr),SS(nsr),TT(nsr)AsSinglePrivaten,l1,l2,icAsIntegerConstpiAsLong=3.1415926PrivateSubCommand1_Click()DimdeAsLongDimdelayAsLongDimdx,c
2、n,zu,x,zd,xx,yyAsSingleDimmt,dt,i,j,kAsIntegerOpenApp.Path+"resultsz.txt"ForOutputAs#1OpenApp.Path+"resultsq.txt"ForOutputAs#2OpenApp.Path+"inputdata.dat"ForInputAs#3Input#3,dt,ct,cn,nClose#3Fori=1TonDXX(i)=1*1000CNO(i)=cnZZ(i)=4+0.025*(20+1-i)QQ(i)=0Nextimt=60/dtdt=dt*60dtt=2*dt
3、l1=1l2=nic=CInt(Text1.Text)Ific=1Thenib=0zu=4.5ElseIfic=2Thenib=1zu=500Elseib=1EndIfFori=1To149Forj=1Tomtx=i+j/mtzd=4+1.5*Sin(pi*x/12)Ific=1Thenp=zuv=0ElseIfic=2Thenp=zuv=0Elsev=20000000#/dtp=v*ZZ(l1)EndIfCallextern(l1,l2,ib)ZZ(l2)=zdQQ(l2)=p-v*zdDimmt,dt,i,j,kAsInteger;OpenApp.Path
4、+"resu;OpenApp.Path+"resu;OpenApp.Path+"inpu;Input#3,dt,ct,cn,n;Close#3;Fori=1Ton;DXX(i)=1*1000;CNO(i)=cn;ZZ(i)=4+0.025*(20+1-Dimmt,dt,i,j,kAsIntegerOpenApp.Path+"resultsz.txt"ForOutputAs#1OpenApp.Path+"resultsq.txt"ForOutputAs#2OpenApp.Path+"inputdata.dat"ForInputAs#3Input#3,
5、dt,ct,cn,nClose#3Fori=1TonDXX(i)=1*1000CNO(i)=cnZZ(i)=4+0.025*(20+1-i)QQ(i)=0Nextimt=60/dtdt=dt*60dtt=2*dtl1=1l2=nic=CInt(Text1.Text)Ific=1Thenib=0zu=4.5ElseIfic=2Thenib=1zu=500Elseib=1EndIfFori=1To149Forj=1Tomtx=i+j/mtzd=4+1.5*Sin(pi*x/12)Ific=1Thenp=zuv=0ElseIfic=2Thenp=zuv=0Elsev
6、=20000000#/dtp=v*ZZ(l1)EndIfCallextern(l1,l2,ib)ZZ(l2)=zdQQ(l2)=p-v*zdCallback(l1,l2,ib)Fork=1TonPrint#1,ZZ(k),Print#2,QQ(k),NextkPrint#1,Chr(13)+Chr(10);Print#2,Chr(13)+Chr(10);delay=0Forde=1To200000delay=delay+1NextdeNexti;mt=60/dt;dt=dt*60;dtt=2*dt;l1=1;l2=n;ic=CInt(Text1.Text);I
7、fic=1Then;ib=0;zu=4.5;ElseIfic=2Then;ib=1;zu=500;Else;ib=1;EndIf;Fori=1To149;Forj=1Tomt;x=i+j/mt;zd=4+1.5*Sin(pi*x/1Nextimt=60/dtdt=dt*60dtt=2*dtl1=1l2=nic=CInt(Text1.Text)Ific=1Thenib=0zu=4.5ElseIfic=2Thenib=1zu=500Elseib=1EndIfFori=1To149Forj=1Tomtx=i+j/mtzd=4+1.5*Sin(pi*x/12)Ific
8、=1Thenp=zuv=0ElseIf