Hi Philip,
In my experience, the best way to get an ideal plane wave source in
MEEP for simulations like scattering off a nanoparticle is the
following: Place PML layers around the entire computational cell, and
place a plane source along one of the inner PML boundaries. Make sure
the size of the source is the same as that of the ENTIRE simulation
cell (including the PML thicknesses) along its planar dimensions. For
example:
(set! (geometry-lattice (make lattice (size sx sy sz)))
(set! pml-layers (list (make pml (thickness dpml))))
(set! sources
(list
(make source
(src
(make gaussian-src
(width df)
(frequency fcen)))
(component Ex)
(amplitude 2)
(center 0 0 (/ sz 2))
(size sx sy 0))))
When I've instead used "(size (- sx (* 2 dpml)) (- sy (* 2 dpml)) 0)"
for the source, the results have less than ideal due to discrete
dipole effects at the source edges propagating into the simulation
cell. This even seems to be an issue when periodic boundaries are
used. That said, my prescription is not perfect - there is a gradual
decrease in source intensity as the wavefront moves down the
simulation cell due to PML absorption at the boundaries, but the
effect is typically small, especially when sx ~ sz and sy ~ sz. Give
that setup a whirl and let me know if you notice problems with it.
Cheers,
Alex
____________________________________________________________________
Alexander S. McLeod
B.A. Physics and Astrophysics - University of California at Berkeley
Simulation Engineer - Theory Group, Molecular Foundry (LBNL)
Site Lead - Network for Computational Nanotechnology at Berkeley / MIT
asmcl...@lbl.gov 707-853-0716
____________________________________________________________________
On Dec 2, 2009, at 9:00 AM, meep-discuss-requ...@ab-initio.mit.edu
wrote:
Send meep-discuss mailing list submissions to
meep-discuss@ab-initio.mit.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
or, via email, send a message with subject or body 'help' to
meep-discuss-requ...@ab-initio.mit.edu
You can reach the person managing the list at
meep-discuss-ow...@ab-initio.mit.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of meep-discuss digest..."
Today's Topics:
1. Re: superimpose different slices from h5 files (Steven G.
Johnson)
2. plane wave sources in meep (philip)
From: "Steven G. Johnson" <stevenj....@gmail.com>
Date: December 1, 2009 5:24:26 PM PST
To: meep-discuss Discuss <meep-discuss@ab-initio.mit.edu>
Subject: Re: [Meep-discuss] superimpose different slices from h5 files
Sorry, h5topng uses the same slice for the contour as for the other
data.
You could hack the source code for h5topng, of course; it wouldn't
be too hard to do this.
On Dec 1, 2009, at 2:33 PM, F.S.F. Brossard wrote:
Considering 3D h5 files, I would like to superimpose say slice z 10
from epsilon.h5 with slice z 20 from dpwr.h5 for quick
visualization (avoiding using Matlab, etc)
So I tried as follows:
h5topng -z 10 -C epsilon.h5 -z 20 dpwr.h5
but it seems to ignore the first statement about z.
Any straightforward ways around this except rerunning the
simulation with specific slices?
From: philip <philip.rodr...@gmail.com>
Date: December 1, 2009 8:09:50 PM PST
To: meep-discuss@ab-initio.mit.edu
Subject: [Meep-discuss] plane wave sources in meep
Dear Prof. Johnson and meep-users,
While trying to implement plane waves in meep simulations I had to
go through
several of the previous postings and several suggestions made by
users (and some
were not correct).
I would like to suggest that including these techniques in a central
location
eg. in the wiki, would be beneficial for newbies like myself. It
would be really
great if the knowledgeable meep-users could validate these and
provide some
comments on using them.
Here are the main techniques I found from the mailing list.
<b>1) plane-waves with periodic boundary conditions (simulation of
periodic
structures)</b>
(define-param s 11) ; the size of the computational cell, not
including PML
(define-param dpml 1) ; thickness of PML layers
(define sxy (+ s (* 2 dpml))) ; cell size, including PML
(set! geometry-lattice (make lattice (size s sxy no-size)))
(set! pml-layers (list (make pml (thickness dpml) (direction Y)) ))
(set-param! resolution 12)
(define-param fcen 2) ; pulse center frequency
(define-param df 0.1) ; turn-on bandwidth
(define theta (/ pi 4))
(define kx (* fcen (sin theta)))
(set! k-point (vector3 kx 0 0))
(set! ensure-periodicity true)
(define (my-amp-func p)
(exp (* 0+2i pi kx (vector3-x p))))
(set! sources
(list
(make source
(src (make gaussian-src (frequency fcen) (fwidth df)))
(component Ez) (center 0 (* -0.5 s)) (size s 0)
(amp-func my-amp-func))))
(define-param T 80) ; run time
(run-until T
(at-beginning output-epsilon)
(at-every 2 (output-png Ez "-Zc dkbluered"))
<b>2) plane-waves with perpendicular source planes/lines and PML
boundaries
(non-periodic eg. free-space)</b>
http://article.gmane.org/gmane.comp.science.electromagnetism.meep.general/700
; This example creates an approximate TM planewave in vacuum
; propagating at a 45-degree angle, by using a couple of current
sources
; with amplitude exp(ikx) corresponding to the desired planewave.
(define-param s 11) ; the size of the computational cell, not
including PML
(define-param dpml 1) ; thickness of PML layers
(define sxy (+ s (* 2 dpml))) ; cell size, including PML
(set! geometry-lattice (make lattice (size sxy sxy no-size)))
(set! pml-layers (list (make pml (thickness dpml))))
(set-param! resolution 10)
; pw-amp is a function that returns the amplitude exp(ik(x+x0)) at a
; given point x. (We need the x0 because current amplitude functions
; in Meep are defined relative to the center of the current source,
; whereas we want a fixed origin.) Actually, it is a function of k
; and x0 that returns a function of x ...
(define ((pw-amp k x0) x)
(exp (* 0+1i (vector3-dot k (vector3+ x x0)))))
(define-param fcen 0.8) ; pulse center frequency
(define-param df 0.02) ; turn-on bandwidth
(define-param kdir (vector3 1 1)) ; direction of k (length is
irrelevant)
(define k (vector3-scale (* 2 pi fcen)
(unit-vector3 kdir))) ; k with correct length
(define kxcos (vector3-x (unit-vector3 k))) ; direction cosine of k
in x
(define kycos (vector3-y (unit-vector3 k))) ; direction cosine of k
in x
(set! sources
(list
; left
(make source
(src (make continuous-src (frequency fcen) (fwidth df)))
(component Ez) (center (* -0.5 s) 0) (size 0 s)
(amp-func (pw-amp k (vector3 (* -0.5 s) 0))))
; bottom
(make source
(src (make continuous-src (frequency fcen) (fwidth df)))
(component Ez) (center 0 (* -0.5 s)) (size s 0)
(amp-func (pw-amp k (vector3 0 (* -0.5 s)))))
))
(define-param T 400) ; run time
(run-until T (at-end output-efield-z)
)
<b>3) plane waves with multiple point sources </b>
http://article.gmane.org/gmane.comp.science.electromagnetism.meep.general/3058
(define-param dpml 3.0)
(define-param len (+ 20 dpml))
(define-param wid (+ 20 dpml))
(set! geometry-lattice (make lattice (size len wid no-size)))
(define-param beam-waist 2.5) ; beam sigma (gaussian beam width)
(define-param rotation-angle (* (/ 22.5 360) 2 pi)) ; Degrees if you
like them
(define-param source-points 60) ; should be a big number
(define-param source-size (* 10 beam-waist)) ; should be bigger than
beam-waist
(define-param src_list (list ))
(do
((
r_0 (/ source-size -2) ;
(+ r_0 (/ source-size (- source-points 1)))
))
((> r_0 (/ source-size 2)))
;for r_0 = -source-size/2 : r_0 += source-size/(source-points-1) :
r_0 > source-
size/2
(set! src_list
(append src_list
(list
(make source
(src
(make gaussian-src
(wavelength 1)
(width 3))
)
(amplitude (exp (- 0 (/ (* r_0 r_0)
(* 2 beam-
waist beam-waist)))))
(component Ez)
(center (* r_0 (sin rotation-angle))
(* r_0 (cos
rotation-angle)))
)
)
)
)
)
(set! sources src_list)
(set! pml-layers (list (make pml
(thickness dpml)
)))
(set! resolution 10)
(use-output-directory)
(run-until (* 2 len)
;(to-appended "ez" (at-every 0.1 output-efield-z))
(at-every 2 (output-png Ez "-Zc dkbluered"))
)
All these provide seemingly nice plane-waves. But I would really
appreciate if
someone could provide comments on what specific scenarios they can
be used,
pros/cons etc.
Thanks
--
philip
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss