油藏数值模拟程序设计报告班级:油工12-3班姓名:孙雷学号:1202011403121程序一:1、程序内容12345110003121008013101500141240001529xxxxx2、程序框图求解三对角方程组开始输入a,b,c,d值输入主对角线个数令11111111,,bduylaaa计算iiii-1iiii-1iiii,,bdcylacuuyll令nnxyiiii+1xyux输出nx值结束图1程序一程序框图i=2,3…ni=n-1,n-2,…,123、程序代码PrivateSubCommand1_Click()n=InputBox(输入主对角线个数)Dima(),b(),c(),d()Diml(),y(),u(),x()ReDima(n),d(n),b(n-1),c(n)Fori=1Tona(i)=Text1(i-1).Textd(i)=Text4(i-1).TextNextiFori=1Ton-1b(i)=Text2(i-1).TextNextiFori=2Tonc(i)=Text3(i-2).TextNextiReDiml(n),y(n),u(n)l(1)=a(1)y(1)=d(1)/a(1)u(1)=b(1)/a(1)Fori=2Ton-1l(i)=a(i)-c(i)*u(i-1)u(i)=b(i)/l(i)y(i)=(d(i)-c(i)*y(i-1))/l(i)Nextil(n)=a(n)-c(n)*u(n-1)y(n)=(d(n)-c(n)*y(n-1))/l(n)ReDimx(n)x(n)=y(n)Fori=n-1To1Step-1x(i)=y(i)-u(i)*x(i+1)NextiFori=1TonPicture1.Printx(;i;)=;Format(x(i),0)Nexti3EndSub4、计算结果图2程序一运行界面程序运行结果为:123451,2,3,4,5xxxxx4程序二:1、程序内容已知一维均质等厚单相渗流,已知边界条件定压、初始压力分布,求任意时刻的压力分布,渗流微分方程为:24122),(5),0()0(10)0,()0(22LtxtLptpLxxpLxtpxp,,取2、程序框图开始输入已知的三个边界条件输入,xL值0t输入maxt和tttt系数矩阵和右端项利用追赶法求解压力方程组打印,tpmaxtt结束是图3程序二程序框图53、程序代码Dima(),b(),c(),d()Diml(),y(),u(),x()DimnSubjs()ReDima(n),d(n),b(n-1),c(n)Fori=1Tona(i)=Text1(i-1).Textd(i)=Text4(i-1).TextNextiFori=1Ton-1b(i)=Text2(i-1).TextNextiFori=2Tonc(i)=Text3(i-2).TextNextiReDiml(n),y(n),u(n)l(1)=a(1)y(1)=d(1)/a(1)u(1)=b(1)/a(1)Fori=2Ton-1l(i)=a(i)-c(i)*u(i-1)u(i)=b(i)/l(i)y(i)=(d(i)-c(i)*y(i-1))/l(i)Nextil(n)=a(n)-c(n)*u(n-1)y(n)=(d(n)-c(n)*y(n-1))/l(n)ReDimx(n)x(n)=y(n)Fori=n-1To1Step-1x(i)=y(i)-u(i)*x(i+1)NextiEndSubPrivateSubCommand1_Click()Text5=6DimdetDimchushi()n=Text9/Text10det=Text7/Text10^2Fori=0Ton-2Text3(i)=detText2(i)=detNextiFori=0Ton-1Text1(i)=-(1+2*det)NextiReDimchushi(n)Fori=1Tonchushi(i)=Text11Nextitmax=Val(Text8)dt=Val(Text7)t=0t=t+dtWhile(ttmax)Text4(0)=-chushi(1)-Text12*detFori=1Ton-2Text4(i)=-chushi(i)NextiText4(n-1)=-chushi(n)-Text13*detCalljsFori=1Tonchushi(i)=x(i)NextiText5=Text5&t=&t&vbCrLfFori=1TonText5=Text5&x(&i&)=&Format(x(i),0.00)&vbCrLfNextit=t+dtWend7EndSub4、计算结果图4程序二运行界面本次计算得出十五个时刻的压力分布,具体结果如下表表一程序二计算结果时间p1p2p3p418.629.499.337.8327.658.348.466.5336.937.417.435.6246.396.726.634.9756.006.206.034.4965.705.825.594.1475.495.545.273.8985.335.335.033.7095.215.184.853.56105.125.064.723.46115.054.984.623.39125.014.924.553.33134.974.874.503.298144.944.844.463.26154.934.814.433.24程序三:1、程序内容设某油藏由5×4的排列组成,边界压力为常数,x,y步长为2,微分方程如下:令tCK,若=2,求第一个时间段时压力分布。2、程序框图22PPcPxyKt222()x开始数据准备输入,xt值计算记录k1,1p计算(k+1)()()()ni,ji,j-1i-1,ji,j+1i,j1()4kkkppppp(k+1)(k)1,11,1||0.00001pp结束是图5程序三程序框图93、程序代码Constm=4Constn=3ReDimp(m,n)ReDimcu(m,n),chu(m,n)Fori=0Tomp(i,0)=Val(Text1(i).Text)p(i,1)=Val(Text2(i).Text)p(i,2)=Val(Text3(i).Text)p(i,3)=Val(Text4(i).Text)NextiFori=0TomForj=0Toncu(i,j)=p(i,j)'p的上一次值chu(i,j)=p(i,j)'p的初值NextjNextiyi=p(1,1)Fori=1Tom-1Forj=1Ton-1p(i,j)=(cu(i,j-1)+cu(i-1,j)+cu(i+1,j)+cu(i,j+1)+aef*chu(i,j))/(4+aef)NextjNextiFori=1Tom-1Forj=1Ton-1cu(i,j)=p(i,j)NextjNextiWhile(Abs(yi-p(1,1))0.00001)yi=p(1,1)Fori=1Tom-1Forj=1Ton-1p(i,j)=(cu(i,j-1)+cu(i-1,j)+cu(i+1,j)+cu(i,j+1)+aef*chu(i,j))/(4+aef)NextjNextiFori=1Tom-1Forj=1Ton-110cu(i,j)=p(i,j)NextjNextiWendFori=1Tom-1Forj=1Ton-1Text8.Text=Text8&p(&i&,&j&)=&Format(p(i,j),0.000)&vbCrLfNextjNextiEndSub4、计算结果图6程序三运行界面11实验三的运行结果如下表所示:表二程序三运行结果j=3543j=2106.5895.0873.8462j=1107.4466.0874.9894j=0876i=0i=1i=2i=3i=4