Diffusion in a 2D Box

Continuing the series of “animations you may find useful”, this is part of a homework assignment for my Transport & Mixing class. The general idea is this: you have an instantaneous point source in the middle of a two-dimensional box with unit length and height. It spreads via diffusion until it hits the walls of the box, which are no-flux boundaries. Since these are parallel reflective boundaries, the solution for C(x,y,t) is given by an infinite superposition of image sources.

Here’s what concentration looks like as a function of time. It follows a symmetric 2D Gaussian distribution until it hits the walls of the box. Then it spreads out until the concentration is approximately uniform.

And if we zoom out a bit, we can also look at the image sources. (There are technically an infinite number of them, but we can only see a handful over this particular timescale). The image sources are plotted as circles with a radius equal to three standard deviations of the plume.


Here’s the code for the second animation (which also contains the first animation). If you want to actually run it, you’ll also need the function C(x,y,t) which is given here. Finally, the function “circle” was just copied from this discussion. Thanks for reading, let me know if you have questions.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s