1. 1、本文档共11页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
lbm程序

/* This is a standard two dimensional lattice Boltzmann program with periodic boundary conditions that should perform reasonably efficiently. It has been written for teaching purposes by Alexander Wagner at NDSU (March 2003). Extended to simulate the motion of one particle (March 2005). */ #include stdio.h #include stdlib.h #include string.h #include unistd.h /* for the sleep function. this may not be standard */ #include math.h #include mygraph.h #define xdim 31 #define ydim 21 #define DEBUG double f0[xdim][ydim], f1[xdim][ydim],f2[xdim][ydim],f3[xdim][ydim],f4[xdim][ydim], f5[xdim][ydim],f6[xdim][ydim],f7[xdim][ydim],f8[xdim][ydim]; #ifdef DEBUG double b1[xdim][ydim],b3[xdim][ydim],b5[xdim][ydim],b6[xdim][ydim], bb[xdim][ydim]; #endif double omega=1; /* Some constants that appear often and dont need to be calculated over and over again. So we calculate them just once here. */ double fourOnine=4.0/9.0, oneOnine=1.0/9.0, oneOthirtysix=1.0/36.0; /* Some variables for the suspended particle */ typedef double *doublep; typedef doublep pair[2]; pair *Bf1=NULL,*Bf3=NULL,*Bf5=NULL,*Bf6=NULL; int Bf1c,Bf1m=0,Bf3c,Bf3m=0,Bf5c,Bf5m=0,Bf6c,Bf6m=0; double Cx=15,Cy=10,Mx=0,My=0,Zxx=0,Zxy=0,Zyy=0,Ux=0,Uy=0,R=5,M=100; int Repeat=1,iterations=0,FrequencyMeasure=100,Graphics=1; int Pause=1,sstep=0,done=0; double Amp=0.001,Amp2=0.1,Width=10; /* Some special data types that are required to view the graphics */ int Xdim=xdim,Ydim=ydim,noreq; double rho[xdim][ydim]; int rhoreq=0; double u[xdim][ydim][2]; int ureq=0; void BCmem(pair **p, int c, int *cm){ if (c*cm-2) return; *cm+=100; *p=(pair *) realloc(*p,*cm*sizeof(pair)); } void circleBC(){ /* Sets up the links that are cut by a circular object. */ int x,y,Px,Py,Pxp,Pyp,R2; double dx,dy; #ifdef DEBUG for (x=0;xxdim;x++) for (y=0;yydim;y++) b1[x][y]=b3[x][y]=b5[x][y]=b6[x][y]=bb[x][y]=0; #endif Bf1c=Bf3c=Bf5c=Bf6c=0; R2=R*R; for (x=Cx-R-2;xCx+R+2;x++){ Px=(x+xdim)%xdim; Pxp=(x

文档评论(0)

zhuwenmeijiale + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:7065136142000003

1亿VIP精品文档

相关文档