• No results found

Supporting Information

N/A
N/A
Protected

Academic year: 2021

Share "Supporting Information"

Copied!
18
0
0

Loading.... (view fulltext now)

Full text

(1)

Supporting Information

Numerical Simulation of Jumping-Droplet Condensation

Patrick Birbarah

1

, Shreyas Chavan

1

, and Nenad Miljkovic

1,2,3,4,*

1

Department of Mechanical Science and Engineering, University of Illinois, Urbana, Illinois

61801, USA

2

Department of Electrical and Computer Engineering, University of Illinois, Urbana, IL,

61801, USA

3

Materials Research Laboratory, University of Illinois, Urbana, Illinois 61801, USA

4

International Institute for Carbon Neutral Energy Research (WPI-I2CNER), Kyushu

University, 744 Moto-oka, Nishi-ku, Fukuoka 819-0395, Japan

* Corresponding Author E-mail: [email protected]

Address: 105 S. Mathews Avenue, Mechanical Engineering Laboratory, Room 2136, Urbana, IL

61801, USA

(2)

S.1 VIDEOS

Video S1.

3D simulation of jumping droplet condensation on a superhydrophobic surface. The

condensing surface is 50

μm

x 50

μm

in face area, with a nucleation site density of 4x10

6

droplets/cm

2

and 100 sites simulated. Surface temperature is fixed at 15°C with a vapor saturation

temperature of 25°C. The hydrophobic coating thickness is 1

μm.

Droplet jumping is achieved by

coalescing with one or multiple neighboring droplets. The size of the image is 1920x1080 pixels

and the video is played at 30 frames per seconds, 50X slower than the actual simulation. Droplet

mismatch was not considered in this video and all coalescing droplets, assuming they were in the

correct size range, jumped and were removed from the simulation domain.

Video S2.

Droplet Mismatch video. The same simulation as video S1 is repeated with an added

constraint for droplet jumping considering the size mismatch between droplets (see Figure 17 of

manuscript).

(3)

S.2 MATLAB CODES

1) “Main_jump.m”.

This is the main file for running the simulation. Inputs such as number of

nucleation sites, size of condensing area and other are included in the beginning of the code. The

code is written for running parallel cells.

2) “cell_initialize.m”.

This function is for initialization of cell parameters.

3) “cell_coalescence_jump.m”.

This function takes care of droplet coalescence within each cell.

4) “Merging_clusters.m”.

This function takes care of the droplet coalescences happening in

between cells.

5) “GrowthAndNucleation.m”.

This function is responsible for the droplet growth and

nucleation in free nucleation sites.

(4)

S.3 MATLAB CODE PDF

The entirety of the Matlab codes are provided here for ease of access. The six code files

presented in section S.2 are incorporated in this section.

Main_jump.m

%%

clc; clear all

close all

disp('starting parallel pool');tic

poolobj = gcp('nocreate');%deleting parallel pool

delete(poolobj); parpool(32) toc

%%

clc;clear all;close all;tic

% disp('initializing variables and cells');

%========================================================================== %Parameters

max_jumps = 10000; N0 =1000;

L = 0.1;%mm

mismatch = 0.1711;%mismatch parameter for cluster of droplets: avg/std

PA=50;%percentage of average to consider for jumping

% mismatch = 100;%mismatch parameter for cluster of droplets: avg/std % PA=0;%percentage of average to consider for jumping

repeat = 1;%repeat for repeatibility and error analysis

plotting=0;

%==========================================================================

CA = 175; %[degrees] contact angle%[cm] side length

NEW=1; %if new simulation vs continuing a simulation

Rmin = 2e-8; %[m]minimum radius (can use Rmin_thermo function) use a bit above 10nm for growth purposes

grid_size=10;

% N0 =7e2;Rmin = 4e-5;dt = 100; %for testing

Rfall = 500e-6; %[m]falling radius

sweep_dy = 0.1*Rfall; %[m]sweeping step See effect?(CAN INCREASE MORE FOR 90 CA, maybe Rfall?)

Rjump_min = 1e-6; Rjump_max = 100e-6; L=L/1000;CA = CA/180*pi;

s=sqrt(1/(4*N0/L^2)); %number of initial nucleation sites-followed by average spacing in m

for repet=0:repeat-1

(5)

if (plotting)

hfig1 = figure;hold on;

set(hfig1,'units','normalized','position',[0 0 1 1]); fps = 30;

v = VideoWriter('Final_mismatch.avi'); open(v);

end

%---% Growth rate selection

%---%DONT forget to change CA above

%Shreyas CA 175

dR_dt_max = 1.76e-6;

dR_dt=@(R) exp(-21.6381-1.2132*log(R)-0.0439*(log(R)).^2);

dt=0.01*s/dR_dt_max;%1e-5;%by trial gives 15 nm dR at maximum growth rate

tend = 1e5*dt;%max 100K iters for now

tvector = [0:dt:tend];%[s] %========================================================================== %========================================================================== %---% Initialization %---jumping_events = 0; Lc=L/grid_size;

N0c = floor(N0/grid_size^2);%number of droplets per cell

Mem1 = 10;%for cell_droplets size memory factor

Mem2 = 10;%for finding clusters memory factor

cell_info = zeros(grid_size^2,8+4+2*N0c); %for each cell:neighbors (size8)/x_left/x_right/y_up/y_down

% NS0 array initial nucleation sites in cell (x(size N0c),y(size N0c))

cell_droplets = zeros(grid_size^2,3*Mem1*N0c);%allocating a safe size for the number of droplets in a cell

% cell_droplets contains for every cell :

% Xposition array (size 2*N0c)/Yposition array (size 2*N0c)/Radius(size2*N0c)

% last entry is Rmax in this cell

for ic=1:grid_size^2%%going through cells, index of cell ic

[cell_info(ic,:),cell_droplets(ic,:)] = cell_initialize...

(cell_info(ic,:),cell_droplets(ic,:),ic,grid_size,Lc,N0c,Rmin,Mem1);

end

% load('cell_info_test.mat')%optional loading of a test case

%---%for saving % exponent=-8:+0.01:-3;bins = 1*10.^exponent; bins = 1e-8:1e-8:1000e-8; % exponent=-8:+0.5:-5;bins = 1*10.^exponent; for i=1:length(bins)-1

mid_bins(i) = 0.5*bins(i)+0.5*bins(i+1);%check if need log average or smth

end

RadiusData=zeros(length(tvector),length(bins)-1);

%**************************************************************************

(6)

%---% Time Stepping

%---%**************************************************************************

c=0;%for autosave purposes

if NEW==1 kstart=1; else load('Droplets_Data.mat') kstart=k1; end for k=kstart:length(tvector) % Saving Results

for ic=1:grid_size^2%placing in bins

s0=find(cell_droplets(ic,1:Mem1*N0c)==0,1)-1;Rad=cell_droplets(ic,1+2*Mem1*N0c:s0+2*Mem1*N0c);

for p=2:length(bins)-1%no need to take care of ending since it will be zero

ind=find(Rad>bins(p));s1=length(ind);

RadiusData(k,p-1)=RadiusData(k,p-1)+s0-s1;s0=s1;%have to add each cell contribution

end

end

k1=k;

cumulTime=toc;

if cumulTime>c*6*3600%6 hours autosave

c=c+1;save('Droplets_Data.mat','cell_droplets','RadiusData','k1'); end

% coalescing in each cell

cell_droplets_1 = zeros(grid_size^2,3*Mem1*N0c);%temporary cell droplets to be used for coalescence purposes

inter_cluster = zeros(grid_size^2,N0c*3*Mem1*N0c);%inter_cluster holds the clusters between cells(L3 clusters)

inter_cluster_2D = zeros(grid_size^2*N0c,3*Mem1*N0c);

jumping_num = zeros(grid_size^2,1);%jumping events in each cell

% disp('coalescing in cells'); parfor ic=1:grid_size^2 temp = [ic,cell_info(ic,1:8)];nei=temp(temp>0); [cell_droplets_1(ic,:),inter_cluster(ic,:),jumping_num(ic)]=cell_coalescence_ jump(nei,cell_droplets(nei,:),N0c,CA,Mem1,Mem2,Rjump_min,Rjump_max,mismatch,P A); end %transforming 1d to 2d intercluster for i=1:grid_size^2 for j=1:N0c inter_cluster_2D((i-1)*N0c+j,:)=inter_cluster(i,(j-1)*3*Mem1*N0c+1:j*3*Mem1*N0c); end end nz=find(inter_cluster_2D(:,1)~=0); reduced_clusters = inter_cluster_2D(nz,:); % cross-cell coalescence

(7)

% disp('cross-cell coalescence');

reduced_clusters=Merging_clusters(reduced_clusters,N0c,Mem1); nnd=size(reduced_clusters,1);%nd is for Number of New Droplets

remaining_drops=0;%drops that do not jump

for i=1:nnd

z=find(reduced_clusters(i,:)==0,1)-1;

if isempty(z) error('Cluster is too big in finding center of mass -Main Code-, increase Mem');end

sumX=0;sumY=0;sumV=0;sumR2=0; for d = 1:z

xd=reduced_clusters(i,d);yd=reduced_clusters(i,d+Mem1*N0c);R=reduced_clusters (i,d+2*Mem1*N0c);

sumX = sumX+R^3*xd;sumY = sumY+R^3*yd;sumV = sumV+R^3;sumR2=sumR2+R^2;

Rarray(d) = R; end

x = sumX/sumV;y=sumY/sumV;R = sumV^(1/3);

Ravg = sumV/sumR2;%area based average used to get rid of small drops

BigDrops=0;%number of big drops in coalescence

sumR2=0;sumR3=0;sumR4=0; for kk=1:d if Rarray(kk)>PA/100*Ravg BigDrops=BigDrops+1; sumR2 = sumR2+Rarray(kk)^2; sumR3 = sumR3+Rarray(kk)^3; sumR4 = sumR4+Rarray(kk)^4; end end

RavgBig = sumR3/sumR2;Rstd = sqrt(sumR4/sumR2-RavgBig^2);

if BigDrops==1 Rstd=100*Ravg;end%arbitrarily large Std to prevent jumping

%place in appropriate cell if not jumping

if ~(R>=Rjump_min && R<=Rjump_max && Rstd/Ravg<mismatch)%not jumping droplet remaining_drops=remaining_drops+1; for ic=1:grid_size^2 xl=cell_info(ic,9);xr=cell_info(ic,10);yu=cell_info(ic,11);yd=cell_info(ic,12 );

if x>xl && x<xr && y>yd && y<yu

z=find(cell_droplets_1(ic,:)==0,1); cell_droplets_1(ic,z)=x;cell_droplets_1(ic,z+Mem1*N0c)=y;cell_droplets_1(ic,z +2*Mem1*N0c)=R; end end end end jumped_cross=nnd-remaining_drops;

jumping_events = jumping_events+sum(jumping_num)+jumped_cross%adding jumping from all individual cells and from cross-cell

jumping_cumul(k) = jumping_events;

% Plot

(8)

if (plotting) show_cells=0; pause(1);clf; daspect([1 1 1])

rotate3d on;hold on;%view(45,30);

view(0,30)

zlim([0 0.02e-3]);xlim([0 L]);ylim([0 L]);

xlabel('X (m)');ylabel('Y (m)');zlabel('Z (m)'); %using cell_droplets_1 for plotting

disp('plotting after coalescence');

% figure(hfig1);ax=gca;ax.XDir='reverse';ax.YDir='reverse'; % grid on;ax.XGrid='on';ax.YGrid='on'; for ic=1:grid_size^2 % fig=figure(ic); % CondensationPlot(fig,cell_droplets(ic,1:2*N0c),cell_droplets(ic,2*N0c+1:4*N0c ),... % cell_droplets(ic,4*N0c+1:6*N0c),CA,L)%CA in radians Droplet3Dplot(gca,cell_droplets_1(ic,1:Mem1*N0c),cell_droplets_1(ic,Mem1*N0c+ 1:2*Mem1*N0c),... cell_droplets_1(ic,2*Mem1*N0c+1:3*Mem1*N0c),CA); if(show_cells==1) if ic<grid_size+1 plot(cell_info(ic,10)*ones(1,101),0:L/100:L, '--','LineWidth',3,'Color','m'); plot(0:L/100:L,cell_info(ic,10)*ones(1,101), '--','LineWidth',3,'Color','m'); end text(0.5*cell_info(ic,9)+0.5*cell_info(ic,10),0.5*cell_info(ic,11)+0.5*cell_i nfo(ic,12),... num2str(ic),'FontSize',14) end end F=getframe; writeVideo(v,F); end

%finding biggest drop size at each iteration

Rd_max(k) = max(max(cell_droplets_1(:,2*Mem1*N0c+1:3*Mem1*N0c),[],2));

% Updating cell_droplets + growth+Nucleation!

cell_droplets = zeros(grid_size^2,3*Mem1*N0c); for ic=1:grid_size^2 temp = [ic,cell_info(ic,1:8)];nei=temp(temp>0); cell_droplets(ic,:)=GrowthAndNucleation(nei,cell_droplets_1(nei,:),cell_info( ic,:),N0c,Rmin,CA,dR_dt,dt,Mem1); end

% Sweep (maybe add later or smth)

if(jumping_events>=max_jumps) break;

(9)

end

save('Droplets_Data.mat','cell_droplets','RadiusData','k1');

%saving the file!

save(strcat(num2str(max_jumps),'--jumps--',num2str(N0),'--', 'drops--',num2str(L*1e3),'--','length(mm)--',...

num2str(mismatch),

'--IsItSteady--','r',num2str(repet),'.mat'),'RadiusData','jumping_cumul','k','N0','L','s','R d_max');

if (plotting)

close(v);%close video

end close all toc end % Email_me();

cell_initialize.m

function [info,droplets] = cell_initialize(info,droplets,ic,grid_size,Lc,N0c,Rmin,Mem1) % initializes the cell_info data_struct (info) to cell

%boundaries and initial nucleation sites

%and also the cell_droplets data_struct(droplets) to droplets data in that cell

%cell_info contains for every cell: x_left (left boundary) % x_right (righ_boundary) % y_up (upper boundary) % y_down (lower boundary)

% NS0 array initial nucleation sites

% in the cell (x1,x2,x3,...x(N0c),y1,y2,y3,...y(N0c))

%cell_droplets contains for every cell : Xposition array (size 2*N0c)

% Yposition array (size 2*N0c)

% Radius values array (size2*N0c)

%they are concatenated serially % finding cell_row and cell_column quo = floor(ic/grid_size);%quotient rem = ic - quo*grid_size;%remainder

if rem==0

cell_col = grid_size; cell_row = quo;

(10)

else cell_col = rem; cell_row = quo+1;

end

%finding neighbors

if cell_row ==1 && cell_col==1

info(5)=ic+1;info(7)=ic+grid_size;info(8)=ic+grid_size+1;

else if cell_row==1 && cell_col==grid_size

info(4)=ic-1;info(6)=ic+grid_size-1;info(7)=ic+grid_size;

else if cell_row ==grid_size && cell_col==1

info(2)=ic-grid_size;info(3)=ic-grid_size+1;info(5)=ic+1; else if ic==grid_size^2 info(1)=ic-grid_size-1;info(2)=ic-grid_size;info(4)=ic-1; else if cell_col==1 info(2)=ic-grid_size;info(3)=ic-grid_size+1;info(5)=ic+1; info(7)=ic+grid_size;info(8)=ic+grid_size+1; else if cell_col==grid_size info(1)=ic-grid_size-1;info(2)=ic-grid_size;info(4)=ic-1; info(6)=ic+grid_size-1;info(7)=ic+grid_size; else if cell_row==1 info(4)=ic-1;info(5)=ic+1;info(6)=ic+grid_size-1; info(7)=ic+grid_size;info(8)=ic+grid_size+1; else if cell_row==grid_size info(1)=ic-grid_size-1;info(2)=ic-grid_size;info(3)=ic-grid_size+1; info(4)=ic-1;info(5)=ic+1; else info(1)=ic-grid_size-1;info(2)=ic-grid_size;info(3)=ic-grid_size+1; info(4)=ic-1;info(5)=ic+1;info(6)=ic+grid_size-1;info(7)=ic+grid_size; info(8)=ic+grid_size+1;

end;end;end;end;end;end;end;end

%filling the cell_info data_structure

info(1+8) = (cell_col-1)*Lc; %xleft info(2+8) = cell_col*Lc; %xright info(3+8) = (grid_size-cell_row+1)*Lc; %y_up info(4+8) = (grid_size-cell_row)*Lc; %y_down %creating nucleation sites

info(5+8:N0c+4+8) = rand(1,N0c)*(info(2+8)-info(1+8))+info(1+8);

info(N0c+5+8:2*N0c+4+8) = rand(1,N0c)*(info(3+8)-info(4+8))+info(4+8); %creating droplets matrix

(11)

droplets(Mem1*N0c+1:Mem1*N0c+N0c) = info(N0c+5+8:2*N0c+4+8); droplets(2*Mem1*N0c+1:2*Mem1*N0c+N0c) = ones(1,N0c)*Rmin; end

cell_coalescence_jump.m

function [droplets,interClust,jumping_number] = cell_coalescence_jump(nei,A,N0c,CA,Mem1,Mem2,Rjump_min,Rjump_max,mismatch,PA)

%this funtion will determine which clusters are level 1 (L1) clusters, i.e. %single droplets, L2 i.e. clusters within the same cell, and L3 i.e.

%inter_cell_clusters. the function will return L1 and L2 with updated %droplets array containing the new locations and radii...

% L3 coalescences will be returned in interClust

%nei has the neighboring cells including the center cell %A has the cell_droplets of the vector nei cells

%interClust will be filled inter_cell clusters

%cell_droplets contains for every cell : Xposition array (size 2*N0c) % Yposition array (size 2*N0c) % Radius values array (size2*N0c) %they are concatenated serially

%factor of memory *N0c allocated for cell_droplets %factor of memory *N0c allocated for drop_clust

%---%find the first zero element to determine size

s = zeros(length(nei),2);

for k=1:length(nei)

s(k,:) = [nei(k) find(A(k,:)==0,1)-1];%s has the cell number and the size of non zero elements

% xk = A(k,1:s(k,2))

% yk = A(k,2*N0c+1:2*N0c+s(k,2)) % Rk = A(k,4*N0c+1:4*N0c+s(k,2))

if isempty(s(k,2)) && k==1

error('droplet array is filled, should have zero elements for buffer') end

end

%filling what each droplet in center cell is intersecting with

n1 = s(1,2);%number of droplets at current time 1

drop_clust = zeros(n1,2*Mem2*N0c);%intersections of each droplet in center cell

%first 2*N0c is for cell number then from

%2*N0c+1: end is the number of droplet in the

%cell

for i=1:n1

xi = A(1,i);yi = A(1,Mem1*N0c+i);Ri = A(1,2*Mem1*N0c+i);zi = -Ri*cos(CA); count = 1;%counter for number of intersections

(12)

drop_clust(i,count) = nei(1);drop_clust(i,count+Mem2*N0c) = i; for n=1:length(nei)

for j=1:s(n,2)%compare all droplets for easier sorting later

xj = A(n,j);yj = A(n,Mem1*N0c+j);Rj = A(n,2*Mem1*N0c+j);zj = -Rj*cos(CA);

D = sqrt((xi-xj)^2+(yi-yj)^2+(zi-zj)^2); %droplet distance

if D<=Ri+Rj && ~(n==1 && i==j)%drop distance comparison excluding droplet itself

count=count+1; if count==Mem2*N0c

error('Droplet intersections>= 2*N0c. Need bigger allocation for {Mem2} variable');end

drop_clust(i,count) = nei(n);drop_clust(i,count+Mem2*N0c)=j; end end end end droplets = zeros(1,3*Mem1*N0c); %---%removing single entries and filling in droplets, zeroing in A and desizing %drop_clust

count =0;%number of droplets filled in droplets array

for i=n1:-1:1

z=find(drop_clust(i,:)==0,1);%index of first 0 element

b=all(z==2);

if b %L1 cluster has only 1 element(in 1st half) non zero

count=count+1;

droplets(count)=A(1,i);droplets(count+Mem1*N0c)=A(1,i+Mem1*N0c); droplets(count+2*Mem1*N0c)=A(1,i+2*Mem1*N0c);%x, y and R

A(1,i)=0;A(1,i+Mem1*N0c)=0;A(1,i+2*Mem1*N0c)=0;%removing entries from A (mainly for debugging)

drop_clust(i,:)=[]; end

end

%---n2 = size(drop_clust,1);%new dimension of drop_clust %merging rows with common droplets and reduce drop_clust

%we keep the ones corresponding to the cell first, followed by neighboring %droplets

for i=n2:-1:2

zi = find(drop_clust(i,:)~=nei(1),1);zi=zi(1);

zzi = find(drop_clust(i,:)==0,1);zzi=zzi(1);%index of 1st zero zzi>=zi always

for j=i-1:-1:1

zj = find(drop_clust(j,:)~=nei(1),1);zj=zj(1);

zzj = find(drop_clust(j,:)==0,1);zzj=zzj(1);%zzj>=zj always

b=all(zzi+zzj-2>=Mem2*N0c);

if b error('Droplet cluster merging>= 2*N0c. Need bigger allocation for {Mem2} variable');end

%find common droplet from current cell and merge clusters with common droplets

AA=sort(drop_clust(i,Mem2*N0c+1:Mem2*N0c+zi-1)); BB=sort(drop_clust(j,Mem2*N0c+1:Mem2*N0c+zj-1)); if length(intersect(AA,BB))>=1

(13)

%copy all droplets not only ones that are in center cell conserving order

drop_clust(j,zj+zi-1:zi+zzj-2)=drop_clust(j,zj:zzj-1);%shift the ones not in the j cell to make room

drop_clust(j,Mem2*N0c+zj+zi-1:Mem2*N0c+zi+zzj-2)=drop_clust(j,Mem2*N0c+zj:Mem2*N0c+zzj-1);%shift2

drop_clust(j,zj:zj+zi-2)=drop_clust(i,1:zi-1);%copy cell data from i

drop_clust(j,Mem2*N0c+zj:Mem2*N0c+zj+zi-2)=drop_clust(i,Mem2*N0c+1:Mem2*N0c+zi-1);%copy2

drop_clust(j,zi+zzj-1:zzj+zzi-2)=drop_clust(i,zi:zzi-1);%copy neighbor droplets from i to j

drop_clust(j,Mem2*N0c+zi+zzj-1:Mem2*N0c+zzj+zzi-2)=drop_clust(i,Mem2*N0c+zi:Mem2*N0c+zzi-1);%copy neighbor2

%remove redundancies for m=zzi+zzj-2:-1:2 vm=[drop_clust(j,m);drop_clust(j,Mem2*N0c+m)]; for n=m-1:-1:1 vn=[drop_clust(j,n);drop_clust(j,Mem2*N0c+n)]; if vn(1)==vm(1) && vn(2)==vm(2) drop_clust(j,m)=0;drop_clust(j,Mem2*N0c+m)=0; break;%(max 2 repetitions for each case)

end

end

end

%Re-aligning to have zeros to the right % arr=zeros(1,zzi+zzj-2); arr=drop_clust(j,1:zzi+zzj-2); ind = find(arr>0); temp = drop_clust(j,ind);drop_clust(j,1:zzi+zzj-2)=zeros(1,length(arr)); temp_size=length(temp);drop_clust(j,1:temp_size)=temp;

%doing same for the droplets index

arr=drop_clust(j,1+Mem2*N0c:Mem2*N0c+zzi+zzj-2); ind = find(arr>0); temp = drop_clust(j,Mem2*N0c+ind);drop_clust(j,Mem2*N0c+1:Mem2*N0c+zzi+zzj-2)=zeros(1,length(arr)); temp_size=length(temp);drop_clust(j,Mem2*N0c+1:Mem2*N0c+temp_size)=temp; %eliminating drop_clust i drop_clust(i,:)=[]; break; end end end %---%separating L2 from L3 clusters and removing L2

n3 = size(drop_clust,1);%new dimension of drop_clust

L2_clusters = 0;%for counting L2 clusters

(14)

for i=n3:-1:1 z=find(drop_clust(i,:)~=nei(1),1);z=z(1); b = all(drop_clust(i,z)==0); if b%L2 cluster case L2_clusters = L2_clusters+1; sumx=0;sumy=0;sumV=0;Rarray = zeros(1,z-1);sumR2=0; for k=1:z-1

id = drop_clust(i,Mem2*N0c+k);%index of droplet

xd = A(1,id);yd=A(1,Mem1*N0c+id);R=A(1,2*Mem1*N0c+id);

A(1,id)=0;A(1,Mem1*N0c+id)=0;A(1,2*Mem1*N0c+id)=0;%not necessary but maybe for later debugging

sumx = sumx+R^3*xd; sumy = sumy+R^3*yd; sumV = sumV+R^3; Rarray(k) = R; sumR2 = sumR2+R^2; end x_new=sumx/sumV;y_new=sumy/sumV;R_new=sumV^(1/3);

Ravg = sumV/sumR2;%area based average used to get rid of small drops

BigDrops=0;%number of big drops in coalescence

sumR2=0;sumR3=0;sumR4=0; for kk=1:k if Rarray(kk)>PA/100*Ravg BigDrops=BigDrops+1; RBig(BigDrops)=Rarray(kk); sumR2 = sumR2+Rarray(kk)^2; sumR3 = sumR3+Rarray(kk)^3; sumR4 = sumR4+Rarray(kk)^4; end end

RavgBig = sumR3/sumR2;Rstd = sqrt(sumR4/sumR2-RavgBig^2);

if BigDrops==1 Rstd=100*Ravg;end%arbitrarily large Std to prevent jumping

%jumping condition : more than 1 droplet (already satisfied since L2 cluster), and between rjump min and

%Rjump_max and mismatch condition if std/avg <0.2 which corresponds to R1>1.5R2 for 2 droplets

% if ~(R_new>=Rjump_min && R_new<=Rjump_max) && % Rstd/Ravg>mismatch%wrong

if ~(R_new>=Rjump_min && R_new<=Rjump_max && Rstd/Ravg<mismatch)%not jumping droplet

remaining_drops = remaining_drops+1;

count = count+1;%add one droplet to droplets since this droplet is not jumping and hence conserved

droplets(count)=x_new;droplets(count+Mem1*N0c)=y_new;droplets(count+2*Mem1*N0 c)=R_new; end drop_clust(i,:)=[]; end end jumping_number=L2_clusters-remaining_drops; %---%filling InterClust

n4 = size(drop_clust,1);%new dimension of drop_clust

interClust=zeros(1,N0c*3*Mem1*N0c);

(15)

z=find(drop_clust(i,:)==0,1);z=z(1); if z>=Mem1*N0c error('need bigger interClust');end for j=1:z-1 cell_nb = drop_clust(i,j); droplet_nb = drop_clust(i,j+Mem2*N0c); k=find(s(:,1)==cell_nb);k=k(1); interClust(1,(i-1)*(3*Mem1*N0c)+j)= A(k,droplet_nb); interClust(1,(i-1)*(3*Mem1*N0c)+j+Mem1*N0c)= A(k,droplet_nb+Mem1*N0c); interClust(1,(i-1)*(3*Mem1*N0c)+j+2*Mem1*N0c)= A(k,droplet_nb+2*Mem1*N0c); end end

Merging_clusters.m

function Clust=Merging_clusters(Clust,N0c,Mem1) for i=size(Clust,1):-1:1 si=find(Clust(i,1:Mem1*N0c)==0,1)-1;si=si(1);%size of cluster i

if isempty(si) error('Cluster is too big in Merging_clusters');end

for j=i-1:-1:1

sj = find(Clust(j,1:Mem1*N0c)==0,1)-1;sj=sj(1);%size of cluster j

if isempty(sj) error('Cluster is too big in

Merging_clusters');end

exit2=0;

for di=1:si%di denotes droplet in cluster i

xdi=Clust(i,di);ydi=Clust(i,di+Mem1*N0c); exit1=0;

for dj=1:sj

xdj=Clust(j,dj);ydj=Clust(j,dj+Mem1*N0c);

if xdi==xdj && ydi==ydj

%add i cluster to j cluster

Clust(j,sj+1:sj+si)=Clust(i,1:si); Clust(j,Mem1*N0c+sj+1:Mem1*N0c+sj+si)=Clust(i,Mem1*N0c+1:Mem1*N0c+si); Clust(j,2*Mem1*N0c+sj+1:2*Mem1*N0c+sj+si)=Clust(i,2*Mem1*N0c+1:2*Mem1* N0c+si); Clust(i,:)=[]; exit1=1; break; end end

if exit1==1 exit2=1;break;end

end

if exit2==1

(16)

sj=find(Clust(j,:)==0,1)-1;sj=sj(1);%new size after merging for di=sj:-1:1 xdi=Clust(j,di); ydi=Clust(j,di+Mem1*N0c); for dj=di-1:-1:1 xdj=Clust(j,dj);ydj=Clust(j,dj+Mem1*N0c);

if xdi==xdj && ydi==ydj

Clust(j,di)=0; Clust(j,di+Mem1*N0c)=0; Clust(j,di+2*Mem1*N0c)=0; break; end end end %aligning zeros nz=find(Clust(j,1:sj)>0);temp1=Clust(j,nz);temp2=Clust(j,nz+Mem1*N0c); temp3=Clust(j,nz+2*Mem1*N0c); Clust(j,1:sj)=zeros(1,sj);Clust(j,1+Mem1*N0c:sj+Mem1*N0c)=zeros(1,sj); Clust(j,1+2*Mem1*N0c:sj+2*Mem1*N0c)=zeros(1,sj); Clust(j,1:length(nz))=temp1;Clust(j,1+Mem1*N0c:length(nz)+Mem1*N0c)=te mp2; Clust(j,1+2*Mem1*N0c:length(nz)+2*Mem1*N0c)=temp3; break; end end end

GrowthAndNucleation.m

function Droplets=GrowthAndNucleation(nei,A,center_cell_info,N0c,Rmin,CA,dR_dt, dt,Mem1) % A is part of cell_droplets Droplets = zeros(1,3*Mem1*N0c); %check for free nucleation site NSfree = center_cell_info(13:end); NSfree_organized=zeros(1,2*N0c); count=1;

for ns=N0c:-1:1%going through nucleation sites

xn=center_cell_info(12+ns);yn=center_cell_info(12+ns+N0c);zn=-Rmin*cos(CA);

exit=0;

for n=1:length(nei)%going through neighboring cells droplets

(17)

for d=1:s

xd = A(n,d);yd = A(n,d+Mem1*N0c);Rd = A(n,d+2*Mem1*N0c); zd = -Rd*cos(CA);

D = sqrt((xn-xd)^2+(yn-yd)^2+(zn-zd)^2); %droplet distance

if D<=Rmin+Rd NSfree(ns) = 0;NSfree(ns+N0c)=0; exit=1; break; end end

if(exit) break;end

end if NSfree(ns)~=0 NSfree_organized(count) =NSfree(ns);NSfree_organized(count+N0c) =NSfree(ns+N0c); count=count+1; end end % NSfree_organized

z=find(A(1,:)==0,1);%finding the size %applying growth Droplets(1,1:z-1) = A(1,1:z-1);%copying x Droplets(1,1+Mem1*N0c:z-1+Mem1*N0c) =A(1,1+Mem1*N0c:z-1+Mem1*N0c);%copying y dR = feval(dR_dt,A(1,1+2*Mem1*N0c:z-1+2*Mem1*N0c))*dt; Droplets(1,1+2*Mem1*N0c:z-1+2*Mem1*N0c) =A(1,1+2*Mem1*N0c:z-1+2*Mem1*N0c)+dR;

%inserting free nucleation sites n=count-1; Droplets(1,z:z+n-1)=NSfree_organized(1:n); Droplets(1,z+Mem1*N0c:z+n-1+Mem1*N0c)=NSfree_organized(1+N0c:n+N0c); Droplets(1,z+2*Mem1*N0c:z+n-1+2*Mem1*N0c)=ones(1,n)*Rmin; end

Droplet3Dplot.m

function Droplet3Dplot(axes,Xlocation,Ylocation,Radius,CA)%CA in radians for i=1:length(Xlocation)%---parfor xc = Xlocation(i); yc = Ylocation(i);

(18)

R = Radius(i); zc = -R*cos(CA); [x y z]=sphere; mysurf=surf(axes,x*R+xc,y*R+yc,z*R+zc); set(mysurf,'FaceColor',[0 0 1],'FaceAlpha',0.5); hold on end end

% %to test function % hey=rand(10,3); % x = hey(:,1); % y = hey(:,2); % R=hey(:,3); % CA=170/180*pi; % figure(1);daspect([1 1 1]);ax1=gca; % zl=zlim; % zlim([0 zl(2)]) % rotate3d on % Droplet3Dplot(ax1,x,y,R,CA)

References

Related documents

Registered SAA Voyager members who are active with the SAA Voyager programme and have Voyager numbers or loyalty cards are permitted to earn Miles when fuelling at TSA.. The

Ten years into the reign of Thorin the First, son of Thráin the Old, the King resolved to remove the royal house of Durin’s folk from Erebor to abide in the Grey Mountains.. At the

Step 1: Draw the configuration diagram.. • Problem 11: For the mechanism shown in figure link 2 rotates at constant angular velocity of 1 rad/sec construct the velocity polygon

All stationary perfect equilibria of the intertemporal game approach (as slight stochastic perturbations as in Nash (1953) tend to zero) the same division of surplus as the static

For more detailed information on the process, and what it may or may not do for you, refer to the resource guide titled Expunging Criminal Records: Step by Step that is provided by

Enhancing Gas Adsorption and Separation Capacity through Ligand Functionalization of Microporous Metal–Organic Framework Structures.. A Microporous Metal-Organic Framework

Steal your accidental coverage is square trade assurant offers a few industry with ongoing support services or tablet, so i upgrade to repair?. Compared to cost, square trade same

The coefficient represents the difference in the spatial regression discontinuity estimates between the pre (2013-2014) and post (2015) periods, i.e., by how much