Jan's OpenCL FDTD electromagnetic simulation in 3 dimensions
Go to file
2017-08-14 15:41:20 -07:00
opencl_fdtd rename lib 2017-08-14 15:41:20 -07:00
.gitignore gitignore changes 2016-03-30 15:06:20 -07:00
fdtd.py rename lib 2017-08-14 15:41:20 -07:00
LICENSE.md Use markdown for license 2016-04-13 03:57:09 -07:00
pcgen.py Fix triangular lattice code in pgcgen 2016-06-21 18:25:23 -07:00
README.md Update readme 2017-03-29 01:09:21 -07:00
requirements.txt Rewrite, with the following features: 2017-03-28 21:53:51 -07:00

opencl_fdtd

opencl_fdtd is a python application for running 3D time-domain electromagnetic simulations on parallel compute hardware (mainly GPUs).

Performance highly depends on what hardware you have available:

  • A 395x345x73 cell simulation (~10 million points, 8-cell absorbing boundaries) runs at around 91 iterations/sec. on my AMD RX480.
  • On an Nvidia GTX 580, it runs at 66 iterations/sec
  • On my laptop (Nvidia 940M) the same simulation achieves ~12 iterations/sec.
  • An L3 photonic crystal cavity ringdown simulation (1550nm source, 40nm discretization, 8000 steps) takes about 3 minutes on my laptop.

Capabilities are currently pretty minimal:

  • Absorbing boundaries (CPML)
  • Perfect electrical conductors (PECs; to use set epsilon to inf)
  • Anisotropic media (eps_xx, eps_yy, eps_zz, mu_xx, ...)
  • Direct access to fields (eg., you can trivially add a soft or hard current source with just sim.E[ind] += sin(f0 * t), or save any portion of a field to a file)

Installation

Requirements:

To get the code, just clone this repository:

git clone https://mpxd.net/gogs/jan/opencl_fdtd.git

You can install the requirements and their dependencies easily with

pip install -r requirements.txt

Running

The root directory contains fdtd.py, which sets up and runs a sample simulation (cavity ringdown).

python3 fdtd.py