Differential Algebra (DA) based Fast Multipole Method (FMM) Department of Physics and Astronomy Michigan State University June 27, 2010
Space charge effect Space charge effect : the fields of the charged particles in a bunch on each other affect the motion of themselves. Pair-to-pair method, time consuming, O(N 2 ) Tree code, O(N log N). (The field of the electrons far away from the observer point, can be represented by the field of a multipole.) Fast multipole method, much faster, O(N). (Multipole expansion and local expansion, recursive progress.)
Space charge effect L M O(N log N) M O(N)
History of FMM 1 J.Barnes, and P.Hut. A Hierarchical O(N log N) Force-Calculation Algorithm. Nature Vol. 324, pp. 446-449, Dec. 4, 1986 2 L.Greengard, and V.Rokhlin. A Fast Algorithm for Particle Simulations. J. Comput. Phys. 73, pp. 325-348, 1987 3 J.Carrier, L.Greengard, and V.Rokhlin. A Fast Adaptive Multipole Algorithm for Particle Simulations. SIAM J. Sci. Stat. Comput. Vol. 9, No. 4, pp. 669-686, July 1988. 4 R.Beatson and L.Greengard. A Short Course on Fast Multipole Methods. Numerical Methematics and Scientific Computation, Wavelets, Multilevel Methods and Elliptic PDEs. Oxford University Press, pp. 1-37, 1997 5 B.Shanker and H.Huang. Accelerated Cartesian Expansions - A Fast Method for Computing of Potentials of the Form R ν for All Real v. J. Comput. Phys. 226, pp. 732-753, 2007
Some concepts Cut box, near region, and far region. First Level Second Level Near region (neighbors) Far region
Some concepts Interaction list and how it works. Interaction list Interaction list Already calculated
Brief introduction of FMM The process of FMM can be described as follows. Select the level of boxes according to the accuracy needed. From the finest level to the coarest level, calculate the multipole expansion of the charges inside each box. For each box in each level, convert the multipole expansions of the boxes in its interaction list into its local expansion. From the coarest to the finest level, translate the local expansion of each box into its child boxes and add it to the local expansion of the child box In the finest level, in each box calculate the potential or field by the local expansion on each particle inside. The potentials or fields of the particles inside the box or in its near region are calculated directly.
Automatic Taylor expansion of a function f (x + δx) = f (x) + f (x)δx + 1 2! f (x)δx 2 + 1 3! f (x)δx 3 +... In Cosy, f (x+da(1)) = f (x)+f (x)da(1)+ 1 2! f (x)da(1) 2 + 1 3! f (x)da(1) 3 +... Composition of two maps G(x) = G(F) F(x), or G(x) = G(F(x)) In COSY, it can be done by the command POLVAL L P NP A NA R NR
Multipole expansion from charges R(x, y, z) R(x, y, z) R 1 R2 φ R ( R i ) = φ R ( M) M S(0, 0, 0) S(0, 0, 0) R i
Multipole expansion from charges (for boxes in the finest level) φ c2m = with N i=1 Q i (xi x) 2 + (y i y) 2 + (z i z) 2 = 1 + x2 i +y2 i +zi 2 x 2 +y 2 +z 2 d 1 = d 3 = Q i / x 2 + y 2 + z 2 2x ix x 2 +y 2 +z 2 2y iy x 2 +y 2 +z 2 2z iz x 2 +y 2 +z 2 Q i d 1 =, 1 + (xi 2 + yi 2 + zi 2)d2 1 2x id 2 2y i d 3 2z i d 4 1 x 2 + y 2 + z 2 = 1 r, d 2 = y x 2 + y 2 + z 2 = y r 2, d 4 = x x 2 + y 2 + z 2 = x r 2, z x 2 + y 2 + z 2 = z r 2,
Multipole expansion in the higher level boxes M M M M M
Translation of a Multipole Expansion R(x, y, z) R(x, y, z ) S (x s, y s, z s) M S (0, 0, 0) M S(0, 0, 0) φ R ( M) = φ R ( M ) S( x s, y s, z s)
DA variables in S frame. d 1 = 1 x 2 + y 2 + z 2 = 1 r, d 2 = d 3 = y x 2 + y 2 + z 2 = y x x x 2 + y 2 = + z 2 r 2, r 2, d 4 = z x 2 + y 2 + z 2 = z Relation between the new and old DA variables (M 1 ). d 1 = 1 + (x s 2 + y s 2 + z s 2 ( d d 2 = 2 d 1 2 + x s d 1 )d 2 ) ( d d1 2, d 3 = 3 d 1 2 + y s 1 + 2x s d 2 + 2y s d 3 + 2z sd 4 Potential in S frame is φ m2m = φ c2m M 1. r 2, ) ( d d1 2, d 4 = 4 d 1 2 + z s ) d 2 1.
Conversion of a Multipole Expansion (in the interaction list) into a Local Expansion R(x, y, z) R(x, y, z ) O(x o, y o, z o ) L O(0, 0, 0) M S(0, 0, 0) φ R ( M) = φ R ( L) S( x o, y o, z o )
DA variables in the observer frame O. d 1 = x, d 2 = y, d 3 = z. Relation between the DA variables in the source frame S and the observer frame O. (M 2 ) d 1 = 1 (xo + d 1 )2 + (y o + d 2 )2 + (z o + d 3 )2 d 2 = d 3 = d 4 = x o + d 1 (x o + d 1 )2 + (y o + d 2 )2 + (z o + d 3 )2, y o + d 2 (x o + d 1 )2 + (y o + d 2 )2 + (z o + d 3 )2, z o + d 3 (x o + d 1 )2 + (y o + d 2 )2 + (z o + d 3 )2. The potential in the observer frame O is φ m2l = φ c2m M 2.
Local Expansion inherited from the parent box. L L L L L
Translation of a Local Expansion R(x, y,z) R(x, y, z ) L L O (x o, y o, z o) O(0, 0,0) O (0,0, 0) φ R ( L) = φ R ( L ) O( x o, y o, z o)
DA variables in the new observer frame O. d 1 = x, d 2 = y, d 3 = z. Relation between the DA variables in the old and new frame. (M 3 ) d 1 = x o + d 1, d 2 = y o + d 2, d 3 = z o + d 3. The potential in the observer frame O is φ l2l = φ m2l M 3.
Field is easy to calculate. In the local expansion, the potential is represented as a polynomial of the local coordinates. The calculate the field, one just need to take derivative of the the respect coordinate. This is also important in the high order map method.
Check the convergence. Case 1, source box center (0,0,0), observer box center (2,0,0), length of the box side 1, 50 electrons in each box, repeat 1000 times. order 3 4 5 6 7 M error 1.488E-3 1.040E-3 1.454E-4 6.067E-5 2.104E-5 L error 3.026E-3 1.264E-3 2.170E-4 8.357E-5 2.655E-5 Case 2, source box center (0,0,0), observer box center (2,2,0), length of the box side 1, 50 electrons in each box, repeat 1000 times. order 3 4 5 6 7 M error 3.923E-4 1.038E-4 2.196E-5 7.561E-6 1.482E-6 L error 7.109E-4 1.568E-4 3.698E-5 9.741E-6 2.075E-6
Case 3, source box center (0,0,0), observer box center (2,2,2), length of the box side 1, 50 electrons in each box, repeat 1000 times. order 3 4 5 6 7 M error 2.567E-4 7.852E-5 8.991E-6 2.315E-6 4.031E-7 L error 4.281E-4 1.088E-4 1.475E-5 3.451E-6 6.133E-7 Case 4, DA order 3, 50 electrons in each box, repeat 1000 times, change the position of the observer box,50 electrons in each box, repeat 1000 times. observer (2,0,0) (3,0,0) (4,0,0) (5,0,0) M error 1.488E-3 3.361E-4 1.248E-4 5.966E-5 L error 3.026E-3 6.308E-4 2.116E-4 9.265E-5
Work to do Finish the code,some low level tools for COSY to increase efficiency. How about bunch size in some dimension is much larger/smaller than the other dimensions. Apply it in some simulation. Error Analysis, rigorous error bound by TM.
Thank you!