## Diffusion ##

### Diffusion


### Diffusion vs. Turbulence
* Diffusive Transport: perfume, cigarette smoke
* [Fick's Law](http://en.wikipedia.org/wiki/Fick's_laws_of_diffusion):
Diffusion flux = $\kappa \times$ concentration gradient.
* Turbulent Transport: eddies carry particles

### Example: Dye in a pipe
* A circular pipe is filled with a fluid at rest.
* Dye in the fluid varying along length $x$.
* Density (mass per unit length) of dye: $u(t,x)$.
The amount of dye between $x\_1$ and $x\_2$ is
$$
M(t) = \int\_{x\_1}^{x\_2} u(t,x) dx.
$$
How does $M(t)$ change as dye diffuses?
### How does $M(t)$ change?
$$
\frac{dM}{dt} = \int\_{x\_1}^{x\_2} u_t (t,x) dx.
$$
Dye is neither destroyed nor created. Mass changes as dye flows. Fick's diffusion law shows:
$$
\frac{dM}{dt} = dye~ flows ~in - dye ~flows~ out = \kappa [u\_x (t, x\_2) - u\_x (t, x\_1)].
$$
Setting expressions for $\frac{dM}{dt}$ equal to each other
$$
\int\_{x\_1}^{x\_2} u_t (t,x) dx = \kappa [u\_x (t, x\_2) - u\_x (t, x\_1)].
$$
### Deriving Diffusion Equation
$$
\frac{1}{x\_2 - x\_1} \int\_{x\_1}^{x\_2} u_t (t,x) dx = \kappa \frac{ u\_x (t, x\_2) - u\_x (t, x\_1)}{x\_2 - x\_1}
$$
Taking the limit $x\_2 \rightarrow x\_1$
$$
\implies u\_t = u\_{xx}.
$$
**Initial Value Problem for the Diffusion Equation:**
$$ \begin{cases}
\partial\_t u = \partial_x^2 u \\\\
u(0, x) = u\_0(x)
\end{cases} $$
### Maximum Principle
If $u(t,x)$ solves the diffusion equation on a spacetime rectangle $[(t,x): t \in [0,T], x \in [0,L] ]$ then the maximum value of $u$ in the rectangle is either located when $t=0$ or on the lateral sides $x=0$ or $x =L$.
* *Miniumum Principle* also holds true.
* Initial hot spots cool off.
### Uniqueness
Consider the *Dirichlet Problem* for the diffusion equation:
$$ \begin{cases}
\partial\_t u - \kappa \partial_x^2 u = f(t,x), ~ x \in [0,L], t>0 \\\\
u(0, x) = u\_0 (x) \\\\
u(0,t) = g(t), ~ u(L,t) = h(t).
\end{cases} $$
Here $f, u\_0, g$ and $h$ are given functions.
Maximum Principle $\implies \exists$ at most one solution.
### Proof of Uniqueness
* Suppose $u\_1$ and $u\_2$ are two distinct solutions.
* Form $w(t,x) = u\_1 (t,x) - u\_2 (t,x)$.
Then $w$ satisfies the diffusion equation
$$ \begin{cases}
\partial\_t w - \kappa \partial_x^2 w = 0, ~ x \in [0,L], t>0 \\\\
u(0, x) = 0 \\\\
w(0,t) = 0, ~ w(L,t) = 0.
\end{cases} $$
By the Maximum Principle, $w$ has maximum along $t=0$ or $x=0$ or $x=L$, so $w \leq 0$.
By the Minimum Principle, $w$ has minimum along $t=0$ or $x=0$ or $x=L$, so $w \geq 0$.
We conclude that $w = 0$ and $u\_1 = u\_2.$
### Deriving the Fundamental Solution
We want to solve the initial value problem:
$$ \begin{cases}
\partial\_t u = \partial_x^2 u \\\\
u(0, x) = u\_0(x)
\end{cases} $$
**Strategy:**
* Find a *special* solution.
* Build *general* solution using the special one.
## Invariance Properties
1. Any **translate** $u(t, x - y)$ solves if $u(t,x)$ solves.
2. Any **derivative** ($u\_x, u\_t, u\_{xx}, ...$) solves if $u$ solves.
3. **Linear** combos of solutions are also solutions.
* $\implies$ An **integral** of solutions is a solution.
4. **Parabolic dilations** of a solution are solutions:
$$u_a (t,x) = u (at, \sqrt{a} x), ~\forall a > 0.$$
(Check it with the chain rule.)
### We seek a special solution $Q(t,x)$
**Boundary Conditions for $Q$**
* $Q(0,x) =1$ for $x>0$
* $Q(0,x) = 0$ for $x<0$.
**Step 1:** Seek $Q$ in special form.
$$ Q(t,x) = g(p), ~p = \frac{x}{\sqrt{t}}$$
Why is this a good idea?
**Step 2: Diffusion Equation converts into an ODE!**
$$Q\_t = \frac{dg}{dp} \frac{\partial p}{\partial t} = - \frac{1}{2t} \frac{x}{\sqrt{4kt}} g' (p).$$
$$Q\_x = \frac{dg}{dp} \frac{\partial p}{\partial x} = \frac{1}{\sqrt{4kt}} g' (p).$$
$$Q\_{xx} = \frac{d {Q_x}}{dp} \frac{\partial p}{\partial x} = \frac{1}{4kt} g'' (p).$$
Using $Q\_t = Q\_{xx}$, we find an ODE for $g$:
$$
g'' + 2p g' = 0.
$$
**Step 3: Solve the ODE**
Multiply by the integrating factor $e^{\int 2p dp}$ to recast as
$$
g'(p) = c\_1 e^{-p^2}.
$$
Integrating again yields
$$
Q(t,x) = g(p) = c\_1 \int e^{-p^2} dp + c\_2.
$$
Recalling $p$, we write more explicitly $\forall ~ t>0$,
$$
Q(t,x) = c\_1 \int\_0^{\frac{x}{\sqrt{4kt}}} e^{-p^2} dp + c\_2.
$$
**Step 4: Determine $c\_1, c\_2$ using boundary conditions.**
If $x>0$, we want
$$
1 = \lim_{t \searrow 0} Q(t,x) = c\_1 \int\_0^\infty e^{-p^2} dp + c\_2 = c\_1 \frac{\pi}{2} + c\_2.
$$
If $x<0$, we want
$$
1 = \lim_{t \searrow 0} Q(t,x) = c\_1 \int\_0^{-\infty} e^{-p^2} dp + c\_2 = - c\_1 \frac{\pi}{2} + c\_2.
$$
These conditions lead us to choose:
* $c\_1 = \frac{1}{\sqrt{\pi}}$
* $c\_2 = \frac{1}{2}$
$$
Q(t,x) = \frac{1}{2} + \frac{1}{\sqrt{\pi}} \int\_0^{\frac{x}{\sqrt{4kt}}} e^{-p^2} dp .
$$
**Step 5: Define $S = \frac{\partial Q}{\partial x}$.**
$$ S(t,x) = \frac{1}{2 \sqrt{\pi k t}} e^{-{\frac{x^2}{4kt}}}, ~ t>0.
$$
***
$$u(t,x) = \int\_{-\infty}^{+\infty} S(t, x-y) u\_0 (y) dy, ~t>0$$
solves the initial value problem!
## Solution of the Initial Value Problem
$$ \begin{cases}
\partial\_t u - \partial_x^2 u = 0 \\\\
u(0, x) = u\_0(x)
\end{cases} $$
$ \implies $
$$u(t,x) = \int\_{-\infty}^{+\infty} S(t, x-y) u\_0 (y) dy, ~t>0$$
## Solution of the inhomogeneous IVP
$$ \begin{cases}
\partial\_t u - \partial_x^2 u = f(t,x) \\\\
u(0, x) = u\_0(x)
\end{cases} $$
$ \implies $
$$u(t,x) = \int\_{-\infty}^{+\infty} S(t, x-y) u\_0 (y) dy + \int\_0^t \int\_{-\infty}^{+\infty} S(t-s, x-y) f(y,s) dy ds.$$