Skip to main content
Chemistry LibreTexts

10.2: Solving the Diffusion Equation

  • Page ID
    294318
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Solutions to the diffusion equation, such as eq. (10.1.5) and (10.1.6), are commonly solved with the use of Fourier transforms. If we define the transformation from real space to reciprocal space as

    \[ \stackrel{\sim}{C} (k,t) = \int^{\infty}_{-\infty} C(x)e^{ikx} \, dx \nonumber \]

    one can express the diffusion equation in 1D as

    \[ \dfrac{d \stackrel{\sim}{C}(k,t)}{dt} = -Dk^2 \stackrel{\sim}{C}(k,t) \]

    [More generally one finds that the Fourier transform of a linear differential equation in x can be expressed in polynomial form: \(\mathcal{F} (\partial^nf/\partial x^n)=(ik)^n\stackrel{\sim}{f} (k) \). This manipulation converts a partial differential equation into an ordinary one, which has the straightforward solution \(\stackrel{\sim}{C}(k,t)= \stackrel{\sim}{C}(k,0)\exp (-Dk^2t)\). We do need to express the boundary conditions in reciprocal space, but then, this solution can be transformed back to obtain the real space solution using \(C(x,t) = (2\pi )^{-1} \int^{\infty}_{-\infty} \stackrel{\sim}{C} (k,t) e^{-ikx}dx\).

    Since eq. (10.2.1) is a linear differential equation, sums of solutions to the diffusion equation are also solutions. We can use this superposition principle to solve problems for complex initial conditions. Similarly, when the diffusion constant is independent of x and t, the general solution to the diffusion equation can also be expressed as a Fourier series. If we separate the time and space variables, so that the form of the solution is \(C(x,t)=X(x)T(t)\) we find that we can write

    \[ \dfrac{1}{DT} \dfrac{\partial T}{\partial t} = \dfrac{1}{x} \dfrac{\partial^2 x}{\partial x^2} = -\alpha^2 \nonumber \]

    Where α is a constant. Then \(T=e^{-\alpha^2Dt} \) and \( x=A\cos \alpha x+B\sin \alpha x\). This leads to the general form:

    \[ C(x,t) = \sum^{\infty}_{n=0} (A_n \cos \alpha_nx+B_n \sin \alpha_n x) e^{-\alpha_n^2Dt} \]

    Here An and Bn are constants determined by the boundary conditions.

    Examples

    Diffusion across boundary

    At time t = 0, the concentration is uniform at a value C0 for x ≥ 0, and zero for x < 0, similar to removing a barrier between two homogeneous media. Using the superposition principle, the solution is obtained by integrating the point source solution, eq. (10.1.5), over all initial point sources \(\delta (x-x_0) \) such that \( x_0=0 \longrightarrow \infty\). Defining \(y^2 = (x-x_0)^2/4Dt\),

    \[ C(x,t) = \dfrac{C_0}{\sqrt{\pi}}\int^{\infty}_{-\dfrac{(x-x_0)}{\sqrt{4Dt}}}dy \, e^{-y^2} = \dfrac{C_0}{2} erfc \left( \dfrac{-(x-x_0)}{\sqrt{4Dt}} \right) \nonumber \]

    clipboard_e42c3844836720f7d1a7419fec3cd8898.png

    Diffusion into “hole”

    A concentration “hole” of width 2a is inserted into a box of length 2L with an initial concentration of C0. Let’s take L = 2a. Concentration profile solution:

    \[ C(x,t) = C_0 \left[ \left( \dfrac{L-a}{L} \right) -\sum^{\infty}_{n=1} A_n \cos (\alpha_n x) e^{-\alpha^2_nDt} \right] \nonumber \]

    \[ A_n = \dfrac{2\sin (\alpha_n a)}{n\pi} \qquad \alpha_n = \dfrac{n \pi}{L} \nonumber \]

    clipboard_ee35192c55acf20eaf4cc7386108b5a9e.png

    • Fluorescence Recovery after Photobleaching (FRAP): We can use this solution to describe the diffusion of fluorescently labeled molecules into a photobleached spot. Usually observe the increase of fluorescence with time from this spot. We integrate concentration over initial hole:

    \[ \begin{aligned} N_{FRAP} (t) &= \int^{+a}_{-a} C(x,t) dx \\ &=C_0 \left[ \dfrac{2a}{L} (L-1)-L\sum^{\infty}_{n=1} A^2_n e^{-\alpha_n Dt} \right] \end{aligned} \]

    clipboard_e208ca5269c6ef8a92dea5a322571c5cc.png

    Reflecting and Absorbing Boundary Conditions

    We will be interested in describing the time-dependent probability distribution for the case in which particles are releases at x=0, subject to encountering an impenetrable wall at x=xw, which can either absorb or reflect particles.

    Consider the case of a reflecting wall, where the boundary condition requires that the flux at xw is zero. This boundary condition and the resulting pile-up near the wall can be described by making use of the fact that any \(P(x>x_w,t)\) can be reflected about xw , which is equivalent to removing the boundary and adding a second source term to \(P(x,t)\) for particles released at \(x=2x_w\)

    \[ P_{refl}(x,t) = P(x,t) + P(2x_w-x,t) \qquad (x<x_w) \nonumber \]

    This is also known as a wrap-around solution, since any component with any population from \(P(x,t)\) that passes the position of the wall is reflected about \(x_w\). Similarly, an absorbing wall, \(P(x=x_w,t)=0\), means that we remove any population that reached \(x_w\), which is obtained from the difference of the two mirrored probability distributions:

    \[ P_{abs}(x,t) = P(x,t)-P(2x_w-x,t) \qquad (x<x_w) \nonumber \]

    clipboard_eb97e2e5743fb5a60ac0d69651abf32bf.png


    This page titled 10.2: Solving the Diffusion Equation is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Andrei Tokmakoff via source content that was edited to the style and standards of the LibreTexts platform.