# Why is the answer to this diffusion example unintuitive?

Imagine a linear decrease in concentration from left to right. Using Fick's first law,

$J = -D \frac{d \psi}{d x}$

for all x, from left to right, we have the same flux amount because the decrease is linear.

So $J(x) = m$

According to Fick's second law,

$\frac{d \psi}{d t} = -D \frac{d^2 \psi}{d x^2} = \frac{d J}{d x}$

So $\frac{d J(x)}{d x} = 0$

so dJ/dx is just 0 since the 2nd derivative of a line is 0. Yet this seems unintuitive. I would expect as long as there is a concentration gradient, there should be a change in concentration at each point until the concentration is completely uniform. There must be an error in my math or reasoning, where is it?

EDIT:

To clarify the boundary conditions, imagine a closed box with no out flow or in flow at the edges.

-
If there is a concentration gradient, the concentration will change - but only later. At the very same time, there's just nonzero "acceleration", and it takes nonzero time for it to acquire a velocity. Your complaint is completely analogous to the complaint that $d^2 h/dt^2 = -g$ for the height of an apple is wrong because the apple should always fall down, even if it has a zero velocity. Well, velocity is independent of the acceleration. It's only the acceleration that is equal to $-g$, and the initial velocity may be 0 or anything. The same with velocity of the concentration. –  Luboš Motl Feb 12 '11 at 7:14

As Ted Bunn said, the linear concentration profile is only a steady state if there is a steady inflow at one end and a steady outflow at the other. This net flow is what preserves the concentration gradient.

With the "closed box" boundary condition instead, there is indeed an error in your reasoning because the linear profile is no longer a steady state. So, to make things explicit, you should have instead:

$$\left.J(x)\right|_{t=0} = m$$ $$\left.\frac{\partial\psi}{\partial t}\right|_{t=0} = 0$$ for all x in the interior of the box.

However, these results do not imply that $\psi(x)$ is always constant. At time $t=0$, there is a constant flow from left to right, but because the box is closed this means that the concentration at the left edge of the box is decreasing and the concentration at the right edge is increasing (even though it hasn't yet begun to change anywhere in the interior - If you want, you can say that $\partial\psi/\partial t(t=0)$ has the form of two Dirac delta functions).

The only way I know to get the full solution is expanding in a Fourier series. For concreteness, say the box extends from $x=-1/2$ to $x=1/2$. The correct basis of eigenfunctions to use for this boundary condition contains functions whose derivative is zero at the edges of the box, namely $\sin(n \pi x)$ for odd n and $\cos(n \pi x)$ for even n. Since the initial condition is an odd function, the cosines don't appear. Also, for convenience, set the initial slope equal to $\pi^2/4$.

$$\psi(x,t=0) = \frac{\pi^2}{8} - \frac{\pi^2}{4} x = \frac{\pi^2}{8} - \sum_{n\text{ odd}} \frac{\sin(n\pi x)}{n^2}$$ (where the last equality is from the well-known Fourier series of a triangle wave) $$\psi(x,t) = \frac{\pi^2}{8} - \sum_{n\text{ odd}} \frac{\sin(n\pi x)}{n^2} e^{-nt/\tau}$$

where $\tau$ is a time scale that depends on the diffusion constant and dimensions (if you want, I can work out what it actually is, but it's irrelevant for the discussion).

If you plot this function at different $t$ values increasing from zero, you can clearly see that the concentration is becoming smoothed out and tending toward a uniform concentration of the average value, $\pi^2/8$.

Thus, even though at $t = 0$ it seems like the concentration isn't changing anywhere ($\partial\psi/\partial t$ = 0), it immediately begins changing, and diffusion does eventually lead to a uniform concentration.

Here are some plots I made, using terms through $n=15$:

-
+1 excellent answer! –  David Z Feb 12 '11 at 6:44
Thanks for the great answer. I have to remember to keep in mind the interesting stuff tends to happen at the boundary conditions so I always need to consider them for these types of physics problems. –  bmillare Feb 12 '11 at 16:09

I see. I was thinking that the $d\psi/dx$ retained its constant value even at the edges, which implies the inflow / outflow. Now that I understand the intended situation correctly, I agree with Keenan Pepper's excellent answer. –  Ted Bunn Feb 12 '11 at 14:36