Rigorous Coupled Wave Analysis

The Problem

Computational electromagnetics is really complicated. Calculating electromagnetic properties of structures can be time-consuming and difficult to set up. When I was a graduate student, I was repeatedly frustrated at how difficult it was to simulate the structures that I was interested in studying. The few packages that did exist were old - most were distributed as C programs requiring compilation and without a straightforward API. They weren't feasible for researchers to use to ask the questions that they wanted to ask.

The Solution

I set out to write a package that would be broadly accessible without compromising on performance, with a clear, declarative API, while being flexible enough to be used as part of larger programs or efforts.

I chose python as the language to write this software in, as it is the most commonly-used language by academic researchers. While technically an interpreted language, it offers C-like performance with optimized numerical computating libraries like numpy, giving researchers the best of both worlds. This is especially important in computational electromagnetics, where researchers may want to run hundreds or thousands of different simulation conditions.

Major Challenges

The biggest challenge was decoupling the modules of this software as much as possible. Because of the way the math works behind the type of simulation I was performing, circular dependencies are almost unavoidable. Avoiding these by careful architectural design (and re-design, and re-re-design) to make the API clear, simple, and loosely coupled was the biggest challenge.