/ .

, . 1.

 

. 1.

:

1)   ;

2)   : , , , ;

3)   ;

4)   . , . 2 .

. 2

Tw c:\Tw.txt, , .

1

 

1.

unit Unit08;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart, TeeFunci;

 

const n_y=10;

n_x=4000;

T0_x_0=15;

type

TForm1 = class(TForm)

Label1: TLabel;

Edit1: TEdit;

Button1: TButton;

Chart1: TChart;

Series1: TLineSeries;

TeeFunction1: TLowTeeFunction;

Label2: TLabel;

Button2: TButton;

Label3: TLabel;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

RadioButton3: TRadioButton;

RadioButton4: TRadioButton;

Edit2: TEdit;

Edit3: TEdit;

Label4: TLabel;

Edit4: TEdit;

RadioGroup1: TRadioGroup;

RadioButton5: TRadioButton;

RadioButton6: TRadioButton;

Button3: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure RadioButton2Click(Sender: TObject);

procedure RadioButton1Click(Sender: TObject);

procedure RadioButton3Click(Sender: TObject);

procedure RadioButton4Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

 

private

{ Private declarations }

public

{ Public declarations }

 

end;

type

real=EXTENDED;

mas=array[0..n_x,0..n_y+1] of real;

var

Form1: TForm1;

dx,dy:real;

T, u_m,v_m,delt:mas;

implementation

 

 

 

{$R *.dfm}

 

procedure TForm1.Button1Click(Sender: TObject);

 

var al,bt:mas;

i,j:integer;

dx_old,dy_old,a,b,u,v,s,s1,gm,ksi,v_k,nu,delta,U_sr, u1,u2,u3,u4:real;

{-----------------------------------------------------------}

function f_ksi(x:real):real;

begin

if x=0 then f_ksi:=0

else

f_ksi:=8e-4*exp((1/3)*ln(x));

end;

{-----------------------------------------------------------}

function f_delta(x:real):real;

begin

if v_k=0 then f_delta:=0

else

f_delta:=(nu/v_k)*(f_ksi(x)+(5/36)*f_ksi(x)*f_ksi(x))

end;

{-----------------------------------------------------------}

function f_d_delta(x:real):real;

begin

f_d_delta:=(nu/v_k)*(1+(10/36)*f_ksi(x))*(8e-4/3)*exp((-2/3)*ln(x));

end;

{-----------------------------------------------------------}

function f_d_u_sr(x:real):real;

begin

f_d_u_sr:=((0.01*9.81)/(3*nu))*2*f_ksi(x)*(8e-4/3)*exp((-2/3)*ln(x));

end;

{-----------------------------------------------------------}

function f_b(x,y:real):real;

var a,b, f_d:real;

begin

f_d:=f_delta(x);

{a:=-v_k+f_d_u_sr(x)*f_d-0.75*f_d_delta(x)*U_sr;

b:=f_d_u_sr(x)*f_d*f_d*f_d/2;

b:=b+3*U_sr*(f_d_delta(x)*f_d*f_d/2-f_d*f_d*f_d/3);

f_b:=a/b;}

a:=2*v_k-1.5*f_d*f_d_u_sr(x)+1.5*u_sr*f_d_delta(x);

b:=f_d*f_d*(3*U_sr*f_d_delta(x)+f_d*f_d_U_sr(x));

f_b:=-a/b;

end;

{-----------------------------------------------------------}

function interp(num:integer; a1:real):real;

var j:integer;

begin

j:=1;

while (j<=n_y+1) and (j*dy_old<a1) do

begin

j:=j+1

end;

interp:=a1*(T[num,j+1]-T[num,j])/dy_old-(T[num,j+1]*j*dy_old-T[num,j]*(j+1)*dy_old)/dy_old;

end;

{-----------------------------------------------------------}

function f_u(x,y:real):real;

var f_d:real;

begin

f_d:=f_delta(x);

if f_d=0 then f_u:=0

else

{ f_u:=3*U_sr*(y/f_d-0.5*(y*y)/(f_d*f_d));}

f_u:=3*U_sr*((0.5/f_d-f_b(x,y)*f_d)*y+f_b(x,y)*(y*y));

end;

{-----------------------------------------------------------}

function f_v(x,y:real):real;

var a,b1, f_d:real;

begin

f_d:=f_delta(x);

a:=(0.5/f_d-f_b(x,y)*f_d)*y*y/2;

a:=-(a+f_b(x,y)*y*y*y/3)*3*f_d_U_sr(x);

b1:=(0.5*f_d_delta(x)/(f_d*f_d)+f_b(x,y)*f_d_delta(x))*y*y/2;

b1:=3*U_sr*b1;

f_v:=a+b1;

end;

{===============================================}

 

begin

{Íà÷àëüíûå óñëîâèÿ íà ïðè x=0}

dx:=5e-6{m} ;

v_k:=1e-5; nu:=1e-6

dy:=f_delta(dx)/(n_y+1);{m};

{a:=0.5862}; u:=1;v:=1;

a:=strtofloat(edit3.Text);

dx_old:=dx; dy_old:=dy;

delt[0,0]:=0;

 

for i:=0 to n_y do T[0,i]:=T0_x_0;

{T[i,j+1]-(s+2)T[i,j]+T[i,j-1]=-T[i-1,j]*s}

 

for i:=1 to n_x do

begin

{ksi:=8e-4*exp((1/3)*ln(i*dx));}

{delta:=0.1*(ksi+(5/36)*ksi*ksi);}

{ chart1.Series[0].AddXY(i*dx,Delta,'',clGreen);}

delta:=f_delta(i*dx);

delt[i,0]:=delta;

U_sr:=(0.01*9.81*f_ksi(i*dx)*f_ksi(i*dx))/(3*nu);

dy:=delta/(n_y+1);

{ u1:=f_u((i+1)*dx,2*dy);

u2:=f_u((i-1)*dx,2*dy);

v:=(dy/(2*dx))*(u1-u2);}

u_m[i,1]:=f_u((i)*dx,dy);

v_m[i,1]:=f_v((i)*dx,dy);

v_m[i,n_y+1]:=-v_k;

s:=(dy*dy*f_u(i*dx,dy))/(dx*a);

s1:=(v*dy)/(2*a);

 

{T[i,2]-(s+2)T[i,1]=-(T[i-1,1]*s+T[i,0]}

{T[i,1]=al[i,1]*T[i,2]+bt[i,1]}

{T[i,1]=(1/(2+s))*T[i,2]+(T[i-1,1]*s+T[i,0])/(2+s)}

{al[i,1]=1/(2+s); bt[i,1]=(T[i-1,1]*s+T[i,0])/(2+s)}

al[i,1]:=(1+s1)/(2+s);

{T[i,0]:=100000*dy+T[i-1,1];}

T[i,0]:=-100*dy+interp(i-1,1*dy);

{t[i,1]:=(T[i,0]+s*T[i-1,1])/(2+s);}

bt[i,1]:=(T[i,0]*(1+s1)+s*interp(i-1,1*dy))/(2+s);

for j:=2 to n_y-1 do

begin

u1:=f_u((i+1)*dx,(j+1)*dy);

u2:=f_u((i-1)*dx,(j+1)*dy);

u3:=f_u((i+1)*dx,(j-1)*dy);

u4:=f_u((i-1)*dx,(j-1)*dy);

v:=(dy/(2*dx))*(u1-u2+u3-u4);

v_m[i,j]:=f_v((i)*dx,j*dy);

u_m[i,j]:=f_u((i)*dx,j*dy);

s:=(dy*dy*f_u(i*dx,j*dy))/(dx*a);

s1:=(v*dy)/(2*a);

gm:=-(2+s)+al[i,j-1]*(1+s1);

al[i,j]:=-1/gm;

bt[i,j]:=(-s*interp(i-1,j*dy)-(1+s1)*bt[i,j-1])/gm;

end;

{Ïðàâàÿ ãðàíèöà ïðè j=n_y}

T[i,n_y+1]:=15;

v:=(dy/(2*dx))*(0*f_u((i+1)*dx,(n_y+1)*dy)-0*f_u((i-1)*dx,(n_y+1)*dy)+f_u((i+1)*dx,(n_y-1)*dy)-f_u((i-1)*dx,(n_y-1)*dy));

v_m[i,n_y]:=f_v((i)*dx,(n_y)*dy);

u_m[i,n_y]:=f_u((i)*dx,(n_y)*dy);

s:=(dy*dy*f_u(i*dx,j*dy))/(dx*a);

s1:=(v*dy)/(2*a);

gm:=-(2+s)+(1+s1)*al[i,n_y-1];

bt[i,n_y]:=-(s*T[i-1,n_y]+(s1+1)*bt[i,n_y-1]+T[i,n_y+1])/gm;

T[i,n_y]:=bt[i,n_y];

for j:=n_y-1 downto 1 do T[i,j]:=al[i,j]*T[i,j+1]+bt[i,j];

dy_old:=dy; dx_old:=dx;

end; {Öèêë ïî i}

delt[n_x,0]:=f_delta(n_x*dx);

chart1.Series[0].clear;

label3.Caption:=' ';

for j:=0 to n_y+1 do

begin

{ Series1.AddXY(j*0.29,10*sin(j*0.29),'',clGreen)}

chart1.Series[0].AddXY(j*dy,T[n_x,j],'',clGreen);

end;

end;

 

 

 

 

procedure TForm1.Button2Click(Sender: TObject);

begin

form1.Close;

end;

 

procedure TForm1.RadioButton2Click(Sender: TObject);

var i:integer;

begin

radiobutton2.Checked:=true;

radiobutton1.Checked:=false;

radiobutton3.Checked:=false;

radiobutton4.Checked:=false;

chart1.Series[0].clear;

label3.Caption:=' ';

for i:=1 to n_x do

begin

chart1.Series[0].AddXY(i*dx,delt[i,0],'',clGreen);

end;

end;

 

procedure TForm1.RadioButton1Click(Sender: TObject);

var i:integer;

begin

radiobutton1.Checked:=true;

radiobutton2.Checked:=false;

radiobutton3.Checked:=false;

radiobutton4.Checked:=false;

chart1.Series[0].clear;

label3.Caption:=' ';

for i:=0 to n_y+1 do

begin

chart1.Series[0].AddXY(i*dy,T[n_x,i],'',clGreen);

end;

end;

 

procedure TForm1.RadioButton3Click(Sender: TObject);

begin

radiobutton1.Checked:=false;

radiobutton2.Checked:=false;

radiobutton3.Checked:=true;

radiobutton4.Checked:=false;

end;

 

 

procedure TForm1.RadioButton4Click(Sender: TObject);

var i:integer;

begin

radiobutton1.Checked:=false;

radiobutton2.Checked:=false;

radiobutton3.Checked:=false;

radiobutton4.Checked:=true;

chart1.Series[0].clear;

label3.Caption:=' ';

for i:=0 to n_y+1 do

begin

chart1.Series[0].AddXY(i*dy,v_m[n_x,i],'',clGreen);

end;

end;

 

procedure TForm1.Button3Click(Sender: TObject);

var f:textfile;

i:integer;

begin

assignfile(f,'c:\Tw.txt');

rewrite(f);

for i:=1 to n_x do

writeln(f,floattostr(i*dx)+' '+floattostr(T[i,0])+' '+floattostr(delt[i,0]));

closefile(f);

end;

 

end.