From APL
Revision as of 12:00, 14 June 2015 by Aplstudent (talk | contribs)

Jump to: navigation, search


Meep (or MEEP) which stands for MIT Electromagnetic Equation Propagation, is a free finite-difference time-domain (FDTD) simulation software package developed at MIT to model electromagnetic systems.

Meep is written in C++, there is two main interfaces that are the most used (libctl/scheme). C++ provides the interfaces with the greatest level of flexibility in designing FDTD simulations. Although the foundations are built in C++ you do not need to be a real programmer to use Meep.


The MEEP user guide was created to give the next user of MEEP a starting point. The user guide contains a background, simple commands, package build instructions, and a tutorial to build a waveguide.

Ctl File: The use of Meep revolves around the control file, abbreviated "ctl" and typically called something like foo.ctl (although you can use any file name you wish). The ctl file specifies the geometry you wish to study, the current sources, the outputs computed, and everything else specific to your calculation.

Scheme: programming language developed at MIT, which has a particularly simple syntax: all statements are of the form (function arguments...).

Maxwell's Equations: Meep simulates Maxwell's equations, which describe the interactions of electric (E) and magnetic (H) fields with one another and with matter and sources.

Units in Meep: Meep uses "dimensionless" units where all these constants are unity. Almost everything you might want to compute (transmission spectra, frequencies, etcetera) is expressed as a ratio anyway, so the units end up canceling.

Boundary conditions and symmetries: we can only simulate a finite region of space, which means that we must terminate our simulation with some boundary conditions. Three basic types of terminations are supported in Meep: Bloch-periodic boundaries, metallic walls, and PML absorbing layers.


It is important to note that Meep is an Unix bases shell program or like one. Which means that all operations will be done through a Unix machine in the terminal, in my case I am using Ubuntu 14.10 but any Unix interface should work as long as you correctly build the package.

Recommended installations: Below are some highly recommended things that should be also installed with your Meep package. You do however must go through the installation page and manually build each of them since there is no built packages.

Libctl: Front-end to Meep •HDF5: Meep's output of visuals •BLAS and LAPACK: Algebra packages

Now that you have your package built, Meep is ready for use.

Open up your Terminal and type in “meep” and it should pull up your active shell.

Before we work out way through a tutorial, you should take a look at the very basic code and syntax that I have listed below so that you can a feel of what code will look like in the program.

Starting Meep:


Resetting the Meep Shell:


Reading a file and executes it:

       unix% meep YOUR_FILE_NAME.ctl

Converting image to PNG:

       unix% h5topng -S3 Name_OF_YOUR_IMAGE.h5

-S3 is the scale of the image, so when you use (3) that is the increase that you are making

I think the best way to get started is to actually build something. So finally I will walk you through a simple simulation in Meep and hopefully by the end of this you will had the basic knowledge of how to use Meep.

90 Degree Bend Tutorial:

First you want to make sure that your shell is clear of any other code that could be running so it is always good to run the rest script before starting.

Lets begin by setting up your boundaries by using:

     (set! geometry-lattice (make lattice (size 16 16 no-size)))

-This piece of code will create a 16x16 area for your waveguide to compute. Remember that Meep is unit-less so 16 will just become a ratio in respects to your waveguide.

Setting up your blocks and fitting:

           (set! geometry (list
               (make block (center -2 -3.5) (size 12 1 infinity)
                     (material (make dielectric (epsilon 12))))
               (make block (center 3.5 2) (size 1 12 infinity)
                     (material (make dielectric (epsilon 12))))))

- The code here breaks up your waveguide into two blocks, as you can see the size of each block is 12 while it is centered at the given coordinates in respect to your 16x16 boundary. Finally the material is added at the end that will travel the same 12 units as your blocks.

Setting the thickness:

       (set! pml-layers (list (make pml (thickness 1.0))))
       (set! resolution 10)

-now your block thickness is set to 1 and the resolution of your system is created

Setting your wavelength:

           (set! sources (list
               (make source
               (src (make continuous-src
                       (wavelength (* 2 (sqrt 12))) (width 20)))
                (component Ez)
                (center -7 -3.5) (size 0 1))))


          (run-until 200
                 (at-beginning output-epsilon)
                 (to-appended "ez" (at-every 0.6 output-efield-z)))

Here is a PDF of the information above:

File:Meep User Guide 2015.pdf

Simulations in MEEP

File:ParaView Viewer User Guide.pdf

External Links