ÈÇÁÆ Ê Ë ÌÁÇÆ

advertisement
1
SECTION
POINCARE
• The Contopoulos and Hénon-Heiles model.
• Numerical integration.
• Numerical computation of the Poincaré section.
“Do or do not, there is no try”, Yoda
• Operating system: GNU/Linux (I don’t care about other OS, do you?).
• Programming language: C.
• Graphic library: Mizar — Giorgilli (1979), fair enough!
• I will give you the code “as is” (GPLv3) . . . enjoy!
REMARK: you are supposed to code!
“Be a man, write your own programs!”, Carles Simó.
“A mathematical formula should never be owned by anybody!
Mathematics belong to God.”, D.E. Knuth.
Poincaré section
–
2
Yes, you need to code!
Keep in mind:
• Real Programmers aren’t afraid to use GOTOs.
• Real Programmers don’t need comments — the code is obvious.
• Real Programmers don’t comment their code.
If it was hard to write, it should be hard to understand.
• The computers in the Space Shuttle were programmed by Real Programmers.
• No Real Programmer works 9 to 5. (Unless it’s the ones at night.)
References:
“Real Programmers Don’t Write Specs”, Tom Van Vleck (1982).
“Real Programmers Don’t Use Pascal”, Ed Post, Tektronix, Wilsonville OR USA. (1983)
Poincaré section
–
3
Tools needed
• C compiler (GCC).
• Make utility (GNU Make).
• Unix shell (Bash).
• Mizar.
• All the material for the exercises is on-line at the page
http://www.mat.unimi.it/users/sansotte/ms ravello2014.html.
• I strongly suggest to use the live GNU/Linux Mint distribution, see
http://www.mat.unimi.it/users/sansotte/2014-ravello/technical info.txt.
Poincaré section
–
4
1.1
The rediscovery of chaos: Contopoulos (1960), Hénon and Heiles (1964)
H(q, p) =
• Equations of motion
ω0 2
ω1 2
1
(p + q02 ) +
(p + q12 ) + q02 q1 − q13 .
2 0
2 1
3
q̇ =
∂H
,
∂p
ṗ = −
∂H
.
∂q
• Problem: study the dynamics of the system.
• Tool: numerical integrations and Poincaré sections.
• The idea is to transform the continuous flow induced of an autonomous differential equation in Rn into
a map Π : Σ → Σ, with Σ ⊂ Rn a (n − 1)-dimensional surface.
Poincaré section
–
5
1.1.1 How to compute the Poincaré section
H(q, p) =
ω0 2
ω1 2
1
(p + q02 ) +
(p + q12 ) + q02 q1 − q13 ,
2 0
2 1
3
ω0 , ω1 > 0 .
• We need a surface transversal to the flow (q0 = 0).
• Fix the initial energy E0 and a point (q1 , p1 ), and compute p1 > 0 such that (0, q1 , p0 , p1 ) ∈ Σ.
• The Poincaré section is the intersection of the orbit with the transversal surface.
• If E0 satisfies
E0 ≤ E c ,
E c = min
the Poincaré section is bounded in the region
ω 2 ω1 ω 3
ω03
+ 0 , 1
24
8
6
,
ω1 2
1
(p + q12 ) − q13 ≤ E0 .
2 1
3
We need an accurate numerical integrator.
“Random numbers should not be generated with a method chosen at random.”, D.E. Knuth.
(it applies also to integration schemes. . .)
Poincaré section
–
6
1.1.2 Runge-Kutta vs. Leap-Frog (order 2)
• Runge-Kutta (RK2): ẋ = f (x),
τ
f (xn ) ,
2
= xn + τ f (xn + dxn+ 12 ) .
dxn+ 21 =
xn+1
• Leapfrog (LF2): ẍ = f (x),
xn+1 = xn + τ ẋn+ 21 ,
ẋn+ 32 = ẋn+ 21 + τ f (xn+1 ) .
Question: How to choose the good one?
Answer: The Hamiltonian flow is symplectic, the leapfrog is symplectic . . . wanna bet?
“An algorithm must be seen to be believed.”, D.E. Knuth.
Poincaré section
–
7
1.1.3 Error against time-step
• RK2 (△) and LF2 (⊕) have the same accuracy.
• For τ too small, the accumulation of round-off
errors is dominant.
1.1.4 Error against integration time
• RK2 (△) shows a linear drift in the error.
• LF2 (⊕) keeps its accuracy!
Poincaré section
–
8
1.1.5 Open the box . . . (error against time-step)
The file hh rk2 errstep.c contains the program that produces the data file needed to reproduce the plot
“error against time-step” (RK2).
Performs the following operations:
• read from the file hh rk2 errstep.inp some parameters;
• compute some “rough” Poincaré sections;
• compute the maximum relative error for different time-steps;
• store the results in hh rk2 errstep.dat.
..............................................................................
The file hh lf2 errstep.c contains the program that produces the data file needed to reproduce the plot
“error against time-step” (LF2).
Performs the following operations:
• read from the file hh lf2 errstep.inp some parameters;
• compute some “rough” Poincaré sections;
• compute the maximum relative error for different time-steps;
• store the results in hh lf2 errstep.dat.
..............................................................................
The file hh comp errstep.c permits to reproduce the plot “error against time-step” (RK2 vs. LF2).
Poincaré section
–
9
1.1.6 Open the box . . . (error against integration time)
The file hh rk2 errtot.c contains the program that produces the data file needed to reproduce the plot
“error against integration time” (RK2).
Performs the following operations:
• read from the file hh rk2 errtot.inp some parameters;
• compute some “rough” Poincaré sections;
• compute the maximum relative error for different integration times;
• store the results in hh rk2 errtot.dat.
..............................................................................
The file hh lf2 errtot.c contains the program that produces the data file needed to reproduce the plot
“error against integration time” (LF2).
Performs the following operations:
• read from the file hh lf2 errtot.inp some parameters;
• compute some “rough” Poincaré sections;
• compute the maximum relative error for different integration times;
• store the results in hh lf2 errtot.dat.
..............................................................................
The file hh comp errtot.c permits to reproduce the plot “error against integration time” (RK2 vs. LF2).
Poincaré section
–
10
1.1.7 Poincaré sections for the Hénon-Heiles (resonant case)
H(q, p) =
ω0 2
ω1 2
1
(p + q02 ) +
(p + q12 ) + q02 q1 − q13 ,
2 0
2 1
3
ω0 = ω1 = 1 .
◦ Energies:
E = 1/100 (upper left);
E = 1/12 (upper right);
E = 1/8 (lower left);
E = 1/6 (lower right).
◦ For low energy the dynamics appears
to be completely ordered.
◦ The separation into two main regions
is due to the 1:1 resonance.
◦ At the center of the main regions there
are fixed points that correspond to periodic orbits; the surrounding curves
represent beat phenomena due to resonance.
◦ For increasing energy a “chaotic sea”
apparently filled by an orbit appears.
◦ Higher order resonances create “ordered islands” inside the chaotic sea.
Poincaré section
–
11
1.1.8 Poincaré sections for the Hénon-Heiles (non-resonant case)
ω0 2
ω1 2
1
H(q, p) =
(p0 + q02 ) +
(p1 + q12 ) + q12 q2 − q23 ,
2
2
3
√
5−1
ω0 = 1 , ω1 =
.
2
E = 0.001
E = 0.024
E = 0.025
E = 0.030
E = 0.034
E = 0.039344
Poincaré section
–
12
1.1.9 Poincaré sections for the Hénon-Heiles (frequencies with different sign)
ω0 2
ω1 2
1
H(q, p) =
(p0 + q02 ) +
(p1 + q12 ) + q12 q2 − q23 ,
2
2
3
√
5−1
ω0 = 1 , ω1 = −
.
2
◦ E = 0.015
◦ The energy surface is not compact.
◦ Many orbits escape to infinity.
◦ Successive enlargements of small
regions (see the scale on the axes).
◦ The phenomenon of “boxes into
boxes”: resonant islands and separatrices creating homoclinic intersections show up at every enlargement.
Poincaré section
–
13
1.1.10 Open the box . . . (Poincaré sections)
The file hh section noX.c allows to interactively set all the parameter of the Hénon-Heiles model and to
compute the Poincaré section.
The program store the points of the Poincaré section in the file hh section noX points.dat and the
corresponding relative errors in hh section noX errors.dat. The accuracy of the Poincaré section can
be improved changing a parameter in the code. The data file can be easily visualized using Gnuplot
(http://www.gnuplot.info/).
..............................................................................
The file hh section X.c allows to interactively compute the Poincaré section for the Hénon-Heiles model.
• If the file hh section X.dat is found, it is supposed to be valid and the previous state is loaded.
• All the operations are stored in hh section X 2.dat. The idea is that after some runs, the good points
are stored in a file that can be used as a skelton to produce nice plots.
The program uses the Mizar graphics library in interactive mode via Tektronix Graphics (xterm).
•
•
•
•
•
•
•
Active keys:
E: change the energy
F: change the frequencies
R: reset
Z: zoom (select a rectangle)
B: change the boundary
C + n: continue the previous orbit (n sections)
<other> + n: compute n sections
Poincaré section
–
14
1.2
Proposed exercises
• Write your own program to compute the Poincaré sections. If the graphics is a problem just save the
date in a text file and use Gnuplot!
• Reproduce the figures reported in this chapter.
• Open the box and have a look at the code.
• Modify the programs that compute the Poincaré sections so as to read the input parameters from file.
• Improve the integration scheme (e.g., RK4, LF4, SBAB ).
“Science is what we understand well enough to explain to a computer.
Art is everything else we do.”, D.E. Knuth.
Poincaré section
–
15
Poincaré section
–
16
Download