哈工程传热学数值计算大作业
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
传热学
二维稳态导热问题的数值解法
杨达文2011151419
赵树明2011151427
杨文晓2011151421
吴鸿毅2011151416
第一题:
a=linspace(0,0.6,121);
t1=[60+20*sin(pi*a/0.6)];
t2=repmat(60,[80 121]);
s=[t1;t2]; %构造矩阵
for k=1:10000000 %理论最大迭代次数,想多大就设置多大S=s;
for j=2:120
for i=2:80
S(i,j)=0.25*(S(i-1,j)+S(i+1,j)+S(i,j-1)+S(i,j+1));
end
end
if norm(S-s)<0.0001
break; %如果符合精度要求,提前结束迭代else
s=S;
end
end
S %输出数值解
数值解数据量太大,这里就不打印出来,只画出温度分布。
画出温度分布:
figure(1)
xx=linspace(0,0.6,121);
yy=linspace(0.4,0,81);
[x,y]=meshgrid(xx,yy);
surf(x,y,S)
axis([0 0.6 0 0.4 60 80])
grid on
xlabel('L1')
ylabel('L2')
zlabel('t(温度)')
.60.66666777778L 1
L 2t (温度)
A0=[S(:,61)];
for k=1:81
B1(k)=A0(81-k+1);
end
B1 %x=L1/2时y方向的温度
A1=[S(41,:)] %y=L2/2时x方向的温度
x=0:0.005:0.6;
y=0:0.005:0.4;
A2=60+20*sin(pi*x/0.6)*((exp(pi*0.2/0.6)-exp(-pi*0.2/0.6))/2)/((exp(pi*0.4/0.6)-exp(-pi*0.4/0.6) )/2) %计算y=L2/2时x方向的解析温度
B2=60+20*sin(pi*0.3/0.6)*((exp(pi*y/0.6)-exp(-pi*y/0.6))/2)/((exp(pi*0.4/0.6)-exp(-pi*0.4/0.6))/ 2) %计算x=L1/2时y方向的解析温度
figure(2)
subplot(2,2,1);
plot(x,A1,'g-.',x,A2,'k:x'); %画出x=L1/2时y方向的温度场、画出x=L1/2时y方向的解析温度场曲线
xlabel('L1');ylabel('t温度');
title('y=L2/2');
legend('数值解','解析解');
subplot(2,2,2);
plot(x,A1-A2); %画出具体温度场与解析温度场的差值曲线
xlabel('L1');ylabel('差值');
title('y=L2/2时,比较=数值解-解析解');
subplot(2,2,3);
plot(y,B1,'g-.',y,B2,'k:x'); %画出y=L2/2时x方向的温度场、画出y=L2/2时x方向的解析温度场曲线
xlabel('L2');ylabel('t温度');
title('x=L1/2');
legend('数值解','解析解');
subplot(2,2,4);
plot(y,B1-B2); %画出具体温度场与解析温度场的差值曲线
xlabel('L2');ylabel('差值');
title('x=L1/2时,比较=数值解-解析解');
y=L2/2时x方向的温度:
60 60.1635347276130 60.3269574318083 60.4901561107239 60.6530189159961
60.8154342294146 60.9772907394204 61.1384775173935 61.2988840936779
61.4584005332920 61.6169175112734 61.7743263876045 61.9305192816696
62.0853891461909 62.2388298405943 62.3907362037523 62.5410041260577
62.6895306207746 62.8362138946214 62.9809534175351 63.1236499915702
63.2642058188844 63.4025245687647 63.5385114436490 63.6720732440951
63.8031184326565 63.9315571966177 64.0573015095482 64.1802651916318
64.3003639687311 64.4175155301449 64.5316395850212 64.6426579173846
64.7504944397430 64.8550752452343 64.9563286582797 65.0541852837075
65.1485780543131 65.2394422768254 65.3267156762441 65.4103384385215
65.4902532515567 65.5664053444751 65.6387425251668 65.7072152160571
65.7717764880854 65.8323820928694 65.8889904930310 65.9415628906652
65.9900632539310 66.0344583417471 66.0747177265744 66.1108138152701
66.1427218680003 66.1704200151959 66.1938892725421 66.2131135539900
66.2280796827826 66.2387774004857 66.2451993740203 66.2473412006888
66.2452014111934 66.2387814706441 66.2280857775556 66.2131216608335
66.1938993747528 66.1704320919304 66.1427358942990 66.1108297620857
66.0747355608048 66.0344780262737 65.9900847476605 65.9415861485773
65.8890154662295 65.8324087286383 65.7718047299493 65.7072450038462
65.6387737950858 65.5664380291767 65.4902872802189 65.4103737369294
65.3267521668755 65.2394798789402 65.1486166840471 65.0542248541689
64.9563690796505 64.8551164248743 64.7505362822981 64.6427003248976
64.5316824570463 64.4175587638655 64.3004074590802 64.1803088314159
64.0573451895733 63.9316008058186 63.8031618582281 63.6721163716264
63.5385541572596 63.4025667512431 63.2642473518283 63.1236907555290
62.9809932921539 62.8362527587866 62.6895683527611 62.5410406036774
62.3907713045038 62.2388634418130 62.0854211252013 61.9305495159367
61.7743547548873 61.6169438897778 61.4584248018242 61.2989061317983
61.1384972055701 60.9773079591820 60.8154488635041 60.6530308485230
60.4901652273162 60.3269636197632 60.1635378760476 60
x=L1/2时y方向的温度:
60 60.1308958471008 60.2618814819943 60.3930468323419 60.5244819487850
60.6562770664196 60.7885226663977 60.9213095376979 61.0547288391086
61.1888721614654 61.3238315901874 61.4596997681540 61.5965699589666
61.7345361106384 61.8736929197574 62.0141358961654 62.1559614281981
62.2992668485325 62.4441505006859 62.5907118062120 62.7390513326424
62.8892708622179 63.0414734614594 63.1957635516239 63.3522469800970
63.5110310927684 63.6722248074423 63.8359386883315 64.0022850216885
64.1713778926236 64.3433332631650 64.5182690516120 64.6963052132389
64.8775638224022 65.0621691561100 65.2502477791090 65.4419286305490
65.6373431122839 65.8366251788694 66.0399114293203 66.2473412006888
66.4590566635297 66.6752029193167 66.8959280998773 67.1213834689139
67.3517235256817 67.5871061108928 67.8276925149213 68.0736475883809
68.3251398551535 68.5823416279436 68.8454291264398 69.1145825981625
69.3899864420822 69.6718293350911 69.9603043614169 70.2556091450646
70.5579459853794 70.8675219958221 71.1845492460516 71.5092449074134
71.8418314019312 72.1825365549057 72.5315937512233 72.8892420954831
73.2557265760494 73.6312982331452 74.0162143310978 74.4107385348577
74.8151410909089 75.2296990126956 75.6546962706925 76.0904239872462
76.5371806363247 76.9952722483076 77.4650126199600 77.9467235297321
78.4407349585321 78.9473853161230 79.4670216732992 80