Question

I am coding to simulate the growth of a sphere in a solution environment. I am doing in this way.

  1. Create of space and put a cell in the center as a seed.

    pSpace = new char[nXRange * nYRange * nZRange];
    for (int i = 0; i < nZRange; i++)
    for (int j = 0; j < nYRange; j++)
    for (int k = 0; k < nXRange; k++)
      pSpace[i * nXRange * nYRange + j * nXRange + k] = 0;
    pSpace[nXRange * nYRange * nZRange / 2 + nXRange * nYRange / 2 + nXRange/2] = 1;
    
  2. Create a cell in the solution. The position of the cell is created by a random number.

    int nXPostion = (int)(((float)rand()/RAND_MAX) * (nXRange - 1));
    int nYPostion = (int)(((float)rand()/RAND_MAX) * (nYRange - 1));
    int nZPostion = (int)(((float)rand()/RAND_MAX) * (nZRange - 1));
    
  3. Calculate the change of the potential for creation of the cell.Six neighbors of the new cell are checked as left (L), Right (R), Front (F), Behind(B), Top (T), and Bottom (B*). If the neighbors of the new cell is an old cell as L in the figure, the change of the potential is PA2A, else, if it is not an old cell but solution, as R, F, B, T, and B * in the figure, it is PA2S. The creation of the new cell change the potential with PCREATE. So, the change of the potential is

    fPotential = PCREATE + P(Left) + p(Right) + p(Front) + p(Behind) + p(Top) + p(Bottom);
    
  4. Use a random number to compare the change of the potential as following. If the random number is larger than the exponential of change of the potential, than create a new cell, else cancel.

Theoretically, a sphere will growth around the seed. However, in my experiment, the shape of the cluster is irregular. The attached image is a cluster of 50000 cells. Could anyone give me some comments. Is it related with the generation of the random number? Thanks.

a cluster created around a seed with random number

XY plane of cluster

XZ plane of cluster

Interplate in process 3

Was it helpful?

Solution

I have two thoughts regarding this.

First: the rectilinear grid you are using presents a difficulty. That is, without looking too deeply at your code, growth along an x-, y-, or z-axis is likely proceed at a different rate than growth along a diagonal axis.

This problem is difficult to work around. If you allow d-26 connectivity (central cell connects to the cube of all cells around it), then how do you account for the (slightly) longer distance to diagonal cells? If you only allow growth along x-, y-, and z-axes, how do you account for the fact that cell in a diagonal direction now takes longer to get to than it should?

This may account for some of the fuzziness.

Second: Right now we are using the metric of "it looks irregular". But is it really? What we need is a good statistical test of how irregular it is versus how irregular we would expect it to be. Certainly it is the case that you wouldn't expect the edge of your blob to be completely spherical, since this is, after all, a random process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top