| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Since the improvements in meep and its Python bindings in 2018/19, following scripts are rather obsolete. I recommend to refer to the (semi)official meep pages, e.g. https://meep.readthedocs.io/en/latest/ and http://www.simpetus.com/projects.html for up-to-date examples. Filip Dominec 2019
MEEP is a library of functions for numerical simulations of how electromagnetic waves propagate and interact with various structures; it is a finite-difference time-domain solver of the Maxwell equations. The simulation is defined by programming, with bindings to C/C++, Scheme, or Python; I chose to use python-meep as Python is a user-friendly language that makes simple simulations (relatively) simple, and really complex ones possible. One can also seamlessly integrate them with powerful Python modules as numpy, scipy, matplotlib and many others.
After I set up several different realistic simulations with python-meep, I noticed that much of the Python code for initialisation, material definition, processing and data output can be shared. I therefore moved such code in the meep_utils.py and meep_materials.py modules.
To demonstrate how to use them to simplify the simulation setup, I accompany these modules with several ready-to-use simulations of various typical problems. I believe the presented scripts can be a great starting point for anybody doing their research on photonic crystals, metamaterials, integrated photonics and nanophotonics, cavity resonators, waveguides, etc.
You are encouraged to clone this repository and to modify the examples to match your needs. I would be very happy if this project helps you with your thesis, homework or any publication. Do not hesitate to contact me if you need some advice, new functionality or if you find a bug.
Filip Dominec, filip.dominec@gmail.com, 2012 - 2016
Usually, everything you need to run an example is to change to its directory, and launch ./batch.sh. In a multiprocessing environment, it is recommended to launch it like export NP=4; ./batch.sh.
Uses scatter.py and effparam.py to retrieve the effective behaviour of a metamaterial using the Nichols-Ross-Weir (s-parameters) method. Some of these examples are scans through a parameter of the structure.
Runs scatter.py multiple times in frequency-domain, and then compares the results to the classical Fourier-transformed time-domain simulation
Using cdh.py, plot_cdh.py, computes and plots data for current-driven homogenization; compares them with those obtained from s-parameters
Sets up both the source and the monitor planes such that they have a growing phase in space (done simply by harmonic modulation of the source amplitude). This way, an oblique wave is excited and recorded. Using arccosine, the angle can be computed from our knowledge of the frequency and the transverse component of the wavevector. By several time-domain simulations with different transverse wavevectors, we can efficiently build a 2D map of angle- and frequency-dependent reflectance of a sample.
The simulation in cylindrical_cavity.py defines a metallic cylindrical cavity, excites the field by a short pulsed source, and analyzes the ringdown to search for all modes.
Then the data are processed by ringdown_analysis.py and a comparison of Fourier transform, filter-diagonalisation (harminv) method and the textbook analytic solution is plotted.
Optionally, by uncommenting the bottom half of example_ringdown_cylindrical_cavity/batch.sh, the ringdown analysis can be used to search for terahertz resonances in experimental transmission water vapour. Quite a good match is obtained, which means that harminv works as expected.
Uses plasmons.py: A small aperture in a thin metal sheet couples incident light to surface plasmons.
If the film is surrounded by two media with similar index of refraction, circular interference pattern can be observed between the symmetric and antisymmetric plasmon modes. A different (hyperbolic) interference pattern can be obtained when the plasmons are coupled by two holes.
Official website of MEEP: http://ab-initio.mit.edu/wiki/index.php/Meep
Contains information on the FDTD algorithm and simulations in general, documentation of the MEEP functions. Examples
are mostly in Scheme.
Website of the python-meep interface: https://launchpad.net/python-meep
Provides some examples of how the python-meep functions can be used in scripts.
I also write my own website on simulations: http://f.dominec.eu/meep/index.html
Contains my experience with installation requirements and procedure, simulation performance, realistic definition of
materials, data postprocessing etc.
License: GPLv2, http://www.gnu.org/licenses/gpl-2.0.html
The scripts require working python-meep environment, recommended compilation procedure is supplied in the python-meep-install.py script which is hosted here: https://github.com/FilipDominec/python-meep-install
Some scripts use the matplotlib's binding for LaTeX for nicer plots. You may either install the dependencies using sudo apt-get install -y texlive-latex-extra dvipng, or modify the scripts to avoid using the latter.
The procedure is tested on Debian-based Linux distributions. You may have to manually modify it if your system differs. Please read the script for details.
scatter.py, cdh and others should output sim_param in the header (moreover CDH has weird header!!)
move Kx, Ky out of the model parameters
put the models into separate module
sync harminv from its module with meep_utils, and remove from the latter
effparam.py does not cope with "plot_freq_max=None" anymore? -- fix
why I do not see interference of sym/asym plasmons in the example? wrong metal model!
plot_contour to read any column from direct sim output / effparam
[ ]
stability of metals - try to increase 'gamma' until it goes unstable; map the parameter!
from scipy.misc import imsave; imsave('../docs/static/tutorial-epsilon.png', -N.rot90(epsilon)) ?
Use average_field_function instead of my own averaging!
use synchronize_fields() instead of shifting H(t) ? - benchmark
test averaging on SRR
test the Fresnel inversion algorithm on dispersive dielectric slabs
fix the stupid SWIG bug: http://sourceforge.net/donate/?user_id=246059#recognition
resonant modes extraction via HarmInv, done in a branched file
optimize the structure using D.E (http://inspyred.github.com) or CMA-ES
mode separation on the user-defined ports
add examples (tests / case study?):
check what functionality is available on Windows (could add the procedure to compile python-meep for Win)
currently, the materials are composed into a structure only for the permittivity (static value + Lorentzians), shall we do this also for permeability? And for nonlinear effects etc.?
compress video with something like: ffmpeg -i input -c:v libx264 -preset veryslow -qp 0 output.mkv
solve the following message Progress 0.90 of expected total 107 s CMD: cd 'SphereWire_comment=TiO$_2$ spheres only_resolution=5.000e-06_radius=3.000e-05'; h5tovtk 'EPS_at_t0.000e+00.h5:eps' '-t 0' -o 'EPS_at_t0.000e+00.vtk' CMD: cd 'SphereWire_comment=TiO$_2$ spheres only_resolution=5.000e-06_radius=3.000e-05'; rm 'EPS_at_t0.000e+00.h5' Traceback (most recent call last): File "../../scatter.py", line 113, in eps1=getattr(model, 'mon1eps', 1), eps2=getattr(model, 'mon2eps', 1)) ## enable monitors inside dielectrics File "/home/filip/python-meep-utils/meep_utils.py", line 902, in get_s_parameters Ex1, Hy1, Ex2, Hy2 = map(lambda x: np.append(x, np.zeros(target_len - len(Ex1))), (Ex1, Hy1, Ex2, Hy2)) File "/home/filip/python-meep-utils/meep_utils.py", line 902, in Ex1, Hy1, Ex2, Hy2 = map(lambda x: np.append(x, np.zeros(target_len - len(Ex1))), (Ex1, Hy1, Ex2, Hy2)) TypeError: 'numpy.float64' object cannot be interpreted as an index
| Back | FazBrowse Home | New Git URL |