Code covered by the BSD License  

Highlights from
immiscible LB

immiscible LB

by

 

23 Jul 2009 (Updated )

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

Select_Colour_Redistribution_Method_2010e.m
% same code as above but in vectorial fashion usind abosolute

if  strcmp(Refill_method,'Keller'),  % VECTORIAL CODE
    %tC2=C2(:,1:8);
    new_order = repmat(int32(0),lenag,9); %
    
    if(0)
        [x, new_order] = sort(Grad_List,2,'descend'); % use 2009b
        new_order = int32(new_order);
        new_order = [new_order(:,1:4), repmat(int32(9),lenag,1) , new_order(:,5:8)]; % RP=9 ... link prioritization !
    else % breaking sort in two parts ( positiva values & neg. values)
        
        G_listma0 = zeros(lenag,4,'single') ; %G_listmi0 = zeros(lenag,4,'single');
        ima0m=zeros(lenag,4,'int32') ;% imi0m=zeros(lenag,4,'int32') ;
        zetre=int32([0,1,2,3]).*lenag;
        
        indicx1=repmat(zetre,lenag,1)+int32(repmat((1:lenag)',1,4));
        
        
        bima0=logical(Grad_List>=0.001);
        ima0m = int32(findfirst(bima0,2,4));

        indicx2=(ima0m(:,:)-ones(lenag,4,'int32')).*lenag+repmat((1:lenag)',1,4);
        
        G_listma0(indicx1(:))= single(Grad_List( indicx2(:)));
        [x,isma] = sort(G_listma0,2,'descend');
        
        isma=int32(isma);
        
        indicx3=(isma-ones(lenag,4,'int32')).*lenag+repmat((1:lenag)',1,4);
        ima0m(indicx1(:))=ima0m(indicx3);
        
        imi0m = ic_op( fliplr(ima0m) ) ;
        
        new_order=[ima0m, repmat(int32(9),lenag,1) ,imi0m];
        
    end
    
    %new_order = repmat(double(ijagr(:)),1,9) + double(NxM)*(new_order-1); % 9 elements vector
    new_order = repmat(ijagr(:),1,9) + NxM.*(int32(new_order-1)); % 9 elements  su ogni riga
    %%
    %Colour_refill_vector_based; % sequential fast m code ( as today)
    %Colour_refill_parfor; % slow m code
    %Colour_refill_vector_based_Luigino; % seq medium speed m code
    %Colour_refill_parfor_4; % new but still slow m code
    %Colour_refill_parfor_41; % new but still slow m code
    Colour_refill_all_at_once;
end % END VECTORIAL SECTION

if strcmp(Refill_method,'Latvo_Kakko') % LATVA KOKKO IMPROVED METHOD Physical Review E 72 2005
    Latva_Kokko_Colour_Redistribution_Vet;
end

Contact us