An efficient Multigrid calculation of the Far field and Near Field map for Helmholtz and Schrödinger problems Department of Mathematics and Computer Science, University of Antwerp, Belgium Siegfried Cools∗ , Bram Reps† , Wim Vanroose‡ November 15, 2013 ∗ BOF U. Antwerpen FWO Flanders ‡ BOF U. Antwerpen † Far and Near field maps Cross sections in chemical reactions Near Field Scanning Microscope Helmholtz equation: far- and near field. Solvers and deforming the contour of volume integral. Schrödinger equations are Helmholtz equations No free lunch? Discussion and Conclusions Helmholtz equation The total wave solution utot satisfies the homogeneous Helmholtz equation −∆ − k 2 (x) utot (x) = 0 on Ω ⊂ Rd , d ≥ 1, with no wave source present within the domain. Space-dependent wave number function k defined as k 2 (x)−k 2 0 χ(x)= k2 0 Ω ( k(x), k(x) = k0 , for x ∈ O, for x ∈ Ω \ O, where k0 ∈ R, O ⊂ Ω ⊂ Rd . O χ(x) 6= 0 χ(x) = 0 Helmholtz equation Decomposition (uin = e ik0 η·x = incoming wave, u = scattered wave) utot = uin + u, implies ⇒ ⇒ −∆ − k 2 (x) utot (x) = 0 −∆ − k 2 (x) u(x) = (∆ + k 2 (x))uin (x) −∆ − k 2 (x) u(x) = (k 2 (x) − k02 )uin (x), yielding the inhomogeneous scattered wave equation −∆ − k 2 (x) u(x) = f (x) on Ω ⊂ Rd , . where f (x) = (k 2 (x) − k02 )uin (x) = k02 χ(x)uin (x). (1) Helmholtz equation Scattered wave equation (1) −∆ − k 2 (x) u(x) = f (x) on Ω ⊂ Rd , with f (x) = k02 χ(x)uin (x). Solved for u on discretized subset ΩN ⊂ Ω (‘numerical box’) with outgoing wave boundary conditions, e.g. PML, ECS. Far- and near field map Assume −∆ − k 2 (x) u N (x) = k02 χ(x)uin (x) −∆ − k02 u(x) = k02 χ(x)(uin (x) + u N (x)) {z } | for x ∈ Ω, for x ∈ Rd , g (x) Analytic solution using Helmholtz Green’s function: Z u(x) = G (x, x0 ) g (x0 ) dx0 d ZR = G (x, x0 ) k02 χ(x0 ) uin (x0 ) + u N (x0 ) dx0 , Ω x ∈ Rd . . Calculate u in any point x ∈ Rd outside the numerical box, using only the information inside the numerical box. Far field mapping Let x = (α, ρ) be given by a unit vector α ∈ Rd and length ρ ∈ R. Asymptotic form of G (x, x0 ) (separable) yields the far field (ρ → ∞) wave pattern for u lim u(ρ, α) = D(ρ)F (α), ρ→∞ where Z F (α) = 0 e −ik0 x ·α g (x0 ) dx0 . Ω is the far field amplitude map. 2D schematic: F (α) uin O α ∈ Rd , α (2) Far field mapping Note that the far field integral can be split into a sum of two contributions: F (α) = I1 + I2 , with Z Z −ik0 x·α I1 = e χ(x)uin (x)dx and I2 = e −ik0 x·α χ(x)u N (x)dx Ω Ω {z } {z } | | all factors known explicitly requires u N (x) for x ∈ Ω ! Far field mapping Note that the far field integral can be split into a sum of two contributions: F (α) = I1 + I2 , with Z Z −ik0 x·α I1 = e χ(x)uin (x)dx and I2 = e −ik0 x·α χ(x)u N (x)dx Ω Ω {z } {z } | | all factors known explicitly requires u N (x) for x ∈ Ω ! Summary: Far field map calculation in a nutshell: I Step 1. Solve the Helmholtz eqn. (1) for u to obtain a solution u N on a numerical domain. I Step 2. Calculate/approximate the Fourier integral (2) on the given numerical domain. Far field mapping Note that the far field integral can be split into a sum of two contributions: F (α) = I1 + I2 , with Z Z −ik0 x·α I1 = e χ(x)uin (x)dx and I2 = e −ik0 x·α χ(x)u N (x)dx Ω Ω {z } {z } | | all factors known explicitly requires u N (x) for x ∈ Ω ! Summary: Far field map calculation in a nutshell: I Step 1. Solve the Helmholtz eqn. (1) for u to obtain a solution u N on a numerical domain. main computational bottleneck I Step 2. Calculate/approximate the Fourier integral (2) on the given numerical domain. Iterative Solution I Helmholtz equation is hard to solve with iterative methods. −∆ − k 2 (x) u(x) = f (x) (3) Elman, Ernst and O’Leary, 2002 Ernst and Gander, 2012 I Complex Shifted Laplacian as a preconditioner. −∆ − (1 + iβ)k 2 (x) u(x) = f (x) Erlangga, Oosterlee and Vuik, 2006, Cools and Vanroose, 2013 (4) Multigrid Two-grid correction scheme • Relax ν1 times on Ah v h = f h (e.g. ω-Jacobi, Gauss-Seidel, . . . ). • Compute r h = f h − Ah v h , restrict r 2h = Ih2h r h , and solve A2h e 2h = r 2h . h 2h • Interpolate e h = I2h e and correct h h h v ←v +e . • Relax ν2 times on Ah v h = f h . Multigrid V-cycle = recursion. Convergence Erlangga, Oosterlee, Vuik, SISC, 2006 Complex contour method ={z} For u and χ analytic the far field integral Z I2 = e −ik0 x·α Ω Z1 Z2 γ <{z} N χ(x) u (x) dx | {z } difficulty can be calculated over a complex contour Z = Z1 + Z2 , rather than over the real domain Ω, i.e. Z I2 = e Z1 | −ik0 z·α N χ(z)u (z)dz + {z } requires u N (z) for z ∈ Z1 ! Z Z2 e −ik0 z·α χ(z)u N (z)dz. Complex contour method ={z} For u and χ analytic the far field integral Z I2 = e −ik0 x·α Ω Z1 Z2 γ <{z} N χ(x) u (x) dx | {z } difficulty can be calculated over a complex contour Z = Z1 + Z2 , rather than over the real domain Ω, i.e. Z I2 = e Z1 | −ik0 z·α N χ(z)u (z)dz + {z } requires u N (z) for z ∈ Z1 ! Z Z2 e −ik0 z·α χ(z)u N (z)dz. Solving Helmholtz eqn. on complex contour Complex Shifted Laplacian (CSL) system with β ∈ R −∆ − (1 + iβ)k 2 (x) u(x) = f (x) is efficiently solvable using multigrid. Erlangga Oosterlee Vuik (2004) Discretized: 1 2 − L + (1 + iβ)k uh = bh , h2 with L = Laplacian stencil matrix. Division by (1 + iβ) yields 1 bh 2 − L + k uh = 2 (1 + iβ)h 1 + iβ = the system discretized with √ original Helmholtz . iγ h̃ = 1 + iβ h = ρe h. Reps, Vanroose, bin Zubair (2010) (5) Solving Helmholtz eqn. on complex contour Rule-of-thumb for CSL Helmholtz system (5) can be efficiently solved using multigrid for β > 0.5. Conversion to angle γ h̃ = p 1 + iβ h = ρ exp(iγ)h ⇔ γ= arctan(β) 2 ≈ 13.28◦ β=0.5 Note: softened to γ ≈ 9.5◦ with GMRES as smoother substitute. p . 1 + βi = ρexp(iγ) ={z} h̃ h γ <{z} Numerical validation (2D) χ(x, y ) = − 1 5 e −(x 2 +(y −4)2 ) +e −(x 2 +(y +4)2 ) Object of interest |χ| (modulus) Real domain with ECS |χ(x)| (θECS = 45◦ ) Complex contour |χ(z)| (γ = 14.6◦ ) Numerical validation (2D) χ(x, y ) = − 1 5 e −(x 2 +(y −4)2 ) +e −(x 2 +(y +4)2 ) Scattered wave solution |u| Real domain with ECS |u(x)| LU factorization Complex contour |u(z)| V(1,1) cycles (tolres = 10−6 ) Numerical validation (2D) χ(x, y ) = − 1 5 e −(x 2 +(y −4)2 ) +e −(x 2 +(y +4)2 ) Far field amplitude map Real domain with ECS F (α) Complex contour F (α) kFre − Fex k2 = 9.37e-5 kFex k2 kFco − Fex k2 = 1.39e-4 kFex k2 Multigrid performance (3D) Solving the Helmholtz system - complex contour γ = 10◦ GMRES(3)-smoothed V(1,1) cycles (tolres = 10−6 ) nx ×ny ×nz k0 = 1/4 k0 = 1/2 k0 = 1 k0 = 2 k0 = 4 163 323 643 1283 2563 10 (0.79s.) 0.24 12 (0.92s.) 0.31 7 (0.62s.) 0.13 2 (0.28s.) 0.00 1 (0.20s.) 0.00 9 (4.65s.) 0.20 10 (4.96s.) 0.24 13 (6.59s.) 0.32 8 (4.24s.) 0.14 2 (1.35s.) 0.00 9 (44.2s.) 0.21 10 (48.3s.) 0.22 11 (54.6s.) 0.27 13 (63.9s.) 0.33 7 (36.1s.) 0.12 9 (352s.) 0.20 10 (390s.) 0.23 10 (387s.) 0.24 11 (428s.) 0.27 13 (503s.) 0.33 9 (2778s.) 0.20 9 (2797s.) 0.21 10 (3079s.) 0.24 10 (3006s.) 0.24 11 (3306s.) 0.26 Multigrid performance (3D) Solving the Helmholtz system - complex contour γ = 10◦ k0 h = 0.625 GMRES(3)-smoothed V(1,1) cycles (tolres = 10−6 ) nx ×ny ×nz k0 = 1/4 k0 = 1/2 k0 = 1 k0 = 2 k0 = 4 163 323 643 1283 2563 10 (0.79s.) 0.24 12 (0.92s.) 0.31 7 (0.62s.) 0.13 2 (0.28s.) 0.00 1 (0.20s.) 0.00 9 (4.65s.) 0.20 10 (4.96s.) 0.24 13 (6.59s.) 0.32 8 (4.24s.) 0.14 2 (1.35s.) 0.00 9 (44.2s.) 0.21 10 (48.3s.) 0.22 11 (54.6s.) 0.27 13 (63.9s.) 0.33 7 (36.1s.) 0.12 9 (352s.) 0.20 10 (390s.) 0.23 10 (387s.) 0.24 11 (428s.) 0.27 13 (503s.) 0.33 9 (2778s.) 0.20 9 (2797s.) 0.21 10 (3079s.) 0.24 10 (3006s.) 0.24 11 (3306s.) 0.26 Multigrid performance (3D) Solving the Helmholtz system (k0 = 1) - complex contour γ = 10◦ GMRES(3)-smoothed FMG(1,1) cycle nx × ny × nz 163 323 643 1283 2563 CPU time kr k2 0.20 s. 3.3e-5 0.78 s. 7.9e-5 6.24 s. 2.7e-5 53.3 s. 1.1e-5 462 s. 4.6e-6 R Intel CoreTM i7-2720QM 2.20GHz CPU, 6MB Cache, 8GB RAM. Multigrid performance (3D) Solving the Helmholtz system (k0 = 1) - complex contour γ = 10◦ GMRES(3)-smoothed FMG(1,1) cycle R Intel CoreTM i7-2720QM 2.20GHz CPU, 6MB Cache, 8GB RAM. System with two electrons r1 = (x, y , z)1 r2 = (x, y , z)2 (6) Schrödinger equation is a Helmholtz equation 1 − (∆r1 + ∆r2 ) + V (r1 , r2 ) − E u(r1 , r2 ) = f (r1 , r2 ) 2 (7) Schrödinger equation is a Helmholtz equation 1 − (∆r1 + ∆r2 ) + V (r1 , r2 ) − E u(r1 , r2 ) = f (r1 , r2 ) 2 (7) Defining k 2 (r1 , r2 ) := 2(E − V (r1 , r2 )) leads to a 6D Helmholtz equation −∆6D − k 2 (r1 , r2 ) u(r1 , r2 ) = f (r1 , r2 ) (8) Schrödinger equation is a Helmholtz equation 1 − (∆r1 + ∆r2 ) + V (r1 , r2 ) − E u(r1 , r2 ) = f (r1 , r2 ) 2 (7) Defining k 2 (r1 , r2 ) := 2(E − V (r1 , r2 )) leads to a 6D Helmholtz equation −∆6D − k 2 (r1 , r2 ) u(r1 , r2 ) = f (r1 , r2 ) (8) Again the solution outside the numerical box can be found from Z u(r1 , r2 ) = G (r1 , r2 , s1 , s2 ) f (s1 , s2 ) − k02 χ(s1 , s2 )u N (s1 , s2 ) ds1 ds2 V (9) Example in 2D. Spectral properties. The Hamiltonian 1 d2 1 d2 − −4.5 exp(−x 2 )−4.5 exp(−y 2 )+2 exp(−(x+y )2 ) 2 dx 2 2 dy 2 (10) It can be written as H=− H = H1d ⊗ I + I ⊗ H1d + 2 exp(−(x + y )2 ) (11) where 1 d2 − 4.5 exp(−x 2 ) 2 dx 2 The eigenvalues of 2D system are then approximately: H1d = − λ2D ≈ µ1d + µ1d where H1D φi = µi φi (12) (13) Eigenvalues of 1D Hamiltonian The example 1 d2 − 4.5 exp(−x 2 ) 2 dx 2 For the example the 1D Hamiltonian has eigenvalues H1d = − (14) σ(H1D ) = {−1.0215} ∪ [0, ∞( When we discretize the Lapacian with finite differences. h → he iθ Real contour Complex Contour Eigenvalues of 2D Hamiltonian The eigenvalues of H = H1d ⊗ I + I ⊗ H1d Real Contour Complex Contour Solution depends on the energy E µ0 < E < 0 0<E Solution depends on the energy E single ionization double ionization ={z} Z1 γ Z2 <{z} 2D model problem 1 d2 1 d2 − −4.5 exp(−x 2 )−4.5 exp(−x 2 )+2 exp(−(x+y )2 ) 2 dx 2 2 dy 2 (15) We discretize with 2552 grid points. E< −1.0215 < E ¡ <0<E no scattering single ionization single and double ionization H=− Validation of the resulting far field map ·10−3 Total Cross section single ionization CC single ionization double ionization CC double ionization crosssection(au) 4 3 2 1 0 −1 0 1 E 2 3 V-cycle convergence rate as function of Energy. 2552 , V-cycle with GMRES(3) smoother. 3D model problem H = −∆3D + V (x) + V (y ) + V (z) + V12 (x, y ) + V12 (y , z) + V12 (z, x) (16) We discretize with 2553 grid points. E< −1.8 < E < −1.0215¡ E no scattering single single and double <0<E single, double and trip 3D Benchmark Multigrid Convergence rate 2553 grid points, V-cycle with GMRES(3) smoother, 1 0.8 0.6 0.4 0.2 0 −4 −2 0 2 E 4 6 8 No free lunch? The larger β, or γ (rotation angle), the larger the damping in the Helmholtz equation, the better the multigrid convergence. −∆ − (1 + iβ)k 2 u = f (17) In principle, the value of the integral Z u(x) = G (x, x0 ) k02 χ(x0 ) uin (x0 ) + u N (x0 ) dx0 , Ω should be independent of the complex shift β. x ∈ Rd . Example with Coulomb Potentials Incoming wave is evanenescant wave φn (x) sin(kn y ) wherep φn (x) is an eigenstate with eigenvalue λn and kn = 2(E − λn ) However, φn is calculated numerically (18) Incoming wave on the contour φn (x) sin(kn y ) (19) Contaminates the volume integral The scattered wave is contaminated After multiplication with exponentially growing function the volume integral is contaminated Possible Solutions? WIP I I Smaller rotation angles? Shift and invert iteration increases the accuracy of the eigenstate. But also object needs to be know very accurately. Comments 1. For educational purposes we have used a volume integral to calculate the far and near field map. Using Green’s second theorem it can be rewritten as a surface integral. It is cheaper and gives the same results. 2. The volume integral is a oscillatory integral. The method of steepest descent allows to calculate the integral without resolving all the oscillation. However, here we have product of an exponentially increasing function and a decaying function. 3. A detailed analysis of the discretization of the complex contour is required. For the integral only points around the origin are required. However, we still need to solve the PDE along the contour accurately, this might require more grid points. Conclusions I There are many applications that require an integral over solution of the Helmholtz equations. This gives additional freedom to develop a solver. I We have deformed the contour of the integral and this requires us to solve a Complex Shifted Laplacian problem. I Complex shifted Laplacian problems can be solved scalable with multigrid. But any solver becomes easier: Domain Decomposition, ... I We have validated and bench-marked the method on 3D Helmholtz and Schrodinger problems. I Extra care is required rounding errors might accumulate and contaminate the result. Outlook I I We are working with computational chemists to develop solvers for Schrödinger equations. Coupled electronic and molecular motion: unsolved because of the very high number of dimension. Explore near field integral: I I Phase Contrast Tomography, Near field Microscopy. Inverse problems. We reconstruct the object on the contour. References [1] Y.A. Erlangga, C.W. Oosterlee and C. Vuik. A novel multigrid based preconditioner for heterogeneous Helmholtz problems. SIAM Journal on Scientific Computing 27(4):1471–1492, 2006. [2] H.C Elman, O.G Ernst, D.P O’Leary, A Multigrid method enhanced by Krylov subspace iteration for Discrete Helmholtz Equations, SIAM Journal on Scientific Computing, 23(4):1291-1315 (2001). [3] O.G Ernst and M.J. Gander, Why it is difficult to solve Helmholtz problem with Classical Iterative methods, Numerical Analysis of Multiscale Problems, LNCS, 83:325-263, 2012. [4] W. Vanroose, D.A. Horner, F. Martin, T.N. Rescigno and C.W. McCurdy. Double photoionization of aligned molecular hydrogen. Physical Review A, 74(5):052702, 2006. [5] B. Reps, W. Vanroose and H. bin Zubair. On the indefinite Helmholtz equation: Complex stretched absorbing boundary layers, iterative analysis, and preconditioning. Journal of Computational Physics 229(22):8384–8405, 2010. [6] S. Cools, B. Reps and W. Vanroose. An efficient multigrid method calculation of the far field map for Helmholtz problems. Submitted SISC arXiv:1211.4461, 2013.