大家好!     请把迭代算法的原理和概念讲一下好吗??给个列子!!!!

解决方案 »

  1.   

    http://www.delphifans.com/SoftView/SoftView_436.html
      

  2.   

    我的一道作业题  迭代计算一维稳态温度场x[1]:=0.0;  x[2]:=0.15; x[3]:=0.2; x[4]:=0.25;
    x[5]:=0.3;  x[6]:=0.37; x[7]:=0.4; x[8]:=0.45;x[9]:=0.5;
     //划分9个结点
    tf1:=1300; tf2:=1450; h1:=240;  h2:=280; //边界条件
    shijian:=60;
    dt:=0;
    urft:=0.38;
    cp:=465.0;
    dens:=7600.0;
    iom:=3;
    tcb1:=0.0;for i:=1 to 3 do
      drxu[i]:=15.8;
    for i:=4 to N do
      drxu[i]:=43.2; //  导热系数for i:=1 to N do
    begin
    t0[i]:=20.0;
    t[i]:=20.0 ;               //起始温度
    end;for i:=2 to N-1 do
       begin
       dx[i]:=0.5*(x[i+1]-x[i-1]);
       dxep[i]:=x[i+1]-x[i];
       dxpw[i]:=x[i]-x[i-1];
       end;
    dxep[1]:=x[2]-x[1];
    dxpw[1]:=-1;
    dxep[N]:=-1;
    dxpw[9]:=x[N]-x[N-1];
    dx[1]:=0.5*(x[2]-x[1]);
    dx[N]:=0.5*(x[N]-x[N-1]);
    repeat
    dt:=dt+1;
    niter:=0;
    repeat
    niter:=niter+1;
    resort:=abs(tcb1-t[iom]);
    tcb1:=t[iom];for i:=1 to N do
       begin
       ae[i]:=drxu[i]/dxep[i];
       aw[i]:=drxu[i]/dxpw[i];
       ap0[i]:=dens*cp*dx[i]/dt;
       ap[i]:=ae[i]+aw[i]+ap0[i];
       sd[i]:=ap0[i]*t0[i];
       end;
    aw[1]:=0.0;
    sd[1]:=tf1*h1+ap0[1]*t0[1];
    ap[1]:=ae[1]+h1+ap0[1];
    ae[N]:=0.0;
    sd[N]:=tf2*h2+ap0[N]*t0[N];
    ap[N]:=aw[N]+h2+ap[N];for i:=1 to N do
      begin
      sd[i]:=sd[i]+((1-urft)*ap[i]/urft)*t[i] ;
      ap[i]:=ap[i]/urft;
      end;for i:=1 to N do
       begin
       a[i]:=ap[i];
       b[i]:=ae[i];
       c[i]:=aw[i];
       d[i]:=sd[i];
       end;
    c[1]:=0.0;
    b[N]:=0.0;
    P[1]:=b[1]/a[1];
    Q[1]:=d[1]/a[1];
    for i:=2 to N do
       begin
       e[i]:=a[i]-c[i]*P[i-1];
       P[i]:=b[i]/e[i];
       Q[i]:=(c[i]*Q[i-1]+d[i])/e[i];
       end;
    t[N]:=Q[N];
    for i:=N-1 downto 1 do
    t[i]:=P[i]*t[i+1]+Q[i];until resort<=1.0e-4;for i:=1 to N do
    t0[i]:=t[i];until dt=shijian;for i:=1 to N do
    richedit1.Text :=richedit1.Text+#10+floattostrf(x[i],fffixed,4,3)+'      '+floattostr(t[i]);
    label6.Caption :='niter='+inttostr(niter)+'  '+'resort='+floattostr(resort);