I wanted to compare the difference in flux across 10 different simulations. 3D simulations can take a long time
Manually running the 10 simulations, along with post processing the results, seemed like it took all day. This kit was
The kit is simply a few scripts in a folder. At night, drop all the control files you want to simulate into the folder,
run the shell script, and go to bed. In the morning, you will have graphed results of each simulation, along with
comparisons of each. Here are the basic steps taken by the Kit.
A) It begins by finding the name of every control file in the folder
B) The following steps are executed for each control file
1) save filename to myfilelist.txt
2) run meep simulation and save output to filename.out
3) copy lines from filename.out that include the text "flux1:" to filename.dat
4) create animations using h5utils and imagemagick
5) run octave script splitflux.m to create clean .mat data and plot simulated data
6) copy .mat data file created by splitflux.m to the directory tmp-mat-files
7) create epsilon images
8) clean up folder
C) Run octave script compare_mat_data.m to compare simulations and plot comparisons
D) Clean up and organize folder
How to use the Kit
All the scripts are self
contained and run inside this single folder. Basically, just drop
your control files into this folder, navigate to the folder with a
terminal, and run "./run_sim". Don't forget the period in
"./run_sim". If the shell script won't run on your computer, you
might need to make it executable with, "chmod 755 run_sim".
user@comp:~/meepkit$ chmod 755 run_sim
What is in folder folder after you run "./run_sim".
This is where the two octave scripts are. I added a bunch of comments
to all the scripts so other people could have an idea of what they do.
This folder has all the flux plane data from each simulation. It's
in a funny Octave format. You can open it in a text edit editor and see what it looks like if
The shell script will create a log file each time it runs. All the
log files are stored in this folder. Look at the log file after you
run everything. it will show you step by step what it did and show
you if each step was successful or had errors.
This is a comparison of flux data from each
simulation. This plot makes it easy to see the effect of changing individual parameters
from one simulation to the next.
This has some random calculations from each simulation. Such as, max
flux values, ratio of transmitted to reflected, flux sum across all
This is the result of adding the flux at each frequency together. I
found this was the most definitive value to look at and this file
makes it easy to compare.
This is a list of all the .ctl filenames in the folder. The scripts use it to keep
track of what's going on.
each of these folders includes all the stuff for that specific
simulation. You will find the raw .h5 data, the animations, the epsilon
images, and other random stuff.
This kit has worked for many different sets of simulations for me but Meep has more functionality than I
generally take advantage of. How the kit will deal with different types of output from Meep is a mystery.
All the simulations I have used with the kit include 2 flux planes as outputs. If more or less than 2 flux
planes are output by Meep there will probably be errors at some point in the process. The kit looks for certain
outputs from Meep and I'm just not sure what will and won't work. Maybe if I get more time, I will make the kit more
flexible, but that time will probably not be soon. If you're interested in improving the flexibility of the kit
be my guest. I did take some time to add plenty of comments to each script in hope someone else might grow an interest
CREATINGRF [at] GMAIL.COM