Qaralayotgan masalani yechishning Pascal dasturi matni
(oshkormassxema)
uses crt;
const mf=102;
R=8.31;
eps=1e-5;
Patm=101325;
type
vector1=array[1..mf] of real;
vector2=array[1..mf,1..mf] of real;
var {dasturda ishlatiladigan uzgaruvchilarni tavsiflash}
i, j, Nx, Ny : integer;
T : vector2;
alfa, beta : vector1;
ai, bi, ci, fi, d, d1 : real;
lamda, ro, c : real;
q, A, qev, P0, M : real;
hx, hy, tau, t_end, time : real;
T0, Te, kapa, L, H : real;
f, g : text;
begin
clrscr;
{klaviatura orqali barcha zaruriy parametrlarning qiymatlarini kiritamiz}
Writeln('Plastinkada x uq buyicha fazoviy tugunlar sonini kiriting, Nx');
Readln(Nx);
Writeln('Plastinkada y uq buyicha fazoviy tugunlar soninikiriting,Ny');
Readln(Ny);
Writeln('Hisob jarayonining tugash vaqtini kiriting, t_end');
29
Readln(t_end);
Writeln('Plastinkaning uzunligini kiriting, L');
Readln(L);
Writeln('Plastinkaning qalinligini kiriting, H');
Readln(H);
Writeln('Plastinka maretialining issiqlik utkazuvchanlik koeffisiyentini
kiriting, lamda');
Readln(lamda);
Writeln('Plastinka materialining zichligini kiriting, ro');
Readln(ro);
Writeln('Plastinka materialining issiqlik sigimini kiriting, c');
Readln(c);
Writeln('Akkomodatsiya koeffisiyentini kiriting, A');
Readln(A);
Writeln('Plastinka chegarasidagi issiqlik oqimi zichligini kiriting, q');
Readln(q);
Writeln('Fazaviy almashinishning issiqlik effektini kiriting, qev');
Readln(qev);
Writeln('Molyar massani kiriting, M');
Readln(M);
Writeln('Eksponensial had oldidagi koeffosiyentni kiriting, P0');
Readln(P0);
Writeln('y=0 chegara uchun issiqlik almashinish koeffisiyentini kiriting,
kapa');
Readln(kapa);
Writeln('y=0 chegaraga nisbatan tashqi muhit temperaturasini kiritin, Te');
Readln(Te);
Writeln('Boshlangich temperaturani kiriting, T0');
Readln(T0);
30
{fazoviy koordinatalar bo‟yicha tur qadamlarini hisoblash}
hx:=L/(Nx-1);
hy:=H/(Ny-1);
{vaqt qadamini hisoblash}
tau:=t_end/1000.0;
{boshlangich vaqt momentida temperaturф maydonini aniqlash}
for i:= 1 to Nx do
for j:= 1 to Ny do
T[i,j]:=T0;
{nostatsionar issiqlik utkazuvchanlik tenglamasini integrallash}
time:=0;
whiletime
begin
{vaqto‟zgaruvchisiniτqadamgaoshiribborish}
time:=time+tau;
{(n+1/2) oraliq vaqt qatlamida Ox uq yunalishida temperature maydonini
aniqlash uchun chiziqli algebraik tenglamalar sistemasini yechish}
for j:=1 to Ny do
begin
{q1=0 holuchun (20) munosabatdan foydalanib chap chegaraviy shartda
temperaturaning qiymati asosida progonka boshlangich koeffisiyentlarini
hisoblash}
alfa[1]:=2.0*tau*lamda/(2.0*tau*lamda+ro*c*sqr(hx));
beta[1]:=ro*c*sqr(hx)*T[1,j]/(2.0*tau*lamda+ro*c*sqr(hx));
{(8) formula bo‟yicha progonka koeffisiyentlarini hisoblash uchun parametrli sikl}
for i:= 2 to Nx-1 do
begin
{ai, bi, ci, fi – kanonik kurinishda ifodalangan chiziqli algebraic tenglamalar
sistemasining uchdiagonalli matritsasi koeffisiyentlari}
31
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 koeffisiyentlari}
alfa[i]:=ai/(bi-ci*alfa[i-1]);
beta[i]:=(ci*beta[i-1]-fi)/(bi-ci*alfa[i-1]);
end;
{q2=0 holuchun (21) munosabatdan foydalanib ung chegaraviy shartda
temperaturaning qiymatini hisoblash}
T[Nx,j]:=(ro*c*sqr(hx)*T[Nx,j]+2.0*tau*lamda*beta[Nx-1])
/(ro*c*sqr(hx)+2.0*tau*lamda*(1-alfa[Nx-1]));
{(7) formuladan foydalanib (n+1/2) oraliq vaqt qatlamida nomalum
temperatura maydoni qiymatlarini aniqlash}
for i:= Nx-1 downto 1 do
T[i,j]:=alfa[i]*T[i+1,j]+beta[i];
end; {(n+1/2) oraliq vaqt qatlamida temperatura maydonini aniqlash}
{(n+1) vaqt qatlamida oy uq buyicha temperature maydonini aniqlashning
chiziqli algebraik tenglamala rsistemasin iyechish}
for i:=1 to Nx do
begin
{(24) formuladan foydalanib, quyi chegaraviy sharta sosida progonka
boshlang‟ich koeffisiyentlarini aniqlash}
alfa[1]:=2.0*tau*lamda/(2.0*tau*(lamda+kapa*hy)+ro*c*sqr(hy));
beta[1]:=(ro*c*sqr(hy)*T[i,1]+2.0*tau*kapa*hy*Te)
/(2.0*tau*(lamda+kapa*hy)+ro*c*sqr(hy));
{progonka koeffisiyentlarini odatdagi progonka formulasi (8) buyicha
aniqlashning sikl parametri}
32
for j:= 2 to Ny-1 do
begin
{ai, bi, ci, fi – chiziqli algebraic tenglamalar sistemasi koeffisiyentlarini
ifodalovchi uchdiagonalli matritsanining kanonik shakli koeffisiyentlari}
ai:=lamda/sqr(hy);
bi:=2.0*lamda/sqr(hy)+ro*c/tau;
ci:=lamda/sqr(hy);
fi:=-ro*c*T[i,j]/tau;
{alfa[j], beta[j] – progonka koeffisiyentlari}
alfa[j]:=ai/(bi-ci*alfa[j-1]);
beta[j]:=(ci*beta[j-1]-fi)/(bi-ci*alfa[j-1]);
end;
{(n+1/2) oraliq vaqt qatlamida yuqori chegarada temperaturaning qiymatini
saqlab qolish}
d:=T[i,Ny];
{chegaradagi nochiziqlilikning tasirida yuqori chegarada temperaturaning
qiymatini iteratsion hisoblashni siklik hisoblash}
repeat
d1:=T[i,Ny];
{Yuqori chegaraviy shartdan foydalanib (55) formulaga kura yuqori
chegaradagi temperaturani aniqlaymiz}
T[i,Ny]:=(ro*c*sqr(hy)*d+2.0*tau*(lamda*beta[Ny-1]+h*q))
/(ro*c*sqr(hy)+2.0*tau*lamda*(1-alfa[Ny-1]))-2.0*tau
*A*hy*qev*(P0*exp(-qev/(R*d1))-Patm)/((ro*c*sqr(hy)
+2.0*tau*lamda*(1-alfa[Ny-1]))*sqrt(2.0*pi*R*d1/M));
untilabs(d1-T[i,Ny])<=eps;
{yuqorichegarada
temperaturaning
qiymati
aniqlandi}
{Progonkaning asosiy formulasi (7) danfoydalanib, (n+1) vaqt qatlamdagi
nomalum temperatura maydonini topamiz}
33
for j:= Ny-1 downto 1 do
T[i,j]:=alfa[j]*T[i,j+1]+beta[j];
end; { (n+1) vaqt qatlamida temperatura maydoni aniqlandi}
end; {Oldindan shartli sikl operatorining tugashi}
{Hisob natijalarini faylga yozish}
Assign(f,'res.txt');
Rewrite(f);
Writeln(f,'Plastinka uzunligiL = ',L:6:4);
Writeln(f,'Plastinka qalinligiH = ',H:6:4);
Writeln(f,'Plastinkada xfazoviy koordinata bo‟yicha tugunlar soni Nx = ', Nx);
Writeln(f,'Plastinkada y fazoviy koordinata bo‟yicha tugunlar soni Ny = ',Ny);
Writeln(f,'Plastinka materialining issiqlik o‟tkazuvchanlik koeffisiyentilamda =
',lamda:6:4);
Writeln(f,'Plastinka materialining zichligiro = ',ro:6:4);
Writeln(f,'Plastinka materialining issiqlik sigimiс = ',c:6:4);
Writeln(f,'Boshlangich temperaturaT0 = ',T0:6:4);
Writeln(f,'Issiqlik almashinishi koeffisiyentikapa = ',kapa:6:4);
Writeln(f,'Tashqi muhitning temperaturasiTe = ',Te:6:4);
Writeln(f,'Akkomaditatsiya koeffisiyentiA = ',A:6:4);
Writeln(f,'Chegarada issiqlik oqimining zichligi q = ',q:6:4);
Writeln(f,'Fazaviy almashinishning issiqlik effekti qev = ',qev:6:4);
Writeln(f,Molyar massaM = ',M:6:4);
Writeln(f,'Eksponensial had oldidagi koeffisiyentP0 = ',P0:6:4);
Writeln(f,'Hisob natijalari x koordinatabo‟yichaquyidagi qadam bo‟yicha olindi hx
= ',hx:6:4);
Writeln(f,'Hisob natijalari ykoordinatabo‟yichaquyidagi qadam bo‟yicha olindi hy
= ', hy:6:4);
Writeln(f,'Hisob natijalari t vaqtbo‟yichaquyidagi qadam bo‟yicha olindi tau = ',
tau:6:4);
34
Writeln(f,'Temperatura maydoni hisoblangan vaqt moment 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]-273):8:5);
close(g);
end.
Masalani yechish natijasida 8-rasmda tasvirlangan temperatura taqsimoti olindi.
8-rasm. Plastinkada t=120 s vaqt momentida temperatura (
)ning taqsimlanishi.
Rasmdan ko‟rinadiki, plastinka bo‟ylab temperatura taqsimoti gorizontal
yo‟nalishda deyarli bir xil, vertikal yo‟nalishda esa eksponensial ko‟rinishda oshib
boradi (9-rasm).
35
Do'stlaringiz bilan baham: |