18.303 Problem Set 8 Solutions Problem 1: 15+10 points (a) Plugging in unm = g n eikm∆x , we obtain: g n eikm∆x and so g − cos(k∆x) 2 cos(k∆x) − 2g , = g n eikm∆x ∆t ∆x2 1 cos(k∆x) ∆t + g= 1 2 ∆t + ∆x2 2 ∆x2 = cos(k∆x), and hence |g| ≤ 1 for all k and the discretization is unconditionally stable (independent of ∆t and ∆x). For k = 0 and k = π/∆x, |g| = 1, meaning that those Fourier components do not decay in time. The k = 0 solution (constant), however, does not decay even in the exact PDE so that is fine. The k = π/∆x Fourier component of any given initial condition u(x, 0) becomes smaller and smaller as ∆x → 0 (since higher and higher k Fourier components go to zero for k → ∞ for most functions, with the special exception of the Fourier transform of the delta function), so we might expect that lack of decay of this component becomes less important for small ∆x. To check the order of accuracy, we should plug in the Taylor expansion: u([m+a]∆x, [n+b]∆t) = u(m∆x, n∆t)+ 2 2 ∂u 1 ∂2u ∂u 2 1∂ u 2 1 ∂ u a∆x+ a∆t+ (a∆x) + (b∆t) + (a∆x)(b∆t)+· · · , ∂x ∂t 2 ∂x2 2 ∂t2 2 ∂x∂t where the partial derivatives are evaluated at (m∆x, n∆t), and we will have a, b = ±1 below. Before we plugging this into the difference equation, however, it is useful to simplify a bit, first, by solving for un+1 m , in which case we find: unm+1 + unm−1 un+1 , = m 2 which looks a bit suspicious because all of the ∆x and ∆t terms cancelled! Plugging in the Taylor expansions, and cancelling the u(m∆x, n∆t) terms from both sides (noting that the ∆x and ∆x3 terms also cancel on the right-hand side), we find: ∂u ∂2u ∆t + O(∆t2 ) = ∆x2 + O(∆x4 ). ∂t ∂x2 This is does not even go to the PDE as ∆x, ∆t → 0 (i.e. it is not consistent with the original PDE) unless we set ∆t = ∆x2 . If we do that, and divide both sides by ∆t (= ∆x2 ), then the scheme is consistent and is first-order in time and second-order in space. So, this discretization scheme is a bit screwy; to make it work you have to be quite careful, and although it is unconditionally stable it is not consistent unless you choose ∆t = ∆x2 . (Sorry about that, I didn’t intend for it to be that weird.) (b) Solving for un+1 , we have (same derivation as in class for the diffusion equation) " −1 # D∆t D∆t n+1 1+ un . u = 1− 2 2 Stability requires that [· · · ] have eigenvalues g with |g| ≤ 1. Since the eigenvalues of D are of the form λ = iω where ω is real, the corresponding eigenvalues g of [· · · ] have the form: g= and hence |g|2 = gḡ = 1 + i ω∆t 2 1 − i ω∆t 2 ω∆t 1 + i ω∆t 2 1−i 2 = 1, ω∆t 1 − i ω∆t 2 1+i 2 so |g| = 1: the scheme is unconditionally stable, and the solutions are neither growing nor decaying. |g| = 1, so the solutions are oscillating (or constant if ω = 0), just as in the exact wave equation. 1 Problem 2: (5+5+15) 2 In class (and notes), we showed that we can turn the scalar wave equation b∇ · (a∇u) = ∂∂t2u (a > 0 and b > 0) into ∂v two coupled first-derivative equations: ∂u ∂t = b∇ · v, ∂t = a∇u by introducing a new (vector) unknown v(x, t). By T defining w = (u, v) , we obtained the form ∂w b∇· = w = D̂w, a∇ ∂t R where D̂ was anti-Hermitian under the inner product hw, w0 i = Ω 1b ūu0 + a1 v̄ · v0 , for appropriate boundary conditions (e.g. u|dΩ = 0).\ (a) If u|dΩ = 0, then ∂u ∂t |dΩ = 0 and hence ∇ · v|dΩ = 0 from the ∂u ∂t = b∇ · v equation. (b) If v · n̂|dΩ = 0 then ∂v ∂t · n̂|dΩ = 0 (n̂ is independent of t, assuming a time-independent domain Ω) and hence the ∂v = a∇u equation implies that ∇u · n̂|dΩ = 0, i.e. Neumann boundary conditions on u. ∂t u b∇ · v ∗ (c) The left nullspace is the set of vectors n such that D̂ n = 0 = −D̂n. Since n = implies D̂n = , v a∇u the nullspace consists of u’s with ∇u = 0 and v’s with ∇ · v = 0. First, ∇u = 0 can be satisfied by any constant u, and nonzero constants satisfy the Neumann boundary conditions in (b). Second, as in the hint ∇ · v = 0 is satisfied for v = ∇ × f for any vector field f , subjectto the boundary condition v · n̂|dΩ = 0 from (b). Hence, we 1 0 have an infinite-dimensional nullspace, spanned by combined with for any f subject to the 0 ∇×f boundary conditions. 1 The element of the nullspace gives the conervation law 0 Z ∂ u ∂ 1 , wi = , 0= h 0 ∂t ∂t Ω b R i.e. u/b is conserved (don’t forget the 1/b and 1/a factors in the inner product!). Correspondingly, the ∇ × f elements of the nullspace give conservation laws of the form: Z ∂ v 0= · ∇ × f, ∂t Ω a which is a bit hard to decipher. It simplifies a great deal if we use the hint to integrate by parts: Z Z Z v ·∇×f = [∇ · (f × v/a) + f · (∇ × v/a)] = f · ∇ × (v/a), Ω a Ω Ω where the ∇ · (f × v/a) term turns into a surface integral that vanishes for any f that vanishes on dΩ (which we can certainly choose f to do). But for the final integral to have zero ∂/∂t for any such f , it must be that ∂ [∇ × (v/a)] = 0, ∂t i.e. the curl of v/a is conserved at every point (or more strictly speaking, it is conserved in the sense of being a constant distribution, since its integral against any test function f is conserved). The curl conservation is actually more easily derived from the original equation ∂v ∂(∇ × v/a) = a∇u =⇒ = ∇ × ∇u = 0 ∂t ∂t since the curl of a gradient is always zero. (Physically, if we consider the example from class of a scalar pressure wave in a uniform gas/fluid a = constant , then v is a velocity and ∇ × v is a “vorticity”—essentially, how much the medium is “spinning”. A longitudinal wave such as a pressure wave does not change the spinning motion, i.e. the vorticity, of the medium.) 2