Numerical methods for differential equations
Hyperbolic PDEs
Hyperbolic partial differential equations (PDEs) have a totally different nature with respect to others. Let's start our analysis from conservation laws:
∂u/∂t + ∂(f(u))/∂x = 0
∂/∂t > c1 > c2 > cb f(x)
∂g(u)/∂x generally could be q f(u,x)
∂u/∂t + a(u) ∂u/∂x conservative form
If a(u) = const., then:
- du/dt + a du/dx = 0
- f(u) = 1/2 u2 ⇒ Burgers
- ∂u/∂t + 2u ∂u/∂x
a(u) = x0 ⇒ dx/dt
x(t) - x0 = a t ⇒ dx/dt = a t ⇒ Sub = x0
Periodic boundary conditions: I trace back to the foot
Generic (non-periodic) boundary conditions: only on inflow
➔ Inflow is where a·n
Exist Γ such that A:TΛT-1
Condition for system to be hyperbolic if A can be reduced to diag through Γ
Non-conservative form
∂u/∂t + j(u)/∂x = 0
Generally could be f(u,x)
∂u/∂t + ∂(a(u)u)/∂x = 0 ⇒ ∂u/∂t + a(u) ∂u/∂x
If a(u) = const., then:
- ∂u/∂t + a ∂u/∂x = 0
- If f(u) = 1/2 u2 ⇒ Burgers
∂u/∂t + ∂u/∂t + a(u) ∂u/∂x
∂(u)/∂t; a(u) = u ⇒ ∂u/∂t + a(u) ∂u/∂x = 0
∂u/∂t + a(u) ∂u/∂x = 0 ⇒ total derivative is zero!
x(t) - x0 = a(u) t ⇒ x(t) = x0 + a(u) t
Characteristic lines: x(x) = x0
Unbounded, i.e. u(x,0) = u0(x)
∂u/∂t + a ∂u/∂x = 0
u(x,t) = u0(x-at)
Periodic b.c.: I trace back to the foot
Generic (non-periodic) b.c.: only on inflow
Foot of characteristic line from (x,t) ⇒ (x-at,0)
INFLOW is where an < 0
∂Ω
Going to multi-dimensional case, ∂u/∂t + A ∂u/∂x = 0, A(p×p) u,p-vector
Exist ∇ such that A=TΛT-1 where Λ is a diagonal matrix containing all eigenvalues of A, eigenvalues being real numbers Λ = diag(λ1, ..., λp)
Condition for system to be hyperbolic is A can be reduced to diag through T.Ti-1
T-1 ∂u/ ∂t + ΛΓ-1 ∂u/ ∂x = 0
w = Γ-1u define w/ ∂t + Λ w/∂ x = 0
-> It's a decoupled system if Λ-∇ΓΛΓ-1 holds
New variables w are called characteristic variables
1D characteristic lines Suppose p=3, p p system
- λ >0
- λ >0
- λ <0
Boundary conditions must be provided on proper points (inflow & outflow)
D(x,t)={x-λit, i=1,...,p}
w = Γ-1 u ; A = ∇ΓΛ-1 -> λi ∂wi/ ∂x = ∂wi/ ∂t
If A is diag, Γ will be a linear combination, Γ and T-1 will be just coefficients, related to eigenvalues of A
If A(u) in T we have solution itself, and mapping from characteristic to real variables is more difficult
How do we solve hyperbolic problems?
Finite volume
Very closely related to finite differences. We look for a numerical method which mimics as much as possible the dynamics of the physical problem.
Elements in finite volume are called cells, which can be a □ or ▢ or anything else. In practice, we can have generic elements close to the boundary more structured mesh good grid around boundaries, caution away.
We'll stick to the 1D case:
Introduce: Usually called cell average. Want to find a good average value for the cell equation very similar to the real, original one. Generic numerical method related to finite volumes. Different methods depend on the choice of numerical flux. Most compute values on the boundaries can have discontinuities, values of U on two sides:
- First problem: find a meaningful U
- Second problem: missing time
Stability constraints! Choose quite often explicit method: but it is an unstable method. Must be then an upwind method derived from physical considerations.
Numerical flux for upwind method? Very good for implementation; no need to worry about its sign. Time loop & space loop (to update all values). To change the method, just change the numerical flux, not the structure of the code. To increase the accuracy of the method must increase the degree of polynomials in each cell.
Problem of discontinuity: shockwave controlling diffusion. Linear case initial solution transported. Non-linearity leads to break wave or reach a steady state. Non-linear case (e.g., Burger equation) can create discontinuity. Non-continuous initial conditions. Want to capture the shock (discontinuity) and propagate it correctly.
For simplicity, we'll consider 1D finite volumes in our analysis:
∂u/∂t + a ∂u/∂x = 0
uin+1 = uin + λ (Fi+1/2H - Fi-1/2H), λ = Δt/Δx
Forward Euler Centered (FEC)
uin+1 - uin + a (uin - uin) / Δx = 0
uin+1 - uin - λ/2 a (uin+1 - uin)
⇔ Fi+1/2H = 1/2 [a (uiin - ui) ]
Note: Not the best one, because not respectful of the physics of the problem: would be more "example" to consider only upwind infos
Lax-Friedrichs (LF)
uin+1 = 1/2 (un+1i+1 + uni-1) - λ/2 (uini - uini-1)
⇔ Fi+1/2H = 1/2 [a (uini + uini-1) - λ (uini-1 - uini)]
Lax-Wendroff (LW)
• Compute uin+1 as Taylor-expanded in time: uin+1 = uin + (∂u∕∂t)| i Δt + (∂2 u∕∂t2)| i(Δt2/2 + (Δt3)
• From original equation: ∂u/∂t = -a ∂u/∂x ⇒ (∂2u∕∂t2) = -∂u∕∂t ∂x = -a ∂2u∕∂x2
un+1 = un+1 + (∂u/∂x) i Δt + (a2∂2u/∂x2)| i (Δt2/2 …
Discretizing with centered approximations:
uin+1 = uin Δ(uin - uiina) Δt + a2 Δ(uiin -uiina) (Δt2/2)
⇔ Fi+1/2H = 1/2 [ a (uini + uii) - λ2 a2(uini-1 - uini)]
Upwind (up)
uin+1 - uin-1 + a uin-1 - uiin - uin)
• How do we choose which method to use? (In practice LW, UP are the most used; FEC almost fewer) (Check Consistency, stability, convergence)
• Consistency LTE (Local Truncation Error): "remainder of unexactness of the solution"
• FoL upwind
U(x,t) analytical solution T: T = (u(xi, tn+1) - u(xi, tn)) + u(xi, tn) - u(xi, t) )
• Function Error TF: τ = max n,i | T|↳ If τ → ∞ when Δt , Δx → 0"
1 |If τ"(Δt, Δx) = O(Δtp Δxq) method is said to be of order p with respect to time and q with respect to space
Let us check consistency and order of upwind
In the same way, we can proceed to compute space approx, getting to O(Δx) q = 1
For upwind p = 1, q = 1
For FEC p = 1, q = 2
For LF O(Δx 2 + Δt + o x2)
For LW O(Δt 2 + Δx 2 + o x 2Δt)
Convergence
lim max (u(xi, tn) - un) = 0
All of the methods we’ve seen are actually convergent, but most of the times it is better not to prove it directly but by means of: consistency + stability ⇒ convergence.
If method stable order of convergence is the same of the order of consistency
Stability
For T there is a CT(T) such that ∀Δx > 0 there is δ(Δx) such that for 0c 0t c J0, ‖un‖Δ c CT ‖u0‖Δ for nQt ≤ T‖.‖Δ is Norm delta; function inside is defined pointwise, so it is a vector containing [un, ui…, un] all averages
Delta norm must be able to measure numerical solution. Problem with this is discretization of the norm: do not take into account all size reduction when number of cells increases
Δx is introduced to 'weight' value introduced in the computation
‖un‖Δ discrete norm of discrete solution at time np = CT + 1 method is said to be strongly stable ‖un‖Δ ≤ ‖un-1‖Δ true at each step; ‖un‖Δ ≤ ‖un-1‖Δ
Let us check stability of upwind method
G un+1 = un + λΔ(uni+1 - uni) = (1- λΔ)
Numerical domain of dependence must contain Physical domain of dependence.
Courant-Friedrichs-Lewy (CFL) condition ➔ c = a Δt/Δx = Courant number
For systems, λi ∂Δt/Δx < 1
For FEC never strong stability, could have stability if Δt ∈ (Δx/σ)2, with stability constant C = eh/2
Another method to check stability is Von Neumann Method, using ‖un‖l2∂un/∂t = a ∂u/∂x = 0
Numerical method will introduce some dissipation, so we’re ready to accept energy reduction
uo(xj) = Σk αk eikxj
Let's consider FEC
un+1j - unj = a∂t/Δx (unj+1 - unj)
Direct amplification factor- yjn or yn j+1 can iterate, ending up with: yn j = (3v)n yn j
If I want the method to be stable, I need |U (n)|l2≤ ||U(n-1)||l2
Check how things work in this case:|r|1/2 = (1 + Δt2 Δx-2 sin2 (∇X))
Let's check for the upwind:
un+1j - unj = Δtνφνnxβw = αρξφcSUPβw = 0 such that |r|x,y
Numerical solution will obviously differ from numerical analysis in two ways:
- Amplitude of the wave is reduced (*)
- Peak is moved (forward or backward)
(*) - Phase modification
Upwind: function V that satisfies the equation ΔV + ΔV.x(t) - Vx(t)
-
Takehome problems
-
Navier Sokes Problems
-
General useful results and Elliptic Problems
-
Stokes Problems