SANDIA REPORT SAND2015-0339 Unlimited Release Printed March 2014 Aleph code electrostatic solver verification Matthew T. Bettencourt Prepared by Sandia National Laboratories Albuquerque, New Mexico 87185 and Livermore, California 94550 Sandia National Laboratories is a multi-program laboratory managed and operated by Sandia Corporation, a wholly owned subsidiary of Lockheed Martin Corporation, for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-AC04-94AL85000. Approved for public release; further dissemination unlimited. Sandia National Laboratories Issued by Sandia National Laboratories, operated for the United States Department of Energy by Sandia Corporation. NOTICE:This report was prepared as an account of work sponsored by an agency ofthe United States Government. Neither the United States Government, nor any agency thereof, nor any of their employees, nor any of their contractors, subcontractors, or their employees, make any warranty, express or implied, or assume any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represent that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government, any agency thereof, or any of their contractors or subcontractors. The views and opinions expressed herein do not necessarily state or reflect those of the United States Government, any agency thereof, or any of their contractors. Printed in the United States of America. This report has been reproduced directly from the best available copy. Available to DOE and DOE contractors from U.S. Department of Energy Office of Scientific and Technical Information P.O. Box 62 Oak Ridge, TN 37831 Telephone: (865)576-8401 Facsimile: (865)576-5728 E-Mail: reports@adonis.osti.gov Online ordering: http://www.osti.gov/bridge Available to the public from U.S. Department of Commerce National Technical Information Service 5285 Port Royal Rd Springfield, VA 22161 Telephone: (800)553-6847 Facsimile: (703)605-6900 E-Mail: orders@ntis.fedworld.gov Online ordering: http://www.ntis.gov/help/ordermethods.asp?loc=7-4-0#online 2 SAND2015-0339 Unlimited Release Printed March 2014 Aleph code electrostatic solver verification Matthew T. Bettencourt Electromagnetic Theory Sandia National Laboratories P.O. Box 5800, MS 1168 Albuquerque, NM 87185-1168 mbetten@sandia.gov Abstract Aleph is an electrostatic particle-in-cell code which uses the finite element method to solve for the electric potential and field based on external potentials and discrete charged particles. The field solver in Aleph was verified for two problems and matched the analytic theory for finite elements. The first problem showed the mesh-refinement convergence for a nonlinear field with no particles within the domain. This matched the theoretical convergence rates of second order for the potential field and first order for the electric field. Then the solution for a single particle in an infinite domain was compared to the analytic solution. This also matched the theory of first order convergence in both the potential and electric fields for both problems over a refinement factor of 16. These solutions give confidence that the field solver and charge weighting schemes are implemented correctly. 3 This page intentionally left blank. Contents Summary 8 1 Introduction 11 2 Results 15 Solution to Laplace's equation: the charge-free solution 15 Solution to Poisson's equation: solutions with charge 19 3 Conclusion 25 References 26 Appendix A Input deck 27 5 List of Figures 1 Contour plot and line-out of potential and electric fields. As can be seen the bulk of the differences are at the boundaries for the electric fields and the potential field is nearly exact. 8 The effect of regualization on the electric field magnitude is shown with a regualization factor (5x = 0.01 in dimensionless units. 12 Two and three dimensional mesh used in the convergence study. The resolution shown represents the second mesh in the refinement study. 16 2.2 Top: 3D Potential field (left) and corresponding 2D electric fields (right). Bottom: Line out of 2D field between points (-0.1, -1.0) to (0.1, 1.0). The exact and fine solutions overlap. 17 1.1 2.1 2.3 Convergence plots of the two-dimensional potential (left) and the electric (right) fields in three norms for the two-dimensional grid shown in Fig. 2.1 18 Convergence plots of the three-dimensional potential (left) and the electric (right) fields in three norms for the three-dimension grid shown in Fig. 2.1 18 Top': 3D (left) and 2D (right) potential fields for a single particle with infinite domain boundary conditions. Bottom: Line out of 2D field between points (0.0, -1.0) to (0.0, 1.0). The exact and fine solutions overlap. 19 Relative error in the potential field normalized by the local value of the potential field 21 2.7 Relative error in the electric field normalized by the local value of the electric field 22 2.8 Convergence plots of the two-dimensional potential (left) and the electric field (right) in three norms for a single particle in the two-dimension grid shown in Fig. 2.1 23 Convergence plots of the three-dimensional potential (left) and the electric field (right) in three norms for a single particle in the three-dimension grid shown in Fig. 2.1. 23 2.4 2.5 2.6 2.9 6 List of Tables 1 Summary of mesh-refinement convergence results for homogeneous and in-homogeneous problems in both 2D and 3D. Theory states that the homogeneous problem should converge as h2, where h is mesh size, for the potential field and as h for the electric field, while both fields should be first order for the in-homogeneous problem. .... 9 2.1 Grid resolution requested to Cubit and calculated from the mesh file for both two and three dimensions 15 2.2 Two-dimensional convergence rates for the potential and electric field in the L1,L2 and L., norms 16 2.3 2.4 2.5 Three-dimensional convergence rates for the potential and electric field in the L1, L2 and L. norms 17 Two-dimensional convergence rates for the potential and electric field for a single particle in the L., L1, and L2 norms. The first point was neglected in the convergence rate because it was not in the asymptotic regime. 20 Three-dimensional convergence rates for the potential and electric field for a single particle in the L1,L2 and L.norms. 20 7 Summary The electrostatic finite-element solver within the Aleph code was tested against two different verification problems with analytic solution. The first was the solution to a homogeneous problem forced only by boundary conditions, Fig 1, and the second was an in-homogeneous problem consisting of a single point charge. Both of these problems were tested in both two and three dimensions on a non-trivial mesh. These problems were tested against the theoretical convergence order and were found to match theory to a sufficient level of accuracy. Due to the delta function nature of the in-homogeneous problem convergence was only first order in the L1 norm as predicted. The convergence results are summarized in Table 1. These tests give great confidence in several parts of the Aleph code; the core field solver, the application of boundary conditions, the gradient operator which computes the electric field, and the charge weighting scheme. These tests were conducted with Aleph SVN version 4403 compiled with gcc-4.4.7 and Cubit version 14.1. These examples are in the Aleph repository at alephlexamples/verification/field_solve. 14001330120011001000900800700-Simlatbn E -51,7xilatbn V -ExactE -ExactV — Drererce E -Drererce 600500900300200/ 100- o -100- -300 Figure 1. Contour plot and line-out of potential and electric fields. As can be seen the bulk of the differences are at the boundaries for the electric fields and the potential field is nearly exact. 8 Table 1. Summary of mesh-refinement convergence results for homogeneous and in-homogeneous problems in both 2D and 3D. Theory states that the homogeneous problem should converge as h2, where h is mesh size, for the potential field and as h for the electric field, while both fields should be first order for the inhomogeneous problem. Norm L1 L2 L. Homogeneous Problem 2D 3D Potential Electric Potential Electric Field Field Field Field 1.91 2.04 1.79 1.67 2.02 1.64 1.98 1.59 1.85 1.21 1.74 1.08 9 In-Homogeneous Problem 2D 3D Potential Electric Potential Electric Field Field Field Field 1.28 1.23 1.07 1.03 1.17 0.20 0.67 0.31 0.17 0.30 0.00 0.46 This page intentionally left blank. Chapter 1 Introduction Aleph is an electrostatic particle-in-cell(PIC)used in simulating low density plasma processes in complex geometries. It uses an unstructured finite element method (FEM)[1] to solve the electrostatic field and a collection of Lagrangian particles to represent the electrons, ions, and uncharged particles in the simulation. The electric field is defined as the negative gradient of the electric potential 0, Ë = —vo. (1.1) Furthermore, the divergence of the electric field is proportional to the charge density, V •E = 12 = —V20. (1.2) E0 Thus,the electric potential is defined as a solution to Poisson's equation with the source term being proportional to the charge density. For Dirichlet boundary conditions the values on the boundary represent the voltage at that location. For Neumann boundary conditions, the value represents _a•ff. Solving the system without charges reverts to simply solving the Laplace equation with a prescribed boundary condition. One can perform a separation of variables technique to determine the form of the solution. In one dimension only linear solutions are valid solutions to Laplace's equation. In two-dimensions a more complicated solution is allowed in the form of 02D(x,y)= clx+c2y+[c3 sin(Xx)+c4cos(Xx)][c5 sinh(Xx)+c6 cosh(Xx)], (1.3) where A, can be chosen to satisfy the boundary conditions. In three dimensions one can see that 03D(x,y,z) = clx+ c2y+c3z+ [c4 sin(Xx)+c5 cos(A,x)][c6 sinh(Xx)+c7 cosh(Xx)], (1.4) is a valid solution. Once a charged particle is introduced the equation is no longer homogeneous and we are now solving Poisson's equation and one requires a different analytic solution. For this one uses the Green's function to compute the solution. The Green's function in two and three dimensions are G(Y)= r l'71(1 Y 1), 11 1 G(Y)= 47E 1 y r (1.5) Therefore, the analytic potential for point charges qi located at xi is the solution of 1 N V2 = —Eqiö(x— Yi), E0 i=1 (1.6) 1 N 0(X)= — Eo i=t (1.7) E — A). The solution technique for Aleph, and all PIC codes, is to use a charge which is not a delta function, but has a finite size and shape [2][3]. Aleph defaults to a charge with a constant density and the shape ofthe current element. This weights equal charge density to the nodes for the element containing the particle of where Vj is the volume of elementjwhich contains particle i. Because of this particle smoothing it can be shown that the charge density approaches the delta function linearly as AxD, where D is the dimensionality of the problem with a solution proportional to xpl . Thus, the solution is expected to converge as Ax1. Furthermore, in two and three dimensions the potential becomes singular at the particle, which could cause an extremely large error if the particle is near a nodal location. Because of this we will be utilizing a regularized potential [4] which is of the form (1.8) GR(Y)= G(.X'+ 3x). The effect of this is shown for the electric field magnitude in Fig. 1.1. This work will use a regularization factor of half a typical length of an element edge. 100 • Unregularized • Regualized 50 o -50 1000.2 -0.1 0.1 02 x Figure 1.1. The effect of regualization on the electric field magnitude is shown with a regualization factor Sx = 0.01 in dimensionless units. For this work we implemented a special infinite boundary condition. When point charges are present this boundary condition mimics infinite free space by setting a Dirichlet condition of the 12 regularized Green's function (1.8). Note that the Green's function and regularization factor are only used in computing this specialized boundary condition and the analytic solution to compare against the output of Aleph. 13 This page intentionally left blank. Chapter 2 Results The solution for the electrostatic field can be broken into two parts. The first is the solution to the homogeneous part of (1.2)(Laplace's equation) forced only by the boundary values. This tests the basic FEM solution technique. Then one can solve the in-homogeneous problems with non-trivial charge density. Both of these solutions have analytic solutions to compare against and are addressed below. The meshes for the simulations provided below were created using Cubit version 14.1. The results below are based on the average edge length of a tetrahedron for three-dimensions and triangle for two-dimensions. This is slightly different than the input spacing requested of Cubit. Table 2.1 shows the input and output mesh spacings. Table 2.1. Grid resolution requested to Cubit and calculated from the mesh file for both two and three dimensions Cubit Input 2D Edge Length 3D Edge Length 0.1000 0.0794 0.0907 0.0500 0.0437 0.0467 0.0229 0.0250 0.0237 0.0125 0.0119 0.0125 0.0061 0.0063 N/A Solution to Laplace's equation: the charge-free solution To perform the analysis a non-trivial geometry and meshes were created, Fig. 2.1, then a specific Dirichlet boundary condition (1.3),(1.4) was applied to all the nodes on the external surfaces. Then the potential field was solved for the internal nodes and the electric field was computed from the potential field and projected to the nodes through a solid angle averaging. The results for this solve are shown in Fig. 2.2 for the potential and electric fields. Both the potential and electric fields were compared to the analytic result and an order of convergence was calculated through successive mesh refinements. 15 Figure 2.1. Two and three dimensional mesh used in the convergence study. The resolution shown represents the second mesh in the refinement study. For two dimensions one can see in Fig. 2.3 that the order for the potential is approximately second order in all the standard norms, whereas the error for the electric field is between first and second order, consistent with finite element theory for linear basis functions used in the code. The exact convergence rates are given in Table 2.2. A convergence rate p means that en « AxP, where en is the error in the n norm defined as ) n =i1VPIn (Elisi (2.1) en = MCLOPD • Table 2.2. Two-dimensional convergence rates for the potential and electric field in the L1,L2 and Lo, norms. Norm Potential Field 1.91 L1 2.02 L2 L. 1.85 Electric Field 2.04 1.64 1.21 Similar tests were done in three dimensions with similar results as shown in Fig 2.4 and Table 2.3. As can be seen the L2 error for the Laplace equation is nearly identical to 2.0 for the potential and between 1 and 2 for the electric field. This is as expected and confirms the numerical accuracy of the solver. 16 1500 — E exact — V exact —E coarse —Vcoarse — E One — V rine 14001300120011001000900500700000- 400300200100- -100200 0.1 a2 0,3 0.4 0,5 0.0 0.7 22 2,9 12 1,3 12 Figure 2.2. Top: 3D Potential field (left) and corresponding 2D electric fields (right). Bottom: Line out of 2D field between points (-0.1, -1.0) to (0.1, 1.0). The exact and fine solutions overlap. Table 2.3. Three-dimensional convergence rates for the potential and electric field in the L1, L2 and L. norms. Norm L1 L2 L. Potential Field 1.79 1.98 1.74 17 Electric Field 1.67 1.59 1.08 1 .B 1 .9 0 10 -2 10 3 10 i. 0 L.17 — — — — — — — 101,— — L Infinity nonn LI Norm L2 Norm Second Order Ref 6 1 2 _4 10 10 10 L Infinity Norm L1 Nonn L2 Nomi First Order Ref Second Order Ref w 5 10- 3 io 6 1 10 le 2 10 10 1 Grid Spacing Grid Spacing Figure 2.3. Convergence plots of the two-dimensional potential (left) and the electric (right) fields in three norms for the twodimensional grid shown in Fig. 2.1. 0 10 :— — — — 1. — 10 101 — — — 102 — 6 1 14 L Infinity Norm L1 Nrom L2 Nonn Second Order Ref L Infinity Norm L1 Norm L2 Norm First Order Ref Second Order Ref 3 102 10 4 10 10 1 10 -2 10 10 Grid Spacing Grid Spacing Figure 2.4. Convergence plots of the three-dimensional potential (left) and the electric (right) fields in three norms for the threedimension grid shown in Fig. 2.1. 18 1 Solution to Poisson's equation: solutions with charge To compute the convergence of the fields created by a single particle in a domain the same geometry was used as in the previous section. A single particle was placed in the domain to induce a field. Now the boundary conditions were set to the analytic potential value for the particle introduced to the geometry, then the field was solved. The solution is shown in Fig. 2.5. le+12 — Eflne — V flre — Eeeact — V exact — Ecoarse — V coarse 90+11 80+11 7e+11 60+11 50+11 4e+11 3e+11 2e+11 1 e+11 1 e+11 0.1 0.2 0.3 0.4 0,5 0.6 0.7 0.8 0.9 1.1 1.2 1.3 1.4 1.5 1.6 1,8 1.9 Figure 2.5. Top': 3D (left) and 2D (right) potential fields for a single particle with infinite domain boundary conditions. Bottom: Line out of 2D field between points (0.0, -1.0) to (0.0, 1.0). The exact and fine solutions overlap. An identical convergence analysis as shown previously was performed. These results are shown in Figures 2.8, 2.9, and Tables 2.4, 2.5. As one can see, the convergence in the L1 and L2 norms are as theory predicts, first order; however, the results are much more noisy. Second the convergence 19 in the Lc° norm is nearly zero. This is as expected because of the nature of the exact solution. If one inserts a charge whose size is proportional to an element size, as constant charge weighting dictates, one gets a solution which has a singularity which grows as th. This produces a solution which has a Fourier transform with constant magnitude for all wave numbers representable on a mesh. Thus, as one refines the mesh there is always locally a contribution to the error which is constant. This results in a zeroth order convergence in the Loo norm. However, this effect is purely local and thus allows lower order norms to converge as expected, at an order higher than zeroth order convergence. This argument is analogous to one made for boundary conditions in [5]. The high level of noise in the convergence plots is because the particle placement within an element has a great deal to do with the error in the run and no effort to center the particle in the element was made. This is extremely evident in the Le. norms which locally can be negative. As can be seen in Figs. 2.6, 2.7 the error is very localized. This is caused by the inability of the FEM to resolve a function of the form r+3 as r —> 0. This error causes the large error in the higher order norms. Table 2.4. Two-dimensional convergence rates for the potential and electric field for a single particle in the L., Li, and L2 norms. The first point was neglected in the convergence rate because it was not in the asymptotic regime. Norm Potential Field 1.28 L1 1.17 L2 L. 0.30 Electric Field 1.07 0.20 0.00 Table 2.5. Three-dimensional convergence rates for the potential and electric field for a single particle in the Li,L2 and Los norms. Norm L1 L2 Lc° Potential Field 1.23 0.67 0.17 20 Electric Field 1.03 0.31 0.46 Pseudocolor Var: V EL0.1400 — 0.1050 I 0.07002 0.03501 2.570e-07 Max: 0.1400 Min: 2.570e-07 Figure 2.6. Relative error in the potential field normalized by the local value of the potential field. 21 Pseudocolor Var: E_nd angle_smooth_magnitude -0.579 E —0.4184 1 0.2789 0.1395 7.069e-07 Max: 0.5579 Min: 7.069e-07 Figure 2.7. Relative error in the electric field normalized by the local value of the electric field. 22 0 10 o 10 101 -2 t. 10 o w 6 1 2 w — — — — — 10-4 L Infinity Norm L1 Norm L2 Norm First Order Ref Second Order Ref -2 10 10- 10 le 10 1 — — — — — 3 L Infinity Norm L1 Norm L2 Norm First Order Ref Second Order Ref -2 10 10 1 Grid Spacing Grid Spacing Figure 2.8. Convergence plots of the two-dimensional potential (left) and the electric field (right)in three norms for a single particle in the two-dimension grid shown in Fig. 2.1. 0 10 o 10 1 10- .. wE ,1 w -2 10 — — — — — — — — — — L Infinity Norm L1 Norm L2 Norm First Order Ref Second Order Ref 101 10 -2 10 10 Grid Spacing Grid Spacing Figure 2.9. Convergence plots of the three-dimensional potential (left) and the electric field (right) in three norms for a single particle in the three-dimension grid shown in Fig. 2.1. 23 L Infinity Norm L1 Norm L2 Norm First Order Ref Second Order Ref 1 This page intentionally left blank. Chapter 3 Conclusion The field solver in Aleph was verified for two problems and matched the analytic theory for finite elements. The first problem showed the mesh-refinement convergence for a nonlinear field with no particles within the domain. This matched the theoretical convergence rates of second order for the potential field and first order for the electric field. Then the solution for a single particle in an infinite domain was compared to the analytic solution. This also matched the theory of first order convergence in both the potential and electric fields. These solutions give confidence that the field solver and charge weighting schemes are implemented correctly. 25 References [1] Gilbert Strang and George J. Fix. An analysis of the finite element method, volume 212. Prentice-Hall Englewood Cliffs, 1973. [2] Charles K. Birdsall and A. Bruce Langdon. Plasma physics via computer simulation. CRC Press, 2005. [3] Roger W. Hockney and James W. Eastwood. Computer simulation using particles. Taylor & Francis Group, 1988. [4] A. J. Christlieb, R. Krasny, and J. P. Verboncoeur. A treecode algorithm for simulating electron dynamics in a Penning—Malmberg trap. Computer physics communications, 164(1):306-310, 2004. [5] P. Colella. Volume of fluid methods for partial differential equations. In Proceedings of the International Conference on Godunov Methods, Oct 18-22 1999. Oxford, UK. 26 Appendix A Input deck These tests have been committed to the Aleph repository and added to the regression tests run prior to check-in. Below is the input deck used for testing the code. More information such as the error calculation routines can be found in the repository. # INPUT DECK FOR FIELD VERIFICATION TESTS units = SI Input mesh file name = happy.g timestep size = 4e-50 total number of timesteps = 1 apply electrostatic model to all, interpolation=constant, window = discrete, size = 1, stride = 1 Exodus output file name = output.exoll exodus output stride = 1 output electric field with smoothing = none output electric field with smoothing = solid_angle_average # Comment next line for for particle tests BC for voltage on nodelist_l is verification_dirichlet_bc # Uncomment these next four lines for particle tests #BC for voltage on nodelist_1 is infinite boundary_condition #regularization factor = 0.0125 #particle weighting = 1 #initial H+ weight = 6.241509341896704e+18, T=000.0, vx = 0, vy = 0.00, vz = 0, inside = point, x=-.0, y=.4, z=0.38 27 v1.40 28 Sandia National laboratories 29