Computational Electromagnetics with MEEP

Introduction to Computational Electromagnetics with MEEP


Who needs computation, anyway?

While you can get far (really really far) with theoretical electromagnetics alone, often you have a simple analytic model that works great, but you want to model some added complexity that would be difficult to do analytically "So how do things change when I add this little bump right here... What if this was sitting next to this other object... ? What if this structure is finite instead of infinite?". It's these kinds of questions that computational electromagnetics allows us to answer. In this course we will be working with MEEP, a Finite Difference Time Domain electromagnetics simulator.

Why FDTD? Flexibility vs. Speed

There is a saying I'm not so fond of as a cat lover - there are many ways to skin a cat. So too with computational electromagnetics. For a given problem, there are usually many different ways to solve it. How do you know which way to solve your problem? Usually, there is a trade-off between speed and flexibility. There are lots of specialized, very fast, very accurate methods which can be used to solve specific problems. Want to know the reflection coefficient from a planar stack of materials? You should probably use the Transfer Matrix Method (also known as the Scattering Matirx Method). This is blazingly fast, but it's limited to this specific problem. Want to simulate reflection off photonic crystals, or find what happens when you shine light on a diffraction grating? Rigorous Coupled Wave Analysis can do that for you. Also extremely fast, but can only simulate stacks of periodic structures. Need to know how small spheres and infinite cylinders scatter light? Look no further than Mie theory. Want to simulate optical systems like lenses, apertures and mirrors, when the angles are small? Fourier Optics will blaze through that no problem. Want to find the mode of a 2D waveguide? The Finite Difference Frequency-domain method is your best friend. There are many such problem-specific theories and frameworks, all of which have their own set of problems for which they are extremely well-suited. One method, however, which can be used for pretty much any problem, and is a great method-of-last-resort, is the Finite Difference Time Domain method (FDTD). It's also a fantastic method for learning about electromagnetics and building intuition, because you get to see what is happening in real-time as charges move and fields propagate through space. You get to see why standing waves occur, what reflection actually looks like, how fields diffract, and much more.

Why MEEP?

In this course, we will be using MEEP (this cute name stands for MIT Electromagnetic Equation Propagation). Why? Well first of all, it's a free, unlike its paid-for counterparts (like Lumerical). It's also pretty widely used in academia, open-source (for those of you that care), and its interface is written in python, one of the easiest-to-learn-and-use programming languages on the planet. It's also impressively full-featured, with fancy stuff like nonlinear optics, a frequency-domain solver, a photonic band structure solver, and lots more.

The only major stumbling I have run into is the lack of learning materials. There is pretty extensive documentation on the MEEP Documentation page, and while very useful and impressively complete, it seems to be written for people with graduate-level physics mastery and intermediate-level python expertise. If you know what you are doing, you can probably find what you need in the documentation, but I found the learning curve to be extremely steep - and I'm a Ph.D. student in Optoelectronics. Through my own stumbling through learning to use MEEP I created this course, which (once it is complete) is probably equivalent to a one- or two-semester lab course on computational electromagnetics. My hope is that it makes electromagnetics simulation accessible at the undergraduate level. For this reason, I have relied primarily on simple examples that students can check analytically themselves (propagation through space, reflection off an interface, thin-film interference), and then build up to more complex examples that would be impossible to do by hand.

Prerequisites

I do expect you have had an upper-division course on engineering electromagnetics, or the equivalent in the physics department. You know what a plane wave is, how plane waves reflect off interfaces, and are maybe at least a little familiar with waveguides. You also should be at least somewhat familiar with python, as that is the language we will be doing everything in. If you are not familiar, there are excellent tutorials on Real Python which can get you up to speed very quickly. We won't be using anything super advanced - basic functions, and a couple of things from numpy (arrays) and matplotlib (for animation).

What this course is not

This course is not one on how to create electromagnetics simulators. I might do this in the future, but in the meantime, Professor Raymond Rumpf has some great ones at his website which I have followed to create a Rigorous Coupled-Wave Analysis Solver and a Transfer Matrix Method solver.

A quiz question






If you found this content helpful, it would mean a lot to me if you would support me on Patreon. Help keep this content ad-free, get access to my Discord server, exclusive content, and receive my personal thanks for as little as $2. :)

Become a Patron!