OSTWALD RIPENING

DEFINITIONS

peq[gvonT_,r_]:=Exp[2 gvonT/r]

Module[{drl,dv},
orEvolve[{p_,rl_},{gvont_:1,rtonvin_:1},dt_:0.01]:=(
drl=Table[If[rl[[i]]>0,Max[dt*Log[p/peq[gvont,rl[[i]]]],-rl[[i]]],0],{i,1,Length[rl]}];
dv=-4Pi (rl^2).drl;
{p+dv/rtonvin,drl+rl}
)]

Module[{cl,nc},
mkcenters[rl_,d_]:=
(nc={RandomReal[{-d+rl[[1]],d-rl[[1]]}],RandomReal[{-d+rl[[1]],d-rl[[1]]}]};
cl={nc};
Do[
While[Or@@Table[Norm[nc-cl[[i]]]<rl[[i]]+rl[[Length[cl]+1]],{i,1,Length[cl]}],
nc={RandomReal[{-d+rl[[j]],d-rl[[j]]}],RandomReal[{-d+rl[[j]],d-rl[[j]]}]};];
cl=Append[cl,nc],{j,2,Length[rl-1]}
];
cl
)]

dd=10;
orPlot[{p_,rl_},cl_]:=Show[Graphics[{
RGBColor[1.0,0.3,0.1],Opacity[(1+Log[p])/10],
Rectangle[-(dd+2){1,1},(dd+2){1,1}],Opacity[1],RGBColor[0.2,0.4,1.0],EdgeForm[Directive[Thick,RGBColor[0,0,0.5]]],
Table[Disk[cl[[i]],rl[[i]]],{i,1,Length[rl]}],
Black,Text[Style["P="<>ToString[SetAccuracy[p,2]],FontFamily->"Comic Sans", FontSize->14,Background->White],Offset[{5,-5},{-dd,dd}],{-1,1}]
}]
,ImageSize->6*72]

pr={0.5,{1,2,2,2,2,2.2}}
lc=mkcenters[pr[[2]],dd]

pr=orEvolve[pr,{1,1},0.1]
Total[4./3 Pi pr[[2]]^3]
orPlot[pr,lc]

interactive

Manipulate[Dynamic[orPlot[pr,lc]],
{{n0,10,"Number of particles"},5,25,1,Appearance->"Labeled"},
{{p0,1,"Initial Pressure"},0.5,5,Appearance->"Labeled"},
Button["reset",
pr={p0,Table[RandomReal[{1,8/Sqrt[n0]}],{i,1,n0}]};
lc=mkcenters[pr[[2]],dd];
,ImageSize->80],
{{k,1,"Kinetic Factor"},0.1,10,Appearance->"Labeled"},
Button["go",While[Sort[pr[[2]]][[-2]]>0,pr=orEvolve[pr,{1,1},k*0.0001]],ImageSize->80,Method->"Queued"],SaveDefinitions->True
]