12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

t482 chapter 18Xi, j-1i-1, j i, j i+1, ji, j+1Figure 18.2 The solutions of the wave equation for four earlier space-time points are used toobtain the solution at the present time. The boundary and initial conditions are indicated bythe white-centered dots.Substituting (18.17) in the wave equation (18.2) yields the difference equationy i,j+1 + y i,j−1 − 2y i,jc 2 (∆t) 2= y i+1,j + y i−1,j − 2y i,j(∆x) 2 . (18.18)Notice that this equation contains three time values: j+1 = the future, j = thepresent, and j−1 = the past. Consequently, we rearrange it into a form that permitsus to predict the future solution from the present and past solutions:y i,j+1 =2y i,j − y i,j−1 + c2c ′2 [y i+1,j + y i−1,j − 2y i,j ] ,c ′ def= ∆x∆t . (18.19)Here c ′ is a combination of numerical parameters with the dimension of velocitywhose size relative to c determines the stability of the algorithm. The algorithm(18.19) propagates the wave from the two earlier times, j and j − 1, and from threenearby positions, i − 1, i, and i +1, to a later time j +1and a single space positioni (Figure 18.2).As you have seen in our discussion of the heat equation, a leapfrog method isquite different from a relaxation technique. We start with the solution along thetopmost row and then move down one step at a time. If we write the solutionfor present times to a file, then we need to store only three time values on thecomputer, which saves memory. In fact, because the time steps must be quite small−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 482

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!