The near-to-far field transformation feature is demonstrated using four different examples. There are three steps involved in this type of calculation. First, the "near" surface s is defined as a set of surfaces capturing all outgoing radiation in the desired direction s. Second, the simulation is run using a pulsed source or alternatively, a CW source via the frequency-domain solver to allow Meep to accumulate the DFT fields on the near surface s.

Third, Meep computes the far fields at any desired points with the option to save the far fields to an HDF5 file. In this example, we compute the radiation pattern of an antenna.

This involves an electric-current point dipole emitter in vacuum. The source is placed at the center of a 2d cell surrounded by PML. The near fields are obtained on a bounding box defined along the edges of the non-PML region. From both the near and far fields, we will also army asu setup guide the total outgoing Poynting flux and demonstrate that they are equivalent.

Results will be shown for three orthogonal polarizations of the input source. In the first part of the simulation, we define the cell and source as well as the near field and flux regions. In the first of two cases, the flux of the far fields is computed using the flux routine for a square box of side length 2 mm which is times larger than the source wavelength. This requires computing the outgoing flux on each of the four sides of the box separately and summing the values. This means there are 2x10 6 points per side length.

The six far field components,are stored as separate arrays of complex numbers. From the far fields at each pointwe compute the outgoing or radial flux:where and are the components of the Poynting vector.

Note that is always 0 since this is a 2d simulation. The total flux is computed and the three flux values are displayed. By Poynting's theoremthe total outgoing flux obtained by integrating around a closed surface should be the same whether it is calculated from the near or far fields unless there are sources or absorbers in between. The flux of the near fields for the source is 2. The ratio of near- to far-field circle flux is 0. Similarly, for the source, the values are 1.

The ratio of near- to far-field circle flux is 1. The slight differences in the flux values are due to discretization effects and will decrease as the resolution is increased. Finally, we plot the radial flux normalized by its maximum value over the entire interval to obtain a range of values between 0 and 1. These are shown below in the linearly-scaled, polar-coordinate plots.

As expected, the and sources produce dipole radiation patterns while has a monopole pattern. This example demonstrates how to compute the far-field profile at the focal length of a metasurface lens.

### Near to Far Field Spectra

The lens design, which is also part of the tutorial, is based on a supercell of binary-grating unit cells. The far-field calculation of the lens contains two separate components: 1 compute the phasemap of the unit cell as a function of a single geometric parameter, the duty cycle, while keeping its height and periodicity fixed 1.

The design wavelength is 0. The input source is an -polarized planewave at normal incidence. In the first of two parts of the calculation, a phasemap of the binary-grating unit cell is generated based on varying the duty cycle from 0.

**MEEP Simulation of Wave Scattering**

The phasemap is shown below.Simulation of reflection and refraction of polarized opticial beams at plane and curved dielectric interfaces.

GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Work fast with our official CLI.

Learn more. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. FDTD simulation of reflection and refraction of polarised optical beams at plane and curved dielectric interfaces based on Meep as underlying FDTD simulation software package.

A mathematical description of the currently implemented beam profiles is outlined in this Jupyter notebook. Originally, these files have been used in studying optical beam shifts providing independent numerical simulations. For detailed installation instructions, see the Meep documentation.

A Scheme extension. All possible Meep parameters that can be set from the command line are defined in expressions beginning with define-param The generated HDF5 files can be processed by different visualisation tools. To get a quick impression of the data Meep comes bundled with the h5utils programs. Utilising these tools, visualisation is fairly easy performed by issuing for example the following commands:.

The Meep Scheme tutorial provides further useful information and assistance. For a more detailed explanation of our configuration files and the physical background, please see my dissertation thesis.

Coming soon. We use optional third-party analytics cookies to understand how you use GitHub. You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement. We use essential cookies to perform essential website functions, e. We use analytics cookies to understand how you use our websites so we can make them better, e.

Skip to content. MIT License. Dismiss Join GitHub today GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Sign up. Go back.Meep is a free and open-source software package for electromagnetics simulation via the finite-difference time-domain FDTD method spanning a broad range of applications.

A time-domain electromagnetic simulation simply evolves Maxwell's equations over time within some finite computational volume, essentially performing a kind of numerical experiment. This can be used to calculate a wide variety of useful quantities. Major applications include:. Meep's scriptable interface makes it possible to combine many sorts of computations along with multi-parameter optimization in sequence or in parallel. The source repository is hosted on GitHub.

Gzipped tarballs of tagged versions are in Releases. The release history is in NEWS.

## Mode Decomposition

Installation instructions are in Installation. For a list of topics, see the left navigation sidebar. This documentation is for the master branch of the source repository. Note that certain features described in this documentation may therefore be unavailable if you are using a tagged release. Subscribe to the read-only meep-announce mailing list to receive notifications of updates and releases. Subscribe to the meep-discuss mailing list for discussions regarding using Meep.

The meep-discuss archives includes all postings since spanning a large number and variety of discussion topics related to installation, setting up simulations, post-processing output, etc. The list archives can also be accessed using a newsgroup reader via the NNTP interface address: news. For bug reports and feature requests, please file a GitHub issue. The Meep project is maintained by Simpetus and the developer community on GitHub.

Acknowledgements provides a complete listing of the project contributors.

### Python Tutorial

If you have questions or problems regarding Meep, you are encouraged to query the mailing list. Professional consulting services for photonic design and modeling including development of custom, turn-key simulation modules, training, technical support, and access to Meep in the public cloud via Amazon Web Services AWS are provided by Simpetus.

MEEP Documentation. Simulation in 1d, 2d, 3dand cylindrical coordinates. Distributed memory parallelism on any system supporting MPI. Precompiled binary packages of official releases and nightly builds of the master branch via Conda. Materials library containing predefined broadband, complex refractive indices.

Perfectly matched layer PML absorbing boundaries as well as Bloch-periodic and perfect-conductor boundary conditions. Subpixel smoothing for improving accuracy and shape optimization. Custom current sources with arbitrary time and spatial profile as well as a mode launcher for waveguides and planewaves, and Gaussian beams. Frequency-domain solver for finding the response to a continuous-wave CW source as well as a frequency-domain eigensolver for finding resonant modes.This tutorial demonstrates the mode-decomposition feature which is used to decompose a given mode profile via the Fourier-transformed fields into a superposition of harmonic basis modes.

Examples are provided for two kinds of modes in lossless, dielectric media: 1 localized i. This example involves computing the reflectance of the fundamental mode of a linear waveguide taper. The structure and the simulation parameters are shown in the schematic below.

We will verify that computing the reflectance, the fraction of the incident power which is reflected, using two different methods produces nearly identical results: 1 mode decomposition and 2 Poynting flux. Also, we will demonstrate that the scaling of the reflectance with the taper length is quadratic, consistent with analytical results from Optics Express, Vol.

The material is silicon with. The taper geometry is defined using a single Prism object with eight vertices. PML absorbing boundaries surround the entire cell. An eigenmode current source with polarization is used to launch the fundamental mode.

There is an eigenmode-expansion monitor placed at the midpoint of the first waveguide. This is a line monitor which extends beyond the waveguide in order to span the entire mode profile including its evanescent tails.

The Fourier-transformed fields along this line monitor are used to compute the basis coefficients of the harmonic modes. These are computed separately via the eigenmode solver MPB. This is described in Mode Decomposition where it is also shown that the squared magnitude of the mode coefficient is equivalent to the power Poynting flux in the given eigenmode. The ratio of the complex mode coefficients can be used to compute the S parameters.

In this example, we are computing which is the reflectance shown in the line prefixed by "refl:,". Another line monitor could have been placed in the second waveguide to compute the transmittance or into the various guided modes since the second waveguide is multi mode.

The scattered power into the radiative modes can then be computed as. As usual, a normalization run is required involving a straight waveguide to compute the power in the source. The structure has mirror symmetry in the direction which can be exploited to reduce the computation size by a factor of two. A quadratic scaling of the reflectance with the taper length appears as a straight line on a log-log plot. The results are plotted using the commands below with the plot shown in the accompanying figure.

The reflectance values computed using the two methods are nearly identical.

For reference, a line with quadratic scaling is shown in black. The reflectance of the linear waveguide taper decreases quadratically with the taper length which is consistent with the analytic theory.

In principlethis trick would not be required for the mode-decomposition method, because the reflected mode is orthogonal to the forward mode and so the decomposition will separate the forward and reflected coefficients automatically. However, this is only true in the limit of infinite resolution â€” for a finite resolution, the reflected mode used for the mode coefficient calculation calculated via MPB is not exactly orthogonal to the forward mode propagating in Meep whose discretization scheme is different from that of MPB.

In consequence, if you did not subtract the fields of the reference simulation, the mode-coefficient could only calculate the reflected power down to a "noise floor" set by the discretization error.

With the subtraction, in contrast, you can compute much smaller reflections limited by the floating-point precision.Installation procedure, basic simulation, material definition and some advanced features are discussed.

I use the python-meep interface for all examples presented. It can compute the propagation of an electromagnetic wave through very complicated structures, using realistic material models including dispersion, conductivity, anisotropy or nonlinearitiesdistributed computing and combination of time-domain and frequency-domain solver.

MEEP is controlled by command-line interface which requires some programming. This has a good purposeas experienced users may employ MEEP for problems where more user-friendly simulation software does not provide enough versatility e. On the other hand, it may be quite disappointing to start using MEEP: Setting up a realistic simulation is usually a challenging scientific task on its own, and with MEEP one also needs to write a working code.

I will try to provide the reader with a module and examples that should help to focus on the scientific part of the task. The examples here are based on the python-meep interface. One of the interfaces is python-meep with its official website at Ghent university.

The reason why I chose the Python interface lies in my preference of Python syntax as well as in many excellent Python modules available scipymatplotlib and mayavi2 will be used in the examples here. I will simply try to provide the reader with several working examples. Get inspired and reuse them as you need! Before we get to writing the first simulation, we will discuss the installation procedure and multiprocessing.

The python-meep interface has always to be compiled against the MEEP binary present in the system. They seem to work the same, so for simplicity, we choose the latter and compile everything with support for MPI.

If our simulation environment was built without support for multiprocessing, it would be simply called meep and imported as import meep. All these steps are covered by the following blue box, so you may simply copy the commands to your terminal. It was tested to work flawlessly on many systems, so in case of any problems, write me an e-mail and I will try to fix it.

The following compilation procedure has been tested on Debian-based Linux distributions, but there should be no principial limitation in running meep and python-meep on and other systems, too.

The same holds for older Ubuntu Hereby I thank Martin Fiers for his kind help with the installation process. Failsave alternative: download the 1.In this example, we will consider the two-dimensional structure shown above, which is based on a system considered in:. See also our our online textbookchapter 7. In particular, there are three basic ideas behind this structure, which we briefly summarize here. First, by taking a dielectric wavgeuide and perforating it with a periodic sequence of holes, we form a kind of photonic crystal : there are still index-guided modes propagating losslessly down the periodic waveguide, but there is also a partial photonic band gap : a range of frequencies in which no guided modes exist.

Second, by making a defect in the periodic sequence, in this case by separating one pair of holes by a greater amount, we can trap a resonant cavity mode : it is localized along the waveguide direction by the band gap, and partially in the transverse direction by index-guiding.

Third, by making a sequence of: ordinary no holes waveguide, periodic structure, defect, periodic structure, waveguide, we can make a filter see our online textbookch. In particular, because there is now a finite number of holes, the resonant mode can now leak into the waveguide as well as to the surrounding air. Then, input light from the waveguide at the resonance frequency undergoes resonant coupling, and is transmitted to the other side with a Lorentzian transmission spectrum.

In the limit where the resonant mode couples much more strongly with the waveguide than the air i. In the following, we will analyze the structure in exactly the opposite order of what we really should do. Really, we should analyze the periodic system first to understand the band gap, then analyze the resonant mode, and then finally analyze the transmission spectrum.

Since all of those calculations have already been done in the above paper, however, we can jump straight to the transmission spectrum which is conceptually the easiest computation to understand and work backwards. See also the holey-wvg-cavity. To calculate the transmission spectrum, much as in the bend example in the Meep tutorialwe'll measure the flux spectrum at one end of the waveguide from a source at the other end, normalized by the flux from a case with no holes in the waveguide.

## Meep Tutorial/Band diagram, resonant modes, and transmission in a holey waveguide

First, we'll define some parametes defining our structure, as in the figure above; note that we'll choose units so that our periodicity is 1 a typical choice for photonic crystals. Our geometry will consist of a single block for the waveguide, and 2N cylindrical holes. To make the holes, we could use some kind of loop see also how to write a loop in Schemebut in this case it is even easier to to use the predefined function geometric-object-duplicateswhich replicates a given object by shifting by a given vector a given number of times see the Meep reference :.

Note that we call geometric-object-duplicates twice, for the holes before and after the defect, and that we combine the resulting lists with the standard Scheme append function. As usual, later objects in geometry take precedence over earlier objects, so the cylinder objects will punch holes through the block.

Now, we'll define a couple of parameters to determine the frequency range to look at. We already know from the paper or our calculation below that this structure has a TE band gap for frequencies from about 0. Ideally, we would excite exactly the fundamental mode of the waveguide, but it is good enough to just excite it with a line source. Moreover, since we are interested in the TE polarization electric field in the planewe will excite it with a J y current source transverse to the propagation directionwhich is specified as Ey :.

The structure has mirror symmetry planes through the x and y axes. The source breaks the mirror symmetry through the y axis, but we still have odd mirror symmetry through the x axis:.

Note that we specify the plane by its normal, the y direction. See also: Exploiting symmetry in Meep. Finally, we need to tell Meep to compute the flux spectrum at the other end of the computational cell, after the holes but before the PML:.GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Work fast with our official CLI.

Learn more. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. Meep is a free and open-source software package for electromagnetics simulation via the finite-difference time-domain FDTD method spanning a broad range of applications.

We kindly request that you cite the following paper in any published work for which you used Meep:. See the manual on readthedocs for the latest documentation.

We use optional third-party analytics cookies to understand how you use GitHub. You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement. We use essential cookies to perform essential website functions, e. We use analytics cookies to understand how you use our websites so we can make them better, e.

Skip to content. Dismiss Join GitHub today GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Sign up. Go back. Launching Xcode If nothing happens, download Xcode and try again. Latest commit. Add more details and examples to Verbosity's docstring Git stats 2, commits.

Failed to load latest commit information. Jul 30, Oct 8,

## thoughts to “Meep simulation”