Re: [Meep-discuss] E and H for the same point

2008-07-19 Thread Steven G. Johnson
On Jun 3, 2008, at 2:27 AM, Steven G. Johnson wrote:
 To get the fields for the same *time*, you will need to do some  
 averaging yourself.   In particular, each time step first steps H  
 and then steps E (and D), so the E (and D) field is always half a  
 time-step ahead of the H field.  So, for example, you could output  
 HDF5 files for E and H from two consecutive time steps, and use the  
 *first* E field with the *average* of the two H fields.

Update: this is now easy to do in Meep version 0.20: just wrap your  
step function in (synchronized-magnetic ...) and Meep will synchronize  
H (and B) with E (and D) in time for you, and then you can do your  
field computations normally (e.g. to compute the stress tensor as for  
the original poster in this thread).  See also:

http://ab-initio.mit.edu/wiki/index.php/Synchronizing_the_magnetic_and_electric_fields

Steven


___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


Re: [Meep-discuss] E and H for the same point

2008-06-07 Thread Juntao Xi
In two dimensions, the fields (by symmetry since the xy plane is a
 mirror plane) can be divided into two polarizations, TE (Hz, Ex, Ey)
 and TM (Ez, Hx, Hy).  When you use an Ey source, it only produces TE-
 polarized fields.  You get a magnetic field (and a nonzero stress
 tensor), but it is in the z direction only.  Conversely, an Hx source
 produces only TM fields, by symmetry.

 (See also chapter 3 of our new textbook, available online at 
 http://ab-initio.mit.edu/book)

 Obviously, the optical forces (the stress tensor) will depend on what
 source you use (and consequently what field patterns you excite).  I
 have no idea what physical situation you are interested in.  However,
 there is nothing physically wrong with using just a TE source,
 computing the stress tensor from the resulting (Ex,Ey,Hz) fields, and
 hence obtaining the radiation pressure on some object.

1. A quick question: how to implement (dielectric constant = -24.9 + 1.57i)

2.Back to the previous topic
I consider a model based on nearly touching gold spheres illuminated with a 
plane wave incident
perpendicular to an axis through the particles' centers and with the 
electrical field parallel to
the axis.

In my case, wavelengh of source is 550nm, the radius of gold sphere is 25nm 
and the gap between two
spheres is 1nm. The electrical field is implemented as Ey and the 
propagation is along X+.
As I am running my simulation on the Sun Grid with parallel meep, the 
resolution is
set high (400) in order to get good visualization result.

My target is to calculate the stress tensor in the X-Y plane.

==
;define the simulation cell
;basic unit is 100nm
;planewave source
;frequency 1/(550nm), fwidth 0.2  (346nm~1127nm)

; Drude model of Au
(set! eps-averaging? false)
(define-param wp_au 0.67) ; resonant plasma frequency
(define-param gama_au 6.85e-3) ; gamma of Gold
(define-param e_au 9.84) ; epsilon of Gold9.84
(define-param r 0.25)
(define-param d 0.01)
(define-param th 0.5)

(define Au
  (make dielectric (epsilon e_au)
(polarizations
 (make polarizability
   (omega 1e-20) (gamma gama_au) (delta-epsilon (* wp_au wp_au 
1e+20 1e+20))




(set! geometry-lattice (make lattice (size  (+ th 15) (+ th 15) no-size)))


(set! geometry (list
(make block (center 0 0) (size 3 3 infinity) (material (make 
dielectric (epsilon 1.77
(make sphere (center 0 0) (radius r) (material Au))
(make sphere (center 0 (+ (* 2 r) d)) (radius r) (material 
Au))
))

(set! sources (list
   (make source
 (src (make continuous-src (wavelength 5.5)))
 (component Ey)
 (center -7 0)
 (size 0 14 

(set! pml-layers (list (make pml (thickness th

(set! resolution 400)

(use-output-directory)

(run-until 200
   (at-beginning
(in-volume( volume (center 0 0) (size 1 1)) output-epsilon))
   (to-appended ey
  (at-every 1
(in-volume (volume (center 0 0) (size 1 1)) 
output-efield-y)))
(to-appended ex
   (at-every 1
(in-volume (volume (center 0 0) (size 1 1)) 
output-efield-x)))
 (to-appended hy
   (at-every 1
(in-volume (volume (center 0 0) (size 1 1)) 
output-hfield-y)))
  (to-appended hx
(at-every 1
(in-volume (volume (center 0 0) (size 1 1)) 
output-hfield-x)))
)
 


___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


Re: [Meep-discuss] E and H for the same point

2008-06-05 Thread Steven G. Johnson
On Jun 5, 2008, at 7:47 AM, Juntao Xi wrote:

 --
 From: Steven G. Johnson [EMAIL PROTECTED]
 Sent: Thursday, June 05, 2008 9:16 PM
 To: meep-discuss@ab-initio.mit.edu
 Subject: Re: [Meep-discuss] E and H for the same point


 Both E and H are necessary in order to calculate stress tensor.
 Do I need to run the simulation twice with different source  
 component?

 No.  A single source produces both E and H.  (From Maxwell's
 equations, an oscillating E field creates H fields and vice versa.)

 However, all Hx and Hy field are zero when src-component is set as Ey.
   all Ex and Ey field are zero when scr-component is set as Hxuss

In two dimensions, the fields (by symmetry since the xy plane is a  
mirror plane) can be divided into two polarizations, TE (Hz, Ex, Ey)  
and TM (Ez, Hx, Hy).  When you use an Ey source, it only produces TE- 
polarized fields.  You get a magnetic field (and a nonzero stress  
tensor), but it is in the z direction only.  Conversely, an Hx source  
produces only TM fields, by symmetry.

(See also chapter 3 of our new textbook, available online at 
http://ab-initio.mit.edu/book)

Obviously, the optical forces (the stress tensor) will depend on what  
source you use (and consequently what field patterns you excite).  I  
have no idea what physical situation you are interested in.  However,  
there is nothing physically wrong with using just a TE source,  
computing the stress tensor from the resulting (Ex,Ey,Hz) fields, and  
hence obtaining the radiation pressure on some object.

Steven

___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


Re: [Meep-discuss] E and H for the same point

2008-06-03 Thread Steven G. Johnson
To get the fields for the same point in space, you can just use one of  
the supplied interpolation routines as defined in the manual, such as  
get-field-pt.  The HDF5 output routines also interpolate all the  
fields onto the same spatial grid.  Also, the built-in field- 
integration routines (see the reference manual) also interpolate the  
fields onto the same spatial grid for you --these routines may be  
useful to you if you want to integrate the stress tensor.

To get the fields for the same *time*, you will need to do some  
averaging yourself.   In particular, each time step first steps H and  
then steps E (and D), so the E (and D) field is always half a time- 
step ahead of the H field.  So, for example, you could output HDF5  
files for E and H from two consecutive time steps, and use the *first*  
E field with the *average* of the two H fields.

To do this averaging within Meep is possible, but is a bit tricky  
right now from the Scheme interface.  To see how it is done in C++,  
see the implementation of fields::flux_in_box in src/ 
energy_and_flux.cpp.

Or you could just ignore the time difference and use E and H at  
slightly different times; this will still converge as you increase  
resolution, but is only first-order-accurate in the resolution.

Steven

On Jun 3, 2008, at 1:13 AM, matt wrote:
 Do these texts answer your question?
 http://ab-initio.mit.edu/wiki/index.php/Meep_Introduction#Finite-difference_time-domain_methods
 http://ab-initio.mit.edu/wiki/index.php/Meep_Introduction#The_illusion_of_continuity_in_Meep

 On Tue, 3 Jun 2008, Juntao Xi wrote:

 Hi, Steven and Meepers,

 Now, I am working on the optical force simulation project. And  
 mostly, the optical force is presented by the Maxwell stress  
 tensor. (http://en.wikipedia.org/wiki/Maxwell_stress_tensor).

 As you know, Meep is using FDTD algorithms and the E output and H  
 output have half-step difference.

 My question is that how I can get the E and H for the same point

 Regards
 Jun

___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


[Meep-discuss] E and H for the same point

2008-06-02 Thread Juntao Xi
Hi, Steven and Meepers,

Now, I am working on the optical force simulation project. And mostly, the 
optical force is presented by the Maxwell stress tensor. 
(http://en.wikipedia.org/wiki/Maxwell_stress_tensor).

As you know, Meep is using FDTD algorithms and the E output and H output have 
half-step difference.

My question is that how I can get the E and H for the same point

Regards
Jun
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] E and H for the same point

2008-06-02 Thread matt



Do these texts answer your question?
http://ab-initio.mit.edu/wiki/index.php/Meep_Introduction#Finite-difference_time-domain_methods
http://ab-initio.mit.edu/wiki/index.php/Meep_Introduction#The_illusion_of_continuity_in_Meep

Best,
Matt



On Tue, 3 Jun 2008, Juntao Xi wrote:

 Hi, Steven and Meepers,

 Now, I am working on the optical force simulation project. And mostly, the 
 optical force is presented by the Maxwell stress tensor. 
 (http://en.wikipedia.org/wiki/Maxwell_stress_tensor).

 As you know, Meep is using FDTD algorithms and the E output and H output have 
 half-step difference.

 My question is that how I can get the E and H for the same point

 Regards
 Jun


___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss