Book contents
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Getting started with IPython
- 3 A short Python tutorial
- 4 Numpy
- 5 Two-dimensional graphics
- 6 Three-dimensional graphics
- 7 Ordinary differential equations
- 8 Partial differential equations: a pseudospectral approach
- 9 Case study: multigrid
- Appendix A Installing a Python environment
- Appendix B Fortran77 subroutines for pseudospectral methods
- References
- Index
9 - Case study: multigrid
Published online by Cambridge University Press: 05 August 2014
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Getting started with IPython
- 3 A short Python tutorial
- 4 Numpy
- 5 Two-dimensional graphics
- 6 Three-dimensional graphics
- 7 Ordinary differential equations
- 8 Partial differential equations: a pseudospectral approach
- 9 Case study: multigrid
- Appendix A Installing a Python environment
- Appendix B Fortran77 subroutines for pseudospectral methods
- References
- Index
Summary
In this final chapter, we present an extended example or “case study” of a topic which is relevant to almost all of the theoretical sciences, called multigrid. For many, multigrid is a closed and forbidding book, and so we first look at the type of problems it can be used to solve, and then outline how it works, finally describing broadly how it can be implemented very easily in Python. The rest of the chapter fleshes out the details.
In very many problems, we associate data with points on a spatial grid. For simplicity, we assume that the grid is uniform. In a realistic case, we might want a resolution of say 100 points per dimension, and for a three-dimensional grid we would have 106 grid points. Even if we store only one piece of data per grid point, this is a lot of data which we can pack into a vector (one-dimensional array) u of dimension N = O(106). These data are not free but will be restricted either by algebraic or differential equations. Using finite difference (or finite element) approximations, we can ensure that we are dealing with algebraic equations. Even if the underlying equations are non-linear, we have to linearize them (using, e.g., a Newton–Raphson procedure, see Section 9.3) for there is no hope of solving such a large set of non-linear equations.
- Type
- Chapter
- Information
- Python for Scientists , pp. 184 - 204Publisher: Cambridge University PressPrint publication year: 2014