寻高手帮忙把一段de程序改成vb的代码
procedure TForm1.Button1Click(Sender: TObject);
var Q,H:array of array of real;
i,j,k,m,n1,n2:integer;
dh1,dh2,dw,E,E0,rou,QQ0,P0,Tg,L,f1,f2,Te,Dtn,
hh0,dn,dt,c1,c2,dx1,dx2,dQ,
B1,R1,Ad1,Cp,Cm,B2,R2,Ad2:real;
begin
dn:=strtofloat(DnE.Text)/1000; //钻杆内径
dw:=strtofloat(DwE.Text)/1000; //钻杆外径
E:=strtofloat(EE.Text)*1000000000;
E0:=strtofloat(E0E.Text)*1000000000; //钢弹性系数
Rou:=strtofloat(RouE.Text)*1000;
QQ0:=strtofloat(Q0E.Text)/1000;
P0:=strtofloat(P0E.Text)*1000000;
L:=strtofloat(LE.Text);
Tg:=strtofloat(TgE.Text);
f1:=strtofloat(fE.Text)/1000; //粘度
Dtn:=strtofloat(DtnE.Text)/1000;
Te:=strtofloat(TeE.Text)/1000;
// 计算摩阻系数
f2:=16*3.14*f1*(dtn-dw)/(rou*QQ0);
f1:=0.3164*power(3.14*dn*f1/(4*rou*QQ0),0.25);
n1:=100;//钻柱空间段数
hh0:=P0/rou/9.8; //起点压力
c1:=Rou*(1/E+2*dn/E0/(dw-dn));
c1:=sqrt(1/c1);
c2:=Rou*(1/E+Dtn/E0/Te);
c2:=sqrt(1/c2);
//观察?分钟之内的变化
dx1:=L/n1;
dt:=dx1/c1;
n2:=round(n1*c1/c2);
if Frac(n1*c1/c2)>=0.5 then n2:=n2+1;
dx2:=c2*dt;
m:=round((Tg+100)/dt); //时间步长的节点数
Ad1:=3.14*sqr(dn/2);
Ad2:=3.14*sqr(Dtn/2-dw/2);
dh1:=f1/f2*power((Dtn-dw)/dn,3);
dh2:=hh0/(1+dh1)/L; ///// ********************
dh1:=dh2*dh1;
B1:=c1/(9.8*Ad1);
R1:=dh1*dx1/(19.6*dn*sqr(Ad1));
B2:=c2/(9.8*Ad2);
R2:=dh2*dx2/(19.6*(Dtn-dw)*sqr(Ad2));
if tg<=0 then dQ:=0
else dQ:=QQ0/(tg/dt);
setlength(Q,m+1,n1+n2+1);
setlength(H,m+1,n1+n2+1);
//赋初值
for i:=0 to n1+n2 do
begin
Q[0,i]:=QQ0;
if i<=n1 then H[0,i]:=hh0-i*dx1*dh1 //H[0,i]:=hh0+i*(dx1-dh1*dx1)
else H[0,i]:=H[0,n1]-(i-n1)*dx2*dh2;//H[0,i]:=H[0,n1]-(i-n1)*(dh2*dx2+dx2);
if i=n2+n1 then H[0,i]:=0;
end;
//赋边界条件
for j:=1 to m do
begin
if dt*j<Tg then Q[j,0]:=QQ0-j*dQ
else Q[j,0]:=0;
if Q[j,0]<0 then Q[j,0]:=0;
H[j,n1+n2]:=0;
end;
//计算X-t数据点
for j:=1 to m do
begin
for i:=1 to n1+n2-1 do
begin
if i<=n1 then
begin
Cp:=H[j-1,i-1]+B1*Q[j-1,i-1]-R1*abs(Q[j-1,i-1])*(Q[j-1,i-1]);
Cm:=H[j-1,i+1]-B1*Q[j-1,i+1]+R1*abs(Q[j-1,i+1])*(Q[j-1,i-1]);
H[j,i]:=(Cp+Cm)/2;
Q[j,i]:=(Cp-H[j,i])/B1;
if i=1 then H[j,0]:=Cm+B1*Q[j,0]
end else
begin
Cp:=H[j-1,i-1]+B2*Q[j-1,i-1]-R2*abs(Q[j-1,i-1])*(Q[j-1,i-1]);
Cm:=H[j-1,i+1]-B2*Q[j-1,i+1]+R2*abs(Q[j-1,i+1])*(Q[j-1,i-1]);
H[j,i]:=(Cp+Cm)/2;
Q[j,i]:=(Cp-H[j,i])/B2;
if i=n1+n2-1 then Q[j,n1+n2]:=(Cp-H[j,n1+n2])/B2;
end;
end;
end;
//输出结果
for j:=0 to m do
for i:=0 to round(m/80) do
if j/80=i then QhMemo.Lines.Add(floattostr(j*dt)+' '+floattostr((H[j,n1]+L)*9.8*rou/1000000));
end;
end.