GithubHelp home page GithubHelp logo

opencl_fdfd's Introduction

opencl_fdfd

opencl_fdfd is a 3D Finite Difference Frequency Domain (FDFD) electromagnetic solver implemented in Python and OpenCL.

Capabilities:

  • Arbitrary distributions of the following:
    • Dielectric constant (epsilon)
    • Magnetic permeabilty (mu)
    • Perfect electric conductor (PEC)
    • Perfect magnetic conductor (PMC)
  • Variable-sized rectangular grids
    • Stretched-coordinate PMLs (complex cell sizes allowed)

Currently, only periodic boundary conditions are included. PEC/PMC boundaries can be implemented by drawing PEC/PMC cells near the edges. Bloch boundary conditions are not included but wouldn't be very hard to add.

The default solver opencl_fdfd.cg_solver(...) located in main.py implements the E-field wave operator directly (ie, as a list of OpenCL instructions rather than a matrix). Additionally, there is a slower (and slightly more versatile) solver in csr.py which attempts to solve an arbitrary sparse matrix in compressed sparse row (CSR) format using the same conjugate gradient method as the default solver. The CSR solver is significantly slower, but can be very useful for testing alternative formulations of the FDFD electromagnetic wave equation.

Currently, this solver only uses a single GPU or other OpenCL accelerator; generalization to multiple GPUs should be pretty straightforward (ie, just copy over edge values during the matrix multiplication step).

Installation

Dependencies:

  • python 3 (written and tested with 3.7)
  • numpy
  • pyopencl
  • jinja2
  • meanas (>=0.5)

Install with pip, via git:

pip install git+https://mpxd.net/code/jan/opencl_fdfd.git@release

Use

See the documentation for opencl_fdfd.cg_solver(...) (located in main.py) for details about how to call the solver. The FDFD arguments are identical to those in meanas.solvers.generic(...), and a few solver-specific arguments are available.

An alternate (slower) FDFD solver and a general gpu-based sparse matrix solver is available in csr.py. These aren't particularly well-optimized, and something like MAGMA would probably be a better choice if you absolutely need to solve arbitrary sparse matrices and can tolerate writing and compiling C/C++ code. Still, they're usually quite a bit faster than the scipy.linalg solvers.

opencl_fdfd's People

Contributors

anewusername avatar

Stargazers

Lucas Grosjean 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.