  ~ Octave
~ Meep
~ MPB

Future Use
MPB Intro
Examples

 MPB Examples Rectangular Dielectric Waveguide Lets simulate a 2D dielectric rectangular waveguide surrounded by air, plot a few key fields, and find the band gaps. Here is a control file to simulate the waveguide. I will not step through every line but will highlight a few new commands. I call the ctl file 2dwaveguide.ctl. (define-param eps-hi 12) ; the waveguide dielectric constant (define-param eps-lo 1) ; the surrounding low-dielectric material (define-param h 1) ; the thickness of the waveguide (arbitrary units) (define-param w 2) ; the thickness of the waveguide (arbitrary units) (define-param X 10) ; the size of the computational cell in the x direction (define-param Y 10) ; the size of the computational cell in the y direction (set! geometry-lattice (make lattice (size X Y no-size))) (set! default-material (make dielectric (epsilon eps-lo))) (set! geometry (list (make block (center 0 0 0) (size w h infinity) (material (make dielectric (epsilon eps-hi)))))) (define-param kxmin 0) (define-param kxmax 2) (define-param kymin 0) (define-param kymax 2) (define-param k-interp 9) (set! k-points (interpolate k-interp (list (vector3 kxmin kymin 0) (vector3 kxmax kymax 0)))) (set-param! num-bands 4) (run-tm) (run-te) (define-param kx 1) (define-param ky 0) (set! k-points (list (vector3 kx ky 0))) (run-tm output-efield-z) (run-te output-hfield-z) The basic components all exist in the file presented here. Although, there are a few differences, most notably, the use of variables. define-param Var x This is how variables can be defined, Var=X. Variables in scheme are not only useful to make changing values easy and improve organization. Scheme variables can be changed from the terminal. Lets say we wanted to make the width of the waveguide equal to 4, instead of 2. Instead of editing the control file, we can just execute the ctl file with the following. user@comp:~\$ Mpb 2dwaveguide.ctl w=4 > 2dwaveguide.out Notice how [ w=4 ] is passed to the control file as an argument. Any variable defined using define- param can be modified from the command line in this fashion. Doing so makes it possible to automate many different simulations using the same control file. One possibility is to use a shell script to execute the same control file many times with different parameters. The ability to automate many different simulations is the primary benefit to using a command line interface. Now lets simulate the waveguide and create some outputs. Execute 2dwaveguide.ctl, correct the data, create the field images, and extract the band frequencies. user@comp:~\$ mpb 2dwaveguide.ctl kx=0 ky=0.7 > 2dwaveguide.out user@comp:~\$ mpb-data -r -m 1 -n 32 epsilon.h5 user@comp:~\$ mpb-data -r -m 1 -n 32 e.k*.b*.z.tm.h5 user@comp:~\$ mpb-data -r -m 1 -n 32 h.k*.b*.z.te.h5 user@comp:~\$ h5topng epsilon.h5:data-new user@comp:~\$ h5topng -C epsilon.h5:data-new -c bluered -Z -d z.r-new e.k*.b*.z.tm.h5 user@comp:~\$ h5topng -C epsilon.h5:data-new -c bluered -Z -d z.r-new h.k*.b*.z.te.h5 user@comp:~\$ grep freqs: 2dwaveguide.out > 2dwaveguide.dat Use your desired plotting program to create a graph of 2dwaveguide.dat. Here is what you should see. A lot of information can be derived from looking at this plot. Let me first describe the general layout of the graph. All values in MPB are normalized to a base unit of distance. The unit of distance is generally labeled [ a ]. If we want everything to be referenced to 1cm, we can set a=1e-2. After setting the distance unit, all other practical values can be derived. The x-axis is the value of the wave vector, and is in units of ka/2pi. To find k, with reference to our defined distance unit a, evaluate k=(x-axis value)*(2*pi). The y-axis is the frequency, and has units of wa/(2*pi*c). c is the speed of light. To find the frequency, with reference to our defined distance unit, evaluate f=(y-axis value)*c/a. Now that we know how to read the graph, I will point out two characteristics worth noting. Notice the separation between the maximum value of band 1 (red) and the minimum value of band 2 (green). This separation represents a band gap. Band gaps are useful because they represent a range of frequencies (bandwidth) before the next mode will present itself. The second interesting piece of information is based on the Kmag/2pi line (black). The black line is called the light line and represents w=ck. The area below the light line is called the light cone and represents w>ck. The modes within the light cone represent solutions to Snell's law . Snell's law is used to define reflection at an interface. It our situation, it tells us when the wave will hit an interface at less than the critical angle, leading to propagation down the waveguide. With this understanding, it is possible to find the modes of our waveguide by looking at bands as they cross the Kmag/2pi line. Next, lets take a look at the fields within and around the waveguide. Interesting field formations can be seen by looking at bands 2 and 4. Band 2 Band 4 Interesting enough, these fields seem to be inversely related. References  http://ab-initio.mit.edu/wiki/index.php/MIT_Photonic_Bands, Nanostructures and Computation Wiki at MIT  John D. Joannopoulos, Steven G. Johnson, Joshua N. Winn, Robert D. Meade, Photonic Crystals Molding the Flow of Light, Princton University Press, 2008