1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: The Diffusion Equation

  1. Nov 24, 2009 #1
    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

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

    This particular problem is subject to the following:

    1) [tex]x[/tex] is limited to be between [tex]0[/tex] and [tex]L[/tex] inclusive, and time [tex]t \geq 0[/tex].
    2) The Initial Condition is [tex]\phi(x,0) =[/tex] the step function centered on [tex]\frac {L}{2}[/tex], that is, for [tex]x\leq \frac {L}{2}[/tex], [tex]\phi(x,0) = 0[/tex], and for [tex]x > \frac {L}{2}[/tex], [tex]\phi(x,0) = 1[/tex].
    3) [tex]\int_0^L \phi(x,t)dx = \frac {L}{2}[/tex], i.e. the total amount of substance is constant, all mass must remain between [tex]0[/tex] and [tex]L[/tex] for all time (Conservation of Mass).
    4) The only boundary condition is [tex]\phi(\frac {L}{2},t) = \frac {1}{2}[/tex]; the value of [tex]\phi[/tex] is always changing at the edges [tex]x = 0[/tex] and [tex]x = L[/tex].
    5) The steady state solution is [tex]\lim_{t\rightarrow\infty}\phi(x,t) = \frac {1}{2}[/tex].
    6) If you were to subtract [tex]\frac {1}{2}[/tex] from the solution, the result should be an odd function about [tex]x = \frac {L}{2}[/tex].
    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 [tex]\phi[/tex] as square pulse of width [tex]\frac {L}{2}[/tex], and enforce a boundary condition at [tex]x = 0[/tex] that [tex]\phi = 0[/tex], 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 [tex]x = 0[/tex] and [tex]x = L[/tex]. 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 [tex]\phi[/tex] 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 [tex]\phi(x,t) = X(x)T(t)[/tex], then I can write

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

    [tex]\phi(x,t) = C_o + \sum_{n = 0}^\infty (A_n \cos(k_n x) + B_n(k_n x))e^{ - k_n^2Dt}[/tex], where [tex]C_o[/tex] is either 0 or [tex]\frac {1}{2}[/tex] 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 ([tex]t = 0[/tex]) [tex]\phi[/tex] is an periodic odd square wave: from [tex]x = 0[/tex] to [tex]x = L[/tex], [tex]\phi = \frac {1}{2}[/tex]; from [tex]x = - L[/tex] to [tex]x = 0[/tex], [tex]\phi = - \frac {1}{2}[/tex]. This repeats. And then the region of interest would be between [tex]x = - \frac {L}{2}[/tex] and [tex]x = \frac {L}{2}[/tex].

    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 [tex]\phi(x,t)[/tex] for this particular case?
  2. jcsd
  3. Nov 25, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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 [itex]x=0[/itex] and [itex]x=L[/itex], we also have the boundary conditions

    [tex]\left.\frac{\partial \phi}{\partial x}\right|_{x=0,L}=0[/tex]

    which is an outcome of applying Fick's first law.
  4. Dec 12, 2009 #3
    Ok, so I decided to solve via a separable solution. From [tex] D\frac {\partial^2 \phi}{\partial x^2} = \frac {\partial \phi}{\partial t}[/tex], assume that [tex]\phi(x,t) = X(x)T(t)[/tex]. I can write [tex] D\frac{X''(x)}{X(x)}=\frac{T'(t)}{T(t)}=-\lambda [/tex]. A solution for [tex]X(x)[/tex] is [tex]X(x) = A\cos(\sqrt{\frac{\lambda}{D}}x) + B\sin(\sqrt{\frac{\lambda}{D}}x)[/tex], where [tex]A[/tex] and [tex]B[/tex] are constants. Also, [tex]T(t) = e^{-\lambda t}[/tex]. The product of these is a solution for [tex]\phi(x,t)[/tex].

    Here, I decided to alter the boundaries for the problem. The problem is now exhibits odd symmetry about the origin, [tex]x=0[/tex]; the initial left and right boundaries are [tex]\phi(\pm \frac{L}{2},0) = \pm \phi_o[/tex], with the plus and minus corresponding. Applying the boundary conditions and initial state of the problem, we know that the [tex]X(x)[/tex] solution must exhibit odd symmetry. Thus, [tex]A=0[/tex] and [tex]B\neq0[/tex]. This requires that [tex]\cos(\sqrt{\frac{\lambda}{D}}\frac{L}{2}) = 0[/tex], leading to [tex]\sqrt{\frac{\lambda}{D}} = \frac{(2n+1)\pi}{L}[/tex], where n is a non-negative integer. Each value of n generates a solution to the diffusion equation, so
    [tex]\phi_n (x,t) = B_n \sin(\frac{(2n+1)\pi}{L}x)e^{-\frac{D(2n+1)^2\pi^2}{L^2}t}[/tex] is a solution, meaning that [tex]\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}[/tex] is a solution. To determine [tex]B_n[/tex], 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 [tex]2L[/tex]--I made the problem have odd symmetry about [tex]x=0[/tex] and have even symmetry about [tex]x=\frac{L}{2}[/tex].
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook