Giter Site home page Giter Site logo

eminsight / dda Goto Github PK

View Code? Open in Web Editor NEW

This project forked from steffen-kiess/dda

0.0 1.0 0.0 521 KB

A discrete dipole approximation (DDA) implementation for the GPU

License: Other

C++ 87.33% C 9.18% Common Lisp 0.06% GLSL 0.15% Shell 0.73% MATLAB 0.09% Python 2.46%

dda's Introduction

This project is a discrete dipole approximation (DDA) implementation for
GPUs (in particular for NVIDIA GPUs) using OpenCL.

The algorithms are heavily based on ADDA <http://code.google.com/p/a-dda/>.

Currently only linux i386 and amd64 is supported. In order to build a windows
version the build system would have to be adapted.

The code includes a CPU implementation which can be used with --cpu, however
this mode is mainly intended for debugging and not particularly fast.

There is some support for multi-gpu operation but this is completely untested.

There also is some support for periodic targets, but no support for getting
the far field or cross sections of periodic targets.

All output files are written as HDF5 files. These HDF5 files can be read by
matlab (with "load -mat 'file.hdf5'") or octave (with "load 'file.hdf5'").

The HDF5 files can be converted to text files and the jones matrix files can be
converted to mueller matrix files using EMSim/Hdf5Util.

There are some examples in Matlab/ which show how to read / write the HDF5 files
with matlab or octave.

The electric far field at distance r (in meter) can be computed as
E_far(r) = exp(ikr) / r * JM * E_inc
where E_far is the electric far field Jones vector, k is the wave number, JM is
the Jones matrix and E_inc is the incident field Jones vector or as
I_far(r) = 1 / r^2 * MM * I_inc
where I_far is the far field Stokes vector, MM is the Mueller matrix and I_inc
is the incident Stokes vector.


To compile and run the code you need:
- omake <http://omake.metaprl.org/index.html>
- gcc and g++ 4.5 or later (clang/clang++ 3.0 or later also should work)
- boost <http://www.boost.org/>
  Version 1.42 or any later version should work
- The HDF5 libraries <http://www.hdfgroup.org/HDF5/>
  Version 1.8.4 or any later version should work
- FFTW <http://www.fftw.org/>
  Version 3.2.2 or any later version should work
  FFTW has to be build for single, double and long double precision
- OpenCL and a OpenCL-capable GPU driver

Under Debian/Ubuntu you should be able to install this (except for OpenCL) with
sudo apt-get install gcc g++ omake libboost-all-dev libhdf5-serial-dev libfftw3-dev

Compilation is started by typing
omake
If adda is in $PATH a list of tests can be executed by typing
omake test


To execute the DDA type
DDA/DDA

A list of available options can be seen with
DDA/DDA --help


Examples:

# Compute plane far field for a sphere with a radius of 10um and a refractive
# index of 1.5+0.1i using a wavelength of 6um:
DDA/DDA --geometry=sphere:10um,1.5+0.1i --lambda 6um --efield

# The same with a dipole distance of 0.5um:
DDA/DDA --geometry=sphere:10um,1.5+0.1i --lambda 6um --efield --grid-unit 0.5um

# Compute grid far field (theta from 0 deg to 180 deg in steps of 2 deg, phi
# from 0 deg to 360 deg in steps of 6 deg) for a box with a size of 10x5x5um
# and a refractive index of 1.5+0.1i with an incident beam direction of (0,1,0)
# with lambda = 6um
DDA/DDA --geometry='box:(10um,5um,5um),1.5+0.1i' --lambda 6um --prop '(0,1,0)' --efield

# Do the same on the CPU
DDA/DDA --geometry='box:(10um,5um,5um),1.5+0.1i' --lambda 6um --prop '(0,1,0)' --efield --cpu

dda's People

Contributors

steffen-kiess avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.