Computational Methods in Physics ASU Physics PHY 494

16 Partial Differential Equations (PDEs)

Most physical phenomena are ultimately described by a relationship between changing quantities. If only a single quantity such as time is changing, Ordinary Differential Equations (ODEs) result. However, as soon as more than a single quantity varies independently from the other ones, partial differential equations (PDEs) have to be solved.

For example, a scalar field admits the general PDE

For notational convenience, partial derivatives are often written in subscript notation, so the same general equation reads

Classes of second-order PDEs

Second-order PDEs (highest partial derivatives are second order, such as or ) are ubiquitous in physics and can be classified as

  • elliptic PDEs (discriminant , second derivatives of all variables and all with the same sign, e.g., Poisson's equation );
  • parabolic PDEs (, second order derivative of one variable and first order derivative of the other one, e.g., the heat equation );
  • hyperbolic PDEs (, second derivatives of all variables with the opposite sign, e.g. wave equation ).

Boundary conditions

PDEs are more complicated than ODEs. General solutions of PDEs involve arbitrary functions and additional boundary conditions (values or derivatives of the solution on the boundary of the problem domain) have to be specified to obtain a specific solution (in addition to any initial conditions).

  • Dirichlet boundary conditions prescribe the value of the solution on a surrounding closed surface.
  • Neumann boundary conditions specify the value of the normal derivative on the surrounding surface.
  • Cauchy boundary conditions set both the value and the normal derivative on the surrounding closed surface (i.e., both Dirichlet and Neumann boundary conditions are imposed).
  • Robin boundary conditions specify that a weighted sum of Dirichlet and Neumann boundary conditions have to have a given value on the boundary.

Often, no analytic solutions can be found or the analytic solutions are unwieldy. PDEs can be solved numerically, though. However, different types of PDEs require customized algorithms.

Solving PDEs numerically

We will look at various finite difference schemes (both explicit and implicit) to solve the different classes of PDEs.

The movies show how the solutions of simple electrostatic problems relax to the converged solution (using successive over-relaxation with the Gauss-Seidel algorithm.)

Class material

  1. 16_PDEs-1.ipynb 1: Poisson's and Laplace's equation: Background (board notes on PDEs (PDF)), Gauss-Seidel algorithm, problems: 16_PDEs-1-Students.ipynb 2
  2. 16_PDEs-2.ipynb 1: fast Jacobi, Gauss-Seidel and Successive Over Relaxation algorithms (using NumPy array operations, see board notes on numpyfied Poisson solvers (PDF)) and how to replace slow Python loops with fastnumpy array operations (numpy_arrays.ipynb), Poisson equation, charge density: 16_PDEs-2-Students.ipynb 2
  3. When plotting arrays of data with matplotlib, one sooner or later one needs to use the numpy.meshgrid() function which "returns coordinate matrices from coordinate vectors"—most users find this function mystifying. The notebook meshgrid.ipynb makes a bit clearer, what meshgrid does and why it is useful.

Additional resources


Footnotes

  1. Notebook will be posted after class; in the mean time look at the student notebook.  2

  2. As usual, git pull the resources repository PHY494-resources to get a local copy of the notebook. Then copy the notebook and all other code into your work directory in order to complete the exercises.  2