Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-5wvtr Total loading time: 0 Render date: 2024-07-22T12:20:55.929Z Has data issue: false hasContentIssue false

8 - Partial differential equations: a pseudospectral approach

Published online by Cambridge University Press:  05 August 2014

John M. Stewart
Affiliation:
University of Cambridge
Get access

Summary

In this chapter, we present two rather different topics, which we have linked together. First we shall study some initial value problems and initial-boundary value problems, where the forward-in-time integration is handled by the “method of lines”. We can treat the spatial derivatives by one of two methods:

  1. finite differencing, the standard approach, which is discussed in every textbook, and some aspects of which will be treated in the next chapter,

  2. spectral methods which, for smooth solutions, will give near exponential accuracy.

For simplicity, we shall study only scalar partial differential equations in one spatial dimension, but everything can be generalized to systems of equations in two or more dimensions. We look first at Fourier methods capable of handling problems with periodic spatial dependence. Then in Section 8.6 we suggest a promising approach using Chebyshev transforms for spatial dependencies that are more general. Unfortunately, there is no pre-existing Python black box package to implement this, but there is legacy Fortran77 code which we list in Appendix B.

The second main topic of this chapter is to present the numpy f2py tool in Section 8.7, so that we can re-use the legacy code of Appendix B to construct Python functions to implement the ideas of Section 8.6. If you are interested in reusing legacy code, then you should study the ideas presented in Section 8.7, to find out how to do it, even if you have no interest in Chebyshev transforms.

Type
Chapter
Information
Python for Scientists , pp. 163 - 183
Publisher: Cambridge University Press
Print publication year: 2014

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×