Optical simulation on Graphics Processing Units

Simulations for propagation of electromagnetic fields are time consuming for complex or large systems. The Vector Wave Propagation Method is a Fourier method, based on the Raleigh-Sommerfeld diffraction integral and the scalar Wave Propagation Method (WPM) introduced by Brenner et. al. in 1993. The VWPM was introduced by Fertig et. al. 2011. It simulates the propagation of three-dimensional vector waves through inhomogeneous media over the full range of spatial frequencies, i.e. without paraxial limitations as they exist for example in the Beam Propagation Method (BPM).

Compared to the Finite Difference Time Domain (FDTD) method, memory space and calculation time consumed by the VWPM are low while the results are comparable for systems with a preferred (optical) axis of propagation. This makes the VWPM a useful method for simulating complex lens systems or comparable system.

A multi-threaded version of the VWPM algorithm exists since 2011. It scales with second order in the number of samples for the three-dimensional case. The two-dimensional scalar algorithm has been ported to a massively parallel GPU system in 2017 and subsequently the three-dimensional and vector versions as well. Executables and system configuration files are available for download in the tables below. Further runtime improvements are subject of investigations.


Fourier methods

The list of Fourier simulators shown here covers Beam and Wave Propagation Methods for scalar and vector waves to run on CPU and GPU hardware. It has to be mentioned that a vectorial version of the Beam Propagation Method if of limited benefit due to its limitation to paraxial propagation. All methods provided here are unidirectional algorithms. The bidirectional versions are available as well but not for free download. All binaries have been compiled for Linux (Ubuntu).

Method Type 2D/3D CPU GPU File
SBPM1 scalar, unidirectional3 2D
[.tgz*]
SBPM scalar, unidirectional 3D
[.tgz*]
SWPM2 scalar, unidirectional 2D
[.tgz]
SWPM scalar, unidirectional 3D
[.tgz]
VWPM vectorial, unidirectional 2D
[.tgz]
VWPM vectorial, unidirectional 3D
[.tgz]
[1] Beam Propagation Method
[2] Wave Propagation Method
[3] bidirectional algorithms are available for all methods but not listed here.
[*] Electromagnetic programming laboratory. Contains various benchmarks for standard and optimized 2D/3D CPU and GPU versions of the BPM.

System configuration files

System File
Homogeneous Medium [.cfg]
Interface [.cfg]
Waveguide [.cfg]
Lens [.cfg]
Taper [.cfg]
Splitter [.TBD]
Grating [.cfg]
Asphere [.TBD]
User-defined [.TBD]
System configurations can be combined to create complex systems. In this case, scene size and sampling have to match. Please secure that the comma separator is a dot to avoid parser problems. Change the dot in the configuration files to a comma in case of parser problems.

How to install the simulator?

In case of library problems, secure that the shared library libcufft7.5.so (or higher) is available on your system and that the environment variable for the linker LD_LIBRARY_PATH in set properly. If the library is not available on your system and you do not have the rights to install it, get the library from the internet and copy it to the extraction directory of the tar-archive your_tar_extract_dir.

export LD_LIBRARY_PATH = your_tar_extract_dir:$LD_LIBRARY_PATH


How to invoke the simulator?

To start a simulation, a configuration file has to be specified. Such files are provided with the tar-archive for simple system configurations like for example a waveguide, i.e. wguide.cfg. A course on electromagnetic Fourier simulation can be found here.

To start a simulation on your CPU, invoke the simulator as follows

./pm -p -i wguide.cfg

To start a simulation on your GPU, invoke the simulator as follows

./pm -g -i wguide.cfg

To run a simulation on CPU and GPU, invoke the simulator as follows

./pm -g -p -i wguide.cfg

To compare execution times of CPU and GPU runs, invoke the simulator as follows

./pm -g -p -c -i wguide.cfg

To store the runtime results for a series of runs into a file, invoke the simulator as follows

./pm -g -p -c -i wguide.cfg -r qor.csv

To suppress messages when invoking the simulator for a series of runs from a script

./pm -q -g -p -c -i wguide.cfg -r qor.csv

To print the available options of the simulator, invoke the help function of the simulator as follows

./pm -h


How to configure a 3D simulation with the VWPM?

Use the executable in the vwpm3u.tgz and create a configuration file of the following format. Global parameters are set in the global section and some parameters are only applicable to the GUI-version of the tool. The relevant parameters for the batch-version are

[global]
nx = 48
ny = 48
nz = 96
x = 4000
y = 4000
z = 8000
method = vwpm
scale = nm
[/global]

Define one or more electric input field distributions by one wave section per distribution. Configuration files are parsed line-by-line. Please do not specify more than one parameter per line.

Gaussian beam Plane wave User-defined

[wave]
shape = gauss
sigmax = 1250
sigmay = 1250
x = 0
y = 0
z = 0
theta = 0
phi = 0
beta = 0
amp = 1
lambda = 850
[/wave]

[wave]
shape = plane
x = 0
y = 0
z = 0
theta = 0
phi = 0
beta = 0
amp = 1
lambda = 850
[/wave]

[wave]
shape = user

...


[/wave]

User-defined wave-sections and
layer-sections are under work
and will be available soon.
Define one or more layers by their real and imaginary parts of the refractive index. Secure that the sum of lengths match the definition in the global section.

Homogeneous medium Lens Waveguide Taper 2D Grating

[layer]
type = homog
z = 1000
n = 1.0
k = 0
[/layer]

[layer]
type = lens
x = 0
y = 0
z = 2000
r = -1800
n = 1.6
k = 0
ne = 1.0
ke = 0
dx = 0
dy = 0
dz = 0
[/layer]

[layer]
type = waveguide
x = 0
y = 0
z = 3000
r = 500
n = 1.6
k = 0
ne = 1.0
ke = 0
dx = 0
dy = 0
dz = 0
[/layer]

[layer]
type = taper
x = 0
y = 0
z = 11000
rin = 1000
rout = 200
n = 1.6
k = 0
ne = 1.0
ke = 0.0
dx = 0
dy = 0
dz = 0
[/layer]

[layer]
type = grating
x = 0
y = 0
z = 2000
px = 10000
py = 10000
wx = 5000
wy = 5000
n = 1.6
k = 0.03
ne = 1.0
ke = 0
dx = 0
dy = 0
dz = 0
[/layer]

User-defined layer-sections are under work and will be available soon.

What is the output?

The simulation returns the electric field distribution of vector or scalar fields as a comma-separated list, i.e. .csv-files. The list can be easily imported to other tools for analysis and coloring. The output can be also imported to the GUI-version of the tool. The GUI-version supports lots of other useful features to setup complex systems and analyze the electromagnetic field distribution, the energy flux and irradiance and more.

What are the next steps?

The actual versions of the simulator do not support shared-memory kernels on the GPU. The improvement of using shared memory is under development and will be available for download soon. It is also planned to improve runtimes by dynamic-programming. The algorithms contain lots of symmetries and shared expressions that can be reused to avoid unnecessary computation steps.

Conservation of energy

WPM and VWPM show violations of the conservation law under specific circumstances, Hence, the system design requires special attention!