Qaralayotgan masalani yechishning Pascal dasturi matni
(oshkormassxema)
uses crt;
const mf=102;
type
vector1=array[1..mf] of real;
vector2=array[1..mf,1..mf] of real;
var{dasturdaishlatiladigano’zgaruvchilarnitavsiflash}
i, j, Nx, Ny : integer;
T : vector2;
alfa, beta : vector1;
ai, bi, ci, fi : real;
a, lamda, ro, c : real;
hx, hy, tau, t_end, time : real;
T0, L, H, Th, Tc : real;
f, g : text;
begin
clrscr;
{zaruriykiritiladiganma’lumotlarklabiaturaorqalikiritiladi}
Writeln('Oxo’qbo’yichaplastinkadagi fazoviy tugunlar sonini kiriting, Nx=');
22
Readln(Nx);
Writeln('Oyo’qbo’yichaplastinkadagifazoviytugunlarsoninikiriting, Ny=');
Readln(Ny);
Writeln('Hisobjarayoniningtugashvaqtiqiymatinikiriting, t_end=');
Readln(t_end);
Writeln('Plastinkaning uzunkigini kiriting, L=');
Readln(L);
Writeln('Plastinkaning qalinligini kiriting, H=');
Readln(H);
Writeln('Plastinkamaterialiningissiqliko’tkauvchanlikkoeffisiyentinikiriting,
Lamda=');
Readln(lamda);
Writeln('Plastinkamaterialiningzichliginikiriting, ro=');
Readln(ro);
Writeln('Plastinkamaterialiningissiqliksigiminikiriting, c=');
Readln(c);
Writeln('Hisobsohasiningx = 0 chegarasidagitemperaturanikiriting, Th=');
70
Readln(Th);
Writeln(' Hisobsohasiningx = Lchegarasidagitemperaturanikiriting, Tc=');
Readln(Tc);
Writeln('Boshlang’ichtemperaturanikiriting, T0=');
Readln(T0);
{Turning fazoviykoordinatalarbuyichahisobqadamlarinianiqlaymiz}
hx:=L/(Nx-1);
hy:=H/(Ny-1);
{Issiqlikutkazuvchanlikkoeffisiyentinianiqlaymiz}
a:=lamda/(ro*c);
{ Turningvaqtbuyichahisobqadaminianiqlaymiz}
tau:=t_end/100.0;
23
{Boshlangichvaqtmomentidatemperaturemaydoninianiqlaymiz}
for i:= 1 to Nx do
for j:= 1 to Ny do
T[i,j]:=T0;
{Nostatsionar issiqlikutkazuvchanliktenglamasiniintegrallaymiz}
time:=0;
while time
begin
{vaqtninguzgaruvchisiqiymatiniτqadamgaoshiramiz}
time:=time+tau;
{VaqtningoraliqqatlamidatemperaturamaydoninianiqlashuchunOxuqyunalishidachi
ziqlialgebraiktenglamalarsistemasiniyechamiz}
for j:=1 to Ny do
begin
{Chapchegaraviyshartasosidaboshlangich progonka koeffisiyentlarini aniqlaymiz}
alfa[1]:=0.0;
beta[1]:=Th;
{(4.6)
formulayordamidaprogonkakoeffisiyentlarinianiqlashuchunishlatiladiganparametrli
sikl}
for i:= 2 to Nx-1 do
begin
{ai, bi, ci, fi –
uchdiagonallymatritsalichiziqlialgebraiktenglamalarsistemasinikanonikko’rinishdai
fodalashkoeffisiyentlari}
ai:=lamda/sqr(hx);
bi:=2.0*lamda/sqr(hx)+ro*c/tau;
ci:=lamda/sqr(hx);
fi:=-ro*c*T[i,j]/tau;
{alfa[i], beta[i] – progonka koeffiyentlari}
24
alfa[i]:=ai/(bi-ci*alfa[i-1]);
beta[i]:=(ci*beta[i-1]-fi)/(bi-ci*alfa[i-1]);
end;
{Ungchegaravishshartasosidaungchegaradatemperaturaningqiymatinianiqlash}
T[Nx,j]:=Tc;
{Vaqtningoraliqqatlamidatemperaturamaydonini (4.8)
formuladanfoydalanibaniqlaymiz}
for i:= Nx-1 downto 1 do
T[i,j]:=alfa[i]*T[i+1,j]+beta[i];
end;
{Vaqtningbutunqiymatliqatlamidatemperaturamaydoninianiqlashuchunchiziqlialge
braiktenglamalarsistemasiniOyuqyunalishidayechamiz}
for i:=2 to Nx-1 do
begin
{ q1 = 0 bulgan hol uchun (4.5) formuladan foydalanib, quyi chegaraviy shart
asosida boshlangich progonka koeffisiyentlarini aniqlaymiz}
alfa[1]:=2.0*a*tau/(2.0*a*tau+sqr(hy));
beta[1]:=sqr(hy)*T[i,1]/(2.0*a*tau+sqr(hy));
{(4.6)
formulayordamidaprogonkakoeffisiyentlarinianiqlashuchunishlatiladiganparametrli
sikl}
for j:= 2 to Ny-1 do
begin
{ai, bi, ci, fi –
uchdiagonallymatritsalichiziqlialgebraiktenglamalarsistemasinikanonikko’rinishdai
fodalashkoeffisiyentlari}
ai:=lamda/sqr(hy);
bi:=2.0*lamda/sqr(hy)+ro*c/tau;
ci:=lamda/sqr(hy);
fi:=-ro*c*T[i,j]/tau;
25
{alfa[j], beta[j] – progonka koeffiyentlari}
alfa[j]:=ai/(bi-ci*alfa[j-1]);
beta[j]:=(ci*beta[j-1]-fi)/(bi-ci*alfa[j-1]);
end;
{ q2 = 0 bulganholuchun (4.7) formuladanfoydalanib,
yuqorichegaradatemperaturaningqiymatinianiqlaymiz}
T[i,Ny]:=(2.0*a*tau*beta[Ny-1]+sqr(hy)*T[i,Ny])/(2.0*a*tau
*(1.0-alfa[Ny-1])+sqr(hy));
{Vaqtningoraliqqatlamidatemperaturamaydonini (4.8)
formuladanfoydalanibaniqlaymiz}
for j:= Ny-1 downto 1 do
T[i,j]:=alfa[j]*T[i,j+1]+beta[j];
end;
end; {sharli sikl operatorining tugashi}
{Hisob natijalarini faylga chiqarish}
Assign(f,'res.txt');
Rewrite(f);
Writeln(f,'Plastinkaning uzunligi L = ',L:6:4);
Writeln(f, 'Plastinkaning qalinligi H = ',H:6:4);
Writeln(f,'Oxo’qbo’yichaplastinkadagi fazoviy tugunlar soni Nx = ',Nx);
Writeln(f,'Oyo’qbo’yichaplastinkadagi fazoviy tugunlar soni Ny = ',Ny);
Writeln(f,'Plastinkamaterialiningissiqliko’tkauvchanlikkoeffisiyenti lamda =
',lamda:6:4);
Writeln(f,'Plastinka materialining zichligi ro = ',ro:6:4);
Writeln(f,'Plastinka materialiningissiqlik sigimi’,c:6:4);
Writeln(f,'Boshlangich temperatura T0 = ',T0:6:4);
Writeln(f,'Hisobsohasiningx = 0 chegarasidagitemperatura Th = ',Th:6:4);
Writeln(f,'Hisobsohasiningx = Lchegarasidagitemperatura Tc = ',Tc:6:4);
Writeln(f,'x koordinata buyicha hx qadam bilan hisoblash natijalari hx = ',hx:6:4);
26
Writeln(f,'y - koordinata buyicha hx qadam bilan hisoblab olingan natijalar hy =
',hy:6:4);
Writeln(f,'Natijalar olingan vaqt qadami tau = ',tau:6:4);
Writeln(f,'Berilganvaqtmomentidagi temperatura maydoni t = ',t_end:6:4);
close(f);
Assign(g,'tempr.txt');
Rewrite(g);
for i:=1 to Nx do
for j:=1 to Ny do
writeln(g,' ',hx*(i-1):10:8,' ',hy*(j-1):10:8,' ',T[i,j]:8:5);
close(g);
end.
Hisob natijalarida tadqiqot sohasidagi temperatura taqsimotining ifodalanishi
quyidagi 6-rasmda tasvirlangan.
8-rasm. Tadqiqot sohasi t = 600 c vaqt momentida plastinka yuzida temperatura
taqsimoti (izotermalar).
27
Do'stlaringiz bilan baham: |