We have been solving equations like: \begin{equation*} \frac{d\mathbf{y}(t)} {dt} = \mathbf{f}(\mathbf{y}, t) \end{equation*} where:
- The function
$\mathbf{f}(\mathbf{y}, t)$ is given. - An initial condition is given, e.g.
$y(0) = 1.0$ . - The problem is to find
$\mathbf{y}(t)$ for a requested range of$t$ . - We refer to finding the solution
$\mathbf{y}(t)$ as solving or integrating a first order ordinary differential equation (ODE) initial value problem.
-
PDEs contain derivatives with respect to multiple variables, e.g.:
$\frac{\partial U}{\partial t}$ ,$\frac{\partial U}{\partial x}$ , etc. -
The solution to our PDE is a field, e.g.
$U(x, y, z, t)$ . -
$U$ might be a physical quantity e.g. ($T$ ,$P$ ) which varies continuously in$x$ and$t$ . -
Changes in
$U(x,y,z,t)$ affect$U$ nearby. -
What about boundary conditions or initial conditions?
-
How do we solve PDEs numerically?
-
Need to discretize multiple independent variables.
Elliptic | Parabolic | Hyperbolic |
---|---|---|
Poisson | Heat | Wave |
- Elliptic PDE: All 2nd order, same signs.
- Parabolic PDE: 1st order and 2nd order derivatives.
- Hyperbolic PDE: All 2nd order, opposite signs.
Boundary Condition | Elliptic (Poisson) | Hyperbolic (Wave) | Parabolic (Heat) |
---|---|---|---|
Dirichlet open |
Under | Under | Unique & stable (1-D) |
Dirichlet closed |
Unique & stable | Over | Over |
Neumann open |
Under | Under | Unique & Stable (1-D) |
Neumann closed |
Unique & stable | Over | Over |
Cauchy open |
Nonphysical | Unique & stable | Over |
Cauchy closed |
Over | Over | Over |
- Boundary conditions: must be sufficient for unique solution.
- Dirichlet: value on surrounding closed
$S$ . - Neumann: value normal derivative on surrounding
$S$ . - Cauchy: both solution & derivative on closed boundary.
No Standard PDE Solver
-
Standard form for ODE: $$ \frac{d\mathbf{y}(t)} {dt} = \mathbf{f}(\mathbf{y}, t) $$
-
Single independent variable
$\implies$ standard algorithm (e.g.rk4
). -
PDEs: several independent variables:
$U(x,y,z,t)$ . -
$\implies$ PDE solving is complicated: -
More variables, more equations, more ICs, BCs.
-
Each PDE and particular BCs
$\implies$ particular algorithm.
Insulated Metallic Bar Touching Ice
- Aluminum bar,
$L=1$ ~m,$w$ along$x$ . - Insulated along length, ends in ice ($T=0^\circ$C).
- Initially $T=100^\circ$C.
- How does temperature vary in space and time?
- Nature: heat flow hot
$\rightarrow$ cold
$T$ = temperature$K$ = conductivity
$C$ = specific heat
$\rho$ = density
$$H = - K ,\mathbf{\nabla} T(\mathbf{x}, t)$$ -
$Q(t)$ = contained heat$$Q(t) = \int dx, C \rho(x) , T(x, t)$$ - Heat Eqn:
$\Delta T$ from flow$$\frac{\partial T(x, t)}{\partial t} = \frac{K}{C \rho} \nabla^2 T(x, t)$$ - Parabolic PDE in
$x$ &$t$ $$\frac{\partial T(x,t)}{\partial t} = \frac{K}{C\rho}\frac{\partial ^2 T(x,t)}{\partial x^2}$$ - "Analytic" Solution
Initial condition:
$T(x,t=0) = 100^\circ$C
Boundary conditions:
$T(x=0) = T(x=L) = 0^\circ$C
$$T(x,t) = \sum_{n=1,3,\ldots}^\infty \frac{400\sin,k_n x,e^{-\alpha k_n^2 t}}{n\pi} $$ $$(k_n = \frac{n\pi}{L}, \alpha = \frac{K}{C\rho})$$
\begin{align*} \frac{\partial T}{\partial t} \simeq & \frac{T(x,t+\Delta t)-T(x,t)}{\Delta t}\ \frac{\partial^2 T}{\partial x^2} \simeq & \frac{T(x +\Delta x)+T(x-\Delta x)-2 T(x)}{(\Delta x)^2} \end{align*}
- Differential
$\rightarrow$ difference equation. - Solve at
$x,t$ lattice sites. - blue = BC row 0 = IC
-
$\partial t$ : forward difference
$\partial^2 x$ : central difference
$\implies$ difference heat equation - Step
$\downarrow$ one$t$ to next.
\begin{align} \frac{T(x,t+ \Delta t)-T(x,t)}{\Delta t} =& \frac{K}{C\rho}\frac{T(x+\Delta x,t) +T(x-\Delta x,t) -2 T(x,t)}{\Delta x^2} \ T_{i,j+1} =& T_{i,j}+ \eta \left[T_{i+1,j}+T_{i-1,j}-2T_{i,j}\right] \end{align}
-
How do we tell if difference solution is approximately a solution of the PDE?
- It's certainly bad if difference diverges.
-
Analysis of error behavior possible:
- Expand spatial variation of error in Fourier series.
- Examine time dependence of each term in series.
- For stability, all terms must decay exponentially with time
$t$ .
-
Requirement for stability: \begin{equation} \eta = \frac{K,\Delta t}{C\rho,\Delta x^2}<\frac{1}{2} \end{equation}
-
$\implies$ Smaller$\Delta t$ more stable -
To use
$\downarrow$ $\Delta x$ must use$\downarrow$ $\Delta t$
- Boundaries are conductors at fixed voltage.
- Closed boundary (insulate openings).
-
$\implies$ Neumann conditions on the boundary. -
$\implies$ Unique & stable solution.
- Boundaries are conductors at fixed voltage.
- Closed boundary (insulate openings).
-
$\implies$ Neumann conditions on the boundary. -
$\implies$ Unique & stable solution.
- Classical EM, static charges, Poisson Equation: $$ \nabla^2 U(x) = - 4 \pi \rho(x) $$
-
Laplace equation if
$\rho(x)=0$ : $$ \nabla^2 U(x) = 0 $$ - Solve in 2-D rectangular coordinates: $$ \frac{\partial^2 U(x,y)}{\partial x^2}+ \frac{\partial^2 U(x,y)}{\partial y^2 } = \begin{cases} 0, & \mbox{Laplace equation,} \
- 4 \pi \rho(x), & \mbox{Poisson equation} \end{cases} $$
-
$U(x,y)$ : two independent variables$\implies$ PDE.
-
Sum not separable:
$\neq \ X(x)\ Y(y)$ . -
Sum = infinite; not true analytic solution.
-
Algorithm:
$\sum^{\infty} \simeq \sum^{N}$ -
Painfully slow convergence
$\implies$ round-off error. -
$\sinh(n)$ means overflow for large$n$ . -
Converges in mean square, Gibbs overshoot.
$N\neq\infty$
$$ \frac{\partial^2 U(x,y)}{\partial x^2}+ \frac{\partial^2 U(x,y)}{\partial y^2 } = \begin{cases} 0, & \mbox{Laplace equation,} \
- 4 \pi \rho(x), & \mbox{Poisson equation} \end{cases} $$
- Form 2-D
$x-y$ lattice. - Solve for
$U$ at each lattice site. - Derivatives
$\rightarrow$ finite-differences. - Or use finite-elements (non-square grid)
$\implies$ more efficient, harder setup
- Forward difference
$\partial/\partial x$ : \begin{align*} U(x +\Delta x, y) = & U(x,y) + \frac{\partial U} {\partial x} \Delta x
- \frac{1}{2} \frac{\partial^2 U} {\partial x^2}(\Delta x)^2 + \cdots \ U(x -\Delta x, y) = & U(x,y) - \frac{\partial U}{\partial x} \Delta x + \frac{1} {2} \frac{\partial^2 U}{\partial x^2} (\Delta x)^2 - \cdots \end{align*}
- Add series, odd terms cancel:
$$
\frac{\partial^2 U(x,y)}{\partial x^2} \simeq
\frac{U(x+\Delta x, y) + U(x-\Delta x, y) -2U(x,y)} {(\Delta x)^2}
$$
$\implies$ Finite-difference Poisson PDE: \begin{align*} & \frac{U(x+\Delta x,y) + U(x-\Delta x,y)-2 U(x,y)}{(\Delta x)^2} + \ & \frac{U(x,y+\Delta y) + U(x,y-\Delta y)-2 U(x,y)}{(\Delta y)^2} = -4\pi\rho \end{align*}
\begin{align}
- 4 \pi \rho(x) =& \frac{\partial^2 U(x,y)}{\partial x^2}+\frac{\partial^2 U(x,y)}{\partial y^2 }\ -4\pi\rho_{i,j}\Delta^2 =& U_{i+1, j} + U_{i-1, j} + U_{i, j+1} + U_{i, j-1} -4 U_{i,j} \ \Rightarrow\quad U_{i,j} =& \frac{1}{4}\left[ U_{i+1,j}+U_{i-1,j}+U_{i,j+1}+U_{i,j-1} \right] + \pi\rho_{i,j} \Delta^2 \end{align}
- Solve (2): a big matrix!
- Correct solution = average of 4 nearest neighbors.
- Can we iterate to relax to the solution?
- Need to know if we arrive or fail.
-
Jacobi: update
$U$ after full sweep: -
Maintains symmetry of BC.
-
Gauss--Seidel: always use latest
$U$ : \begin{equation*} U^{\rm(new)}{i,j} = \frac{1}{4}\left[U^{\rm (old)}{i+1,j} + U^{\rm (new)}{i-1,j} + U^{\rm (old)}{i,j+1} + U^{\rm (new)}_{i,j-1} \right] \end{equation*} -
Faster convergence
$\implies$ $\downarrow$ RO error. -
Decreased memory.
-
Distorts symmetry of BCs.
\begin{align} U^{\rm (new){i,j}} = & { U^{\rm (old)}{i,j} + r_{i,j}}\ r_{i,j } \equiv & U^{\rm (new)}{i,j} - U^{\rm (old)}{i,j} \ =& {\frac{1}{4}\left[U^{\rm (old)}{i+1,j} + U^{\rm (new)}{i-1,j} + U^{\rm (old)}{i,j+1} + U^{\rm (new)}{i,j-1} \right] -U^{\rm (old)}_{i,j}} \ \end{align}
Successive Over Relaxation $$ U^{\rm (new){i,j} = U^{\rm (old)}{i,j} + \omega \ r_{i,j}} $$
Method | |
---|---|
Gauss-Seidel | |
Over-relaxation | |
Under-relaxation | |
Unstable |
- Determine
$\omega$ empirically
-
$U=0$ boundary for uniqueness. - Simple: thin plates
$\pm 100$ V. - Interest: thick plates,
$\rho(x) =?$ Laplace$\implies$ $U(x,y)$ Poisson$\implies$ $\rho(x,y)$ \* - Could have arbitrary BCs
e.g.
$U(x) = 100 \sin\left(\frac{2\pi x}{w}\right)$