Numerical discretization of Hamiltonian PDEs
Jason FrankCWI, Amsterdam
6 May 2009Numerical Methods for Time-Dependent PDEs
Hamiltonian Systems
OutlineSymplectic integrators for Hamiltonian ODEs
Hamiltonian systems
Conservation laws
Symplectic integrators
Examples
Symplectic integrators for Hamiltonian PDEs
Infinite dimensional Hamiltonian systems
Hamiltonian semi-discretizations
Examples
Hamiltonian SystemsA Hamiltonian system of ordinary differential equations
Compact notation
More compact
The J above is “canonical”. A non-canonical H.S. is defined equivalently, but with arbitrary skew-symmetric matrix J:
Examples of Hamiltonian ODEsNonlinear pendulum:
Kepler problem
N-body problem
Properties of Hamiltonian ODEsEnergy conservation. The Hamiltonian typically represents the total energy. Along a solution,
The phase flow preserves volume. The divergence of a Hamiltonian vector field is zero.
Flow mapGiven an autonomous ordinary differential equation
define the flow map to be the operator such that
Properties:
Semi-group property:
Mapping of sets:
Symplectic mapsA symplectic map is one whose Jacobian satisfies
The flow map of a Hamiltonian system is symplectic:
The quantity is a quadratic first integral of the coupled system
Symplectic numerical methodA numerical method describes a discrete flow map. For example, Euler’s method:
The numerical map is symplectic if
To prove method is symplectic, it is sufficient to show:
That the derivative of the numerical flow with respect to the initial condition is equivalent to the method applied to the variational equation, and
That the method conserves the invariant S, i.e.
Symplectic numerical methodsFor the implicit midpoint rule
This is equivalent to implicit midpoint applied to the coupled system
Implicit midpoint preserves arbitrary quadratic invariants. Suppose is a first integral. Hence,
Symplectic numerical methodsFor the canonical case, , the quadratic invariant S can
be simplified. Partition , then
It follows that methods for canonical problems which preserve invariants of the following form are symplectic:
The Störmer-Verlet method is
You can check that this method preserves arbitrary quadratic invariants of the above partitioned form.
Backward error analysisClassical error analysis for numerical integrators compares the numerical solution with the exact solution through the initial value.
In backward error analysis we try to find a modified problem for which the numerical trajectory is exact.
This modified differential equation is an expansion in the stepsize parameter:
Forward Euler agrees with the first two terms on the left. But it is a more accurate approximation of the modified equation if we choose:
Backward error analysisFor Hamiltonian systems, it can be shown that the modified vector field associated to a symplectic method has the form
That is, the modified equations are also Hamiltonian with a perturbed energy function.
The asymptotic expansion generally diverges, but may be optimally truncated to a number of terms which grows exponentially as the stepsize is decreased.
Due to conservation of the modified Hamiltonian, the original Hamiltonian is preserved approximately: with bounded variation over exponentially long intervals. For a method of order p:
Compare solutions of the pendulum equations:
using Forward, Backward and Symplectic Eulers.
PendulumFE
BE SE
Statistical mechanicsA Lorenz model with Hamiltonian structure:
This is a simplified, “low-order” model representing some typical behavior of the atmosphere. The solutions are chaotic. Sometimes it is desirable to solve such systems on long time intervals to produce a data set for statistics.
The long time average of a function g of the first two variables is:
Statistical mechanicsSimulations using a standard (4th-order) time integrator show heavy dependence on the method parameters and integration time.
Statistical mechanicsSimulations using even a 1st-order symplectic integrator show give much better statistics.
The combination of energy and volume conservation is crucial for statistics.
Hamiltonian PDEs arise as the infinite dimensional abstraction of Hamiltonian ODEs. Instead of we consider a domain and a Hilbert space with accompanying inner product:
The Hamiltonian is a functional defined by integration over
A Hamiltonian PDE is given by
Where
Examples:
Hamiltonian PDEs
The variational derivative is also defined with respect to the inner product on
For simplicity, we assume a periodic or unbounded domain. The variational derivative is
Conservation of the Hamiltonian is seen by
Variational derivative
Fine print: integration by parts--we assume the boundary terms vanish. If not, there is energy flux across the boundary, so no energy conservation.
Sample calculation
Variational derivative
Only the terms survive
Nonlinear wave equation:
Korteweg-de Vries equation:
Examples of Hamiltonian PDEs
The case V(u) = -cos(u) is the Sine-Gordon equation
The main idea of discretizing Hamiltonian PDEs is to preserve the Hamiltonian structure under spatial semi-discretization, so that we can take advantage of symplectic time integrators.
To do this, it is enough to consider the discretization of the structure (mathematics) to preserve skew-symmetry, and the Hamiltonian (physics) using any convenient quadrature rule.
Define a grid:
Define a discrete inner product:
Quadrature rule:
Discrete structure:
Numerical discretization
The variational derivative
The semi-discretization defines a Hamiltonian ODE
The discrete energy is a first integral of this ODE. But only that quadrature which was used to define H is exactly conserved. An issue of some confusion.
Numerical discretization
The Kortweg-de Vries equation has Hamiltonian structure
Choose Euclidean inner product on
D = central difference operator
Hamiltonian quadrature
Example: KdV equation
Detailed calculation of the variational derivative
Example: KdV equation
Only the terms survive
Rearranging the terms of the summation, using periodicity:
Example: Linear wave equation can be written as a Hamiltonian PDE:
Choosing a collocated placement and central differences as used for KdV gives
The even and odd grid points decouple!
A better approach is to define a staggered placement
Define dual discrete function spaces
Partition
Define dual difference operators
Discretization:
Example: Linear wave equation
Experiments: KdV EquationApplying the two-step leapfrog method
to the semi-discretization of the KdV equation, leads to a blow-up instability.
The same spatial discretization is stable for a symplectic time stepping method.
KdV Equation
In fact, with the symplectic method we can solve the KdV on an interval more than 10x as long.
Statistics of fluids
The equations for an ideal fluid are Hamiltonian with a special structure.
They conserve not only energy but an infinite class of vorticity functionals.
In this experiment we compute the average vorticity and stream function fields on very long time intervals using (a) a finite difference method that conserves energy and one vorticity functional, and (b-d) a symplectic method that conserves energy in BEA sense and all vorticity integrals.
Statistical studies, weather/climate.
γ = 0
0 2 4 60
2
4
6γ = 2
0 2 4 60
2
4
6
γ = 4
0 2 4 60
2
4
6γ = 6
0 2 4 60
2
4
6
−0.4
−0.2
0
0.2
0.4
0.6
−1 −0.5 0 0.5 1−1
−0.5
0
0.5
1
γ = 2
q̄
!̄−1 −0.5 0 0.5 1−1
−0.5
0
0.5
1
q̄
!̄
γ = 0
−1 −0.5 0 0.5 1−1
−0.5
0
0.5
1
γ = 4
q̄
!̄−1 −0.5 0 0.5 1−1
−0.5
0
0.5
1
q̄!̄
γ = 6
Exercises1. Prove that the symplectic Euler method is symplectic
2. Consider the nonlinear Schrödinger equation:
a. Show that this is Hamiltonian with
b. Show that there is an additional conserved quantity
c. Derive a Hamiltonian semi-discretization for this equation
d. Determine if your discretization preserves the second invariant
e. Which time integrator would do the best job of preserving the invariants?