Re: [Meep-discuss] incorrect reflection coeff. calculation
I found the problem. It's pretty embarassing, and it took me much too long to track, but what happened was that I swapped the transmitted and reflected flux regions. If you fix that, you can calculate scattering properties for a range of frequencies rather quickly and reliably (at least for incidence angles which are not too shallow). Thanks again for all the support! Meep rocks. Kind Regards, Matt Dear Matt, I think I have now the same problem. I did not quite catch form the e-mail above what kind of solution you have found. Could you please explain that in mode details? Thanks, Ruslan ___ 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
I found the problem. It's pretty embarassing, and it took me much too long to track, but what happened was that I swapped the transmitted and reflected flux regions. If you fix that, you can calculate scattering properties for a range of frequencies rather quickly and reliably (at least for incidence angles which are not too shallow). Thanks again for all the support! Meep rocks. Kind Regards, Matt Dear Matt, I think I have now the same problem. I did not quite catch form the e-mail above what kind of solution you have found. Could you please explain that in mode details? Thanks, Ruslan ___ 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
On Wed, 28 Mar 2007, matt wrote: My trouble with this is that it isn't compatible with the periodic plane wave excitation: I can create a planewave with oblique incidence and periodic boundaries, but only if the source is very narrowband (df is small). A large df doesn't work because the periodic boundaries are frequency specific. For a gaussian source, a small df practically makes it a continuous source, producing the same results. No, that's not true. A small-df Gaussian is still a Gaussian. It still goes to zero at both the beginning and end of the simulation, unlike a CW source. Note that, however, you would want to use stop-when-decayed to wait until the fields die away, rather than running for a fixed time. Moreover, a Gaussian is in some sense the optimal shape if you want to maximize localization in both frequency and time. However, it's still better to use a short pulse, as described below. The reason you'd want this is to be able to calculate the scattering properties for a particular angle of incidence. Your reasoning is incorrect here. Assuming you have linear materials, you should get the same results if you put in a narrow-band Gaussian and look at only one frequency component of the Fourier transform, or put in a broad-band Gaussian and look at only one frequency component of the Fourier transform. The latter has the advantage that it requires a shorter simulation for the fields to die away. Morever, if you want the scattering properties as function of both frequency and angle, then the short pulses have a further advantage. Each simulation with a short pulse and fixed k gives you a broad spectrum result, each frequency of which corresponds to a different angle. Then you repeat the simulation for a range of k's, and at the end you'll have a 2d dataset of transmission/reflection vs. both frequency and angle. 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] incorrect reflection coeff. calculation
Hi Steve, I think your response to Matt demands a follow up. Matt's problem (as well as ours) involves periodic boundaries. In our simulations we clearly see that a periodically continued line source only produces a plane wave (CW) without artifacts for specific combinations of wavelength and k vector. These coincide very well with what we would naively expect from periodic boundaries, i.e. sin(prop. angle) = n lambda/period. To us this is an indication that the periodic BC are implemented without correcting for phase mismatch at the boundaries in order to compensate for this problem, and we are unaware of any way to invoke such a correction. As a consequence we do not expect the suggested approach (repeat for all angles: short pulse propagation - Fourier analysis) to work correctly, since only a discrete set of frequencies for each angle (or k) produces correct results. Anything we are missing here? Thanks, Markus Steven G. Johnson wrote: On Wed, 28 Mar 2007, matt wrote: My trouble with this is that it isn't compatible with the periodic plane wave excitation: I can create a planewave with oblique incidence and periodic boundaries, but only if the source is very narrowband (df is small). A large df doesn't work because the periodic boundaries are frequency specific. For a gaussian source, a small df practically makes it a continuous source, producing the same results. No, that's not true. A small-df Gaussian is still a Gaussian. It still goes to zero at both the beginning and end of the simulation, unlike a CW source. Note that, however, you would want to use stop-when-decayed to wait until the fields die away, rather than running for a fixed time. Moreover, a Gaussian is in some sense the optimal shape if you want to maximize localization in both frequency and time. However, it's still better to use a short pulse, as described below. The reason you'd want this is to be able to calculate the scattering properties for a particular angle of incidence. Your reasoning is incorrect here. Assuming you have linear materials, you should get the same results if you put in a narrow-band Gaussian and look at only one frequency component of the Fourier transform, or put in a broad-band Gaussian and look at only one frequency component of the Fourier transform. The latter has the advantage that it requires a shorter simulation for the fields to die away. Morever, if you want the scattering properties as function of both frequency and angle, then the short pulses have a further advantage. Each simulation with a short pulse and fixed k gives you a broad spectrum result, each frequency of which corresponds to a different angle. Then you repeat the simulation for a range of k's, and at the end you'll have a 2d dataset of transmission/reflection vs. both frequency and angle. Steven ___ 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
Re: [Meep-discuss] incorrect reflection coeff. calculation
On Wed, 28 Mar 2007, Steven G. Johnson wrote: If you want to see the *field* pattern for a given angle, then you need a narrowband (CW) source. But if you want the *flux* from a given angle, then you can put in a broadband source and only take that frequency component of the Fourier transform. Let me make a caveat to the above statement. The above assumes that if you input a field at multiple angles, then the scattered power is the sum of the scattered power from each angle individually. This is true only if the structure you are scattering from has translational symmetry in the x direction (parallel to the source plane)---it can be periodic, but in this case your frequency must be below the diffraction cutoff. This was the picture I had in my head, but it occurs to me that this may not be what you are simulating. If you have a non-periodic structure in the x direction, or care about frequencies above the diffraction cutoff, then different input angles can scatter into the same output angle and there can be interference. In this case, the power does not simply sum. In that case, you really must put in a narrowband source (I think, unless there is some additional trick that is not occurring to me now). However, you should still put in a narrowband Gaussian, and wait for it to decay to zero, rather than putting in a CW field. Or, if you really want to use a CW field, then you should use the flux-in-box function (which is integrated in space not time), not the flux spectrum (which is integrated in time and space and is problematic if your fields don't go to zero by the end of the simulation). 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] incorrect reflection coeff. calculation
On Wed, 28 Mar 2007, Steven G. Johnson wrote: If you have a non-periodic structure in the x direction, or care about frequencies above the diffraction cutoff, then different input angles can scatter into the same output angle and there can be interference. In this case, the power does not simply sum. No, I take that back. My previous post was correct. The point is that the different angles correspond to different frequencies, so when you take a single Fourier component of the scattered field you really are looking at just a single angle. In that case, you really must put in a narrowband source (I think, unless there is some additional trick that is not occurring to me now). However, you I take this back. Just put in a short pulse and you are fine, as I first said. (Sorry, I've managed to confuse myself now.) 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] incorrect reflection coeff. calculation
On Wed, 28 Mar 2007, Markus Testorf wrote: I think your response to Matt demands a follow up. Matt's problem (as well as ours) involves periodic boundaries. In our simulations we clearly see that a periodically continued line source only produces a plane wave (CW) without artifacts for specific combinations of wavelength and k vector. These coincide very well with what we would naively expect from periodic boundaries, i.e. sin(prop. angle) = n lambda/period. To us this is an indication that the periodic BC are implemented without correcting for phase mismatch at the boundaries in order to compensate for this problem, and we are unaware of any way to invoke such a correction. Each frequency component produces a plane wave at a specific angle, with a different angle for each frequency component. Therefore if you put in a pulse, you get a superposition of waves from each frequency angle, and the field will look like a mess. However, if you were to take a Fourier transform of the field in time, each Fourier component would again be a nice wave at one angle. This is precisely what the flux-spectrum feature in Meep does. It takes the Fourier transform of the fields in time, and then computes the flux of the Fourier components. So the flux at each frequency corresponds to a source at a well-defined angle. Steven ___ 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
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] incorrect reflection coeff. calculation
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