Meep Tutorial/Ring resonator in cylindrical coordinates

From AbInitio

Revision as of 19:13, 12 November 2005; Stevenj (Talk | contribs)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Jump to: navigation, search
Meep
Download
Release notes
FAQ
Meep manual
Introduction
Installation
Tutorial
Reference
C++ Tutorial
C++ Reference
Acknowledgements
License and Copyright

In the Meep tutorial, we computed the modes of a ring resonator by performing a 2d simulation. Here, we will simulate the same structure while exploiting the fact that the system has continuous rotational symmetry, by performing the simulation in cylindrical coordinates. See also the ring-cyl.ctl example file included with Meep.

We begin, as usual, by defining the parameters of the problem, with exactly the same values as in the 2d simulation.

(define-param n 3.4) ; index of waveguide
(define-param w 1) ; width of waveguide
(define-param r 1) ; inner radius of ring
(define-param pad 4) ; padding between waveguide and edge of PML
(define-param dpml 2) ; thickness of PML

Now, we'll define the dimensions and size of the computational cell:

(define sr (+ r w pad dpml)) ; radial size (cell is from 0 to sr)
(set! dimensions CYLINDRICAL)
(set! geometry-lattice (make lattice (size sr no-size no-size)))

The key thing here was to set the dimensions parameter to CYLINDRICAL. This means that all vectors will represent (r,φ,z) coordinates instead of (x,y,z). The computational cell in the r direction is of size sr = r + w + pad + dpml, and runs from 0 to sr (by default) rather than from -sr/2 to sr/2 as it would for any other dimension. Note that our z size is no-size because it is two-dimensional. The φ size is also no-size, corresponding to the continuous rotational symmetry (a finite φ size might correspond to discrete rotational symmetry, but this is not currently supported in Meep).

In particular, in systems with continuous rotational symmetry, by an analogue of Bloch's theorem, the angular dependence of the fields can always be chosen in the form exp(imφ) for some integer m. Meep uses this fact to treat the angular dependence analytically, with m given by the input variable m (which we'll set to 3, for now).

(set-param! m 3)

Thus, we are essentially performing a 1d calculation, where Meep must discretize the r direction only. For this reason, it will be much faster (and more accurate) than the previous 2d calculation.

The geometry is now specified by a single block object—remember that this is a block in cylindrical coordinates, so that it really specifies an annular ring:

(set! geometry (list
                (make block (center (+ r (/ w 2))) (size w infinity infinity)
                      (material (make dielectric (index n))))))
(set! pml-layers (list (make pml (thickness dpml))))
(set-param! resolution 10)

We have added PML layers on "all" sides. Meep, however, notices that the z direction has no thickness and automatically makes it periodic with no PML. Meep also omits PML from the boundary at r = 0 (which is handled by the analytical reflection symmetry).

Now, the remaining inputs are almost exactly the same as in the previous 2d simulation. We'll add a single Gaussian point source in the z direction to excite TM modes, with some center frequency and width:

(define-param fcen 0.15) ; pulse center frequency                            
(define-param df 0.1)  ; pulse width (in frequency) 
(set! sources (list
               (make source
                 (src (make gaussian-src (frequency fcen) (fwidth df)))
                 (component Ez) (center (+ r 0.1) 0 0))))
              

Note that this isn't really a "point" source, however, because of the cylindrical symmetry—it is really a "ring" source with φ dependence exp(imφ). Finally, as before, we run until the source has turned off, plus 200 additional time units during which we use harminv to analyze the Ez field at a given point to extract the frequencies and decay rates of the modes.

(run-sources+ 200 (after-sources (harminv Ez (vector3 (+ r 0.1)) fcen df)))

At the very end, we'll also output one period of the fields to make movies, etcetera. A single field output would be a 1d dataset (along the r direction), so to make things more interesting we'll use to-appended to append these datasets to a single HDF5 file to get an r \times t 2d dataset. We'll also use in-volume to specify a larger output volume than just the computational cell: in particular, we'll output from -sr to sr in the r direction, where Meep will automatically infer the r field values from the reflection symmetry.

(run-until (/ 1 fcen) 
           (in-volume (volume (center 0) (size (* 2 sr)))
                      (at-beginning output-epsilon)
                      (to-appended "ez" 
                                   (at-every (/ 1 fcen 20) output-efield-z))))
Personal tools