100% found this document useful (1 vote)
129 views

An Introduction To The Split Step Fourier Method Using MATLAB

This document provides an introduction to solving partial differential equations using the Split Step Fourier Method (SSFM) in MATLAB. It discusses using SSFM to solve the linear Schrodinger equation in 1D as a prototypical example. The method is then extended to nonlinear problems, coupled systems, and higher dimensions. Code implementations of SSFM for the 1D linear Schrodinger equation are presented to demonstrate the simplicity and accuracy of the numerical method.

Uploaded by

Leonard Nsah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
129 views

An Introduction To The Split Step Fourier Method Using MATLAB

This document provides an introduction to solving partial differential equations using the Split Step Fourier Method (SSFM) in MATLAB. It discusses using SSFM to solve the linear Schrodinger equation in 1D as a prototypical example. The method is then extended to nonlinear problems, coupled systems, and higher dimensions. Code implementations of SSFM for the 1D linear Schrodinger equation are presented to demonstrate the simplicity and accuracy of the numerical method.

Uploaded by

Leonard Nsah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/281441538

An introduction to the Split Step Fourier Method using MATLAB

Research · September 2015


DOI: 10.13140/RG.2.1.1394.0965

CITATIONS READS
10 40,171

1 author:

Pablo Suarez
Delaware State University
13 PUBLICATIONS   139 CITATIONS   

SEE PROFILE

All content following this page was uploaded by Pablo Suarez on 02 September 2015.

The user has requested enhancement of the downloaded file.


An introduction to the Split Step Fourier
Method using MATLAB
Pablo U. Suárez
January 18, 2013

Abstract
The Split Step Fourier Method provides an excellent methodology
for learning and teaching how to solve time dependent partial differ-
ential equations. This method is ubiquitously used in engineering and
physics applications. In this article, we present the simplicity of this
method by solving the Linear and Nonlinear Schrödinger Equation
and with the aid of MATLAB, we demonstrate a straight forward im-
plementation. Extension to other type of problems are also discussed
with the corresponding codes. This article illustrates a very powerful
numerical technique that can be implemented quite easily.

1 Introduction
The Split Step Fourier Method(SSFM) is a part of the the family of pseudo-
spectral methods used to solve time dependent nonliner partial differential
equation. The approach followed by SSFM follows the old age strategy of
divide and conquer. The nonlinear PDE is divided into related sub-problems
of the original equation. The method is easy to understand and with the use
of MATLAB the implementation is straight forward.
In this article, we shall illustrate the implementation of the Fourier Split
Method using MATLAB. We shall discuss the numerical solution of a variety
of examples. We begin with the one dimesional linear Schrödinger Equation,
the nonliner Schrd̈oinger equation, systems of the Schrodinger and the 2D
Schrödinger equation. For a more detailed discussion on the origins and
development of the method, the reader may wish to refer to books listed in

1
the references such as [7], [8] and [9]. We shall also assume that the reader
has a basic knowledge of MATLAB programming, although the reader may
also wish to consult a standard text on MATLAB such as [10].

2 Solving the Linear Schrödinger Equation


by SSFM
To illustrate the method we consider the prototypical example of solving the
Linear Schrödinger Equation (LSE). This equation appears in many appli-
cations such as quantum mechanics, electromagnetism, telecommunications
and other fields. The non-dimensional time depent Linear Schrödinger equa-
tion is as follows:
∂u 1 ∂ 2u
i =− + V (x)u, −∞ < x < ∞ (1)
∂t 2 ∂x2
u(x, 0) = u0 (x)

Here u is a complex valued function, V (x) a real function and i2 = −1. In


solving this nonliner PDE one requires that the boundary condtions go to 0
as x → ±∞ that is lim u(x, t) → 0 .
x→±∞
It is known that for different values of the “potential” , V (x), one cannot
find a general solution. Instead one needs to resort to numerical methods for
solving this PDE.

Splitting of the LSE It is convinient to rewrite equation (1) as :

∂u
= iLu + iN u, −∞ < x < ∞, (2)
∂t
where
1 ∂2
L=− and N = −V (x). (3)
2 ∂x2
Consider a small interval of time, say [τ, τ + ∆t]. Now assume that u(τ, x) is
known and assume that L is negligible, that is uxx ≈ 0. Then (1) reduces to

∂u
i = Nu (4)
∂t

2
This approximation leads to an ordinary differential equation (ODE) in time.
The solution to this ODE is known and the solution at time t = τ + ∆t is
given by
u(x, τ + ∆t) = exp (i∆tN ) u(x, τ ). (5)
Next, we redo the problem but neglect the contribution of N . For this case
the PDE is linear with no variable coefficients,
∂u
= iLu. (6)
∂t
This equation will be solved in the interval [τ, τ + ∆t] and use u(x, τ + ∆t)
as the initial condition. An analytical solution to this equation can be by
taking the Fourier Transform
 2 
∂ û ∂ u
= iF(Lu) = iF = −ik 2 û. (7)
∂t ∂x2
In this work we use the following Fourier and Inverse Fourier Transform
definitions

Z ∞
ĥ(k) = F(h) = h(x)e−2πikx dx (8)
Z−∞

h(x) = F(ĥ) = ĥ(k)e2πikx dk (9)
−∞

The partial derivatives are now gone and the equation becomes an ODE. The
analytical solution can be computed and value of û(x, τ + ∆t) is given by

û(k, τ + ∆t) = exp −ik 2 ∆t û(k, τ )



(10)

The solution in the x domain can be calculated by inverse of the Fourier


Transform:

u(x, τ + ∆t) = F −1 (exp(−ik 2 ∆t)û(k, τ + ∆t)) (11)

The entire procedure can be stated in a single equation:

u(x, τ + ∆t) = F −1 exp −ik 2 ∆t · F (exp (i∆tV (x)) u(x, τ ))


 
(12)

The essence of the split method is to think of advancing in time and applying
L and N one at a time to complete each time step.

3
3 Implementation
In this section we discuss the algorithm of SSFM, the MATLAB implemeta-
tion of it and show some numerical experiments.

3.1 SSFM Algorithm and Implementation


We now discuss the implementation of the Split Step Fourier Method. u
is solved by first multipliying it by exp (i∆tV (x)) . Then taking Fourier
Transforms of u and finally taking the Inverse of the Fourier Transform.
In the language of a computer, u(n) is a vector that is being updated
first by multipliying it by the expontential of a . The discrete analog of the
Fourier Transform and its inverse are the so called Discrete Fourier Trans-
forms (FDT) and Inverse Discrete Fourier Transform (IFDT). MATLAB can
easily manipulate arrays operations and the DFTs and IFDTs are calcu-
lated by the bulitin functions Fast Fourier Transform (fft) and Inverse Fast
Fourier Transform (ifft). Algorithm (3.1) suggest how this procedure will
go.

Algorithm 3.1: SSFM(u0 , un , M )

u(n) ← u0
k ← 2π
L
(−N/2 : 1 : N/2 − 1)
← 1 to M
for n 

 u(n+1/2) ← exp (i∆tV (x)) u(n)
û(n+1/2) ← F(u(n+1/2) )


do û(n+1) ← exp(−i∆tk 2 )û(n+1/2)
u(n+1) ← F −1 (û(n+1) )



 (n)
u ← u(n+1)
return (un )

In algorithm(3.1) one should be understand that u(n) is a vector and thus


all the operations are component wise vector operations. This algorithm can
be understood by begginers in scientific computing programming. A shorter
version of Algorithm(3.2) can be obtained based on (12).

4
Algorithm 3.2: SSFM(u0 , un , M )

u(n) ← u0
for j ← 1 to M
u(n) ← F −1 exp (−ik 2 ∆t) · F exp (i∆tV (x)) u(n)


return (un )

The beauty of MATLAB can now be revelad when implementing either


Algorithm (3.1) or (3.2). MATLAB’s syntax permits almost “copy paste”
procedure of the algorithms. The reader can see this in the respective imple-
mentation of these codes. In particular, Algorithm (3.2) like the pseudocode
consists of only one line inside a for-loop!

3.2 Numerical Results for 1D LSE


To convince the reader that SSFM is an accurate numerical scheme we
present some numerical examples. We compare known analytical results
of the Schrödinger equation with the results obtained by SSFM. It should
be noted that there are rigorous arguments that concretely prove that this
method is numerically stable and second order accurate. We do not carry
this analysis as it requires more mathematical depth that might not be suit-
able for undergraduates, interested readers can see citation needed and
references therein.
In this subsection we disscuss the performance of SSFM for 1 Dimensional
Schrördinger Equation. We compare the numerical results with known ana-
lytical solutions and the calculated numerical solution.

4 Extension to other type of problems


In this section we discuss the extension of the SSFM to Nonlinear Problems,
Coupled Nonlinear Systems and Higher dimensional problems.

5
0.7 −3
x 10
Exact Solution 4.5
Numerical Solution
0.6 4

3.5
0.5

3
0.4
u(x, t ) 2.5

E rro r
0.3 2

1.5
0.2

0.1
0.5

0 0
−10 −8 −6 −4 −2 0 2 4 6 8 10 −10 −8 −6 −4 −2 0 2 4 6 8 10
x x

(a) Exact Solution vs Analytical (b) Error of the Solution

Figure 1: Linear Schrödinger Solution and Error at t = 2

4.1 Nonlinear Problems


We illustrate the procedure by solving the Nonlinear Schrödinger Equation:
∂u 1 ∂ 2u
i =− 2
− |u|2 u, (13)
∂t 2 ∂x
u(x, 0) = u0 (x) (14)
This equation can be written as a general nonlinear evolution equation of
form
∂u
= (L + N )u,
i (15)
∂t
u(x, 0) = u0 (x) (16)
2
where L = − 21 ∂x
∂ 2
2 and N = −|u| are time independent linear and nonlinear

operators, respectively. To solve this problem we follow the same procedure


as before and split the problem into two parts. The “nonlinear” step is given
by
∂u
i = N u. (17)
∂t
To advance the nonlinear part take N = q|u(x, τ + ∆t)|2 ≈ q|u(x, τ )|2 and
thus the analytical solution is given by
u(x, τ + ∆t) ≈ exp (i∆tN ) u(x, τ ) = exp iq∆t|u(x, τ )|2 u(x, τ ).

(18)
The linear step is given by
∂u
i = Lu. (19)
∂t
6
−3
10

MaxE rror
−4
10

−5
10
0 1 2 3 4 5 6 7 8 9 10
t

(a) Numerical Solution (b) Max error at each time step

Figure 2: Non-Linear Schrödinger Solution and Error

The linear part for this case has not changed and can be handled again
by taking Fourier Transform. If L is a differential operator with constant
coefficient only then we have
   
u(x, τ + ∆t) = F −1 exp i∆tL̂ · F (exp (i∆tN ) u(x, τ )) (20)

The code used in section 3 is modified and can be seen in the appendix.

4.2 Numerical Results for 1D NLSE


The numerical results show promise.

4.3 Higher Dimensional Problems


As a final example we show SSFM for 2D problems. We use the 2D version
of the LSE to illustrate this extension. After reading this last example the
reader can reason that this method can be extended to 2D with nonlinearities
or higher order dimensional problems. If is also worth stating that one can
use this method for systems of PDEs, (see for instance).
The 2D version of the LSE is given by:
1 ∂2 ∂2
 
∂u
i =− + u + V (x, y)u (21)
∂t 2 ∂x2 ∂y 2
The SSFM is employed by letting
1 ∂2 ∂2
 
L=− + (22)
2 ∂x2 ∂y 2
N = V (x, y) (23)

7
(a) Numerical Solution (b) Exact Solution

(c) Relative Error at time step


t=6

Figure 3: Non-Linear Schrödinger Solution and Error

5 Other Nonlinear Equations


The discussion here has been limited only to the nonlinear Schrodinger [2, 7]
equation. However other time dependent nonlinear/linear problems can be
solved by this method.

5.1 Benjamin Ono Equation


In this last example we use the Benjamin Ono equation to show how SSFM
is applied. This example might seem exotic for undergraduate students.
The B-O equation is given by
 2 
∂u ∂u ∂ u
+u +H = 0, −∞ < x < ∞, t > 0 (24)
∂t ∂x ∂x2

8
where H is the Hilbert Transform definde as
1 ∞ f (y)
Z
H{f }(x) = dy
π −∞ y − x

together with initial and boundary conditions as


∂u
u(x, 0) = f (x) and u, → 0 as |x| → ∞.
∂x

6 Conclusions
In this article we presented the SSFM for solving linear and nonlinear Schrödinger
equation. Algorithms and MATLAB implementation were presented for
SSFM for both these equations. The algorithm showed the simplicity of
the method for both cases and thanks to MATLAB the implementation was
shown to be direct. Numerical examples were also shown to show the effi-
ciency of the method. We hope that this article can serve as stepping stone
for introductiong SSFM to undergraduates in a scientific computing course
or as a self study tutorial for advanced undergraduates/beginning graduate
conducting research.

9
References
[1] K-C Ang. Introducing the boundary element method with Matlab. Inter-
national Journal of Mathematical Education in Science and Technology,
39(4):505–519, 2008.

[2] R Becerril, R S Guzmán, A Rendón-Romero, and S Valdez-Alvarado.


Solving the time-dependent Schödinger equation using finite difference
methods. Revista Mexicana de Fı́sica, 54(2):120–132, 2008.

[3] J Boyd. Chebyshev and Fourier Spectral Methods. Dover, New York,
2001.

[4] Y W Kwon and H Bang. The Finite Element Method using Matlab. CRC
Press, New York, 1st edition, 1996.

[5] G M Muslu and H A Erbay. Higher-order split-step fourier schemes for the
generalized nonlinear schrödinger equation. Mathematics and Computers
in simulation, 67:581–595, 2005.

[6] T R Taha and M J Ablowitz. Analytical and numerical aspects of cer-


tain nonlinear evolution equations. II. Numerical, nonlinear Schrödinger
equation. Journal of Computational Physics, 55(2):203–230, 1984.

[7] T R Taha and X Xu. Parallel Split-Step Fourier Methods for the coupled
nonlinear Schrö dinger type equations. The Journal of Supercomputing,
5:5–23, 2005.

[8] JAC Weideman and B M Herbst. Split-step methods for the solution of
the nonlinear Schrödinger equation. SIAM Journal on Numerical Analy-
sis, 23:485–507, 1986.

[9] X-S Yang. An Introduction to Computational Engineering with MAT-


LAB. Cambridge International Science Publishing, 1st edition, 2006.

10
Appendix
In this appendix we present the codes used in this paper. All of the codes
required the standard MATLAB package and it has been tested to work with
the student version as well.

LSE SSFM Implementation


N = Q; % Number of Fourier modes
dt = .005; % Size of time step
tfinal = 2; % Final time
M = round(tfinal/dt); % Total number of time steps
J = 100; % Steps between output
L = 20; % Space period
q = -1;
mu = 2/3;
v = 1;

h = L/N; % Space step


n = (-N/2:1:N/2-1)’; % Indices
x = n*h; % Grid points

u0 = (12 - 48*x.^2 + 16*x.^4)./...


(8.*sqrt(6).*exp(x.*x/2.)*pi.^0.25)
u = u0; % Initial Condition
k = 2*n.*pi/L; % Wavenumbers.
t = 0;

for m = 1:1:M % Start time loop

u = exp(dt/2*1j*q*x.^2).*u; % Solve non-constant part of LSE


c = fftshift(fft(u)); % Take Fourier transform
c = exp(dt/2*1j*-k.^2).*c; % Advance in Fourier Space
u = ifft(fftshift(c)); % Return to Physical Space

end

11
NLSE SSFM Implementation
N = 512; % Number of Fourier modes
dt = .001; % Time step
tfinal = 10; % Final time
M = round(tfinal./dt); % Total number of time steps
J = 100; % Steps between output
L = 50; % Space period
h = L/N; % Space step
n =( -N/2:1:N/2-1)’; % Indices
x = n*h; % Grid points
u = exp(1i*x).*sech(x);%Intial condition
k = 2*n*pi/L; % Wavenumbers.

for m = 1:1:M % Start time loop

u = exp(dt*1i*(abs(u).*abs(u))).*u; % Solve non-linear part of NLSE


c = fftshift(fft(u)); % Take Fourier transform
c = exp(-dt*1i*k.*k/2).*c; % Advance in Fourier space
u = ifft(fftshift(c)); % Return to Physical Spacee

end

12
2D LSE SSFM Implementation
N =
256; % Number of Fourier modes
dt =
.0001; % Time step
tfinal =
6; % Final time
M =
round(tfinal/dt); % Total number of time steps
L =
10; % Space period
h =
L/N; % Space step
n =
[-N/2:1:N/2-1]’; % Indices
x =
n*h; % Grid points along x
y =
n*h; % Grid points along y
[X,Y] =
meshgrid(x,y);
u0 =
(exp(-X.^2/2 - Y.^2/2).*(-2 + 4*X.^2).*...
(-12*Y + 8*Y.^3))/(8*sqrt(6*pi));
u = u0; % Initial condition
k = 2*n*pi/L; % Wavenumbers.
[Ex,Ey] = meshgrid(e,e); % Wavenumbers along both directions.

for m = 1:1:M % Start time loop

u = exp(dt*1i*-1/2*(X.^2+Y.^2)).*u; % Solve non-constant part of 2D-LSE


c = fftshift(fft2(u)); % Take 2D-Fourier transform
c = exp(dt/2*1i*(-Ex.^2-Ey.^2)).*c; % Advance in Fourier space
u = ifft2(fftshift(c)); % Return to physical space

end

13
B-O Equation SSFM Implementation
N = 256; % Number of Fourier modes
dt = .001; % Time step
tfinal = 6; % Final time
M = round(tfinal/dt); % Total number of time steps
L = 200; % Space period
h = L/N; % Space step
n = [-N/2:1:N/2-1]’; % Indices
x = n*h; % Grid points
kk = 1/(2*sqrt(13));
cc = .2;
u = 4*cc./(1 + cc^2*x.^2); % Compute IC
k = 2*n*pi/L; % Wavenumbers.

for m = 1:1:M % Start time loop

u = exp(ifft(fftshift(-dt*1i*k.*... % Solve nonlinear part of B-O Eq.


fftshift(fft(u))))).*u;
c = fftshift(fft(u)); % Take Fourier transform
c = exp(dt*1i*sign(n).*k.^2).*c; % Advance in Fourier space
u = ifft(fftshift(c)); % Return to physical space

end

14

View publication stats

You might also like