Showing posts with label numerical methods. Show all posts
Showing posts with label numerical methods. Show all posts

Monday, February 8, 2016

The Slimplectic Integrator (pt II): The Nonconservative action principle and Variational Integration

In part I of this post I discussed how N-body variational integrators can be constructed (by discretizing the action integral itself, then finding the Euler-Lagrange equations of the discretized action), and why Noether's theorem means that this will give good long term behavior for conserved quantities like Energy, or Angular Momentum.

However, because this method relies on the existence of an action, to be discretized, it only works for conservative systems. In order to be able to apply this numerical method to systems where there is dissipation, drag or some other nonconservative (polygenic, path-dependent, or irreversible) forces we will need an equivalent of the action for such systems. Additionally, in order to guarantee good long-term behavior, we will also need a version of Noether's theorem that applies to such an action.

The Nonconservative Action Principle


In Galley (2013) and Galley, Tsang & Stein (2014), we recently developed such a Nonconservative Action Principle, adapting Hamilton's principle to apply to nonconservative physics.

Nonconservative forces can arise when a subset of the true physical degrees of freedom of a system are ignored, often through a natural separation of scales, or by experimental design. 

Even though, micro-physically, a damped harmonic oscillator is well described by a Lagrangian or Hamiltonian if one includes all the particles and/or thermal degrees of freedom in the damper, when one integrates-out those micro-physical degrees of freedom the system should look nonconservative. 
Usually we are forced to "integrate out" these inaccessible degrees of freedom at the level of the equations of motion. When integrating out at the level of the (normal) action, things tend to become acausal, where the evolution of the system depends on both the initial and final configurations of the system (and thus inconsistent with the correct equation of motion description).

The reasons for this are technical (and may be worth another post), but are related to how Hamilton's principle is traditionally constructed as boundary value problem in time, rather than an initial value problem.
Left: Hamilton's principle requires a minimization of a path between $q_i$ at time $t_i$, and $q_f$ at time $t_f$, describing a boundary value problem in time. Right: The nonconservative action principle doubles the paths, allowing the position at $t_f$  to vary, consistent with an initial value problem. The paths are varied separately, with an equality condition at the final time, and then set equal after taking the Physical Limit. 

Instead Chad constructed the nonconservative action principle to be consistent with an initial value problem. This involves doubling the degrees of freedom and varying each separately subject to a final time equality condition that closes the loop (see figure above), allowing the final time values of the system to vary freely. This is related to the closed-time-path Schwinger-Keldish formalism in non-equilibrium quantum mechanics (in fact in an appendix here we showed how this formalism is the formal classical limit of such a quantum theory).

By moving to this extended, doubled phase-space, extremizing the action over each path, and then equating the doubled variables together (we call this taking the Physical Limit), we gain the freedom to allow nonconservative effects to be included. These nonconservative effects show up in the nonconservative potential $K(q_1, q_2, \dot{q}_1, \dot{q}_2, t)$, which couples the two paths together, and can appear in the nonconservative action. By construction, inaccessible degrees of freedom can also be integrated-out in a self-consistent way, at the level of the action, with no acausal effects.

To construct the nonconservative potential, $K$, which captures the non-hamiltonian physics, one can either build it from known dissipative equations of motion through an adjoint procedure, often equivalent to the Lagrange-d'Alembert approach, or one can build it from known microphysical actions by integrating out inaccessible degrees of freedom.

The Nonconservative Noether's Thoerem

We needed two parts to make a variational integrator work, an action principle, whose action integral can be discretized, and Noether's theorem, to exploit the symmetries of the action to correctly evolve (or preserve) the Noether currents. It turns out that we can prove a generalized Noether's theorem for the nonconservative action principle. The Noether currents are still defined by the symmetries of the conservative parts of the action, but their evolution is described by derivatives of the non-conservative potential $K$.

The nonconservative version of Noether's theorem.


The Slimplectic Integrator


By applying the variational integrator procedure (discussed in part I) to this new action principle we are able to construct general nonconservative variational integrators that are no longer limited to conservative systems (see figure below). We call these “slimplectic” integrators as the phase space volume tends to slim-down for dissipative systems). Slimplectic integrators have all the long-term stability properties of symplectic integrators but can be applied to general nonconservative systems.

This allows long-term numerical evolution of orbital dynamics problems where dissipative or velocity dependent effects, such as tides, drag, or magnetic interactions, can become dynamically important.


Top: For a standard numerical integrator equations of motion are discretized using well-known methods (e.g. Runge-Kutta) in order to derive discrete equations of motion that can be solved numerically. Such algorithms tend to experience long-term instability of quantities that should be physically conserved, as these discrete equations of motion are not connected to the action, and Noether’s theorem does not hold.
Middle: Variational Integrators work by first discretizing the action integral using numerical quadrature. Varying the discretized action produces already discretized equations motion that can be exactly (up to round-off) solved numerically. If the choice of discretization preserves the symmetries of the original action in the discretized action, then Noether’s theorem guarantees the solutions of the discrete equations of motion will preserve the constants of motion (e.g. angular momentum) up to round-off. This is why variational integrators (such as symplectic integrators) have such impressive long-term conservation properties compared to other numerical methods.
Bottom: By applying the Variational Integrator procedure to the Nonconservative Action formalism, we have developed a new type of integrator that has all the long-term integration benefits of a symplectic or variational integrator, but that can be applied to nonconservative systems. By discretizing the Nonconservative Action, and applying the nonconservative variational principle, the discrete equations of motion are guaranteed by the generalized Noether’s theorem (Galley, Tsang, & Stein 2014) to evolve the Noether currents “correctly” during long-term integrations.
We have developed a simple public python-based demonstration code on github that can be used to numerically integrate any system by specifying the (nonconservative) action. Included below are links to several example of a nonconservative system evolved using the slimplectic and traditional (Runge-Kutta) numerical schemes. The slimplectic integrators have fractional energy error that remains bounded, even as the system’s energy evolves, while the traditional methods have fractional energy errors that grow linearly with time.

The slimplectic iPython notebook samples are:

A damped simple oscillator
Poynting-Robertson drag (see figures below)
Post-Newtonian gravitational-wave inspiral of neutron star binaries

In this example we model the effect of Poynting-Robertson drag on a dust grain as it orbits the sun. Poynting-Robertson drag occurs because the dust grain absorbs incoming radiation from the sun, and re-emits in the frame co-moving with the dust particle. This leads to anisotropic radiation in the observer’s frame and a net dissipative drag force. In this case the dust particle begins with an eccentricity 0.2, and semi-major axis a = 1 AU.


The RK methods have poor long term stability, with energy error growing linearly with time, while the energy error remains bounded for the slimplectic methods. However, there is significant precession in the 2nd order slimplectic method, due to the lack of conserved quantity that prevents precession. The phase errors of the slimplectic methods scale linearly with time, while the phase errors of the RK method scale quadratically. The growth at the end of the evolution for the 4th order Slimplectic method is likely due to a build-up of zeroing/round-off error due to the simple implementation.






Friday, January 29, 2016

The Symplectic Integrator (pt 1): Traditional vs Variational Integrators

To start us off, this is more of an in-depth research post, something I had been meaning to write up for a while, describing some recent work that Leo and I have done with our friend Chad Galley at Caltech, and Alec Turner, an undergraduate student I worked with at McGill University.

This work stemmed out of previous work that Chad, Leo and I had done together extending Chad's gorgeous work on nonconservative actions. I won't discuss the nonconservative action formalism in this post, but I will provide a brief summary next week in part 2 in order to describe our use of it for the "Slimplectic" Integrator.

Traditional vs Symplectic Integration

Long-term numerical integration of physical systems are extremely important when studying the stability and evolution of planetary systems, or other astrophysical N-body systems. Traditional integration methods, such as explicit Euler or classical Runge-Kutta schemes, are unstable over thousands or millions of dynamical times, leading to errors in the constants of motion, e.g. energy or momenta, that tend to grow linearly with time. 

In a classic paper of computational astrophysics, Jack Wisdom and Matt Holman described a "symplectic map" for N-body dynamics which allowed for long-term integrations of (conservative) N-body orbits to occur, while preserving physical properties like the constants of motion. Symplectic integrators can be built by partitioning a system's Hamiltonian and then applying the BCH theorem in order to derive mappings that approximate the motion up to a given order.

Traditional integrators, which can be built to minimize the local "error" in the integration-step, can perform comparatively better over short integrations, however in the long term, the non-linear error resulting from the drifting of "constants" of motion make them far worse than symplectic methods.

Solar system evolution stability using first-order traditional and variational (symplectic) integrators. (Hairer, Lubich & Wanner 2006)

Plots of the energy and angular momentum drift from another set of integrations comparing a 4th order symplectic integrator (SI4) to 4th order Runge-Kutta (RK4) taken from Kinoshita (1991).

In order to understand why methods like symplectic integrators are able to preserve the physical constants of motion so well it is helpful to utilize the framework of Variational Integrators and Noether's Theorem.

Noether's Theorem

Of course, since we are discussing the preservation of "constants" of motion, any explanation we have should make full use of Noether's theorem. It is one of the most powerful and beautiful theorems in mathematical physics, and describes the relationship between constants of motion and the symmetries of the system.

Noether's theorem is one of the most powerful in mathematical physics.
More precisely, Noether's theorem relates (differentiable) symmetries of the action that describes the system with quantities that will be conserved by the Euler-Lagrange equations that are derived by extremizing that action.

This means that if we can perform continuous transformations to the system that leave the action invariant, then there will be a constant of motion related to that symmetry which is preserved as the system evolves. Thus, time-translation symmetry leads to energy conservation, translational symmetry leads to momentum conservation, and rotational symmetry leads to angular momentum conservation.

For traditional integration methods, like Runge-Kutta, the focus is on approximating the equation of motion. The differential equation of motion is usually discretized into a form that can be implemented directly on a computer through, for example, finite differencing. Thus, even if the original equation of motion is the Euler-Lagrange equation stemming from some particular action, the actual discrete equation of motion that is solved by the computer does not come from the action, and will not know about its symmetries, so Noether's theorem does not apply. In essence this is why traditional integration methods are not able to prevent long-term drift of the so-called "constants" of motion.


Standard integration methods (e.g. Runge-Kutta) focus on discretizing the equations of motion, leading to a disconnect with the original action. This prevents Noether's theorem from applying, and, without the appropriately constant "constants" of motion, long-term instability occurs.

Variational Integration


A simple way to understand how these integrators work is through the framework of variational integrators (see e.g. the fantastic Marsden & West 2001). Symplectic integrators can generally be written (locally) as variational integrators, and I find this approach, championed by the late, great Jerry Marsden at Caltech, to be much more intuitive than the normal symplectic approach. 

Variational Integrators work by discretizing the action integral itself, rather than the equations of motion. By varying an action that is already discretized, discrete equations of motion are obtained which can be exactly numerically implemented, which are indeed the Euler-Lagrange equations of an action that is closely related to the physical one. 

But how do you discretize the action integral? Exactly how you would discretize any integral, through numerical quadrature! By applying well-known numerical quadratures of a given accuracy order, and then varying the discrete action integral, we can obtain discrete equations of motion that are also accurate up to the same order. 

For Variational Integrators, numerical quadrature rules applied to the action integral yield integrators of the same order after the discretized action is varied. Numerical quadrature is much easier to explain to people than the BCH theorem. 

As long as the discretized action possesses the same symmetries as the original action, the discrete Euler-Lagrange equations we obtain from them will be subject to Noether's theorem, conserving the appropriate quantities (in fact Noether's theorem also tells us how to find the form for the associated conserved momenta, which may be slightly different than in the physical system due to the discretization).

The variational integrator first discretizes the action before performing the variation to obtain the discrete equations of motion. As long as the discretized action possesses the same symmetry as the original action, the discrete Euler-Lagrange equations of motion know about an action, and will exactly preserve the appropriate constants of motion, via Noether's Theorem. 

There are a few wrinkles here, of course. By performing the discretization in time, we break the time-translation symmetry in an exponentially small way. This is the reason why symplectic/variational integrators do not precisely preserve energy in the same way they preserve the other momenta. However, it can be shown that the energy error is always bounded, resulting in energy error that oscillates around zero, with an envelope that depends on the resolution. 

Next week...

Of course, because variational integration or symplectic methods involve systems where an action or Hamiltonian can be specified, they are, by and large, restricted to conservative problems. Problems that involve friction, drag, tidal dissipation, or other nonconservative effects cannot take advantage of the traditional symplectic approach. 

Next week, in part 2 of this post, I will talk about how we used our new nonconservative action principle to develop a variational integration method that applies to general nonconservative systems. This "Slimplectic" Integrator* has all the long-term computational benefits of symplectic integrators, but it can be applied to nonconservative systems where regular symplectic integrators cannot be used. 


*I call it this because phase-space volume "slims" down for dissipative systems, but is constant for conservative ones.