~ Octave
~ Meep

Meep Intro
Meep Kit
Kit Examples
Kit Download

Kit Examples

Example 1: Dielectric Waveguide

Lets simulate a rectangular dielectric waveguide composed of inner and outer dielectrics with different permittivities.

The zip file on the Kit Download page includes the control files I will talk about here.

This folder is ready to go with 12 different dielectric waveguide simulations. The numbers in each control file name represent the inner and outer dielectric epsilon values. The inner dielectric is held constant with E=6 and the surrounding dielectric is varied from 1 to 12. For example, in "waveguide6to3.ctl", the inner dielectric is 6 and the outer dielectric is 3. The shell script "run_sim" will do everything for you. After the simulations are done, Octave will create data files and plots to compare all the simulations

Run the Simulation

user@comp:~/meepkit$ ./run_sim

View the log file

To make sure everything executed successfully take a look at the log file located in the folder tmp-meep. The log is time stamped to let you know which simulation it refers too. Make sure the second column says "successful" from top to bottom. If an line says "***failed***", take a look on the right to see what was being done and go from there. Here's a short section of what you should see.

Mon0113 -- -successful- -- copying splitflux.m from ./scripts
Mon0113 -- -successful- -- copying analyze_mat_data.m from ./scripts
Mon0113 -- ------------ -- 12 .ctl files in this folder
Mon0113 -- ------------ -- __________________________________________________________________________
Mon0113 -- ------------ -- __________________________________________________________________________
Mon0113 -- ------------ -- Executing .ctl file 12 called waveguide6to10.ctl
Mon0113 -- -successful- -- meep finished
Mon0113 -- -successful- -- pulling flux1: lines from waveguide6to10.out and into waveguide6to10.dat
Mon0113 -- ------------ -- octave executing: splitflux("waveguide6to10")
Mon0113 -- -successful- -- octave finished
Mon0113 -- -successful- -- tmp-mat-files folder created
Mon0113 -- -successful- -- creating epsilon images
Mon0113 -- -successful- -- moving .png file
Mon0113 -- -successful- -- moving .mat file
Mon0113 -- -successful- -- moving .dat file
Mon0113 -- -successful- -- moving .out file
Mon0113 -- ------------ -- __________________________________________________________________________
Mon0113 -- ------------ -- __________________________________________________________________________

Verify the structure is correct

Watch animations

The animations for each simulations are found in that simulation's output folder. The animations are too big to post on here but the following will give you an idea of what they look like. The animations are great for helping you visualize what the fields are doing. Depending on the structure, you can see field reflections and even watch as standing waves form.

View plot of comparisons

This plot clearly shows most efficient propagation as the outer epsilon value decreases

View additional comparisons

Octave will take the flux data from each simulation and make some potentially useful calculations. The following is part of what can be found in the file "comparisons.txt". It starts with the simulation name and lists max values, sums, ratios.

Max T: 1.203141e-03
Max R: 6.121571e-02
Sum T: 4.577012e-02
Sum R: 1.255037e+00
T/R: 3.646915e-02
Max T: 6.876033e-03
Max R: 4.046268e-02
Sum T: 2.768836e-01
Sum R: 9.991699e-01
T/R: 2.771137e-01

Another interesting set of comparisons can be found in "comparison_sums.txt". This is the "trans" flux plane sum across all frequencies. This file makes it easy to compare the result of each simulation against the others.