Internat. J. Math. & Math. Sci. (1987) 173-179 No. 173 Vo]. i0 AN ENERGY CONSERVING MODIFICATION OF NUMERICAL METHODS FOR THE INTEGRATION OF EQUATIONS OF MOTION ROBERT A. LABUDDE 821 Hialeah Dr. Virginia Beach, VA 23462 and DONALD GREENSPAN Department of Mathematics University of Texas Arlington, Texas 76019 (Received July 2, 1982) ABSTRACT. In the integration of the equations of motion of a system of particles, con- ventional numerical methods generate an error in the total energy of the same order as the truncation error. A simple modification of these methods is described, which re- sults in exact conservation of the energy. KEY WORDS AND PHRASES. Conventional numerical methods, ordinary differential equations, multiplicative parameters, truncation error. 1980 AMS SUBJECT CLASSIFICATION CODE. i. 70F34. INTRODUCTION. When applied to the motion of a system of particles, conventional numerical methods for the integration of ordinary differential equations only approximately conserve the total energy of the system. The error in the calculated value of the energy is of the same order as the truncation error in the velocities. In previous work [1]-[5], a new class of methods was described, which maximally conserve the constants of motion. These methods exactly conserve the total energy and linear momentum, and conserve the total angular momentum to at least one higher order than the corresponding conventional methods. In what follows, our purpose is to show how conventional numerical methods--exemplified by the third-order Taylor series and Adams’ formulae--can be modified so that exact conservation of energy occurs. This modification simply involves the in- troduction of adjustable, multiplicative parameters, whose values are unity for the conventional case. 2. EQUATIONS OF MOTION. The following is a brief description of the equations of motion of a system of n particles, interacting according to a pairwise-additive potential. For more details, see [i] or [5]. Suppose particle r. l velocity vector i (xi,Yi,Zi) has mass mi, position vector (2.1) - R.A. LABUDDE and D. GREENSPAN 174 .dY i dzil i [dx dt [ vi and acceleration d2xi a. i dt Newton’s d 2 2 dt Yi 2 2 zi dt law of motion m.a. I i d (2.2) (2.3) 2 =. (2.4) I relates the acceleration to the force a.1 Fi, given by (2.5) r. where It will be assumed that is the potential of interaction. has the pair- wise-additive form rn) (ri,r2, where r Z (2.6) ij(rij) i<j is the magnitude of the vector distance 13 ro between particles 13 i and j r.. =r. (2.7) -r.1 J 1J As a consequence of equation (2.6), n (2.8) IF.. F. j=l 31 where 31 and 0 Fji if The introduction of equation (2.8) into equation (2.4) gives i. j (2.9) drij rij drji rji 13 the equation of motion Z F.. j=l 31 m.a.i For particles, equation (2.10) yields a system of second-order ordinary differ- n ential equations for the t’ at any later time . This system may be used to solve for the r..1 t + At, E and v.1 at time and n occurs because of the existence of the poten- n Z mi(v i- vi) i=l a-b + Z i=l mi(v i" vi) denotes the scalar product of two vectors a + and Z i<j b. ij Conservation of energy is expressed by the equation E(t’) for any two times E(t) t and t’, with E i’ t. Here, E where r.1 given the Conservation of the total energy tial (2.i0) drij rij j=l evaluated along the trajectory. NUMERICAL METHODS FOR THE INTEGRATION OF EQUATIONS OF MOTION 175 3. CONVENTIONAL NUMERICAL METHODS A simple example of a conventional approximation method for the numerical solu- (2.10) is provided by the truncated Taylor-series formulae tion of equations r’ r c,i + v.z A i t i + mi Z j=l I i 2 n (At)2 + ji 2 ji (At)31 (3.1) 6 and v’ ,i =v.z +-- where the t’ r’c,i + At, t Z j=l m. z V’c,i and At+ (3.2) are the calculated values for the r ol and v_ at time and dq Goo 31 i d0ji vji drj i rJ i dt 0ji dr.. 2 i d0 jirji ro rJ i drj i (3.3) 3i where rji drji rji’vji dt r.. and v vji vj i The method of equations (3.1) and (3.2) is of third-order, since 7c,i ’r. i + 0[(At) 4] (3.4) 0[(At)3] (3.5) and -v.’ ’.+ C,l l due to the neglect of the succeeding Taylor-series terms. error of V 0[(At) 3] in the value of the energy E’C These errors generate an calculated using the .: Cl AE c E 0[--(At) E c ’ ci 3] and (3.6) The third-order Adams’ method arises via equations (3.1) and (3.2) and the ap- proximation G.. zj /a (3.7) G.. + 0[At] j where /a F G.. c ,ij -ij In equation (3.8) using the (3.8) At zj r’c,zj+o.. used for the Gij. ’ denotes the value of c,ij Equations (3.4), (3.5), and Fij obtained from equation (3.6) also hold when the ij (2.9) are R.A. LABUDDE and D. GREENSPAN 176 . 4. ENERGY CONSERVING MODIFICATION OF CONVENTIONAL METHODS. 3, with Consider the third-order methods of Section G.*. replacing either the or r’c,i r v’ v i + +m v At i (t)2 l ji j=l i + 2 3 (At) G (4 i) 6 i and c,i i +-- E mi 2 (At) + 2 j=l (4 2) When equations (4.1) and (4.2) are used to obtain estimates for AE c r.l and v i, an error is made in the total energy, which is given by n E’c AE c E 7. I m i= 1 At i , c n Z Z j=l I.+ At +-m. vi l + Y. i<j + ($ij + aij -) n Z k=l Fki). +i z i+m. k=l l At i 1 F- n i=l +--(v (v i + aijAt Fij b F ji G*. 3 + A G.*lj i3 + At (4.3) where aij A ij n l Fki k=l Lmj ’ mi ij (r’c ,ij ij c,ij ij(rij ), and . Suppose now, instead of using AE to an error G.. e.. c of or * Gij +a e ij (4.4) c,i c,j c,lJ Gij 0[(At)3]--that Gii Gij adjustable or Gij *..lj in equation (4.3)--which leads given by (4.5) NUMERICAL METHODS FOR THE INTEGRATION OF EQUATIONS OF MOTION is used. The g.. are to be chosen so that lj + 0[At] 1 l] 177 (4.6) (preserving the order of the method) and so that exact conservation of energy occurs. Solving AE 0 C e.. for the ij /+ + (Vij (At) 4 ij + aijAt + 2 t aij--) } At ij + Fij Aij At s ij (4.7) 0 particles, equation (4.7) yields a set of implicit, coupled equations in the For n ij’ since the and bi3 At For small depend upon the values of the c,ij e occur through the ij In both these cases, the terms involving the r’c, ..). 13 proportional to (At)3. (vij + ij aijAt) 0[At]. are of - bij e.o lJ and ... c,ij’ ij’ The (through occur with coefficients (Compare equations (4.1), (4.2), (4.4), and (4.7).) the coefficients of the linear terms in trast ij" the equations of (4.7) are strongly linear in the only nonlinear dependences on the the - gives, for example, for (4.5), the equation (cf. [i] and [5]) In con- namely At . Because the equations of (4.7) are linear except for terms of 0[(At)3], they may be easily solved via the iteration formula .. &ij 2 At ij At I] For small At + (V.o+a. 13 lj At --) z (.) (vij +-" aij At+bij 4 At (4.8) the equations of (4.8) are solved via successive substitutions, starting with .. (4.9) i Iteration to convergence of the e.. guarantees exact conservation of energy in the me tho d. Higher-order formulae may be obtained directly in the same way as equation (4.7). If the highest-order terms involve 13 dt m then these are replaced by /(m)* F.. 13 +(m) e.. F.. 1J R.A. LABUDDE and D. GREENSPAN 178 where the satisfy equation (4.6). S.o lj The formulae for the v’ C,l (4.3), the in equation sum transformed to and the i <j, ij are substituted terms set individually e.. methods, with the first approximations given by equations (4.9). For very high order methods, the extra algebra needed to obtain the to zero. These resulting implicit equations in the are then solved by standard siderable, and substantially reduces the relative efficiency of the method. e.. is conHowever, it should be noted that conservation of energy guarantees stability in the usual sense (bounded motion), which is always a desirable computational property. 5. NUMERICAL EXAMPLE. As an illustration of the affect of the modification described in Section 4, the modified and unmodified forms of the third-order Adams’ method are compared numerically on a sample two-dimensional problem involving two particles. Here m I 2, n m (5.1) 2 2 and the gravitational interaction i 12(r12) is used. (5.2) r12 The initial conditions are chosen so that the center-of-mass of the system is at rest with r12(0) (,0) (5.3) v12(0) (0,1.63). (5.4) The value of the energy is then E 0.6715500000... Because of the form of (5.5) 12 in (5.2), the exact motion that occurs traces out a closed ellipse with major-axis 2a 1.48909 23855 corresponding to upper and lower bounds on 0.98909 23855 r> r< and (5.6) r12 of 0.50000 00000. The motion repeats itself with period equal to 4.0366 15087, The implicit equations of the third-order methods were iterated to a relative con-8 A constant step-size of ergence of I0 t /80 In order to focus attention on the errors made in the methods, results were obtained at times t which were multiples of the period where the exact solu- was used. NUMERICAL METHODS FOR THE INTEGRATION OF EQUATIONS OF MOTION tion returns to the initial conditions. E, error in the calculated value of the deviation of from r12 , Measures of the errors at these points are the the deviations from zero of dX/dt and unmodified Adams’ method makes an error in E t mr. It can be seen that the as well as larger errors in and compares unfavorably with the modified method. dX/dt and Another simple measure of the error for this problem is the number of steps over which a phase error of 180 i.e., the time at which r12 0.985 this was about 2800 steps (35T). phase error of less than 180 and 1/2. Table I gives these quatities for several times Y, 179 instead of 0.5. is made: For the unmodified methods, For the modified methods, at 20000 steps (250T), a had been made. Programs for the methods are given in the Appendix of [6]. m 0 i E Method a Exact b U M c dX dt r 0.00000 Y 0.00000 0.67155 0.50000 0.67140 0.50221 0.20630 -0.08704 0.67155 0.49997 0.02164 -0.00462 2 U M 0.67099 0.67155 0.50873 0.49997 0.40254 0.04328 -0.17213 -0.00923 3 U M 0.67040 0.67155 0.51924 0.50001 0.58036 0.06492 -0.25351 -0.01385 5 U M 0.66905 0.67155 0.55019 0.50017 0.86162 0.10818 -0.39996 -0.02311 i0 U M 0.66679 0.67155 0.65934 0.50116 1.15127 0.21592 -0.64976 -0.04639 I00 U M 0.66561 0.67155 0.97998 0.62554 0.82003 1.35684 -0.97598 -0.57888 At times t alnitial m conditions bunmodified CThird-order third-order Adams’ method Adams’ method modified to give exact energy conservation. TABLE I. Comparison of Modified and Unmodified liethods on a Simple Gravitation Problem REFERENCES i. LaBUDDE, R. A. and GREENSPAN, D., "Discrete Mechanics--A General Treatment", to be published in J. Computational Phys. 2. LaBUDDE, 3. LaBUDDE, R. A. and GREENSPAN, D., "Energy and Momentum Conserving Methods of Arbi- R. A. and GREENSPAN, D., "Discrete Mechanics for Anisotropic Potentials", Univ. of Wis. Computer Sciences Dept. Report WIS-CS-203 (1974). trary Order for the Numerical Integration of Equations of Motion. I. Motion of a Single Particle", Univ. of Wis. Computer Sciences Dept. Report WIS-CS- 208 (1974). 4. LaBUDDE, R. A. and GREENSPAN, D., "Discrete with Application to the LEPS port WIS-CS-210 (1974). Form", Mechanics for Nonseparable Potentials Univ. of Wis. Computer Sciences Dept. Re- GREENSPAN, D., "Energy and Momentum Conserving Methods of Arbitrary Order for the Numerical Integration of Equations of Motion. II. Motion of a System of Particles," Univ. of Wis. Computer Sciences Dept. Report WIS- 5. LaBUDDE, R. A. and 6. LaBUDDE, R. A., and GREENSP/%, D., "An Energy Conserving Modification of Numerical Methods for the Integration of Equations of Motion," Univ. of Wis. Computer CS-215 (1974). Sciences Dept. Report WIS-CS-217 (1974).