哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx

上传人:b****2 文档编号:4964782 上传时间:2023-05-04 格式:DOCX 页数:17 大小:186.47KB
下载 相关 举报
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第1页
第1页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第2页
第2页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第3页
第3页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第4页
第4页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第5页
第5页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第6页
第6页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第7页
第7页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第8页
第8页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第9页
第9页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第10页
第10页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第11页
第11页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第12页
第12页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第13页
第13页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第14页
第14页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第15页
第15页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第16页
第16页 / 共17页
哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx_第17页
第17页 / 共17页
亲,该文档总共17页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx

《哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx(17页珍藏版)》请在冰点文库上搜索。

哈工大传热学虚拟仿真实验报告Word文档下载推荐.docx

图2.2二维数值模拟

2.3建立离散方程

此时对于内部节点,如图2.3:

对于平直边界上的节点,如图2.4:

对于外部和内部角点,如图2.5:

图2.3内部节点图2.4平直边界上的节点图2.5内部角点和外部角点

对于对称边界(绝热边界),如图2.6:

图2.6对称边界(绝热边界)图2.7建立离散方程

此时显示格式、隐式格式依次为,如图2.7:

2.4C++程序

2.4.1程序流程图如下图2.8所示

图2.8程序流程图

2.4.2程序各变量含义如下图2.9所示

n_L1,n_L2,n_L3,n_L4,n_thick1,n_thick2分别为对应边的网格数。

2.4.3程序

#include<

math.h>

fstream.h>

intmain()

{

floatL1,L2,L3,L4,thick1,thick2;

/*L1外矩形宽,L2外矩形长,L3内矩形宽,L4内矩形长,thick1宽度方向厚度,thick1长度方向厚度*/

intn_L1,n_L2,n_L3,n_L4,n_thick1,n_thick2;

/*各边网格数*/

inti,j,n,number;

/*n迭代次数*/

doubleeps=5.0e-6;

floatdelt_y1,delt_y2,delt_x1,delt_x2;

floatcond,conv_out,conv_in,tout,tin;

/*cond导热系数conv_out外部对流换热系数conv_in内部对流换热系数tout外部环境温度tin内部环境温度*/

/*输入几何信息*/

printf("

请输入L1:

"

);

scanf("

%f"

&

L1);

请输入L2:

L2);

请输入L3:

L3);

请输入L4:

L4);

/*输入网格信息*/

请输入边L1网格数(<

100):

%d"

n_L1);

请输入边L2网格数(<

n_L2);

请输入边L3网格数(<

n_L3);

请输入边L4网格数(<

n_L4);

/*输入边界条件*/

请输入材料导热系数(W/(m·

K):

cond);

请输入外部环境温度(K):

tout);

请输入内部环境温度(K):

tin);

请输入外部对流换热系数(W/(m2·

conv_out);

请输入内部对流换热系数(W/(m2·

conv_in);

thick1=(L2-L4);

thick2=(L1-L3);

n_thick1=(n_L2-n_L4);

n_thick2=(n_L1-n_L3);

/**************网格大小*********************/

delt_x1=thick1/n_thick1;

delt_x2=L4/n_L4;

delt_y1=thick2/n_thick2;

delt_y2=L3/n_L3;

/*******************************************/

/*节点赋初值*/

doubletem0[100][100];

/*节点温度tem0()上次迭代结果,tem()本次迭代结果*/

doubletem[100][100];

doublex[100][100];

doubley[100][100];

n=0;

do{

/*区域1内部节点温度*/

/*************************************************/

for(i=1;

i<

n_thick1;

i++)

{

for(j=n_L3+1;

j<

n_L1;

j++)

tem0[i][j]=((tem[i+1][j]+tem[i-1][j])*delt_y1*delt_y1+(tem[i][j+1]+tem[i][j-1])*delt_x1*delt_x1)/2.0/(delt_y1*delt_y1+delt_x1*delt_x1);

}

/*************************************************/

/*区域2内部节点温度*/

for(j=1;

n_L3;

tem0[i][j]=((tem[i+1][j]+tem[i-1][j])*delt_y2*delt_y2+(tem[i][j+1]+tem[i][j-1])*delt_x1*delt_x1)/2.0/(delt_x1*delt_x1+delt_y2*delt_y2);

/*区域3内部节点温度*/

for(i=n_thick1+1;

n_L2;

tem0[i][j]=((tem[i+1][j]+tem[i-1][j])*delt_y1*delt_y1+(tem[i][j+1]+tem[i][j-1])*delt_x2*delt_x2)/2.0/(delt_x2*delt_x2+delt_y1*delt_y1);

/*区域1与区域2边界线*/

i++)

j=n_L3;

tem0[i][j]=((tem[i+1][j]+tem[i-1][j])/2.0*(delt_y1+delt_y2)*delt_y1*delt_y2+tem[i][j+1]*delt_y2*delt_x1*delt_x1+tem[i][j-1]*delt_y1*delt_x1*delt_x1)/((delt_y1+delt_y2)*delt_y1*delt_y2+delt_y2*delt_x1*delt_x1+delt_x1*delt_x1*delt_y1);

/*区域1与区域3边界线*/

i=n_thick1;

tem0[i][j]=((tem[i][j+1]+tem[i][j-1])/2.0*(delt_x1+delt_x2)*delt_x1*delt_x2+tem[i-1][j]*delt_x2*delt_y1*delt_y1+tem[i+1][j]*delt_x1*delt_y1*delt_y1)/((delt_x1+delt_x2)*delt_x1*delt_x2+delt_x2*delt_y1*delt_y1+delt_y1*delt_y1*delt_x1);

/*******************边界条件**********************/

/*******************绝热边界条件(对称面)**********************/

/***右边界***/

i=n_L2;

tem0[i][j]=(2.0*tem[i-1][j]*delt_y1*delt_y1+(tem[i][j+1]+tem[i][j-1])*delt_x2*delt_x2)/2.0/(delt_x2*delt_x2+delt_y1*delt_y1);

/***下边界***/

j=0;

tem0[i][j]=((delt_y2*tem[i-1][j]/2/delt_x1)+(delt_x1*tem[i][j+1]/delt_y2)+(delt_y2*tem[i+1][j]/2/delt_x1))/((delt_y2/2/delt_x1)+(delt_x1/delt_y2)+(delt_y2/2/delt_x1));

tem0[i][j]=((delt_y1*tem[i-1][j]/2/delt_x2)+(delt_x2*tem[i][j+1]/delt_y2)+(delt_y2*tem[i+1][j]/2/delt_x2)+(delt_x2*conv_in*tin))/((delt_y2/2/delt_x2)+(delt_x2/delt_y2)+(delt_y2/2/delt_x2)+(delt_x2*conv_in));

/*******************外部对流边界条件**********************/

/***上边界***/

j=n_L1;

tem0[i][j]=(cond*delt_y1*delt_y1*(tem[i-1][j]+tem[i+1][j])+2.0*cond*delt_x1*delt_x1*tem[i][j-1]+2.0*delt_y1*delt_x1*delt_x1*conv_out*tout)/(2.0*cond*delt_y1*delt_y1+2.0*cond*delt_x1*delt_x1+2.0*delt_y1*conv_out*delt_x1*delt_x1);

tem0[i][j]=(cond*delt_y1*delt_y1*(tem[i-1][j]+tem[i+1][j])+2.0*cond*delt_x2*delt_x2*tem[i][j-1]+2.0*delt_y1*delt_x2*delt_x2*conv_out*tout)/(2.0*cond*delt_y1*delt_y1+2.0*cond*delt_x2*delt_x2+2.0*delt_y1*conv_out*delt_x2*delt_x2);

tem0[i][j]=(cond*delt_y1*delt_y1*delt_x2*tem[i-1][j]+cond*delt_y1*delt_y1*delt_x1*tem[i+1][j]+cond*delt_x1*delt_x2*(delt_x1+delt_x2)*tem[i][j-1]+delt_y1*delt_x1*delt_x2*(delt_x1+delt_x2)*conv_out*tout)/(cond*delt_y1*delt_y1*delt_x2+cond*delt_y1*delt_y1*delt_x1+cond*delt_x1*delt_x2*(delt_x1+delt_x2)+delt_y1*conv_out*delt_x1*delt_x2*(delt_x1+delt_x2));

/***左边界***/

i=0;

tem0[i][j]=((cond*delt_x1*tem[i][j+1]/2/delt_y1)+(cond*delt_y1*tem[i+1][j]/delt_x1)+(cond*delt_x1*tem[i][j-1]/2/delt_y1)+(delt_y1*conv_out*tout))/((cond*delt_x1/2/delt_y1)+(cond*delt_y1/delt_x1)+(cond*delt_x1/2/delt_y1)+(delt_y1*conv_out));

tem0[i][j]=((cond*delt_x1*tem[i][j+1]/2/delt_y2)+(cond*delt_y2*tem[i+1][j]/delt_x1)+(cond*delt_x1*tem[i][j-1]/2/delt_y2)+(delt_y2*conv_out*tout))/((cond*delt_x1/2/delt_y2)+(cond*delt_y2/delt_x1)+(cond*delt_x1/2/delt_y2)+(delt_y2*conv_out));

tem0[i][j]=((cond*delt_x1*tem[i][j+1]/2/delt_y1)+(cond*((delt_y1+delt_y2)/2)*tem[i+1][j]/delt_x1)+(cond*delt_x1*tem[i][j-1]/2/delt_y2)+(((delt_y1+delt_y2)/2)*conv_out*tout))/((cond*delt_x1/2/delt_y1)+(cond*((delt_y1+delt_y2)/2)/delt_x1)+(cond*delt_x1/2/delt_y2)+(((delt_y1+delt_y2)/2)*conv_out));

/*******************内部对流边界条件**********************/

tem0[i][j]=(cond*delt_y1*delt_y1*(tem[i-1][j]+tem[i+1][j])+2.0*cond*delt_x2*delt_x2*tem[i][j+1]+2.0*delt_y1*delt_x2*delt_x2*conv_in*tin)/(2.0*cond*delt_y1*delt_y1+2.0*cond*delt_x2*delt_x2+2.0*delt_y1*conv_in*delt_x2*delt_x2);

tem0[i][j]=((cond*delt_x1*tem[i][j+1]/2/delt_y2)+(cond*delt_y2*tem[i-1][j]/delt_x1)+(cond*delt_x1*tem[i][j-1]/2/delt_y2)+(delt_y2*conv_in*tin))/((cond*delt_x1/2/delt_y2)+(cond*delt_y2/delt_x1)+(cond*delt_x1/2/delt_y2)+(delt_y2*conv_in));

/*******************特殊点**********************/

/*******左下角********/

tem0[0][0]=(cond*delt_x1*delt_x1*tem[0][1]+cond*delt_y2*delt_y2*tem[1][0]+delt_y2*delt_y2*delt_x1*conv_out*tout)/(cond*delt_x1*delt_x1+cond*delt_y2*delt_y2+delt_y2*delt_y2*delt_x1*conv_out);

/*******右下角********/

tem0[n_thick1][0]=(cond*delt_x1*delt_x1*tem[n_thick1][1]+cond*delt_y2*delt_y2*tem[n_thick1-1][0]+delt_y2*delt_y2*delt_x1*conv_in*tin)/(cond*delt_x1*delt_x1+cond*delt_y2*delt_y2+delt_y2*delt_y2*delt_x1*conv_in);

/*******左上角********/

tem0[0][n_L1]=(cond*delt_y1*delt_y1*tem[1][n_L1]+cond*delt_x1*delt_x1*tem[0][n_L1-1]+delt_x1*delt_y1*(delt_y1+delt_x1)*conv_out*tout)/(cond*delt_y1*delt_y1+cond*delt_x1*delt_x1+delt_x1*delt_y1*(delt_y1+delt_x1)*conv_out);

/*******右上角1********/

tem0[n_L2][n_L1]=(cond*delt_y1*delt_y1*tem[n_L2-1][n_L1]+cond*delt_x2*delt_x2*tem[n_L2][n_L1-1]+delt_x2*delt_y1*delt_x2*conv_out*tout)/(cond*delt_y1*delt_y1+cond*delt_x2*delt_x2+delt_y1*delt_x2*delt_x2*conv_out);

/*******右上角2********/

tem0[n_L2][n_L3]=(cond*delt_y1*delt_y1*tem[n_L2-1][n_L3]+cond*delt_x2*delt_x2*tem[n_L2][n_L3+1]+delt_x2*delt_y1*delt_x2*conv_in*tin)/(cond*delt_y1*delt_y1+cond*delt_x2*delt_x2+delt_y1*delt_x2*delt_x2*conv_in);

/*******内角点********/

tem0[n_thick1][n_L3]=(cond*(delt_y1+delt_y2)/delt_x1*tem[n_thick1-1][n_L3]+cond*(delt_x1+delt_x2)/delt_y1*tem[n_thick1][n_L3+1]+cond*delt_y1/delt_x2*tem[n_thick1+1][n_L3]+cond*delt_x1/delt_y2*tem[n_thick1][n_L3-1]+(delt_x2+delt_y2)*conv_in*tin)/(cond*(delt_y1+delt_y2)/delt_x1+cond*(delt_x1+delt_x2)/delt_y1+cond*delt_y1/delt_x2+cond*delt_x1/delt_y2+(delt_x2+delt_y2)*conv_in);

/*******************判断是否收敛*********************/

number=0;

for(i=0;

=n_L2;

for(j=0;

=n_L1;

if(fabs(tem0[i][j]-tem[i][j])>

eps)

number++;

tem[i][j]=tem0[i][j];

n++;

if(n%10000==0)printf("

%d\n"

n);

}while(number>

0&

&

n<

1000000);

/*计算各节点坐标*/

for(i=0;

if(i<

=n_thick1&

j<

=n_L3)

x[i][j]=delt_x1*i;

y[i][j]=delt_y2*j;

j>

n_L3)

y[i][j]=delt_y2*n_L3+delt_y1*(j-n_L3);

if(i>

n_thick1&

x[i][j]=n_thick1*delt_x1+delt_x2*(i-n_thick1);

y[i][j]=j*delt_y2;

/*计算各节点坐标结束*/

ofstreamSaveFile("

temperature.dat"

/*输出计算结果*/

SaveFile<

<

"

title=Tempera

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2