Partial Differetial Equatios Part 2 Massimo Ricotti ricotti@astro.umd.edu Uiversity of Marylad Partial Differetial Equatios p.1/15
Upwid differecig I additio to amplitude errors (istability or dampig), scheme may also have phase errors (dispersio) or trasport errors (spurious trasport of iformatio). Upwid differecig helps reduce trasport errors: u +1 j t u j = v j u j u j 1 x, vj > 0, u j+1 u j x, vj < 0, where here we ve supposed that v is ot costat, for illustratio. Partial Differetial Equatios p.2/15
Schematically, oly use iformatio upwid of grid poit j to costruct differeces: t v t v +1 +1 j 1 j j+1 x j 1 j j+1 x Upwid differece is oly first order i space. Still, it has lower trasport error tha secod-order cetered differece. Better? Ca costruct higher-order upwid differece schemes... Partial Differetial Equatios p.3/15
Secod-order accuracy i time We have bee dealig with two derivatives, / x ad / t. We have costructed higher-order schemes i space. What about t? Staggered leapfrog is 2 d -order i time: t u+1 j u 1 j t ( F j+1 F ) j 1 =. x But, subject to a mesh-drift istability. Thik of space-time discretizatio: Odd-iteger coupled to eve-iteger j, Eve-iteger coupled to odd-iteger j ( red-black orderig; odd ad eve mesh poits decoupled). Partial Differetial Equatios p.4/15
Schematically, t +2 +1 1 j 2 j 1 j j+1 j+2 x Ca be fixed by addig diffusio to couple grid poits (add ǫ(fj 1 2F j + F j+1 ), ǫ 1 to RHS). Partial Differetial Equatios p.5/15
Two-step Lax-Wedroff: aother 2 d -order scheme. 1. Use Lax step to estimate fluxes at + 1 2 ad j ± 1 2 : u +1/2 j 1/2 = u j 1 + u j 2 u +1/2 j+1/2 = u j + u j+1 2 t 2 x t 2 x ( F j Fj 1 ), ( F j+1 F j ). 2. Usig these half-step values of u, calculate F(u +1/2 j±1/2 ) F +1/2 j±1/2. 3. The use leapfrog to get updated values: u +1 j = u j t x ( ) F +1/2 j+1/2 F +1/2 j 1/2. Partial Differetial Equatios p.6/15
Schematically, t +1 +1/2 halfstep poits j 1 j j +1 x Fixes dissipatio ad mesh driftig but itroduces phase error (dispersio). Ofte first-order upwid scheme is as good as/better tha 2 d -order L-W. Partial Differetial Equatios p.7/15
Summary: Hyperbolic methods May IVPs ca be cast i flux-coservative form. Solvig methods: 1. FTCS ucoditioally ustable. Never use. 2. Lax equivalet to addig diffusio, damps small scales. 3. Upwid differecig reduces trasport errors, but oly 1 st -order i space. 4. Staggered leapfrog 2 d -order i time, but subject to mesh-drift istability. Fix with diffusio. 5. Two-step Lax-Wedroff 2 d -order i time, but suffers from phase error. NRiC recommeds staggered leapfrog (presumably with diffusio), particularly for problems related to the wave equatio. For problems sesitive to trasport errors, NRiC recommeds upwid differecig schemes. Partial Differetial Equatios p.8/15
Solvig Parabolic PDEs (Diffusive IVPs) NRiC 19.2. Prototypical parabolic PDE is diffusio equatio: u t = D 2 u x 2, where we have take D > 0 to be costat (D = 0 is trivial ad D < 0 leads to physically ustable solutios). Cosider FTCS differecig: u +1 j t u j = D [ u j 1 2u j + ] u j+1. ( x) 2 Partial Differetial Equatios p.9/15
vo Neuma aalysis gives ξ(k) = 1 4D t ( ) k x ( x) 2 si2. 2 This is stable provided 2D t ( x) 2 1. The 2 d derivative makes all the differece (we saw addig diffusio via the Lax method stabilizes FTCS for the hyperbolic equatio). Diffusio time over scale L is τ D L 2 /D. So stability criterio says t τ D /2 across oe cell. Ofte iterested i evolutio of time scales τ D of oe cell. How ca we build stable scheme for larger t? Partial Differetial Equatios p.10/15
Implicit differecig Evaluate RHS of differece equatio at + 1: u +1 j u j t To solve this, rewrite as: = D [ u +1 j 1 ] 2u+1 j + u +1 j+1. ( x) 2 αu +1 j 1 + (1 + 2α)u+1 j αu +1 j+1 = u j, (1) where α D t/( x) 2. I 1-D, this is a tri-di matrix. I 3-D, get large, sparse, baded matrix. Solve the usual way. Partial Differetial Equatios p.11/15
What is limit of (1) as t (α )? Divide through by α to fid FD form of 2 u/ x 2 = 0, i.e., static solutio. Fully implicit scheme is ucoditioally stable ad gives correct equilibrium structure, but caot be used to follow small-timescale pheomea. Partial Differetial Equatios p.12/15
Crak-Nicholso differecig Form average of explicit ad implicit schemes (i space): u +1 j t u j = D [ (u +1 j 1 2u+1 j + u +1 j 1 ) + (u j 1 2u j + u j 1 ) ]. 2( x) 2 Ucoditioally stable, 2 d -order accurate i time (both sides cetered at + 1/2). Partial Differetial Equatios p.13/15
Schematically, t t Explicit (FTCS) Fully Implicit Crak Nicholso t x x x (1st order stable for small dt) (1st order stable for all dt) (2d order stable for all dt) Freezes small-scale pheomea. Ca use fully implicit scheme at ed to drive fluctuatios to equilibrium. Partial Differetial Equatios p.14/15
Noliear diffusio problems For oliear diffusio problems, e.g., where D = D(x), the implicit differecig more complex. Must liearize system ad use iterative methods. Partial Differetial Equatios p.15/15