Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Python tutorial for near2far to documentation and other fixes #125

Merged
merged 3 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions doc/docs/Acknowledgements.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ Financial Support
-----------------

Meep's continued development has been supported by a Small Business Innovation Research (SBIR) Phase 1 award from the National Science Foundation (NSF) under award number [1647206](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1647206). Initial development was supported in part by the Materials Research Science and Engineering Center program of the NSF under award numbers DMR-9400334 and DMR-0819762, by the Army Research Office through the Institute for Soldier Nanotechnologies under DAAD-19-02-D0002, and DARPA under N00014-05-1-0700 administered by the Office of Naval Research.

We are also grateful to the authors of earlier Fortran FDTD programs that were used in our research group at MIT, which were invaluable as benchmarks in testing our new code. This includes a 2d FDTD code by Jerry Chen, with later improvements by Shanhui Fan, Steven G. Johnson, and others. There was also a 3d code initially written by Shanhui Fan, with later improvements by Daniel Abrams, Doug Allan, Steven G. Johnson, Chiyan Luo, and Elefterios Lidorikis.
2 changes: 1 addition & 1 deletion doc/docs/Download.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The current stable version of Meep preinstalled on [Ubuntu](https://en.wikipedia
Precompiled Meep packages for Ubuntu
------------------------------------

Precompiled packages of Meep are available for [Ubuntu](https://en.wikipedia.org/wiki/Ubuntu) as **meep** via this [list](https://packages.ubuntu.com/search?keywords=meep). We recommend using Ubuntu as Meep and all of its dependencies can be installed using just one line:
Precompiled packages of Meep are available for [Ubuntu](https://packages.ubuntu.com/search?keywords=meep). We recommend Ubuntu as Meep and all of its dependencies can be installed using just one line:

```sh
sudo apt-get install meep h5utils
Expand Down
14 changes: 7 additions & 7 deletions doc/docs/Exploiting_Symmetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# Exploiting Symmetry
---

Meep allows you to take advantage of mirror and rotational symmetries in your problem to reduce the amount of computation and storage required for simulation. Our use of symmetry is designed to be *transparent*: once you specify the symmetry, Meep exploits it as an internal optimization, while everything else about the simulation *appears* the same as if you didn't specify the symmetry. That is, when you output it still outputs the entire non-symmetrized cell, you can still call `get-field-point` to obtain the fields at any point, etcetera — internally, Meep transforms everything as necessary according to the symmetries to get whatever data is needed.
Meep allows you to take advantage of mirror and rotational symmetries in your problem to reduce the amount of computation and storage required for simulation. Our use of symmetry is designed to be *transparent*: once you specify the symmetry, Meep exploits it as an internal optimization, while everything else about the simulation *appears* the same as if you didn't specify the symmetry. That is, when you output it still outputs the entire non-symmetrized cell, you can still call `get_field_point` to obtain the fields at any point, etcetera — internally, Meep transforms everything as necessary according to the symmetries to get whatever data is needed.

An important point to understand is that, when you specify a symmetry, it must be obeyed by *both* the structure/geometry *and* by the current sources and thus the fields. In particular, the symmetry of the currents/fields will typically require you to specify *phase factors* associated with the symmetry operations — for example, a mirror plane can either be used for *even* sources/fields (phase +1) or for *odd* sources/fields (phase −1).

**Meep does not check whether the symmetry is obeyed**. If you specify a symmetry that does not preserve your structure/sources, then the results are undefined.

For the Scheme syntax to specify a symmetry, see the [symmetry reference](Scheme_User_Interface.md#symmetry). There are also examples in [Tutorial/Basics](Scheme_Tutorials/Basics/#exploiting-symmetry).
For the Scheme syntax to specify a symmetry, see the [symmetry reference](Scheme_User_Interface.md#symmetry). There are also examples in [Tutorial/Basics](Python_Tutorials/Basics/#exploiting-symmetry).

[TOC]

Expand All @@ -27,25 +27,25 @@ The first two kinds of symmetry each reduce the computational cell (internally)

There are also two other kinds of symmetry you can exploit.

### $S$/$P$ Polarizations in 2d
### Polarizations in 2d

When you have a two-dimensional simulation with a wavevector $\mathbf{k}$ (if any) lying in the plane, then the $xy$ plane is itself a mirror plane. The consequence of this is that the fields can be chosen purely polarized: either **P polarized** (electric field in the plane and magnetic field in the $z$ direction) or **S polarized** (magnetic field in the plane and electric field in the $z$ direction). Meep can exploit this to save a factor of two in storage and time.
When you have a two-dimensional simulation with a wavevector $\mathbf{k}$ (if any) lying in the plane, then the $xy$ plane is itself a mirror plane. The consequence of this is that the fields can be chosen purely polarized: either **$H_z$ polarized** (electric field in the plane and magnetic field in the $z$ direction) or **$E_z$ polarized** (magnetic field in the plane and electric field in the $z$ direction). Meep can exploit this to save a factor of two in storage and time.

To exploit $S$/$P$ symmetry, you don't have to do anything special: if your sources are only $S$ polarized ($E_z$/$H_x$/$H_y$), then Meep will only propagate these fields, and similarly for $P$ ($H_z$/$E_x$/$E_y$).
To exploit $E_z$/$H_z$ symmetry, you don't have to do anything special: if your sources are only $E_z$ polarized ($E_z$/$H_x$/$H_y$), then Meep will only propagate these fields, and similarly for $H_z$ ($H_z$/$E_x$/$E_y$).

### Cylindrical Symmetry

If your structure has cylindrical symmetry (also known as the $C_{\infty\mathrm{v}}$ group), i.e. continuous rotational symmetry around the $z$ axis, then Meep can exploit this by running the simulation in cylindrical/polar coordinates.

To do this, you must `(set! dimensions CYLINDRICAL)` in the ctl file, and then the vectors are interpreted as ($r$,$\phi$,$z$) triplets instead of ($x$,$y$,$z$).
To do this, you must set `dimensions = mp.CYLINDRICAL` in the Python script, and then the vectors are interpreted as ($r$,$\phi$,$z$) triplets instead of ($x$,$y$,$z$).

In a cylindrical simulation, fields can be written in the form of a function of ($r$,$z$) multiplied by a function $\exp(im\phi)$ for the $\phi$ dependence, where $m$ is a user-specified parameter (related to the angular momentum of the field). If the computational cell includes the $r$=0 origin, then $m$ must be an integer to be single-valued at the origin. Otherwise, $m$ can be arbitrary (this is useful e.g. for bend simulations).

### Translational Symmetry

If the structure has discrete or continuous translational symmetry in some direction, then this is handled in Meep by specifying periodic boundary conditions in that direction. Here, the fields/sources take the form of $\exp(i\mathbf{k}\cdot\mathbf{x})$ multiplied by a periodic envelope, so one specifies **Bloch-periodic** boundary conditions with a given Bloch wavevector $\mathbf{k}$.

For example, to simulate the modes of a uniform waveguide (continuous translational symmetry) in the $x$ direction, one would specify a structure with `no-size` in the $x$ direction and a given $k_x$ corresponding to the wavenumber of the desired mode. For discrete periodicity, see [Tutorial/Resonant Modes and Transmission in a Waveguide Cavity/Band Diagram](Scheme_Tutorials/Resonant_Modes_and_Transmission_in_a_Waveguide_Cavity.md#band-diagram).
For example, to simulate the modes of a uniform waveguide (continuous translational symmetry) in the $x$ direction, one would specify a structure with `no-size` in the $x$ direction and a given $k_x$ corresponding to the wavenumber of the desired mode. For discrete periodicity, see [Tutorial/Resonant Modes and Transmission in a Waveguide Cavity/Band Diagram](Python_Tutorials/Resonant_Modes_and_Transmission_in_a_Waveguide_Cavity.md#band-diagram).

Symmetry Phase Factors
----------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If you are worried about this, then you are probably setting up your calculation

### How do I set the imaginary part of ε?

If you only care about the imaginary part of $\varepsilon$ in a narrow bandwidth around some frequency ω, you should set it by using the electric conductivity as described in [Materials](Materials/#conductivity-and-complex). If you care about the imaginary part of $\varepsilon$ over a broad bandwidth, then for any physical material the imaginary part will be frequency-dependent and you will have to fit it to Meep's dispersive-$\varepsilon$ support. See [Materials](Materials#material-dispersion).
If you only care about the imaginary part of $\varepsilon$ in a narrow bandwidth around some frequency $\omega$, you should set it by using the electric conductivity as described in [Materials](Materials/#conductivity-and-complex). If you care about the imaginary part of $\varepsilon$ over a broad bandwidth, then for any physical material the imaginary part will be frequency-dependent and you will have to fit it to Meep's dispersive-$\varepsilon$ support. See [Materials](Materials#material-dispersion).

Meep doesn't implement a frequency-independent complex $\varepsilon$. Not only is this not physical, but it also leads to both exponentially decaying and exponentially growing solutions in Maxwell's equations from positive- and negative-frequency Fourier components, respectively. Thus, it cannot be simulated in the time domain.

Expand Down
7 changes: 4 additions & 3 deletions doc/docs/Guile_and_Scheme_Information.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ In Scheme, we would then use

The variable *foo* would then be a list of numbers '(1 3 12.2 14.5 16 18).

### Tricks Specific to Libctl-Using Programs such as [Meep](index.md) or [MPB](http://mpb.readthedocs.io)
Libctl Tricks Specific to [Meep](index.md) and [MPB](https://mpb.readthedocs.io)
--------------------------------------------------------------------------------

[libctl](http://libctl.readthedocs.io) has a couple of built-in functions `arith-sequence` and `interpolate` (see the [User Reference](https://libctl.readthedocs.io/en/latest/Libctl_User_Reference/)) to construct lists of a regular sequence of values, which you can use in conjunction with `map` as above:
[libctl](https://libctl.readthedocs.io) has a couple of built-in functions `arith-sequence` and `interpolate` (see the [User Reference](https://libctl.readthedocs.io/en/latest/Libctl_User_Reference/)) to construct lists of a regular sequence of values, which you can use in conjunction with `map` as above:

`(map (lambda (x) `*`...do` `stuff` `with` `x...`*`) (arith-sequence x-min dx num-x))`

or

`(map (lambda (x) `*`...do` `stuff` `with` `x...`*`) (interpolate num-x (list a b)))`

Finally, if you have an entire libctl input file *myfile.ctl* that you want to loop, varying over some parameter *x*, you can do so by writing a loop on the Unix command-line. Using the [bash](https://en.wikipedia.org/wiki/bash) shell, you could do:
Finally, if you have an entire libctl input file `myfile.ctl` that you want to loop, varying over some parameter *x*, you can do so by writing a loop on the Unix command-line. Using the [bash](https://en.wikipedia.org/wiki/bash) shell, you could do:

``for x in `seq a dx b`; do meep x=$x myfile.ctl; done``
4 changes: 2 additions & 2 deletions doc/docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Note also that Meep's usage of BLAS/LAPACK, via Harminv, is not generally perfor

### BLAS

The first thing you must have on your system is a BLAS implementation. "BLAS" stands for "Basic Linear Algebra Subroutines," and is a standard interface for operations like matrix multiplication. It is designed as a building-block for other linear-algebra applications, and is used both directly by our code and in LAPACK (see below). By using it, we can take advantage of many highly-optimized implementations of these operations that have been written to the BLAS interface. Note that you will need implementations of BLAS levels 1-3.
The first thing you must have on your system is a BLAS implementation. "BLAS" stands for "Basic Linear Algebra Subroutines," and is a standard interface for operations like matrix multiplication. It is designed as a building-block for other linear-algebra applications, and is used both directly by LAPACK (see below). By using it, we can take advantage of many highly-optimized implementations of these operations that have been written to the BLAS interface. Note that you will need implementations of BLAS levels 1-3.

You can find more BLAS information, as well as a basic implementation, on its [homepage](http://www.netlib.org/blas/). Once you get things working with the basic BLAS implementation, it might be a good idea to try and find a more optimized BLAS code for your hardware. Vendor-optimized BLAS implementations are available as part of the Intel MKL, HP CXML, IBM ESSL, SGI sgimath, and other libraries. An excellent, high-performance, free-software BLAS implementation is [OpenBLAS](http://www.openblas.net). Another is [ATLAS](http://math-atlas.sourceforge.net/).

Expand Down Expand Up @@ -203,7 +203,7 @@ There are two incompatible versions of HDF, HDF4 and HDF5 (no, not HDF1 and HDF2

HDF5 includes parallel I/O support under MPI, which can be enabled by configuring it with `--enable-parallel`. You may also have to set the `CC` environment variable to `mpicc`. Unfortunately, the parallel HDF5 library then does not work with serial code, so you have may have to choose one or the other.

We have some hacks in our MPB and Meep software so that they can do parallel I/O even with the serial HDF5 library. These hacks work okay when you are using a small number of processors, but on large supercomputers we strongly recommend using the parallel HDF5.
We have some hacks in Meep and MPB so that they can do parallel I/O even with the serial HDF5 library. These hacks work okay when you are using a small number of processors, but on large supercomputers we strongly recommend using the parallel HDF5.

**Note:** If you have a version of HDF5 compiled with MPI parallel I/O support, then you need to use the MPI compilers to link to it, even when you are compiling the serial versions of Meep or MPB. Just use `./configure CC=mpicc CXX=mpic++` or whatever your MPI compilers are when configuring.

Expand Down
Loading