Adjoint Nonlinear Gradients
Project description
angler
angler
(named for 'adjoint nonlinear gradients') is a package for simulating and optimizing optical structures.
It provides a finite-difference frequency-domain (FDFD) solver for simulating for linear and nonlinear devices in the frequency domain.
It also provides an easy to use package for adjoint-based inverse design and optimization of linear and nonlinear devices. For example, you can inverse design optical switches to transport power to different ports for different input powers:
angler
is released as part of a paper Adjoint method and inverse design for nonlinear optical devices
, which can be viewed here.
Installation
One can install the most stable version of angler
and all of its dependencies (apart from MKL) using
pip install angler
Alternatively, to use the most current version
git clone https://github.com/fancompute/angler.git
pip install -e angler
And then this directory can be added to path to import angler, i.e.
import sys
sys.path.append('path/to/angler')
Make angler faster
The most computationally expensive operation in angler
is the sparse linear system solve. This is done with scipy.sparse.linalg.spsolve()
by default. If MKL is installed, angler
instead uses this with a python wrapper pyMKL
, which makes things significantly faster, depending on the problem. The best way to install MKL, if using anaconda, is
conda install MKL
(pyMKL does not work when MKL is pip installed.)
Examples / Quickstart
There are several jupyter notebook examples in the Notebooks/
directory.
For a good introduction, try:
Notebooks/Splitter.ipynb
For more specific applications:
Electromagnetic simulations
For modeling linear devices with our FDFD solver (no optimization), see
Notebooks/Linear_system.ipynb
For modeling nonlinear devices with FDFD (no optimization), see
Notebooks/Nonlinear_system.ipynb
Inverse design & optimization
For examples of optimizing linear devices, see
Notebooks/Splitter.ipynb
Notebooks/Accelerator.ipynb
For examples of optimizing nonlinear devices, see
Notebooks/2_port.ipynb
Notebooks/3_port.ipynb
Notebooks/T_port.ipynb
Package Structure
angler
provides two main classes, Simulation
and Optimization
, which perform most of the functionality.
Generally, Simulation
objects are used to perform FDFD simulations, and Optimization
classes run inverse design and optimization algorithms over Simulation
s. To learn more about how angler
works and how to use it, please take a look at angler/README.md for a more detailed explanation.
Tests
To run all tests:
python -m unittest discover tests
Or to run individually:
python tests/individual_test.py
Contributing
angler
is under development and we welcome suggestions, pull-requests, feature-requests, etc.
If you contribute a new feature, please also write a few tests and document your changes in angler/README.md or the wiki.
Authors
angler
was written by Tyler Hughes, Momchil Minkov, and Ian Williamson.
Citing
If you use angler
, please cite us using
@misc{hughes2018adjoint,
Author = {Tyler W. Hughes and Momchil Minkov and Ian A. D. Williamson and Shanhui Fan},
Title = {Adjoint method and inverse design for nonlinear nanophotonic devices},
Year = {2018},
Eprint = {arXiv:1811.01255},
}
License
This project is licensed under the MIT License - see the LICENSE.md file for details. Copyright 2018 Tyler Hughes.
Acknowledgments
- our logo was made by Nadine Gilmer
- RIP Ian's contributions before the code merge
- We made use of a lot of code snippets (and advice) from Jerry Shi
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file angler-0.0.15.tar.gz
.
File metadata
- Download URL: angler-0.0.15.tar.gz
- Upload date:
- Size: 25.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc75485350b037eae03e5632fdd11b6ed14b44e11cfee93504438331cf363c67 |
|
MD5 | 0342294c01333a04e32c815aca51de6c |
|
BLAKE2b-256 | a044e6a955a09ca9054200bb65a67383e57f2d2f5537ab975a6cbd4af4da2072 |