欢迎来到天天文库
浏览记录
ID:60979939
大小:66.00 KB
页数:4页
时间:2021-01-16
《西安交通大学——一维传热铸件凝固数值计算(matlab).doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、clc,clear%初始化,定义各参量和初值n=24;%网格划分dx=1;%网格步长t=10*ones(1,n);t1=10*ones(1,n);%分别存储t与t+dt时刻各点的温度值tc=zeros(1,n);%存储各点累加温度补偿值k=0.00627*ones(1,n);%存储各点导热系数,数值全部初始化为铸型特性,在循环中再更改rou=1.55*ones(1,n);%存储各点密度,数值全部初始化为铸型特性,在循环中再更改cp=0.8987*ones(1,n);%存储各点比热,数值全部初始化为铸型特性,在循环中再更改kw=zeros
2、(1,n);%存储当量导热系数的调和系数1ke=zeros(1,n);%存储当量导热系数的调和系数2m1=zeros(1,n);%存储差分系数1m2=zeros(1,n);%存储差分系数2dt=0.05;%时间步长,单位秒,满足稳定性条件time=0;ddt=50;Ts=660.0;%凝固温度delta_t=398/1.09;%凝固阶段需补偿的温度值%主程序fori=1:24%中间6个点为铝液物性ifi>9&&i<16t(i)=700.0;t1(i)=700.0;k(i)=10.0;cp(i)=1.09;rou(i)=2.38;ende
3、ndtmax=0.0;num=0;%tmax记录最终凝固时间whilet(12)>=Tstmax=tmax+dt;fori=2:23kw(i)=2/(1/k(i)+1/k(i-1));ke(i)=2/(1/k(i)+1/k(i+1));m1(i)=kw(i)*dt/(rou(i)*cp(i)*dx^2);m2(i)=ke(i)*dt/(rou(i)*cp(i)*dx^2);t1(i)=m1(i)*t(i-1)+m2(i)*t(i+1)+(1-m1(i)-m2(i))*t(i);ifi<16&&i>9ift1(i)4、的温度是否低于Tsiftc(i)=timetime=time+ddt;%50s输出一次温度值num=num+1;%记录输出次数tt(num)=t(12);%50s一次记录中心点温度forkk=1:24ttt(kk,num)=t(kk);%5、ttt中第i列表示第i次输出的温度场值endendenddisp('凝固结束时间tmax为:');fprintf('%f',tmax);xlswrite('每50s记录的温度场.xls',ttt);%将记录的温度场输出到excel文件中figure(1);i=1:24;plot(i,t(i),'-*');title('最后凝固时刻的温度场','fontsize',18);xlabel('x','fontsize',18);ylabel('温度/℃','fontsize',18);figure(2);i=1:length(tt);6、plot(ddt*i,tt,'k-p');axis([02200650700]);title('中心点的冷却曲线','fontsize',18);xlabel('时间/s','fontsize',18);ylabel('温度/℃','fontsize',18);时间/s网格点100300500700900110013001500170019002150110.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.00210.0010.0110.3111.6214.4118.5223.49287、.8634.2739.4945.55310.0010.0911.3615.4922.7232.1842.8153.7664.4774.6186.22410.0010.5515.2125.7740.5057.1874.2490.78106.30120.60136.65510.0013.1227.6450.5576.08101.13124.46145.66164.72181.75200.45610.1024.9762.10103.05140.12172.09199.43222.89243.15260.76279.68711.7669.4818、42.41199.43242.47275.85302.49324.30342.53358.03374.38833.83199.44295.43350.48386.60412.52432.16447.7546
4、的温度是否低于Tsiftc(i)=timetime=time+ddt;%50s输出一次温度值num=num+1;%记录输出次数tt(num)=t(12);%50s一次记录中心点温度forkk=1:24ttt(kk,num)=t(kk);%
5、ttt中第i列表示第i次输出的温度场值endendenddisp('凝固结束时间tmax为:');fprintf('%f',tmax);xlswrite('每50s记录的温度场.xls',ttt);%将记录的温度场输出到excel文件中figure(1);i=1:24;plot(i,t(i),'-*');title('最后凝固时刻的温度场','fontsize',18);xlabel('x','fontsize',18);ylabel('温度/℃','fontsize',18);figure(2);i=1:length(tt);
6、plot(ddt*i,tt,'k-p');axis([02200650700]);title('中心点的冷却曲线','fontsize',18);xlabel('时间/s','fontsize',18);ylabel('温度/℃','fontsize',18);时间/s网格点100300500700900110013001500170019002150110.0010.0010.0010.0010.0010.0010.0010.0010.0010.0010.00210.0010.0110.3111.6214.4118.5223.4928
7、.8634.2739.4945.55310.0010.0911.3615.4922.7232.1842.8153.7664.4774.6186.22410.0010.5515.2125.7740.5057.1874.2490.78106.30120.60136.65510.0013.1227.6450.5576.08101.13124.46145.66164.72181.75200.45610.1024.9762.10103.05140.12172.09199.43222.89243.15260.76279.68711.7669.481
8、42.41199.43242.47275.85302.49324.30342.53358.03374.38833.83199.44295.43350.48386.60412.52432.16447.7546
此文档下载收益归作者所有