Re: [Meep-discuss] frequency scaling in reflection spectrum

2009-02-06 Thread Steven G. Johnson
The Meep reflection spectrum is Fourier transforming the fields using  
exactly the formula given in the Meep Introduction (see the section  
transmission/reflection spectra).  No tricks.  Maybe try evaluating  
this formula manually in Matlab in case you aren't using the fft()  
function correctly?


On Feb 6, 2009, at 4:11 PM, matt wrote:




 No no,  it's not that simple.  it's much smaller than 2pi.  have a  
 look at this image:

 http://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg02384/e2.png

 The inverted-peak in the spectrum is at 300 THz (blue curve), but  
 the fft shows it at about 330 THz (black curve).

 The excitation is a gaussian with start frequency 195 THZ and stop  
 frequency 330THz.





 On Fri, 6 Feb 2009, Steven G. Johnson wrote:


 On Feb 6, 2009, at 6:55 AM, matt wrote:
 In meep, if you generate a broadband pulse, an fft of the field  
 data will show that the pulse is at a higher frequency than what  
 you defined in the source.

 That just means you are interpreting the frequency units wrong  
 (either in Meep or in the FFT).  Possibly you are forgetting about  
 a factor of 2pi?


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


Re: [Meep-discuss] frequency scaling in reflection spectrum

2009-02-05 Thread matt




One thing I'm having trouble understanding is why this frequency scaling 
isn't visible in the libctl transmission coefficient output.

Is there something special the meep flux computation does to repair the 
frequency scaling caused by the gaussian-derivative source?

Kind Regards,
Matt




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


Re: [Meep-discuss] frequency scaling in reflection spectrum

2009-02-05 Thread Steven G. Johnson
On Feb 5, 2009, at 4:11 AM, matt wrote:
 One thing I'm having trouble understanding is why this frequency  
 scaling
 isn't visible in the libctl transmission coefficient output.

 Is there something special the meep flux computation does to repair  
 the
 frequency scaling caused by the gaussian-derivative source?

What frequency scaling are you talking about?


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


[Meep-discuss] frequency scaling in reflection spectrum

2009-01-29 Thread matt




Hello,

To compute transmission spectra, I recently tried two approaches that 
came to two different results.


The first approach is the standard way using flux planes as given in the 
meep examples on the webpage.


In the second approach, I store the time data for points in a plane in 
front of the scatterer.  I also do the same for a free space simulation. 
Then, using MATLAB, I analyze the transforms of the time data as 
follows:


- Matlab snippet
fstart = 195 * 1e12 / 3e8 / 1e6; % convert to meep units
fstop = 330  * 1e12 / 3e8 / 1e6; % convert to meep units
fcen = (fstart + fstop)/2;
samplerate = 1/fcen/50;  % field sampled at this rate in at-every

dt = samplerate*1e-6/3e8;% convert time back into physical units

% the following data comes from h5 files outputted by meep
EN = fft(noscat_ez); % Ez values along plane without scatterer
ES = fft(scat_ez);   % Ez values along plane with scatterer
HN = fft(noscat_hx); % Hx values along plane without scatterer
HS = fft(scat_hx);   % Hx values along plane with scatterer

POWS = real( sum(conj(ES - EN) .* (HS - HN) , 2)); % Scattered power
POWN = real( sum(conj(EN) .* HN , 2)); % Incident power
POW  = POWS ./ POWN;   % Reflectivity

f = (1/dt)/2*linspace(0,1,length(ES)/2+1);

plot(f,-POW(1:floor(length(POW)/2+1)),'k');
-


The attached plot shows a comparison of the two reflection spectra. 
There is an strong frequency shifting/scaling present.  This is 
unrelated to the resolution of the simulation.


This may be related to a previous unresolved discussion:
http://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg02073.html
http://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg00456.html


Previously Prof. Johnson wrote

When the pulse is this wide (in frequency), you can observe a 
computational detail: Meep's Gaussian pulse is not actually precisely a 
Guassian, it is the derivative of a Gaussian (this ensures that there is 
no net charge left in the computational cell after the pulse is gone, 
which prevents divergences in some cases with periodic boundaries). The 
difference between the two is small except for very broad Gaussians in 
frequency (short pulses in time).


Because the main reason to use a short pulse is to get a broad-spectrum 
response, and you have to normalize such a response by the input 
spectrum anyway as explained in the manual, the exact shape of the 
spectrum shouldn't actually matter.


As we can see in my example above, the normalization doesn't cure the 
problems caused by a shifting in the spectra (at least not in my matlab 
processing of the time data).


I'm not sure if this is a bug in meep or if there's something I don't 
understand in the processing of the time data.


Best Regards,
Matt




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