Meep Reference
From AbInitio
(diff) ←Older revision  Current revision  Newer revision→ (diff)
Meep 
Download 
Release notes 
FAQ 
Meep manual 
Introduction 
Installation 
Tutorial 
Reference 
C++ Tutorial 
C++ Reference 
Acknowledgements 
License and Copyright 
Here, we document the features exposed to the user by the Meep package. We do not document the Scheme language or the functions provided by libctl (see also the libctl User Reference section of the libctl manual).
This page is simply a compact listing of the functions exposed by the interface; for a gentler introduction, see the Meep tutorial. Also, we note that this page is not, and probably never will be, a complete listing of all functions. In particular, because of the SWIG wrappers, every function in the C++ interface is accessible from Scheme, but not all of these functions are documented or intended for end users.
Input Variables
These are global variables that you can set to control various parameters of the Meep computation. In brackets after each variable is the type of value that it should hold. (The classes, complex datatypes like geometricobject
, are described in a later subsection. The basic datatypes, like integer
, boolean
, cnumber
, and vector3
, are defined by libctl.)

geometry
[list ofgeometricobject
class]  Specifies the geometric objects making up the structure being simulated. When objects overlap, later objects in the list take precedence. Defaults to no objects (empty list).

sources
[list ofsource
class]  Specifies the current sources to be present in the simulation; defaults to none.

symmetries
[list ofsymmetry
class]  Specifies the spatial (mirror/rotation) symmetries to exploit in the simulation (defaults to none). The symmetries must be obeyed by both the structure and by the sources. See also: Exploiting symmetry in Meep.

pmllayers
[list ofpml
class]  Specifies the absorbing PML boundary layers to use; defaults to none.

defaultmaterial
[materialtype
class]  Holds the default material that is used for points not in any object of the geometry list. Defaults to
air
(ε of 1). 
geometrylattice
[lattice
class]  Specifies the the size of the unit cell (which is centered on the origin of the coordinate system). If any dimension of the lattice
size
is the special valuenosize
, then the dimension of the lattice is reduced (i.e. it becomes two or onedimensional) by default. Defaults to a cubic cell of unit size. 
dimensions
[integer
]  Explicitly specifies the dimensionality of the simulation, if the value is less than 3. If the value is 3 (the default), then the dimensions are automatically reduced if possible when any of the
geometrylattice
sizes arenosize
. Ifdimensions
is the special value ofCYLINDRICAL
, then cylindrical coordinates are used and the x and z dimensions are interpreted as r and z, respectively. 
m
[number
]  For
CYLINDRICAL
simulations, specifies that the angular φ dependence of the fields is of the form e^{imφ} (default ism=0
). If the simulation cell includes the origin r = 0, thenm
must be an integer. 
resolution
[number
orvector3
]  Specifies the computational grid resolution, in pixels per distance unit. Defaults to
10
. 
ensureperiodicity
[boolean
] 
kpoint
[false
orvector3
]  If
false
(the default), then the boundaries are perfect metallic (zero electric field). If a vector, then the boundaries are Blochperiodic: the fields at one side are times the fields at the other side, separated by the lattice vector . Thekpoint
vector is specified in Cartesian coordinates, in units of 2π/distance. (This is different from MPB, equivalent to taking MPB'skpoints
through the functionreciprocal>cartesian
.) 
ensureperiodicity
[boolean
]  If
true
(the default), and if the boundary conditions are periodic (kpoint
is notfalse
), then the geometric objects are automatically repeated periodically according to the lattice vectors (the size of the computational cell). 
forcecomplexfields?
[boolean
]  By default, Meep runs its simulations with purely real fields whenever possible. It uses complex fields (which require twice the memory and computation) if the
kpoint
is nonzero or ifm
is nonzero. However, by settingforcecomplexfields?
totrue
, Meep will always use complex fields. See also: Complex fields in Meep. 
filenameprefix
[string
]  A string prepended to all output filenames. Defaults to the name of the current ctl file, with ".ctl" replaced by "" (e.g.
foo.ctl
uses a"foo"
prefix). 
Courant
[number
]  Specify the Courant factor S which relates the time step size to the spatial discretization
 cΔt = SΔx. Default is
0.5
. For numerical stability, the Courant factor must be at most Failed to parse (unknown error): 1/\sqrt{\textrm{# dimensions}}
, and in practice should be slightly smaller.

outputvolume
[meep::geometric_volume*
]  Specifies the default region of space that is output by the HDF5 output functions (below); see also the
(volume ...)
function to createmeep::geometric_volume*
objects. The default is'()
(null), which means that the whole computational cell is output. Normally, you should use the(involume ...)
function to modify the output volume instead of settingoutputvolume
directly. 
progressinterval
[number
]  Time interval (seconds) after which Meep prints a progress message; default is 4 seconds.
The require a bit more understanding of the inner workings of Meep to use (see also the SWIG wrappers).

structure
[meep::structure*
]  Pointer to the current structure being simulated; initialized by
(initstructure)
which is called automatically by(initfields)
which is called automatically by any of the(run)
functions. 
fields
[meep::fields*
]  Pointer to the current fields being simulated; initialized by
(initfields)
which is called automatically by any of the(run)
functions. 
numchunks
[integer
]  Minimum number of "chunks" (subarrays) to divide the structure/fields into (default 0); actual number is determined by number of processors, PML layers, etcetera. (Mainly useful for debugging.)
Predefined Variables
Variables predefined for your convenience and amusement.

air
,vacuum
[materialtype
class]  Two aliases for a predefined material type with a dielectric constant of 1.

metal
[materialtype
class]  A predefined material type corresponding to a perfectly conducting metal (in which the electric field is zero).

nothing
[materialtype
class]  A material that, effectively, punches a hole through other objects to the background (
defaultmaterial
orepsiloninputfile
). 
infinity
[number
]  A big number (1.0e20) to use for "infinite" dimensions of objects.

pi
[number
]  π (3.14159...).