《计算流体力学一维稳态导热编程作业.docx》由会员分享,可在线阅读,更多相关《计算流体力学一维稳态导热编程作业.docx(6页珍藏版)》请在优知文库上搜索。
1、TheFiniteVolumeMethodforOne-DimensionalDiffusionProblemsLProblemof1-dimensionalSteady-StateSource-freeHeaiConductionConsidertheproblemofsource-freeheatconductioninaninsulatedrodwhoseendsaremaintainedatconstanttemperaturesof100Cand500Crespectively.Theone-dimensionalproblemsketchedintheFigure1isgovern
2、edbyCalculatethesteadystatetemperaturedistributionintherod.Thermalconductivitykequals1000WmK,cross-sectionalareaAis102n2.Fig.1PhysicalModel1网格划分条件L=0.5m,x=/5=O.lw,女=IoOOW/ZK,Ta=100,Tb=500A=W2W22方程离散求解域内共有5个节点,节点2、3、4的离散方程:告“+偿f7;=0G+信-“工+,xPE)VxWP)IxPE)I函由于Z(I=kw=k,BXPe=xwp=x,Ae=Aw=A均为常数,方程:a.JT.=a.
3、rT.r+a.T.工aJoCWP/因此对节点2、3、4有离散5”pSWrVSEE.k.k.式中。卬=AaEAcip=y+aE,QXQX节点1的离散方程:keAe-kwAw与立QXPExAP袅斗FAj7;=Oz+停XxPE)xP)3&可写为:apTp=awTw+aETE+Sltk了LIeAe,。卬0,apa”,十SpxPE(2k、S”-也4,S=AvvTxapIAP同理,节点5的离散方程%Ae生二里-&A,.OXpb(冬Aj&AjO=0Z+aLI瓯PI闲SJ(瓯/可写为:apTp=awTw+aETE+S11k其I4七一0,SAV,ap-aw+aESPxWP=0-ate+(ataI电P)4ZZ2k
4、=0xWP-AJ%+AlZ)所以得到各节点的“w,ciE,op,Sc,SP的值各节点离散方程系数节点、awaSPSUQp=aw+ESp10AaCkA-2Ax29北OXCkA32AavA002rA3Axx002巨4x4Aax-A加002Ax5Ax0-2AxZR”OX3Ax即:节awaSPSUap=aw+aESp10100-2002007;30021001000020031001000020041001000020051000-200200TB300从而得下述代数方程组3007;=1007;+2007;2007;=1007;+1007;2007;=1007;+1007;2007;=1007;+10
5、07;3007;=1007;+2007;写成矩阵形式有:300-100000Tl-200-100200-10000T200-100200-1000q=000-100200-1000000-100300Z.2007;将7;=1007尸500代入,解得此方程组为:3程序C程序内容如下:#includestdafx.h,#include#defineN5intmain()inti;doubleGL,TA,TB,dx,k,Area,Lenth;doubleAWN+1,AEN+1jAPN+1,SPN+1jSUN+1;doubleaN+l,bN+l,cN+l,fN+ljMN+1jLN+1,UN+1jYN+
6、1TN+1;Lenth=0.5;TA=100;长度西边界温度TB=500;东边界温度d=LenthN;k=1000;网格宽度导热系数Area=0.01;截面积第一点计算AW1=0.0;AEl=k*Aread;SPl=-2*k*Areadx;SUl=2*k*Areadx*TA;/最后一点计算AWN=k*Areadx;AEN=0.0;SPN=-2*k*Areadx;SUN=2*k*Areadx*TB;/中间点计算for(i=2ji=N-lji+)AWi=k*Aread;AEi=k*Aread;SPi=0.0;SUi=0.0;计算Apfor(i=l;i=N;i+)APi=AWi+AEi-SPi;三对角方程组追赶法求解for(i=lji=Nji+)ai+l=-AEi;bi=APi;ci=-AWi+l;fi=SUi;)for(i=l;i=N-l;i+)i=ci;Ll=bl;f0r(i=2;i=N;i+)Mi=aiLi-l;Li=bi-Mi*Ui-lj)Yl=fljfor(i=2;i=l;i-)Ti=(Yi-Ui*Ti+l)Li;Printf(,方程组ax=b的解为:n);for(i=l;i=N;i+)printf(T%d=%.3fnji,Ti);return0;