Math 257/316 Assignment 7 Solutions 1. The concentration u(x, t) of a reactive chemical diffusing in one dimension satisfies 0 < x < 2, t > 0 ut = uxx − u, u(0, t) = −1, u(2, t) = 1 . u(x, 0) = 0 where the ‘loss’ term represents a reaction which consumes the chemical. Find u(x, t) and sketch the solution for 3 different values of t. Hint: first find the steady-state,. You may find it helpful to know that (you can check this by integrating by parts) the Fourier sine series coefficients for sinh(x − 1) on [0, 2] are: 0 n odd, bn = −4nπ sinh(1) n even. 4+n2 π 2 A steady state u(x, t) = v(x) should satisfy v 00 = v, 0 < x < 2, v(0) = −1, v(2) = 1. The general solution of this ODE is a linear combination of ex and e−x , or sinh(x) and cosh(x), OR, thinking ahead, since the BCs are odd with respect to x = 1, v(x) = A cosh(x − 1) + B sinh(x − 1). (Note: you do not have to do it this way – leaving things in terms of ex and e−x is also fine – it just makes the formulas and computations a little simpler.) Then −1 = v(0) = A cosh(1) − B sinh(1), 1 = v(2) = A cosh(1) + B sinh(1), so (adding the two) A = 0, and B = 1/ sinh(1), and the steady-state is v(x) = sinh(x − 1) . sinh(1) Now write u(x, t) = v(x) + w(x, t), so that w solves wt = ut = uxx − u = v 00 − v + wxx − w = wxx − w, w(0, t) = u(0, t) − v(0) = 0, 1 w(2, t) = u(2, t) − v(2) = 0. Now do separation of variables: T0 X 00 +1= = −λ = const. T X w(x, t) = X(x)T (t) =⇒ We already know that the X problem X 00 (x) = −λX(x), X(0) = 0 = X(2) has solutions Xn (x) = sin(nπx/2), λn = n2 π 2 /4, n = 1, 2, 3, . . .. Then for each n, the T problem T 00 (t) = −(λn + 1)T (t) = −(n2 π 2 /4 + 1)T (t) 2 π 2 /4+1)t has solution T (t) = (const)e−(n w(x, t) = ∞ X . So the general solution is 2 π 2 /4+1)t cn sin(nπx/2)e−(n . n=1 The initial condition is w(x, 0) = ∞ X cn sin(nπx/2) = u(x, 0) − v(x) = − n=1 sinh(x − 1) sinh(1) and so (using the hint) 1 cn = − sinh(1) Z 2 sinh(x − 1) sin(nπx/2)dx = 0 0 4nπ 4+n2 π 2 n odd . n even Finally then, u(x, t) = sinh(x − 1) + 4π sinh(1) ∞ X n=1,n even n 2 2 sin(nπx/2)e−(n π /4+1)t . 2 2 4+n π 2. There is a gas leak at the end x = 1 of a corridor 0 ≤ x ≤ 1. The concentration of gas satisfies ut = uxx , 0<x<1 ux (0, t) = 0, ux (1, t) = 1 u(x, 0) = 0 (a) Find the solution for u(x, t) by first finding a particular solution of the form v(x, t) = ax2 + bx + ct that satisfies the PDE and BCs; then write u(x, t) = v(x, t) + w(x, t), and find and solve the homogeneous problem for w. 2 Plugging v(x, t) = ax2 + bx + ct into the heat equation gives c = 2a. So v = ax2 + bx + 2at, vx = 2ax + b, and the boundary conditions imply 0 = vx (0) = b, 1 = vx (1) = 2a + b = 2a =⇒ a = 1/2, so v(x, t) = x2 /2 + t. Now write u(x, t) = v(x, t) + w(x, t) and note that w solves the homogeneous problem wt = wxx , w(x, 0) = u(x, 0) − v(x, 0) = −x2 /2, w(0, t) = 0 = w(1, t), so ∞ w(x, t) = a0 X 2 2 + an cos(nπx)e−n π t 2 n=1 with Z a0 = 2 1 (−x2 /2)dx = − 0 1 3 and for n = 1, 2, 3, . . ., Z 1 Z 1 2 2 2 2 1 an = 2 sin(nπx)(−x /2)|0 − cos(nπx)(−x /2)dx = sin(nπx)(−x)dx nπ nπ 0 0 Z 1 2 2 2 = − 2 2 cos(nπx)(x)|10 + 2 2 cos(nπx)dx = − 2 2 (−1)n . n π n π 0 n π Thus ∞ 1 2 1 2 X (−1)n 2 2 u(x, t) = x + t − − 2 cos(nπx)e−n π t . 2 2 6 π n n=1 (b) An alarm in the middle of the corridor (x = 1/2) is triggered when the gas concentration reaches 1. By considering the size of the different terms in your solution, deduce that the alarm goes off at approximately t ≈ 25/24. Now ∞ 1 1 2 X (−1)n 1 1 2 2 2 u(1/2, t) = + t − − 2 cos(nπ/2)e−n π t = t − + 2 e−4π t + · · · 8 6 π n2 24 2π n=1 where the omitted terms get rapidly smaller for t > 0. We seek the t for which u(1/2, t) = 1 so we estimate 1 = u(1/2, t) ≈ t − 2 1 24 =⇒ t≈ 25 24 (and note that by this time that e−4π t is much smaller than 1, justifying the omission of that term (and all the other, even smaller, terms) in our approximation). 3 3. Solve the following non-homogeneous problem for the heat equation. ut = uxx + sin(πx) t e−π u(0, t) = 0, 2t 0 < x < 1, t > 0 u(1, t) = 5 u(x, 0) = 5x. To take care of the BCs, we seek a steady-state solution v(x) of the problem without the source term: v 00 (x) = 0, v(0) = 0, v(1) = 5 =⇒ v(x) = 5x, and so writing u(x, t) = 5x + w(x, t), we find that w solves −π 2 t wt = wxx + sin(πx)te w(0, t) = 0 = w(1, t) w(x, 0) = 5x − 5x = 0 For zero BCs, our ‘eigenfunctions’ are sin(kπx) (k = 1, 2, 3, . . .), so we seek w(x, t) as an eigenfunction expansion w(x, t) = ∞ X ck (t) sin(kπx), k=1 which when we plug it into the PDE for w reads ∞ X 0 2 ck (t) + π 2 k 2 ck (t) sin(kπx) = te−π t sin(πx). k=1 Note we do not have to expand the source term here, as it is already in the form of a (one-term) eigenfunction expansion, and we can just match coefficients: 0 k 6= 1 0 2 2 ck + π k ck = . 2t −π te k=1 Solving these ODEs yields, for k 6= 1, ck (t) = bk e−k 2 π2 t , 2 and for k = 1, using the integrating factor eπ t , h 2 i0 eπ t c1 (t) = t =⇒ 1 2 eπ t c1 (t) = t2 + b1 2 4 1 2 2 =⇒ c1 (t) = t2 e−π t + b1 e−π t . 2 So the general solution for w is ∞ X 1 2 2 2 w(x, t) = t2 e−π t sin(πx) + bk e−k π t sin(kπx). 2 k=1 But the initial conditions read 0 = w(x, 0) = ∞ X bk sin(kπx), k=1 2 so we see b1 = b2 = b3 = · · · = 0, and so w(x, t) = 21 t2 e−π t sin(πx), and thus 1 2 u(x, t) = 5x + t2 e−π t sin(πx). 2 5