Writing a Monte Carlo Simulation for Diffusion?

6 views (last 30 days)
I'm not sure where to start on this problem, how to input the boundary conditions, or how to get a reasonable answer.
Construct a Monte Carlo routine to model a one-dimensional diffusion problem and calculate a distribution of particles from a given starting distribution after a defined number of time steps. Use this routine to model the diffusion of particles over time for the following cases.
A. Fix the concentration at one boundary to be 1.0, and at time zero, let the concentration within your space be zero. Propagate the diffusion of particles into the space. Compare your distributions to the closed form solution for this problem:
c(x,t) = 1erf (x/sqrt(4Dt))
In this equation, c is the concentration normalized to the concentration fixed at the boundary, erf is the error function, x is the distance from the boundary, D is the diffusion coefficient and t is time. The boundary conditions leading to this solution are:
c = 1.0 at x = 0 for all t
c = 0.0 for x > 0 at t = 0
c = 0.0 at x → ∞ for all t
Under what conditions does the Monte Carlo model start to diverge from the closed form solution? Why?

Answers (0)

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!