Computational Methods in Physics ASU Physics PHY 494

15 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 \(U(x, y)\) admits the general second order PDE

\[A(x, y)\frac{\partial^2 U}{\partial x^2} + 2B(x, y)\frac{\partial^2 U}{\partial x \partial y} + C(x, y)\frac{\partial^2 U}{\partial y^2} + D(x, y)\frac{\partial U}{\partial x} + E(x, y)\frac{\partial U}{\partial y} + F(x, y) = 0\]

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

\[A(x, y) U_{xx} + 2B(x, y) U_{xy} + C(x, y) U_{yy} + D(x, y) U_{x} + E(x, y) U_{y} + F(x, y) = 0.\]

Classes of second-order PDEs

Second-order PDEs (highest partial derivatives are second order, such as \(U_{xz}\) or \(U_{tt}\)) are ubiquitous in physics and can be broadly classified as

  • elliptic PDEs (discriminant \(AC - B^2 > 0\), second derivatives of all variables and all with the same sign, e.g., Poisson's equation \(\nabla^2 U(x, y, z) = U_{xx} + U_{yy} + U_{zz} = -4\pi\rho(x,y,z)\));
  • parabolic PDEs (\(AC - B^2 = 0\), second order derivative of one variable and first order derivative of the other one, e.g., the heat equation \(\nabla^2 U(x, y, z, t) - a \frac{\partial U}{\partial t} = 0\));
  • hyperbolic PDEs (\(AC - B^2 < 0\), second derivatives of all variables with the opposite sign, e.g. wave equation \(\nabla^2 U(x, y, z, t) - c^{-2} \frac{\partial^2 U}{\partial t^2} = 0\)).

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 \(U(x,y)\) 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. 15_PDEs-1.ipynb 1: Poisson's and Laplace's equation: Background (board notes on PDEs (PDF)), Gauss-Seidel algorithm, problems: 15_PDEs-1-Students.ipynb 2
  2. 15_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: 15_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