ceviche provides two core electromagnetic simulation tools for solving Maxwell's equations:
finite-difference frequency-domain (FDFD)
finite-difference time-domain (FDTD)
Both are written in numpy / scipy and are compatible with the HIPS autograd package, supporting forward-mode and reverse-mode automatic differentiation.
This allows you to write code to solve your E&M problem, and then use automatic differentiation on your results.
As a result, you can do gradient-based optimization, sensitivity analysis, or plug your E&M solver into a machine learning model without having to go through the tedious process of deriving your derivatives by hand.
Examples
There is a comprehensive ceviche tutorial available at this link with several ipython notebook examples:
If you use this for your research or work, please cite
@article{hughes2019forward,
title={Forward-Mode Differentiation of Maxwell’s Equations},
author={Hughes, Tyler W and Williamson, Ian AD and Minkov, Momchil and Fan, Shanhui},
journal={ACS Photonics},
volume={6},
number={11},
pages={3010--3016},
year={2019},
publisher={ACS Publications}
}