HOME

TheInfoList



OR:

Verlet integration () is a numerical method used to integrate Newton's
equations of motion In physics, equations of motion are equations that describe the behavior of a physical system in terms of its motion as a function of time.''Encyclopaedia of Physics'' (second Edition), R.G. Lerner, G.L. Trigg, VHC Publishers, 1991, ISBN (V ...
. It is frequently used to calculate
trajectories A trajectory or flight path is the path that an object with mass in motion follows through space as a function of time. In classical mechanics, a trajectory is defined by Hamiltonian mechanics via canonical coordinates; hence, a complete traj ...
of particles in
molecular dynamics Molecular dynamics (MD) is a computer simulation method for analyzing the physical movements of atoms and molecules. The atoms and molecules are allowed to interact for a fixed period of time, giving a view of the dynamic "evolution" of th ...
simulations and
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
. The algorithm was first used in 1791 by Jean Baptiste Delambre and has been rediscovered many times since then, most recently by Loup Verlet in the 1960s for use in molecular dynamics. It was also used by P. H. Cowell and A. C. C. Crommelin in 1909 to compute the orbit of
Halley's Comet Halley's Comet or Comet Halley, officially designated 1P/Halley, is a short-period comet visible from Earth every 75–79 years. Halley is the only known short-period comet that is regularly visible to the naked eye from Earth, and thus the on ...
, and by
Carl Størmer Fredrik Carl Mülertz Størmer (3 September 1874 – 13 August 1957) was a Norwegian mathematician and astrophysicist. In mathematics, he is known for his work in number theory, including the calculation of and Størmer's theorem on consecu ...
in 1907 to study the trajectories of electrical particles in a
magnetic field A magnetic field is a vector field that describes the magnetic influence on moving electric charges, electric currents, and magnetic materials. A moving charge in a magnetic field experiences a force perpendicular to its own velocity and to ...
(hence it is also called Störmer's method). The Verlet integrator provides good
numerical stability In the mathematical subfield of numerical analysis, numerical stability is a generally desirable property of numerical algorithms. The precise definition of stability depends on the context. One is numerical linear algebra and the other is algori ...
, as well as other properties that are important in
physical system A physical system is a collection of physical objects. In physics, it is a portion of the physical universe chosen for analysis. Everything outside the system is known as the environment. The environment is ignored except for its effects on the ...
s such as
time reversibility A mathematical or physical process is time-reversible if the dynamics of the process remain well-defined when the sequence of time-states is reversed. A deterministic process is time-reversible if the time-reversed process satisfies the same dyn ...
and preservation of the symplectic form on phase space, at no significant additional computational cost over the simple
Euler method In mathematics and computational science, the Euler method (also called forward Euler method) is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic explicit m ...
.


Basic Störmer–Verlet

For a second-order differential equation of the type \ddot(t) = \mathbf A\bigl(\mathbf x(t)\bigr) with initial conditions \mathbf x(t_0) = \mathbf x_0 and \dot(t_0) = \mathbf v_0, an approximate numerical solution \mathbf x_n \approx \mathbf x(t_n) at the times t_n = t_0 + n\,\Delta t with step size \Delta t > 0 can be obtained by the following method: # set \mathbf x_1 = \mathbf x_0 + \mathbf v_0\,\Delta t + \tfrac 1 2 \mathbf A(\mathbf x_0)\,\Delta t^2, # for ''n'' = 1, 2, ... iterate \mathbf x_ = 2 \mathbf x_n - \mathbf x_ + \mathbf A(\mathbf x_n)\,\Delta t^2.


Equations of motion

Newton's equation of motion for conservative physical systems is :\boldsymbol M \ddot(t) = F\bigl(\mathbf x(t)\bigr) = -\nabla V\bigl(\mathbf x(t)\bigr), or individually :m_k \ddot_k(t) = F_k\bigl(\mathbf x(t)\bigr) = -\nabla_ V\left(\mathbf x(t)\right), where * t is the time, * \mathbf x(t) = \bigl(\mathbf x_1(t), \ldots, \mathbf x_N(t)\bigr) is the ensemble of the position vector of N objects, * V is the scalar potential function, * F is the negative gradient of the potential, giving the ensemble of forces on the particles, * \boldsymbol M is the mass matrix, typically diagonal with blocks with mass m_k for every particle. This equation, for various choices of the potential function V, can be used to describe the evolution of diverse physical systems, from the motion of interacting molecules to the orbit of the planets. After a transformation to bring the mass to the right side and forgetting the structure of multiple particles, the equation may be simplified to :\ddot(t) = \mathbf A\bigl(\mathbf x(t)\bigr) with some suitable vector-valued function \mathbf A(\mathbf x) representing the position-dependent acceleration. Typically, an initial position \mathbf x(0) = \mathbf x_0 and an initial velocity \mathbf v(0) = \dot(0) = \mathbf v_0 are also given.


Verlet integration (without velocities)

To discretize and numerically solve this
initial value problem In multivariable calculus, an initial value problem (IVP) is an ordinary differential equation together with an initial condition which specifies the value of the unknown function at a given point in the domain. Modeling a system in physics or o ...
, a time step \Delta t > 0 is chosen, and the sampling-point sequence t_n = n\,\Delta t considered. The task is to construct a sequence of points \mathbf x_n that closely follow the points \mathbf x(t_n) on the trajectory of the exact solution. Where
Euler's method In mathematics and computational science, the Euler method (also called forward Euler method) is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic explicit met ...
uses the forward difference approximation to the first derivative in differential equations of order one, Verlet integration can be seen as using the
central difference A finite difference is a mathematical expression of the form . If a finite difference is divided by , one gets a difference quotient. The approximation of derivatives by finite differences plays a central role in finite difference methods for th ...
approximation to the second derivative: :\begin \frac &= \frac\\ pt&= \frac = \mathbf a_n = \mathbf A(\mathbf x_n). \end ''Verlet integration'' in the form used as the ''Störmer method'' uses this equation to obtain the next position vector from the previous two without using the velocity as :\begin \mathbf x_ &= 2 \mathbf x_n - \mathbf x_ + \mathbf a_n\,\Delta t^2, \\ pt\mathbf a_n &= \mathbf A(\mathbf x_n). \end


Discretisation error

The time symmetry inherent in the method reduces the level of local errors introduced into the integration by the discretization by removing all odd-degree terms, here the terms in \Delta t of degree three. The local error is quantified by inserting the exact values \mathbf x(t_), \mathbf x(t_n), \mathbf x(t_) into the iteration and computing the
Taylor expansion In mathematics, the Taylor series or Taylor expansion of a function is an infinite sum of terms that are expressed in terms of the function's derivatives at a single point. For most common functions, the function and the sum of its Taylor seri ...
s at time t = t_n of the position vector \mathbf(t \pm \Delta t) in different time directions: :\begin \mathbf(t + \Delta t) &= \mathbf(t) + \mathbf(t)\Delta t + \frac + \frac + \mathcal\left(\Delta t^4\right)\\ \mathbf(t - \Delta t) &= \mathbf(t) - \mathbf(t)\Delta t + \frac - \frac + \mathcal\left(\Delta t^4\right), \end where \mathbf is the position, \mathbf = \dot the velocity, \mathbf = \ddot the acceleration, and \mathbf = \dot = \overset the jerk (third derivative of the position with respect to the time). Adding these two expansions gives :\mathbf(t + \Delta t) = 2\mathbf(t) - \mathbf(t - \Delta t) + \mathbf(t) \Delta t^2 + \mathcal\left(\Delta t^4\right). We can see that the first- and third-order terms from the Taylor expansion cancel out, thus making the Verlet integrator an order more accurate than integration by simple Taylor expansion alone. Caution should be applied to the fact that the acceleration here is computed from the exact solution, \mathbf a(t) = \mathbf A\bigl(\mathbf x(t)\bigr), whereas in the iteration it is computed at the central iteration point, \mathbf a_n = \mathbf A(\mathbf x_n). In computing the global error, that is the distance between exact solution and approximation sequence, those two terms do not cancel exactly, influencing the order of the global error.


A simple example

To gain insight into the relation of local and global errors, it is helpful to examine simple examples where the exact solution, as well as the approximate solution, can be expressed in explicit formulas. The standard example for this task is the
exponential function The exponential function is a mathematical function denoted by f(x)=\exp(x) or e^x (where the argument is written as an exponent). Unless otherwise specified, the term generally refers to the positive-valued function of a real variable, ...
. Consider the linear differential equation \ddot x(t) = w^2 x(t) with a constant w. Its exact basis solutions are e^ and e^. The Störmer method applied to this differential equation leads to a linear
recurrence relation In mathematics, a recurrence relation is an equation according to which the nth term of a sequence of numbers is equal to some combination of the previous terms. Often, only k previous terms of the sequence appear in the equation, for a parameter ...
:x_ - 2x_n + x_ = h^2 w^2 x_n, or :x_ - 2\left(1 + \tfrac12(wh)^2\right) x_n + x_ = 0. It can be solved by finding the roots of its characteristic polynomial q^2 - 2\left(1 + \tfrac12(wh)^2\right)q + 1 = 0. These are :q_\pm = 1 + \tfrac 1 2 (wh)^2 \pm wh \sqrt. The basis solutions of the linear recurrence are x_n = q_+^n and x_n = q_-^n. To compare them with the exact solutions, Taylor expansions are computed: :\begin q_+ &= 1 + \tfrac12(wh)^2 + wh\left(1 + \tfrac18(wh)^2 - \tfrac(wh)^4 + \mathcal O\left(h^6\right)\right)\\ &= 1 + (wh) + \tfrac12(wh)^2 + \tfrac18(wh)^3 - \tfrac(wh)^5 + \mathcal O\left(h^7\right). \end The quotient of this series with the one of the exponential e^ starts with 1 - \tfrac1(wh)^3 + \mathcal O\left(h^5\right), so :\begin q_+ &= \left(1 - \tfrac1(wh)^3 + \mathcal O\left(h^5\right)\right)e^\\ &= e^\,e^. \end From there it follows that for the first basis solution the error can be computed as :\begin x_n = q_+^ &= e^\,e^\\ &= e^\left(1 - \tfrac(wh)^2\,wt_n + \mathcal O(h^4)\right)\\ &= e^ + \mathcal O\left(h^2 t_n e^\right). \end That is, although the local discretization error is of order 4, due to the second order of the differential equation the global error is of order 2, with a constant that grows exponentially in time.


Starting the iteration

Note that at the start of the Verlet iteration at step n = 1, time t = t_1 = \Delta t, computing \mathbf x_2, one already needs the position vector \mathbf x_1 at time t = t_1. At first sight, this could give problems, because the initial conditions are known only at the initial time t_0 = 0. However, from these the acceleration \mathbf a_0 = \mathbf A(\mathbf x_0) is known, and a suitable approximation for the position at the first time step can be obtained using the
Taylor polynomial In mathematics, the Taylor series or Taylor expansion of a function is an infinite sum of terms that are expressed in terms of the function's derivatives at a single point. For most common functions, the function and the sum of its Taylor ser ...
of degree two: :\mathbf x_1 = \mathbf_0 + \mathbf_0 \Delta t + \tfrac12 \mathbf a_0 \Delta t^2 \approx \mathbf(\Delta t) + \mathcal\left(\Delta t^3\right). The error on the first time step then is of order \mathcal O\left(\Delta t^3\right). This is not considered a problem because on a simulation over a large number of time steps, the error on the first time step is only a negligibly small amount of the total error, which at time t_n is of the order \mathcal O\left(e^ \Delta t^2\right), both for the distance of the position vectors \mathbf x_n to \mathbf x(t_n) as for the distance of the divided differences \tfrac to \tfrac. Moreover, to obtain this second-order global error, the initial error needs to be of at least third order.


Non-constant time differences

A disadvantage of the Störmer–Verlet method is that if the time step (\Delta t) changes, the method does not approximate the solution to the differential equation. This can be corrected using the formula : \mathbf x_ = \mathbf x_i + \left(\mathbf x_i - \mathbf x_\right) \frac + \mathbf a_i \Delta t_i^2. A more exact derivation uses the Taylor series (to second order) at t_i for times t_ = t_i + \Delta t_i and t_ = t_i - \Delta t_ to obtain after elimination of \mathbf v_i : \frac + \frac = \mathbf a_i\,\frac2, so that the iteration formula becomes : \mathbf x_ = \mathbf x_i + (\mathbf x_i - \mathbf x_) \frac + \mathbf a_i\,\frac2\,\Delta t_i.


Computing velocities – Störmer–Verlet method

The velocities are not explicitly given in the basic Störmer equation, but often they are necessary for the calculation of certain physical quantities like the kinetic energy. This can create technical challenges in
molecular dynamics Molecular dynamics (MD) is a computer simulation method for analyzing the physical movements of atoms and molecules. The atoms and molecules are allowed to interact for a fixed period of time, giving a view of the dynamic "evolution" of th ...
simulations, because kinetic energy and instantaneous temperatures at time t cannot be calculated for a system until the positions are known at time t + \Delta t. This deficiency can either be dealt with using the velocity Verlet algorithm or by estimating the velocity using the position terms and the
mean value theorem In mathematics, the mean value theorem (or Lagrange theorem) states, roughly, that for a given planar arc between two endpoints, there is at least one point at which the tangent to the arc is parallel to the secant through its endpoints. It i ...
: : \mathbf(t) = \frac + \mathcal\left(\Delta t^2\right). Note that this velocity term is a step behind the position term, since this is for the velocity at time t, not t + \Delta t, meaning that \mathbf v_n = \tfrac is a second-order approximation to \mathbf(t_n). With the same argument, but halving the time step, \mathbf v_ = \tfrac is a second-order approximation to \mathbf\left(t_\right), with t_ = t_n + \tfrac12 \Delta t. One can shorten the interval to approximate the velocity at time t + \Delta t at the cost of accuracy: :\mathbf(t + \Delta t) = \frac + \mathcal(\Delta t).


Velocity Verlet

A related, and more commonly used, algorithm is the velocity Verlet algorithm, similar to the
leapfrog method In numerical analysis, leapfrog integration is a method for numerically integrating differential equations of the form \ddot x = \frac = A(x), or equivalently of the form \dot v = \frac = A(x), \;\dot x = \frac = v, particularly in the case of a d ...
, except that the velocity and position are calculated at the same value of the time variable (leapfrog does not, as the name suggests). This uses a similar approach, but explicitly incorporates velocity, solving the problem of the first time step in the basic Verlet algorithm: :\begin \mathbf(t + \Delta t) &= \mathbf(t) + \mathbf(t)\, \Delta t + \tfrac \,\mathbf(t) \Delta t^2, \\ pt\mathbf(t + \Delta t) &= \mathbf(t) + \frac \Delta t. \end It can be shown that the error in the velocity Verlet is of the same order as in the basic Verlet. Note that the velocity algorithm is not necessarily more memory-consuming, because, in basic Verlet, we keep track of two vectors of position, while in velocity Verlet, we keep track of one vector of position and one vector of velocity. The standard implementation scheme of this algorithm is: # Calculate \mathbf\left(t + \tfrac12\,\Delta t\right) = \mathbf(t) + \tfrac12\,\mathbf(t)\,\Delta t. # Calculate \mathbf(t + \Delta t) = \mathbf(t) + \mathbf\left(t + \tfrac12\,\Delta t\right)\, \Delta t. # Derive \mathbf(t + \Delta t) from the interaction potential using \mathbf(t + \Delta t). # Calculate \mathbf(t + \Delta t) = \mathbf\left(t + \tfrac12\,\Delta t\right) + \tfrac12\,\mathbf(t + \Delta t)\Delta t. This algorithm also works with variable time steps, and is identical to the 'kick-drift-kick' form of
leapfrog method In numerical analysis, leapfrog integration is a method for numerically integrating differential equations of the form \ddot x = \frac = A(x), or equivalently of the form \dot v = \frac = A(x), \;\dot x = \frac = v, particularly in the case of a d ...
integration. Eliminating the half-step velocity, this algorithm may be shortened to # Calculate \mathbf(t + \Delta t) = \mathbf(t) + \mathbf(t)\,\Delta t + \tfrac12 \,\mathbf(t)\,\Delta t^2. # Derive \mathbf(t + \Delta t) from the interaction potential using \mathbf(t + \Delta t). # Calculate \mathbf(t + \Delta t) = \mathbf(t) + \tfrac12\,\bigl(\mathbf(t) + \mathbf(t + \Delta t)\bigr)\Delta t. Note, however, that this algorithm assumes that acceleration \mathbf(t + \Delta t) only depends on position \mathbf(t + \Delta t) and does not depend on velocity \mathbf(t + \Delta t). One might note that the long-term results of velocity Verlet, and similarly of leapfrog are one order better than the
semi-implicit Euler method In mathematics, the semi-implicit Euler method, also called symplectic Euler, semi-explicit Euler, Euler–Cromer, and Newton–Størmer–Verlet (NSV), is a modification of the Euler method for solving Hamilton's equations, a system of ordinary d ...
. The algorithms are almost identical up to a shift by half a time step in the velocity. This can be proven by rotating the above loop to start at step 3 and then noticing that the acceleration term in step 1 could be eliminated by combining steps 2 and 4. The only difference is that the midpoint velocity in velocity Verlet is considered the final velocity in semi-implicit Euler method. The global error of all Euler methods is of order one, whereas the global error of this method is, similar to the
midpoint method In numerical analysis, a branch of applied mathematics, the midpoint method is a one-step method for numerically solving the differential equation, : y'(t) = f(t, y(t)), \quad y(t_0) = y_0 . The explicit midpoint method is given by the formula ...
, of order two. Additionally, if the acceleration indeed results from the forces in a conservative mechanical or
Hamiltonian system A Hamiltonian system is a dynamical system governed by Hamilton's equations. In physics, this dynamical system describes the evolution of a physical system such as a planetary system or an electron in an electromagnetic field. These systems can ...
, the energy of the approximation essentially oscillates around the constant energy of the exactly solved system, with a global error bound again of order one for semi-explicit Euler and order two for Verlet-leapfrog. The same goes for all other conserved quantities of the system like linear or angular momentum, that are always preserved or nearly preserved in a
symplectic integrator In mathematics, a symplectic integrator (SI) is a numerical integration scheme for Hamiltonian systems. Symplectic integrators form the subclass of geometric integrators which, by definition, are canonical transformations. They are widely used in ...
. The velocity Verlet method is a special case of the
Newmark-beta method The Newmark-beta method is a method of numerical integration used to solve certain differential equations. It is widely used in numerical evaluation of the dynamic response of structures and solids such as in finite element analysis to model dy ...
with \beta = 0 and \gamma = \tfrac12.


Algorithmic representation

Since velocity Verlet is a generally useful algorithm in 3D applications, a general solution written in C++ could look like below. A simplified drag force is used to demonstrate change in acceleration, however it is only needed if acceleration is not constant. struct Body ;


Error terms

The global truncation error of the Verlet method is \mathcal O\left(\Delta t^2\right), both for position and velocity. This is in contrast with the fact that the local error in position is only \mathcal O\left(\Delta t^4\right) as described above. The difference is due to the accumulation of the local truncation error over all of the iterations. The global error can be derived by noting the following: :\operatorname\bigl(x(t_0 + \Delta t)\bigr) = \mathcal O\left(\Delta t^4\right) and :x(t_0 + 2\Delta t) = 2x(t_0 + \Delta t) - x(t_0) + \Delta t^2 \ddot(t_0 + \Delta t) + \mathcal O\left(\Delta t^4\right). Therefore :\operatorname\bigl(x(t_0 + 2\Delta t)\bigr) = 2\cdot\operatorname\bigl(x(t_0 + \Delta t)\bigr) + \mathcal O\left(\Delta t^4\right) = 3\,\mathcal O\left(\Delta t^4\right). Similarly: :\begin \operatorname\bigl(x(t_0 + 3\Delta t)\bigl) &= 6\,\mathcal O\left(\Delta t^4\right), \\ px\operatorname\bigl(x(t_0 + 4\Delta t)\bigl) &= 10\,\mathcal O\left(\Delta t^4\right), \\ px\operatorname\bigl(x(t_0 + 5\Delta t)\bigl) &= 15\,\mathcal O\left(\Delta t^4\right), \end which can be generalized to (it can be shown by induction, but it is given here without proof): :\operatorname\bigl(x(t_0 + n\Delta t)\bigr) = \frac\,\mathcal O\left(\Delta t^4\right). If we consider the global error in position between x(t) and x(t + T), where T = n\Delta t, it is clear that :\operatorname\bigl(x(t_0 + T)\bigr) = \left(\frac + \frac\right) \mathcal O\left(\Delta t^4\right), and therefore, the global (cumulative) error over a constant interval of time is given by :\operatorname\bigr(x(t_0 + T)\bigl) = \mathcal O\left(\Delta t^2\right). Because the velocity is determined in a non-cumulative way from the positions in the Verlet integrator, the global error in velocity is also \mathcal O\left(\Delta t^2\right). In molecular dynamics simulations, the global error is typically far more important than the local error, and the Verlet integrator is therefore known as a second-order integrator.


Constraints

Systems of multiple particles with constraints are simpler to solve with Verlet integration than with Euler methods. Constraints between points may be, for example, potentials constraining them to a specific distance or attractive forces. They may be modeled as springs connecting the particles. Using springs of infinite stiffness, the model may then be solved with a Verlet algorithm. In one dimension, the relationship between the unconstrained positions \tilde_i^ and the actual positions x_i^ of points i at time t, given a desired constraint distance of r, can be found with the algorithm :\begin d_1 &= x_2^ - x_1^, \\ pxd_2 &= \, d_1\, , \\ pxd_3 &= \frac, \\ pxx_1^ &= \tilde_1^ + \tfrac d_1 d_3, \\ pxx_2^ &= \tilde_2^ - \tfrac d_1 d_3. \end Verlet integration is useful because it directly relates the force to the position, rather than solving the problem using velocities. Problems, however, arise when multiple constraining forces act on each particle. One way to solve this is to loop through every point in a simulation, so that at every point the constraint relaxation of the last is already used to speed up the spread of the information. In a simulation this may be implemented by using small time steps for the simulation, using a fixed number of constraint-solving steps per time step, or solving constraints until they are met by a specific deviation. When approximating the constraints locally to first order, this is the same as the
Gauss–Seidel method In numerical linear algebra, the Gauss–Seidel method, also known as the Liebmann method or the method of successive displacement, is an iterative method used to solve a system of linear equations. It is named after the German mathematicians Carl ...
. For small
matrices Matrix most commonly refers to: * ''The Matrix'' (franchise), an American media franchise ** ''The Matrix'', a 1999 science-fiction action film ** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchis ...
it is known that
LU decomposition In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix (see matrix decomposition). The product sometimes includes a p ...
is faster. Large systems can be divided into clusters (for example, each
ragdoll The Ragdoll is a breed of cat with a distinct colorpoint coat and blue eyes. Its morphology is large and weighty, and it has a semi-long and silky soft coat. American breeder Ann Baker developed Ragdolls in the 1960s. They are best known for the ...
 = cluster). Inside clusters the LU method is used, between clusters the
Gauss–Seidel method In numerical linear algebra, the Gauss–Seidel method, also known as the Liebmann method or the method of successive displacement, is an iterative method used to solve a system of linear equations. It is named after the German mathematicians Carl ...
is used. The matrix code can be reused: The dependency of the forces on the positions can be approximated locally to first order, and the Verlet integration can be made more implicit. Sophisticated software, such as SuperLU exists to solve complex problems using sparse matrices. Specific techniques, such as using (clusters of) matrices, may be used to address the specific problem, such as that of force propagating through a sheet of cloth without forming a
sound wave In physics, sound is a vibration that propagates as an acoustic wave, through a transmission medium such as a gas, liquid or solid. In human physiology and psychology, sound is the ''reception'' of such waves and their ''perception'' by the ...
. Another way to solve
holonomic constraints In classical mechanics, holonomic constraints are relations between the position variables (and possibly time) that can be expressed in the following form: :f(u_1, u_2, u_3,\ldots, u_n, t) = 0 where \ are the ''n'' generalized coordinates that d ...
is to use
constraint algorithm In computational chemistry, a constraint algorithm is a method for satisfying the Newtonian motion of a rigid body which consists of mass points. A restraint algorithm is used to ensure that the distance between mass points is maintained. The gene ...
s.


Collision reactions

One way of reacting to collisions is to use a penalty-based system, which basically applies a set force to a point upon contact. The problem with this is that it is very difficult to choose the force imparted. Use too strong a force, and objects will become unstable, too weak, and the objects will penetrate each other. Another way is to use projection collision reactions, which takes the offending point and attempts to move it the shortest distance possible to move it out of the other object. The Verlet integration would automatically handle the velocity imparted by the collision in the latter case; however, note that this is not guaranteed to do so in a way that is consistent with collision physics (that is, changes in momentum are not guaranteed to be realistic). Instead of implicitly changing the velocity term, one would need to explicitly control the final velocities of the objects colliding (by changing the recorded position from the previous time step). The two simplest methods for deciding on a new velocity are perfectly
elastic Elastic is a word often used to describe or identify certain types of elastomer, elastic used in garments or stretchable fabrics. Elastic may also refer to: Alternative name * Rubber band, ring-shaped band of rubber used to hold objects togethe ...
and
inelastic collision An inelastic collision, in contrast to an elastic collision, is a collision in which kinetic energy is not conserved due to the action of internal friction. In collisions of macroscopic bodies, some kinetic energy is turned into vibrational ene ...
s. A slightly more complicated strategy that offers more control would involve using the
coefficient of restitution The coefficient of restitution (COR, also denoted by ''e''), is the ratio of the final to initial relative speed between two objects after they collide. It normally ranges from 0 to 1 where 1 would be a perfectly elastic collision. A perfec ...
.


See also

*
Courant–Friedrichs–Lewy condition In mathematics, the convergence condition by Courant–Friedrichs–Lewy is a necessary condition for convergence while solving certain partial differential equations (usually hyperbolic PDEs) numerically. It arises in the numerical analysis of ex ...
*
Energy drift In computer simulations of mechanical systems, energy drift is the gradual change in the total energy of a closed system over time. According to the laws of mechanics, the energy should be a constant of motion and should not change. However, in sim ...
*
Symplectic integrator In mathematics, a symplectic integrator (SI) is a numerical integration scheme for Hamiltonian systems. Symplectic integrators form the subclass of geometric integrators which, by definition, are canonical transformations. They are widely used in ...
*
Leapfrog integration In numerical analysis, leapfrog integration is a method for numerically integrating differential equations of the form \ddot x = \frac = A(x), or equivalently of the form \dot v = \frac = A(x), \;\dot x = \frac = v, particularly in the case of a ...
* Beeman's algorithm


Literature


External links


Verlet Integration Demo and Code as a Java AppletAdvanced Character Physics by Thomas Jakobsen
– bottom of page {{DEFAULTSORT:Verlet Integration Numerical differential equations Articles with example C++ code Computational physics Molecular dynamics