12.07.2015 Views

Chapter 13 - Davidson Physics

Chapter 13 - Davidson Physics

Chapter 13 - Davidson Physics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 14. FRACTALS AND KINETIC GROWTH MODELS 523ggggxggggxggggggxggggggggggggggggggggxgxxggxgxggxgxggxggFigure 14.3: An example of the growth of a percolation cluster. Sites are occupied with probabilityp. Occupied sites are represented by a shaded square, growth or perimeter sites are labeled by g,and tested unoccupied sites are labeled by x. Because the seed site is occupied but not tested,we have represented it differently than the other occupied sites. The growth sites are chosen atrandom.public int L ;public double p ; // s i t e occupation p r o b a b i l i t yint occupiedNumber ;int perimeterNumber ;int nx [ ] = {1 , −1, 0 , 0 } ; // r e l a t i v e change in x to n e a r e s t n e i g h b o r sint ny [ ] = {0 , 0 , 1 , −1}; // r e l a t i v e change in y to n e a r e s t n e i g h b o r sdouble mass [ ] ; // mass o f ring , index i s d i s t a n c e from c e n t e r o f masspublic void i n i t i a l i z e ( ) {s i t e = new byte [ L+2][L+2]; // g i v e s s t a t u s o f each s i t exs = new int [ L*L ] ; // l o c a t i o n o f occupied s i t e sys = new int [ L*L ] ;pxs = new int [ L*L ] ; // l o c a t i o n o f perimeter s i t e spys = new int [ L*L ] ;for ( int i = 0 ; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!