[Meep-discuss] how to set the amplitude of the source according to the power

2007-03-27 Thread ? ?
Dear Steven:
I¡¯m sorry to trouble you again. In MEEP we could not specify the power of the source. Rather we could specify the amplitude only. If I want to set a source with a power 4w, what is the amplitude of the source? Is it simply obtained by 4^0.5 = 2? However, it seems that the expected nonlinear effect could not be observed. What¡¯s wrong with it? Many thanks. Jack
Express yourself instantly with MSN Messenger! MSN Messenger Download today it's FREE!


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

[Meep-discuss] incorrect reflection coeff. calculation

2007-03-27 Thread matt




Hello,

My simple meep example is coming up with an incorrect result.

I found some posts on the list regarding similar problems (incorrect 
reflection coefficient calculation), where the recommendation was to 
move the flux planes away from the source, by at least a wavelength. 
This did not solve the problem for me.


In my example, I have a 2D simulation, with periodicity in X, and PML in 
Y. The scatterer is a dielectric slab with epsilon 9.  The source is a 
plane wave source at the upper PML interface (the angle of incidence is 
30 degrees).



The field output looks great (see attached png; resized smaller for 
posting to list).


To calculate the fluxes, I simple setup flux planes in front of and 
beyond the slab, and run the computation twice; with and without the 
slab.


The coefficents are clearly wrong:
transmission: 0.647382725227634, reflection: 3.21374994463727, loss: 
-2.8611326698649


code:
http://www.pastebin.us/19072

The command to run that code, which also computes the coefficients is:
meep no-scatterer\?=true compute-flux\?=true test.ctl  meep 
no-scatterer\?=false output-finalfield\?=true compute-flux\?=true 
output-finalfield\?=true test.ctl | tee lastrun.out


Best Regards,
Matt


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

Re: [Meep-discuss] band structure

2007-03-27 Thread Steven G. Johnson

On Fri, 2 Mar 2007, xqhuang wrote:
I want to calculate the SW(surface waves) band structure of a dispersive 
slab.I can get the rigorous result by TMM.But the result calculated by 
Meep is not consistent with the theoretical result. I don't know 
why.Attachment is the ctl file. Thanks in advance!


Meep should give the correct results.  Most likely you are misinterpreting 
the units, e.g. note that the units of k have a factor of 2pi, etcetera. 
Also, if your intention is that the structure be uniform in the x 
direction, it should have no-size in that direction -- by setting the size 
to be 0.5, you are setting an artificially large periodicity (a supercell) 
that will result in a folded band structure (which always results from a 
supercell...this is a mathematical consequence of formulating the question 
in the wrong way, and is independent of the specific computational 
method).  More than that, I can't say, since you don't give details on how 
the results are not consistent.


Cordially,
Steven G. Johnson

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


Re: [Meep-discuss] how to set the amplitude of the source according to the power

2007-03-27 Thread Steven G. Johnson

On Tue, 27 Mar 2007, ? ? wrote:
I¡¯m sorry to trouble you again. In MEEP we could not specify the power 
of the source. Rather we could specify the amplitude only. If I want to 
set a source with a power 4w, what is the amplitude of the source? Is it 
simply obtained by 4^0.5 = 2? However, it seems that the expected 
nonlinear effect could not be observed. What¡¯s wrong with it? Many 
thanks. Jack


You are thinking of this in the wrong way.

A source in Meep is a current in Maxwell's equations.  A given current 
source does *not* generate a given power.  The radiated power depends on 
the time-dependence and on the surrounding geometry --- exactly the same 
current, with exactly the same time-dependence, radiates different amounts 
of power depending on what its surroundings are.  This is a consequence of 
the physical laws, independent of Meep's computational method.


So, in a nonlinear calculation where the absolute amount of power is 
important, you need to run two calculations.  Once to calculate the amount 
of power radiated by your source with a given amplitude in the linear 
system, and then again to calculate your nonlinear effect (with either the 
amplitude adjusted to give your desired power, or your chi3 adjusted to 
give the desired index shift).


See also:

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

Cordially,
Steven G. Johnson___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] test run for thin film does not converge to analytical solutions

2007-03-27 Thread Steven G. Johnson

On Fri, 9 Mar 2007, Lu Hu wrote:

I tried to test meep by calculating reflection from a dielectric thin film.
It looks like the results never converge to the analytical solutions no
matter how fine the grids are. Could anybody point out the mistakes
for me? The ctl file and plot are attached.


It works for me.  Perhaps there is a units mixup?

For example, at your center frequency fcen = 0.20833, the analytical 
transmission and reflection through a slab of epsilon=9 with thickness d=5 
at normal incidence are T = 0.52941 and R = 0.47059, respectively.  I 
reproduce this to within 9% at a resolution of 10, and to within  1% at a 
resolution of 40.


I took your input file, and made a couple of small modifications to make 
it run more quickly.


* I commmented out the (run-until 2000) line and uncommented the 
(run-sources+ (stop-when-fields-decayed ...)) line, which is more 
appropriate here.  However, you need to change Ex to Ez in that line since 
you are using an Ez source.


* I changed the cell size to no-size along the x direction - there is no 
point in having more than 1 pixel along the x direction for a structure 
that is uniform along the x direction.


* I changed nfreq to 1 and df1 to 0 so that it only computes the flux at 
the single frequency fcen (since I just wanted one frequency as a quick 
check).


Cordially,
Steven G. Johnson

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


Re: [Meep-discuss] Re: Loading a stored field file

2007-03-27 Thread Steven G. Johnson

On Fri, 9 Mar 2007, Nicholas Smith wrote:
I actually had an application for this... In some simulations that I 
would like to run, the metal structure might change over time due to 
heat or other effects, but as far as I know meep cannot simulate a 
time-dependent structure, and so the way to do it would be to output the 
field, change the geometry incrementally, read the field in again, and 
then iterate it. I realise that edge effects might be a problem, but it 
was just an idea.


Actually, Meep can simulate time-dependent structures.  It even has 
built-in support for changing the structure continuously in time by 
interpolating between two given structures.


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] integrate-field-functions

2007-03-27 Thread Steven G. Johnson

On Sat, 10 Mar 2007, Christine Kreuzer wrote:
What are the units of the integration volume if I integrate over the 
whole computational cell? If I want to calculate the mode volume, for 
example. I use (integrate-field-function) to get the integral(eps*|E|²) 
over the whole computational cell and (max-abs-field-function) to get 
max(eps*|E|²). Dividing integral through max gives the modal volume, but 
in which units? In a³?


Yes, the units are a^3.

In general, Meep tries to give you the illusion that you are working with 
continuous functions in your chosen spatial units.  So, when you compute 
the integral, it really does an (approximate) integral over space (via a 
trapezoidal rule).


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] integrate-field-functions

2007-03-27 Thread Steven G. Johnson

On Sun, 11 Mar 2007, Mischa Megens wrote:
I thought we might try figuring out the units by making the integrand a 
constant.

Suppose our system is two dimensional, 3 furlong wide and 4 furlong high:
(set! geometry-lattice (make lattice (size 3 4)))
(set! resolution 20)
(init-fields)
(integrate-field-function '() (lambda (x) 1))
This gives 11.6094140625, or almost 3 furlong*4 furlong=12 furlong squared.
It suggests that the units of the integral are the product of the units 
specified for the cell volume.


Surprisingly, the result for the integral is not quite the same as what one 
gets by specifying the volume directly:
(integrate-field-function '() (lambda (x) 1) (volume (center 0 0) (size 3 
4)))

This gives 11.91265625 for me.
And
(integrate-field-function '() (lambda (x) 1) (volume (center 0 0) (size 100 
100)))

gives 12.
Ummm ?


Yes, there is some funkiness in how it treats the boundary pixels.  The 
default integration volume is something like the computational cell minus 
one pixel (although that would give 11.653?).  When you specify an 
integration volume larger than the cell, the behavior depends upon whether 
the cell is periodic (in which case it should integrate over the whole 
volume you requested, with the fields periodically extended as needed) or 
not (in which case the volume is truncated).


I would have to look in the code to remember exactly how the volume gets 
truncated in the non-periodic case.  Obviously, it is a little funky. 
However, in practice I don't think this should matter -- if you have a 
non-periodic cell, then normally you will have absorbing boundaries and 
the fields should go to zero at the edges anyway.  It certainly shouldn't 
affect modal-volume calculations.


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] Re: test run for thin film does not converge to analytical solutions

2007-03-27 Thread Steven G. Johnson

On Tue, 13 Mar 2007, Lu Hu wrote:
behind in the script. The script ignores the resolution and uses the 
default value 10. Now comes to a related question: at what point does 
meep start to generate the grid in a typical script , or where exactly 
should we set (set! resolution...)?


The grid gets initialized when you call one of the run functions, or 
init-fields/init-structure, or add-flux, or (meep-time) or any of the 
time-related step functions like at-every or at-time, or (restart-fields).


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


Re: [Meep-discuss] How to calculate mode volume of a cavity?

2007-03-27 Thread Steven G. Johnson

On Thu, 15 Mar 2007, hb wrote:
 I want to calculate the mode volume of a cavity. Could anyone tell 
me how to calculate it using meep?


First, you have to decide what definition of modal volume you want to use. 
For example, one definition that is relevant for the Purcell effect 
(spontaneous emission) is:


V = integral epsilon |E|^2 / max epsilon |E|^2

but this is not the relevant definition for other physical processes, e.g. 
chi3 nonlinear effects.


Second, whatever definition you use, you use Meep's 
integrate-field-function and max-abs-field-function to compute it.


For certain definitions, there may be built-in Meep functions to help you 
further.  For example, there is a built-in function electric-energy-in-box 
to compute integral epsilon |E|^2 / 2.  There are also some functions in 
the C++ interface that are available in the Scheme interface but ar enot 
documented yet in the online manual.


For example, there is a function fields::electric_energy_max_in_box to 
compute max epsilon |E|^2 / 2.  There is even a function 
fields::modal_volume_in_box that computes the volume V according to the 
above definition.  You would call it via:


(meep-fields-modal-volume-in-box fields (volume ...))

where (volume ...) is the volume in which to compute the integrals/maxima, 
e.g. (meep-fields-total-volume fields) to just use the whole computational 
volume.


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] Uniaxial material in meep

2007-03-27 Thread Steven G. Johnson
Although Meep supports anisotropic materials internally (they are required 
for its subpixel averaging technique), there is currently no interface to 
specify this externally; we are working on this.


On Sat, 10 Mar 2007, Daniel Hu wrote:

I am trying to simulate light propagation in a unixial material in meep, after
having successfully been able to do this in mpb with dielectric-anisotropic:

(define mymaterial (make dielectric-anisotropic (epsilon-diag eo ee eo)))

It doesn't seem like this material-type exists in meep, though.  I have found
that the Kerr and Pockels susceptibilities can be modeled using chi2 and chi3
properties of the dielectric material-type, but if I just want a dielectric
tensor though, that is not dependent on the magnitude of the electric field,
then how should I do this in meep?


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


Re: [Meep-discuss] about the nonlinear source

2007-03-27 Thread Steven G. Johnson

On Tue, 20 Mar 2007, ? ? wrote:
   Our group of photonic crystal has encountered a vital problem 
involving the Kerr nonlinearity.


   It seems that we could define the source only through amplitude. If 
we want to set the power of the source as 1GW/cm^2, how to define our 
source in MEEP?


See my previous response to your question, in the thread how to set the 
amplitude of the source according to the power on the mailing list.___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] incorrect reflection coeff. calculation

2007-03-27 Thread Steven G. Johnson

On Tue, 27 Mar 2007, matt wrote:

My simple meep example is coming up with an incorrect result.

I found some posts on the list regarding similar problems (incorrect 
reflection coefficient calculation), where the recommendation was to 
move the flux planes away from the source, by at least a wavelength. 
This did not solve the problem for me.


In my example, I have a 2D simulation, with periodicity in X, and PML in 
Y. The scatterer is a dielectric slab with epsilon 9.  The source is a 
plane wave source at the upper PML interface (the angle of incidence is 
30 degrees).


code:
http://www.pastebin.us/19072


This code is using a continuous-src, which is not appropriate.  You need 
to use a gaussian-src for a flux-spectrum calculation.  More generally, 
you need to use some current source that goes to zero as t - infinity.


Think about how Meep computes a flux spectrum, as described in the manual 
(see e.g. the introduction section).  It computes the Fourier transform of 
the fields in the flux plane, and then computes the flux of the 
Fourier-transformed fields.   This doesn't make (much) sense for a 
continuous-src, because the fields are not integrable---their Fourier 
transform will not converge as you run for longer and longer, because the 
source doesn't stop.  So, you end up chopping off the fields at some point 
arbitrarily.  But this windowing does different things to the 
normalization and computation runs, because the spectra are different in 
the two cases.  In contrast, if you use a Gaussian source, then the fields 
are L2-integrable and everything is well-defined and convergent if you run 
for long enough to let the fields decay away.


Steven

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