资源描述:
《格子玻尔兹曼matlab运用(lbgkdqpoiseuillechanneld)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、%GianniSchenaJuly2005,schena@units.it%LatticeBoltzmannLBE,geometry:D2Q9,model:BGK%ApplicationtopermeabilityinporousmediaRestart=false%torestartfromanearlierconvergencelogical(Restart);ifRestart==false;closeall,clearall%startfromscratchandclean...Restart=false;%ty
2、peofchannelgeometry;%oneoftheflollowingflags==truePois_test=true,%noobstaclesinthe2Dchannel%poroussystemsobs_regolare=false%obs_irregolare=false%tic%IN%
3、vvvv
4、+y%
5、vvvv
6、^%
7、vvvv
8、
9、->+x%OUT%Poresin2D:WetandDrylocations(Wet==1,Dry==0)wXh_Dry=[3,1];wXh_Wet=[3,4];ifobs_r
10、egolare,%withinternalobstaclesA=repmat([zeros(wXh_Dry),ones(wXh_Wet)],[1,3]);A=[A,zeros(wXh_Dry)];B=ones(size(A));C=[A;B];D=repmat(C,4,1);D=[B;D]endifobs_irregolare,%withintobstaclesA1=repmat([zeros(wXh_Dry),ones(wXh_Wet)],[1,3]);A1=[A1,zeros(wXh_Dry)];B=ones(siz
11、e(A1));C1=repmat([ones(wXh_Wet),zeros(wXh_Dry)],[1,3]);C1=[C1,ones(wXh_Dry)];E=[A1;B;C1;B];D=repmat(E,2,1);D=[B;D]endif~Pois_testfigure,imshow(D,[])Channel2D=D;Len_Channel_2D=size(Channel2D,1);%LengthWidth=size(Channel2D,2);%shouldnotbehodChannel_2D_half_Width=Wi
12、dth/2,end%testwithoutobstacles(i.e.2Dchannel&noobstacles)ifPois_test%over-writesthedefinitionoftheporespaceclearChannel2DLen_Channel_2D=36,%lunghezzacanale2dChannel_2D_half_Width=8;Width=Channel_2D_half_Width*2;Channel2D=ones(Len_Channel_2D,Width);%definewetarea%
13、Channel2D(6:12,6:8)=0;%putfluidobstacleimshow(Channel2D,[]);end[NrMc]=size(Channel2D);%NumberrowsandMunbercolumns%porosityporosity=nnz(Channel2D==1)/(Nr*Mc)%FLUIDPROPERTIES%physicalpropertiescs2=1/3;%cP_visco=0.5;%[cP]1CPDinamicwaterviscosity20Cdensity=1.;%fluidd
14、ensityLky_visco=cP_visco/density;%latticekinematicviscosityomega=(Lky_visco/cs2+0.5).^-1;%omega:relaxationfrequency%Lky_visco=cs2*(1/omega-0.5),%latticekinematicviscosity%dPdL=Pressure/dL;%Externalpressuregradient[atm/cm]uy_fin_max=-0.2;%dPdL=abs(2*Lky_visco*uy_f
15、in_max/(Channel_2D_half_Width.^2));dPdL=-0.0125;uy_fin_max=dPdL*(Channel_2D_half_Width.^2)/(2*Lky_visco);%PoiseuilleGradient;%maxpoiseuillefinalvelocityonthefl