MEEP Documentation
MEEP documentation main page.
In order to run a simulation using the MEEP C++ interface, the following steps are necessary:
- initialize mpi(argc, argv); // do this even for non-MPI Meep
- create a meep::volume
- create a meep::structure using that volume
- create a meep::fields object
- add some kind of excitation.
- time step the code. Of course, you'll have to create measurements and output whatever data you are interested in as well.
The meep::volume object contains the information about the spatial extents of the simulation domain. In addition to the object constructors, the following functions are provided, each of which returns a (*)meep::volume.
- meep::vol1d(double zsize, double a)
- meep::vol2d(double xsize, double ysize, double a)
- meep::vol3d(double xsize, double ysize, double zsize,double a).
The meep::structure object contains the structural information about the simulation universe. This means the dielectric values at a particular position, the polarizability information, etc. It contains the discretized information, so the meep::structure object needs to know things like what grid resolution to use, whether to use sub-pixel smoothing, etc.
The meep::fields is a gargantuan one that performes virtually all of the real simulation work inside MEEP. A copy constructor is provided, as well as meep::fields(meep::structure*, double m =0), which requires an initialized pointer to a structure, and has an optional argument m, which may be m as in mystery, as no documentation is provided. Based on the source code though, I guess it might have something to do with symmetry.
In practice, this means once you have generated the meep::structure object, generating the meep::fields object is trivial.
When running a simulation, one typically wants to do the following this:
- Specify absorbing boundary conditions, or periodic boundary conditions.
- Excite some energy (add a source)
- Time step
- Measure some physical quantities. All of these responsibilities belong to the meep::fields class.
The default boundary condition in FDTD is perfectly reflecting wall. i.e. the fields outside the simulation domain are kept at zero. This is only rarely desirable. Usually one wants absorbing boundary conditions, which allow one to simulate a device where radiation can propagate outward, as though one were simulating a much large computational domain, or one wants periodic boundary condtions. Often one wants a combination of some or all of the above three possibilities.
Meep supports perfectly matched layers (PML) as absorbing boundary conditions. The PML begins at the edge of the computational volume,and works inwards. Hence you should specify the computational cell to contain the pml thickness.
To add a source, one generally creates a time signature, and uses this in one of the meep::fields member functions for creating a source, the latter specifying the spatial signature. It is possible to create a point source without specifying a meep::src_time object, using the member function detailed below. The meep::src_time class provides time signature information for sources. Gerally one uses one of the derived classes:
- meep::continuous_src_time
- meep::custom_src_time
- meep::gaussian_src_time
The following fields member functions can be used to add a source:
- add_point_source (component c, double freq, double width, double peaktime, double cutoff, const vec &, complex< double > amp=1.0, int is_continuous=0)
- void add_point_source (component c, const src_time &src, const vec &, complex< double > amp=1.0)
- void add_volume_source (component c, const src_time &src, const geometric_volume &, complex< double > A(const vec &), complex< double > amp=1.0)
- void add_volume_source (component c, const src_time &src, const geometric_volume &, complex< double > amp=1.0)
The size of the time step is computed automatically.
The following are measurements available within the
meep libraries:
- fluxes:
- meep::fields::add_flux_plan()