http://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&limit=250&action=history&feed=atomMeep FAQ - Revision history2024-03-28T19:36:09ZRevision history for this page on the wikiMediaWiki 1.7.3http://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4923&oldid=prevArdavan at 04:09, 22 February 20172017-02-22T04:09:03Z<p></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 04:09, 22 February 2017</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 1:</strong></td>
<td colspan="2" align="left"><strong>Line 1:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">{{Meep}}</td><td> </td><td style="background: #eee; font-size: smaller;">{{Meep}}</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">The following are frequently asked questions about Meep<span style="color: red; font-weight: bold;">. Or, at any rate, they will be, now that Meep has been released</span>.</td><td>+</td><td style="background: #cfc; font-size: smaller;">The following are frequently asked questions about Meep.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">==General==</td><td> </td><td style="background: #eee; font-size: smaller;">==General==</td></tr>
</table>
Ardavanhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4783&oldid=prevStevenj: /* Why does my simulation diverge if ε < 0? */2014-07-09T19:24:28Z<p><span class="autocomment">Why does my simulation diverge if &epsilon; &lt; 0?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 19:24, 9 July 2014</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 32:</strong></td>
<td colspan="2" align="left"><strong>Line 32:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">===Why does my simulation diverge if &epsilon; &lt; 0?===</td><td> </td><td style="background: #eee; font-size: smaller;">===Why does my simulation diverge if &epsilon; &lt; 0?===</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">Maxwell's equations have exponentially growing solutions for a frequency-independent negative &epsilon;. For any physical medium with negative &epsilon;, there must be dispersion, and you must likewise use dispersive materials in Meep to have negative &epsilon; at some desired frequency. (The requirement of dispersion to obtain negative &epsilon; follows from the Kramers–Kronig relations, and also follows from thermodynamic considerations that the energy in the electric field must be positive; see, for example, ''Electrodynamics of Continuous Media'' by Landau, Pitaevskii, and Lifshitz. At an even more <span style="color: red; font-weight: bold;">basic </span>level, it can be derived from [http://arxiv.org/abs/arXiv:1405.0238 passivity constraints].)</td><td>+</td><td style="background: #cfc; font-size: smaller;">Maxwell's equations have exponentially growing solutions for a frequency-independent negative &epsilon;. For any physical medium with negative &epsilon;, there must be dispersion, and you must likewise use dispersive materials in Meep to have negative &epsilon; at some desired frequency. (The requirement of dispersion to obtain negative &epsilon; follows from the Kramers–Kronig relations, and also follows from thermodynamic considerations that the energy in the electric field must be positive; see, for example, ''Electrodynamics of Continuous Media'' by Landau, Pitaevskii, and Lifshitz. At an even more <span style="color: red; font-weight: bold;">fundamental </span>level, it can be derived from [http://arxiv.org/abs/arXiv:1405.0238 passivity constraints].)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">If you solve Maxwell's equations in a homogenous-epsilon material at some real wavevector '''k''', you get a dispersion relation <math>\omega^2 = c^2 |\mathbf{k}|^2 / \varepsilon</math>. If &epsilon; is positive, there are two real solutions <math>\omega^2 = \pm c |\mathbf{k}| / \sqrt{\varepsilon}</math>, giving oscillating solutions. If &epsilon; is negative, there are two ''imaginary'' solutions &omega;, corresponding to exponentially decaying and ''exponentially growing solutions'' from any current source (which can always be spatially decomposed into a superposition of real-'''k''' values via a spatial Fourier transform).</td><td> </td><td style="background: #eee; font-size: smaller;">If you solve Maxwell's equations in a homogenous-epsilon material at some real wavevector '''k''', you get a dispersion relation <math>\omega^2 = c^2 |\mathbf{k}|^2 / \varepsilon</math>. If &epsilon; is positive, there are two real solutions <math>\omega^2 = \pm c |\mathbf{k}| / \sqrt{\varepsilon}</math>, giving oscillating solutions. If &epsilon; is negative, there are two ''imaginary'' solutions &omega;, corresponding to exponentially decaying and ''exponentially growing solutions'' from any current source (which can always be spatially decomposed into a superposition of real-'''k''' values via a spatial Fourier transform).</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4781&oldid=prevStevenj: /* Why does my simulation diverge if ε < 0? */2014-07-09T16:16:37Z<p><span class="autocomment">Why does my simulation diverge if &epsilon; &lt; 0?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 16:16, 9 July 2014</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 32:</strong></td>
<td colspan="2" align="left"><strong>Line 32:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">===Why does my simulation diverge if &epsilon; &lt; 0?===</td><td> </td><td style="background: #eee; font-size: smaller;">===Why does my simulation diverge if &epsilon; &lt; 0?===</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">Maxwell's equations have exponentially growing solutions for a frequency-independent negative &epsilon;. For any physical medium with negative &epsilon;, there must be dispersion, and you must likewise use dispersive materials in Meep to have negative &epsilon; at some desired frequency. (The requirement of dispersion to obtain negative &epsilon; follows from the Kramers–Kronig relations, and also follows from thermodynamic considerations that the energy in the electric field must be positive; see, for example, ''Electrodynamics of Continuous Media'' by Landau, Pitaevskii, and Lifshitz.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">Maxwell's equations have exponentially growing solutions for a frequency-independent negative &epsilon;. For any physical medium with negative &epsilon;, there must be dispersion, and you must likewise use dispersive materials in Meep to have negative &epsilon; at some desired frequency. (The requirement of dispersion to obtain negative &epsilon; follows from the Kramers–Kronig relations, and also follows from thermodynamic considerations that the energy in the electric field must be positive; see, for example, ''Electrodynamics of Continuous Media'' by Landau, Pitaevskii, and Lifshitz<span style="color: red; font-weight: bold;">. At an even more basic level, it can be derived from [http://arxiv.org/abs/arXiv:1405.0238 passivity constraints]</span>.)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">If you solve Maxwell's equations in a homogenous-epsilon material at some real wavevector '''k''', you get a dispersion relation <math>\omega^2 = c^2 |\mathbf{k}|^2 / \varepsilon</math>. If &epsilon; is positive, there are two real solutions <math>\omega^2 = \pm c |\mathbf{k}| / \sqrt{\varepsilon}</math>, giving oscillating solutions. If &epsilon; is negative, there are two ''imaginary'' solutions &omega;, corresponding to exponentially decaying and ''exponentially growing solutions'' from any current source (which can always be spatially decomposed into a superposition of real-'''k''' values via a spatial Fourier transform).</td><td> </td><td style="background: #eee; font-size: smaller;">If you solve Maxwell's equations in a homogenous-epsilon material at some real wavevector '''k''', you get a dispersion relation <math>\omega^2 = c^2 |\mathbf{k}|^2 / \varepsilon</math>. If &epsilon; is positive, there are two real solutions <math>\omega^2 = \pm c |\mathbf{k}| / \sqrt{\varepsilon}</math>, giving oscillating solutions. If &epsilon; is negative, there are two ''imaginary'' solutions &omega;, corresponding to exponentially decaying and ''exponentially growing solutions'' from any current source (which can always be spatially decomposed into a superposition of real-'''k''' values via a spatial Fourier transform).</td></tr>
<tr><td colspan="2" align="left"><strong>Line 41:</strong></td>
<td colspan="2" align="left"><strong>Line 41:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">(If you have ''both'' negative &epsilon; and negative &mu; ''everywhere'', the famous case of a negative-index material, then the simulation is fine. However at the boundary between negative- and positive-index materials, you will encounter instabilities: because of the way Maxwell's equations are discretized in FDTD, the &epsilon; and &mu; are discretized on different spatial grids, so you will get a half-pixel or so of &epsilon;&mu;&nbsp;&lt;&nbsp;0 at the boundary between negative and positive indices, which will cause the simulation to diverge. But of course, any physical negative-index metamaterial also involves dispersion.)</td><td> </td><td style="background: #eee; font-size: smaller;">(If you have ''both'' negative &epsilon; and negative &mu; ''everywhere'', the famous case of a negative-index material, then the simulation is fine. However at the boundary between negative- and positive-index materials, you will encounter instabilities: because of the way Maxwell's equations are discretized in FDTD, the &epsilon; and &mu; are discretized on different spatial grids, so you will get a half-pixel or so of &epsilon;&mu;&nbsp;&lt;&nbsp;0 at the boundary between negative and positive indices, which will cause the simulation to diverge. But of course, any physical negative-index metamaterial also involves dispersion.)</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">Note also that, as a consequence of the above analysis, &epsilon; must go to a positive value in the <math>\omega\to\pm\infty</math> limits to get non-diverging solutions of Maxwell's equations. So the <math>\epsilon_\infty</math> in your [[Materials in Meep|dispersion model]] must be positive.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4760&oldid=prevStevenj: /* How does the current amplitude relate to the resulting field amplitude? */2014-04-03T14:09:34Z<p><span class="autocomment">How does the current amplitude relate to the resulting field amplitude?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 14:09, 3 April 2014</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 20:</strong></td>
<td colspan="2" align="left"><strong>Line 20:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">===How does the current amplitude relate to the resulting field amplitude?===</td><td> </td><td style="background: #eee; font-size: smaller;">===How does the current amplitude relate to the resulting field amplitude?===</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">There is no simple formula relating the input current amplitude ('''J''' in Maxwell's equations) to the resulting fields ('''E''') etcetera, even at the same point as the current. The exact same current will produce a different field (and radiate a different total power) depending upon the surrounding materials/geometry, and depending on the frequency. (This is a physical consequence of the geometry's effect on the local density of states; it can also be thought of as feedback from reflections on the source. As a simple example, if you put a current source inside a perfect electric conductor, the resulting field will be zero. As another example, the frequency-dependence of the radiated power in vacuum is part of the reason why the sky is blue.)</td><td> </td><td style="background: #eee; font-size: smaller;">There is no simple formula relating the input current amplitude ('''J''' in Maxwell's equations) to the resulting fields ('''E''') etcetera, even at the same point as the current. The exact same current will produce a different field (and radiate a different total power) depending upon the surrounding materials/geometry, and depending on the frequency. (This is a physical consequence of the geometry's effect on the local density of states; it can also be thought of as feedback from reflections on the source. As a simple example, if you put a current source inside a perfect electric conductor, the resulting field will be zero. As another example, the frequency-dependence of the radiated power in vacuum is part of the reason why the sky is blue.)</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">See also our online book chapter on [http://arxiv.org/abs/arXiv:1301.5366 Wave source conditions].</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">If you are worried about this, then you are probably setting up your calculation in the wrong way. Especially in linear materials, the absolute magnitude of the field is useless; the only meaningful quantities are dimensionless ratios like the fractional transmission (the transmitted power relative to the transmitted power in some reference calculation). Almost always, you want to perform two calculations, one of which is a reference, and compute the ratio of a result in one calculation to the result in the reference. For nonlinear calculations, see [[Units and nonlinearity in Meep]].</td><td> </td><td style="background: #eee; font-size: smaller;">If you are worried about this, then you are probably setting up your calculation in the wrong way. Especially in linear materials, the absolute magnitude of the field is useless; the only meaningful quantities are dimensionless ratios like the fractional transmission (the transmitted power relative to the transmitted power in some reference calculation). Almost always, you want to perform two calculations, one of which is a reference, and compute the ratio of a result in one calculation to the result in the reference. For nonlinear calculations, see [[Units and nonlinearity in Meep]].</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4321&oldid=prevStevenj: /* Why doesn't turning off subpixel averaging work? */2010-09-09T18:11:29Z<p><span class="autocomment">Why doesn't turning off subpixel averaging work?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 18:11, 9 September 2010</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 44:</strong></td>
<td colspan="2" align="left"><strong>Line 44:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the ''discontinuous'' case) to do the simulation with the subpixel-averaged (''smoothed'') &epsilon;, as long as the averaging is done properly. (See [[Citing Meep|our papers]] for more information.)</td><td> </td><td style="background: #eee; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the ''discontinuous'' case) to do the simulation with the subpixel-averaged (''smoothed'') &epsilon;, as long as the averaging is done properly. (See [[Citing Meep|our papers]] for more information.)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">Still, there are <span style="color: red; font-weight: bold;">cases that</span>, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td><td>+</td><td style="background: #cfc; font-size: smaller;">Still, there are <span style="color: red; font-weight: bold;">times when</span>, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Even if you disable the subpixel averaging, however, when you output the dielectric function to a file and plot it, you may notice that there are some pixels with intermediate &epsilon; values, right at the boundary between two materials. This has a completely different source. Internally, Meep's simulation is performed on a [[Yee grid]], in which every field component is stored on a slightly different grid (offset from one another by half-pixels), and the &epsilon; values are also stored on this Yee grid. For output purposes, however, it is more user-friendly to output all fields etcetera on the same grid (the center of each pixel), so all quantities are interpolated onto this grid for output. Therefore, even though the internal &epsilon; values are indeed discontinuous when you disable subpixel averaging, the ''output'' file will still contain some "averaged" values at interfaces due to the interpolation from the Yee grid to the center-pixel grid.</td><td> </td><td style="background: #eee; font-size: smaller;">Even if you disable the subpixel averaging, however, when you output the dielectric function to a file and plot it, you may notice that there are some pixels with intermediate &epsilon; values, right at the boundary between two materials. This has a completely different source. Internally, Meep's simulation is performed on a [[Yee grid]], in which every field component is stored on a slightly different grid (offset from one another by half-pixels), and the &epsilon; values are also stored on this Yee grid. For output purposes, however, it is more user-friendly to output all fields etcetera on the same grid (the center of each pixel), so all quantities are interpolated onto this grid for output. Therefore, even though the internal &epsilon; values are indeed discontinuous when you disable subpixel averaging, the ''output'' file will still contain some "averaged" values at interfaces due to the interpolation from the Yee grid to the center-pixel grid.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Meep]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Meep]]</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4320&oldid=prevStevenj: /* Why doesn't turning off subpixel averaging work? */2010-09-09T18:11:07Z<p><span class="autocomment">Why doesn't turning off subpixel averaging work?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 18:11, 9 September 2010</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 42:</strong></td>
<td colspan="2" align="left"><strong>Line 42:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">===Why doesn't turning off subpixel averaging work?===</td><td> </td><td style="background: #eee; font-size: smaller;">===Why doesn't turning off subpixel averaging work?===</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the ''discontinuous'' case) to do the simulation with the subpixel-averaged (''smoothed'') &epsilon;. (See [[Citing Meep|our papers]] for more information.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the ''discontinuous'' case) to do the simulation with the subpixel-averaged (''smoothed'') &epsilon;<span style="color: red; font-weight: bold;">, as long as the averaging is done properly</span>. (See [[Citing Meep|our papers]] for more information.)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Still, there are cases that, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td><td> </td><td style="background: #eee; font-size: smaller;">Still, there are cases that, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4319&oldid=prevStevenj: /* Why doesn't turning off subpixel averaging work? */2010-09-09T18:10:30Z<p><span class="autocomment">Why doesn't turning off subpixel averaging work?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 18:10, 9 September 2010</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 42:</strong></td>
<td colspan="2" align="left"><strong>Line 42:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">===Why doesn't turning off subpixel averaging work?===</td><td> </td><td style="background: #eee; font-size: smaller;">===Why doesn't turning off subpixel averaging work?===</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the discontinuous case) to do the simulation with the subpixel-averaged &epsilon;. (See [[Citing Meep|our papers]] for more information.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the <span style="color: red; font-weight: bold;">''</span>discontinuous<span style="color: red; font-weight: bold;">'' </span>case) to do the simulation with the subpixel-averaged <span style="color: red; font-weight: bold;">(''smoothed'') </span>&epsilon;. (See [[Citing Meep|our papers]] for more information.)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Still, there are cases that, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td><td> </td><td style="background: #eee; font-size: smaller;">Still, there are cases that, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4318&oldid=prevStevenj: /* Why doesn't turning off subpixel averaging work? */2010-09-09T18:10:06Z<p><span class="autocomment">Why doesn't turning off subpixel averaging work?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 18:10, 9 September 2010</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 42:</strong></td>
<td colspan="2" align="left"><strong>Line 42:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">===Why doesn't turning off subpixel averaging work?===</td><td> </td><td style="background: #eee; font-size: smaller;">===Why doesn't turning off subpixel averaging work?===</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the discontinuous case) to do the simulation with the subpixel-averaged &epsilon;. (See our papers for more information.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the discontinuous case) to do the simulation with the subpixel-averaged &epsilon;. (See <span style="color: red; font-weight: bold;">[[Citing Meep|</span>our papers<span style="color: red; font-weight: bold;">]] </span>for more information.)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Still, there are cases that, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td><td> </td><td style="background: #eee; font-size: smaller;">Still, there are cases that, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=4316&oldid=prevStevenj: /* Usage */2010-09-09T18:08:12Z<p><span class="autocomment">Usage</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 18:08, 9 September 2010</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 41:</strong></td>
<td colspan="2" align="left"><strong>Line 41:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td><td> </td><td style="background: #eee; font-size: smaller;">==Usage==</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">===Why doesn't turning off subpixel averaging work?===</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">By default, when Meep assigns a dielectric constant &epsilon; (or &mu;) to each "pixel", it uses a carefully designed average of the &epsilon; values within that pixel. This subpixel averaging generally improves the accuracy of the simulation&mdash;perhaps counter-intuitively, for geometries with discontinous &epsilon; it is ''more'' accurate (i.e. closer to the exact Maxwell result for the discontinuous case) to do the simulation with the subpixel-averaged &epsilon;. (See our papers for more information.)</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">Still, there are cases that, for whatever reason, you might not want this feature. (For example, if your accuracy is limited by other issues, or if you want to skip the wait at the beginning of the simulation for it do to the averaging.) In this case, you can disable the subpixel averaging by doing <code>(set! eps-averaging? false)</code> in your control file (see the [[Meep Reference]]).</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">Even if you disable the subpixel averaging, however, when you output the dielectric function to a file and plot it, you may notice that there are some pixels with intermediate &epsilon; values, right at the boundary between two materials. This has a completely different source. Internally, Meep's simulation is performed on a [[Yee grid]], in which every field component is stored on a slightly different grid (offset from one another by half-pixels), and the &epsilon; values are also stored on this Yee grid. For output purposes, however, it is more user-friendly to output all fields etcetera on the same grid (the center of each pixel), so all quantities are interpolated onto this grid for output. Therefore, even though the internal &epsilon; values are indeed discontinuous when you disable subpixel averaging, the ''output'' file will still contain some "averaged" values at interfaces due to the interpolation from the Yee grid to the center-pixel grid.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Meep]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Meep]]</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_FAQ&diff=3924&oldid=prevStevenj: /* Why does my simulation diverge if ε < 0? */2010-02-15T19:06:20Z<p><span class="autocomment">Why does my simulation diverge if &epsilon; &lt; 0?</span></p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 19:06, 15 February 2010</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 30:</strong></td>
<td colspan="2" align="left"><strong>Line 30:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">===Why does my simulation diverge if &epsilon; &lt; 0?===</td><td> </td><td style="background: #eee; font-size: smaller;">===Why does my simulation diverge if &epsilon; &lt; 0?===</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">Maxwell's equations <span style="color: red; font-weight: bold;">are unstable </span>for a frequency-independent negative &epsilon;. For any physical medium with negative &epsilon;, there must be dispersion, and you must likewise use dispersive materials in Meep to have negative &epsilon; at some desired frequency. (The requirement of dispersion to obtain negative &epsilon; follows from the Kramers–Kronig relations, and also follows from thermodynamic considerations that the energy in the electric field must be positive; see, for example, ''Electrodynamics of Continuous Media'' by Landau, Pitaevskii, and Lifshitz.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">Maxwell's equations <span style="color: red; font-weight: bold;">have exponentially growing solutions </span>for a frequency-independent negative &epsilon;. For any physical medium with negative &epsilon;, there must be dispersion, and you must likewise use dispersive materials in Meep to have negative &epsilon; at some desired frequency. (The requirement of dispersion to obtain negative &epsilon; follows from the Kramers–Kronig relations, and also follows from thermodynamic considerations that the energy in the electric field must be positive; see, for example, ''Electrodynamics of Continuous Media'' by Landau, Pitaevskii, and Lifshitz.)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">If you solve Maxwell's equations in a homogenous-epsilon material at some real wavevector '''k''', you get a dispersion relation <math>\omega^2 = c^2 |\mathbf{k}|^2 / \varepsilon</math>. If &epsilon; is positive, there are two real solutions <math>\omega^2 = \pm c |\mathbf{k}| / \sqrt{\varepsilon}</math>, giving oscillating solutions. If &epsilon; is negative, there are two ''imaginary'' solutions &omega;, corresponding to exponentially decaying and ''exponentially growing solutions'' from any current source (which can always be spatially decomposed into a superposition of real-'''k''' values via a spatial Fourier transform).</td><td> </td><td style="background: #eee; font-size: smaller;">If you solve Maxwell's equations in a homogenous-epsilon material at some real wavevector '''k''', you get a dispersion relation <math>\omega^2 = c^2 |\mathbf{k}|^2 / \varepsilon</math>. If &epsilon; is positive, there are two real solutions <math>\omega^2 = \pm c |\mathbf{k}| / \sqrt{\varepsilon}</math>, giving oscillating solutions. If &epsilon; is negative, there are two ''imaginary'' solutions &omega;, corresponding to exponentially decaying and ''exponentially growing solutions'' from any current source (which can always be spatially decomposed into a superposition of real-'''k''' values via a spatial Fourier transform).</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">If you do a simulation of any kind in the time domain (not just FDTD), you pretty much can't avoid exciting both the decaying and the growing solutions.</td><td>+</td><td style="background: #cfc; font-size: smaller;">If you do a simulation of any kind in the time domain (not just FDTD), you pretty much can't avoid exciting both the decaying and the growing solutions<span style="color: red; font-weight: bold;">. This is ''not'' a numerical instability, it is a real solution of the underlying equations (for an unphysical material)</span>.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">See [[Materials in Meep]] for how to include dispersive materials (which can have negative &epsilon; and loss) in Meep.</td><td> </td><td style="background: #eee; font-size: smaller;">See [[Materials in Meep]] for how to include dispersive materials (which can have negative &epsilon; and loss) in Meep.</td></tr>
</table>
Stevenj