0
$\begingroup$

I have a $9 \times 9$ square lattice. In each site of the lattice, there are $N$ molecules, where $N$ is a large random number and it is different for different sites. N equal to 100000000+-100 in beginning and changes by passing time. I want each molecule to do a random walk in each time step. $N$ is very large and it is not possible to apply random walk for each molecule in each site. Could anyone help? It is a part of other code, actually molecules f cites are consumed by other particles and they diffuse in time, but the part I have problem in is diffusion of molcules. I don't have enough score to answer the comments, so I answer here. Yes lattice is 2d. Yes, Exactly! I want number of particles in each site.But I don't underestand what do you mean. Could you provide an answer?

$\endgroup$
2
  • $\begingroup$ I assumed that your lattice is 9x9x9, since it's cubic, and changed the question accordingly. Right now, you are not providing enough information. How big is N? What is the distribution of N? What is the purpose of your model? $\endgroup$
    – nicoguaro
    Mar 29 '17 at 18:45
  • 2
    $\begingroup$ This sounds like you don't want to track each individual particles, but you want to track for each site the number of particles you have there. Based on how exactly you define your random walk, you need to define a time step model that relates the number of molecules at each site to the numbers at neighboring sites. $\endgroup$ Mar 29 '17 at 19:26
1
$\begingroup$

In the comments, @WolfgangBangert mentions the first part, the representation: instead of storing for $10^8$ particles a lattice location -- a two dimensional vector $(x,y)$ with 9 entries in each dimension -- you choose the dual representation by storing for each site $(x,y)$ the number of particles which occupy the site.

The second component is the transition. Straightforwardly, you would have to draw two times $10^8$ random numbers in order to check whether each one of the particles undergoes a transition. By this, however, you would have won nothing (regardless of the reduced representation of the system state in step one).

Therefore you approximate the distribution of the particles which undergo a transition by a normal distribution, which should be a very good approximation as your $N$ is quite large. The theoretical basis for this is the central limit theorem, and the parameters of the normal distribution depend on your microscopic transition law. You then draw a few random numbers from the normal -- which might even not be necessary as the normal should be really sharp, so it's possible you can just pick the mean.

Note that the above procedure is similar to what is done in classical statistical physics, when going from the microscopic description to the canonical ensemble.

$\endgroup$
2
  • $\begingroup$ I cannot comment on your answer, so I write here. I know about central limit theorem and statistical mechanics, the problem is, I cannot apply it. Because there are 2 dimensions. for one dimenston it is easy: I generate a normal random number for each site. this number shows number of particles which go to the write. Other particles on the site go left. But I don't know what to do for 2d case $\endgroup$
    – Sonia Sohi
    Mar 29 '17 at 20:47
  • $\begingroup$ @SoniaSohi: in terms of StackExchange speech, this seems to be a comment :-). The exact application of the CLT depends on your transition law. Basically, it's important whether the x- and y-directions are correlated. If they are not, one can use two one-dimensional normals. If they are, you correspondingly need a correlated normal. (Note that in the worst case, your transition law could also be so pathetic that the CLT doesn't hold or that it is only a bad approximation) $\endgroup$
    – davidhigh
    Mar 30 '17 at 6:26
1
$\begingroup$

For such large numbers the diffusion process becomes essentially 'deterministic' (https://en.wikipedia.org/wiki/Law_of_large_numbers) so the classic approach is to implement a finite differencing method for a diffusion equation, such as: https://nl.mathworks.com/matlabcentral/fileexchange/38088-diffusion-in-1d-and-2d .

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.