Code covered by the BSD License  

Highlights from
immiscible LB

immiscible LB



23 Jul 2009 (Updated )

Implements Immiscible Lattice Boltzmann (ILB, D2Q9) method for two phase flows

Nr=int32(Nr); Mc=int32(Mc); 
% Wet locations etc.
[iawet jawet]=find(Channel2D==1); % indices i,j, of active lattice locations i.e. pore
iawet=int32(iawet); jawet=int32( jawet); 
lena=length(iawet); % number of active location i.e. of pore space lattice cells
ija= (jawet-1)*Nr+iawet; % equivalent single absolute index (i,j)->> ija for active locations
ija=int32(ija); %ija=sort(ija,'ascend');
% absolute (single index) position of the obstacles for bounce back in Channel2D
% wet fluid locations in fron of dry obstacles
[iobs jobs]=find(Obstacles);lenobs=length(iobs); 
iobs=int32(iobs); jobs=int32(jobs);
ijobs= (jobs-1)*Nr+iobs; % as above

% Medial axis of the pore space
[ima jma]=find(Medial_axis);lenma=length(ima); 
ima=int32(ima); jma=int32(jma);
ijma= (jma-1)*Nr+ima; % as above

% Internal wet locations : wet & ~obstacles
% (i.e. internal wet lattice location non in contact with dry locations)
[iawint jawint]=find( Channel2D==1 & ~Obstacles ); % indices i,j, of active lattice locations
lenwint=length(iawint); % number of internal (i.e. not border) wet locations
iawint=int32(iawint); jawint=int32(jawint);
ijaint= (jawint-1)*Nr+iawint; % equivalent single index
ijaint=int32(ijaint);% ijaint=sort(ijaint,'ascend');

% dry lattice location in contact with wet locations)
[iPdry jPdry]=find(Perim_dry==1 & Channel2D==0); %?? indices i,j, of active lattice locations
lenPdry=length(iPdry); % number of internal (i.e. not border) wet locations
iPdry=int32(iPdry); jPdry=int32(jPdry); 
ijPdry = (jPdry-1)*Nr+iPdry; % equivalent singl
ijPdry = int32(ijPdry) ;%ijPdry=sort(ijPdry,'ascend');
% total number of elements

jump=rand(1,lena)<=0.3; % for quiver

%all_indeces= bsxfun(@plus,(ija(:)),int32(0:8).*NxM); all_indeces=all_indeces(:);

Contact us