The Diffusion Equation

1. Nov 24, 2009

osdes

Technically speaking, this is not a homework problem; it is something extra that I want to explore using data from my biomedical engineering class. We recently finished a lab involving testing the design of a micromixer; now comes the analysis of the data. No where in the lab are we instructed to find a fit for our data, nor are we instructed to solve the diffusion equation. The goal of the lab is not to test that the diffusion equation works, but to indicate how well our micromixer performed. I am interested in the former, not the latter. Hence, I want to fit lab data to the solution to the diffusion equation, given that diffusion must occur in a confined space. The steady state solution is trivial and obvious, so I want to find the solution.

1. The problem statement, all variables and given/known data

I've been trying to solve the 1D diffusion equation

$$D\frac {\partial^2 \phi}{\partial x^2} = \frac {\partial \phi}{\partial t}$$, where $$\phi(x,t)$$ is the "concentration" of a particular substance at position $$x$$ at time $$t$$, and $$D$$ is the diffusion coefficient.

This particular problem is subject to the following:

1) $$x$$ is limited to be between $$0$$ and $$L$$ inclusive, and time $$t \geq 0$$.
2) The Initial Condition is $$\phi(x,0) =$$ the step function centered on $$\frac {L}{2}$$, that is, for $$x\leq \frac {L}{2}$$, $$\phi(x,0) = 0$$, and for $$x > \frac {L}{2}$$, $$\phi(x,0) = 1$$.
3) $$\int_0^L \phi(x,t)dx = \frac {L}{2}$$, i.e. the total amount of substance is constant, all mass must remain between $$0$$ and $$L$$ for all time (Conservation of Mass).
4) The only boundary condition is $$\phi(\frac {L}{2},t) = \frac {1}{2}$$; the value of $$\phi$$ is always changing at the edges $$x = 0$$ and $$x = L$$.
5) The steady state solution is $$\lim_{t\rightarrow\infty}\phi(x,t) = \frac {1}{2}$$.
6) If you were to subtract $$\frac {1}{2}$$ from the solution, the result should be an odd function about $$x = \frac {L}{2}$$.
7) I do not believe I can make any analogies between the symmetric semi-infinite version of this problem (which would be to start with an initial $$\phi$$ as square pulse of width $$\frac {L}{2}$$, and enforce a boundary condition at $$x = 0$$ that $$\phi = 0$$, because this would violate the conservation of mass.)
8) That said, perhaps one can enforce an additional boundary condition that mass does not flow across the boundaries $$x = 0$$ and $$x = L$$. I'm not quite sure how to represent this as a differential equation that would be useful in this context, but maybe with further thought and some tips I could. I think that this condition is equivalent to #3; maybe this would be helpful in reformulating the problem.

2. Relevant equations

See above.

3. The attempt at a solution

Finding a separable solution for $$\phi$$ is only slightly enlightening. I believe I should be able to obtain eigenvalues and then form an eigenfunction basis in order to formulate the actual solution. Thus if I if assume a separable solution $$\phi(x,t) = X(x)T(t)$$, then I can write

$$\frac {X''(x)}{X(x)} = \frac {1}{D}\frac {T'(t)}{T(t)} = - k^2$$. It might be helpful to set up the problem so that it repeats periodically in $$x$$ so that $$\sin(kx)$$ and $$\cos(kx)$$ eigenfunctions can be used: Then the eigenfunctions for $$X(x)$$ would be $$\sin(kx)$$ and $$\cos(kx)$$. The solution for $$T(t) = Ce^{ - k^2Dt$$.

Then:
$$\phi(x,t) = C_o + \sum_{n = 0}^\infty (A_n \cos(k_n x) + B_n(k_n x))e^{ - k_n^2Dt}$$, where $$C_o$$ is either 0 or $$\frac {1}{2}$$ depending on where we position the problem.

I need to find the coefficients and the eigenvalues, but I am stuck, unsure about how exactly I should utilize the conditions set in this problem to find them. The lack of boundary conditions I think makes this difficult. However, if this problem is made to periodically go through zero, this might help. I could shift the system so that initially at ($$t = 0$$) $$\phi$$ is an periodic odd square wave: from $$x = 0$$ to $$x = L$$, $$\phi = \frac {1}{2}$$; from $$x = - L$$ to $$x = 0$$, $$\phi = - \frac {1}{2}$$. This repeats. And then the region of interest would be between $$x = - \frac {L}{2}$$ and $$x = \frac {L}{2}$$.

I think this setup would take care of #3 and #8 due to symmetry, in which case perhaps it might be possible to solve this using an alternative method with the mentioned above setup as the initial condition and the Green's function for the diffusion equation, which isn't separable.

So overall, can anyone give me insight on whether or not my approach(es) is(are) correct in solving for $$\phi(x,t)$$ for this particular case?

2. Nov 25, 2009

Mapes

Hi osdes, welcome to PF. Your problem description is very clear. Maybe it will help to note that from the constraint of zero mass flow at $x=0$ and $x=L$, we also have the boundary conditions

$$\left.\frac{\partial \phi}{\partial x}\right|_{x=0,L}=0$$

which is an outcome of applying Fick's first law.

3. Dec 12, 2009

osdes

Ok, so I decided to solve via a separable solution. From $$D\frac {\partial^2 \phi}{\partial x^2} = \frac {\partial \phi}{\partial t}$$, assume that $$\phi(x,t) = X(x)T(t)$$. I can write $$D\frac{X''(x)}{X(x)}=\frac{T'(t)}{T(t)}=-\lambda$$. A solution for $$X(x)$$ is $$X(x) = A\cos(\sqrt{\frac{\lambda}{D}}x) + B\sin(\sqrt{\frac{\lambda}{D}}x)$$, where $$A$$ and $$B$$ are constants. Also, $$T(t) = e^{-\lambda t}$$. The product of these is a solution for $$\phi(x,t)$$.

Here, I decided to alter the boundaries for the problem. The problem is now exhibits odd symmetry about the origin, $$x=0$$; the initial left and right boundaries are $$\phi(\pm \frac{L}{2},0) = \pm \phi_o$$, with the plus and minus corresponding. Applying the boundary conditions and initial state of the problem, we know that the $$X(x)$$ solution must exhibit odd symmetry. Thus, $$A=0$$ and $$B\neq0$$. This requires that $$\cos(\sqrt{\frac{\lambda}{D}}\frac{L}{2}) = 0$$, leading to $$\sqrt{\frac{\lambda}{D}} = \frac{(2n+1)\pi}{L}$$, where n is a non-negative integer. Each value of n generates a solution to the diffusion equation, so
$$\phi_n (x,t) = B_n \sin(\frac{(2n+1)\pi}{L}x)e^{-\frac{D(2n+1)^2\pi^2}{L^2}t}$$ is a solution, meaning that $$\phi(x,t) = \sum_{n=0}^{\infty}B_n \sin(\frac{(2n+1)\pi}{L}x)e^{-\frac{D(2n+1)^2\pi^2}{L^2}t}$$ is a solution. To determine $$B_n$$, apply the I.C. and use orthogonality (i.e. Fourier). To do this, I extended the problem to infinite and made it periodic with a period of $$2L$$--I made the problem have odd symmetry about $$x=0$$ and have even symmetry about $$x=\frac{L}{2}$$.