Module 4
Module 4
Kirit Makwana
Department of Physics, IIT Hyderabad
dy d 2 y d 3 y
f x, y , , 2 , 3 , ...., c1 , c2 , ... = 0 (1)
dx dx dx
is an ODE
The order of the PDE is the highest order derivative that appears in it
Ex. Poisson equation in 1 dimension
d 2ϕ ρ(x)
2
=− (2)
dx ϵ0
F
a=m =⇒
d 2x
=
F = a(x , t) (3)
dt 2 m
If the force field F (x , t), which can be a function of space and time,
is known and the mass of the particle is given, then we know the
acceleration a (x , t) also as a function of space and time
Given the starting position and velocity of the particle, it should be
possible to solve this equation to obtain the position of the particle at
any later time
However, even for simple force fields this may not be possible
analytically
This can be done numerically by breaking time and space into
discrete chunks
Kirit MakwanaDepartment of Physics, IIT Hyderabad
EP4210/EP24040 - Computational Physics 4 / 21
Verlet method
Lets Taylor expand the position of the particle around time t
However, there is a problem at the first time step itself, starting from
t=0
We only know the position and velocity of the particle at time t = 0,
but we also require its position at time −∆t to take the first step
This can again be approximated by the Taylor series
2
x (−∆t) = x (0) − ∆t v (0) + ∆t2 a(0) − O(∆t 3 ) (8)
Exercise
Consider a particle of unit mass moving under the action of a force
The Euler method simply derives from the first order Taylor expansion
df
fn+1 = fn + ∆x + O(∆x 2 ) (12)
dx n
dfn ∆x 2 d 2 fn
fn+1 = fn + ∆x + + O(∆x 3 ) (14)
dx 2 dx 2
∆x 2 dG (xn , fn )
= fn + ∆xG (xn , fn ) + + O(∆x 3 ) (15)
2 dx
By using the chain rule we get
∆x 2 ∂Gn ∂Gn
fn+1 = fn + ∆xG (xn , fn ) + + Gn + O(∆x 3 ) (16)
2 ∂x ∂f
The term in the square brackets is exactly the term required in the
Eq. 16
Ignoring the third order term, we get the midpoint RK method which
is second-order accurate
It can be broken down as
d 2r
= a (r , t) (30)
dt 2
This can be converted into coupled 1st order ODEs
dr
= v (r , t) (31)
dt
dv
= a (r , t) (32)
dt
Now we have two dependent variables, r and v
So the dependent variables can be thought of as a vector, giving
d r v (r , t)
dt v a(r , t)
= (33)
d 2r
= [E + v × B ]
q
(36)
dt 2 m
Then the G vector becomes
vx
vy
vz
G =
(37)
(q/m)(E x + vy Bz − v z By )
(q/m)(Ey − vx Bz + vz Bx )
(q/m)(Ez + vx By − vy Bx )
Repeat the particle trajectory exercise of Verlet method with the RK2
method
Consider a particle of unit mass moving under the action of a force