相变传热与流体流动数值分析作业.doc
文本预览下载声明
相变传热与流体流动数值分析作业6
相变传热与流体流动数值分析
作业6
学 院(系): 能源与动力学院 专 业: 能源与环境工程 学 生 姓 名: 王 佳 琪 学 号: 指 导 教 师: 完 成 日 期:
大连理工大学
Dalian University of Technology
Poiseuille Flow using LBM Subjects Consider the problems of the constant pressure gradient driven constant Poiseuille flow in 2D pipeline using D2Q9 model.
Analytical solution: Simulation conditions: 1.Line width is H = 50, length is L = 200, inlet pressure of 1.01, outlet pressure of 1.0, fluid motion viscosity 1/6. 2. Boundary conditions: the up and down rebound boundary format, or the left and light boundary (no equilibrium extrapolation format or Zou/He boundary)
Solution
The following is the general programs:
// 王佳琪-作业6.cpp : 定义控制台应用程序的入口点。
//
#include stdafx.h
#includelt;stdio.hgt;
#includelt;math.hgt;
#includelt;string.hgt;
#includelt;stdlib.hgt;
#define Q 9
#define NX 100//40
#define NY 20
#define P_in 1.01//1.001
#define P_out 1.0
int e[Q][2]={{0,0},{1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1}}; double w[Q]={4.0/9,1.0/9,1.0/9,1.0/9,1.0/9,1.0/36,1.0/36,1.0/36,1.0/36}; double
p[NX+1][NY+1],u[NX+1][NY+1][2],u0[NX+1][NY+1][2],fp[NX+1][NY+1][Q],Fp[NX+1][NY+1][Q],U[NX+1][NY+1];
int i,j,k,ip,jp,n;//,krever[Q]
double c,dx,dy,dt,rho0,p0,LX,LY,tau_f,niu,error;//dtp
void init();
double fpeq(int k,double p,double u[2]);
void collision();
void boundary();
void streaming();
void macro();
void output (int m);
void Error();
int main()
{
init();
for(i=0;ilt;=NX;i++)
for(j=0;jlt;=NY;j++)
{
U[i][j]=(P_in-P_out)*((LY/2)*(LY/2)-(LY/2-j*LY/NY)*(LY/2-j*LY/NY))/(2*LX*niu);
}
for(n=0; ;n++)
{
collision();
streaming();
macro();
boundary();
if(n%100==0)
{
Error();
printf(The %dth computation result:\n,n);
printf(The u,v of
point(NX/2,NY/2)is:%f,%f\n,u[NX/2][NY/2][0]
显示全部