http://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&limit=500&action=history&feed=atomMeep Reference - Revision history2024-03-29T10:53:44ZRevision history for this page on the wikiMediaWiki 1.7.3http://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4865&oldid=prevArdavan: /* pml */2016-08-25T06:07:45Z<p><span class="autocomment">pml</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 06:07, 25 August 2016</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 288:</strong></td>
<td colspan="2" align="left"><strong>Line 288:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:: A strength (default is <code>1.0</code>) to multiply the PML absorption coefficient by. A strength of <code>2.0</code> will ''square'' the theoretical asymptotic reflection coefficient of the PML (making it smaller), but will also increase numerical reflections. Alternatively, you can change <code>R-asymptotic</code>, below.</td><td> </td><td style="background: #eee; font-size: smaller;">:: A strength (default is <code>1.0</code>) to multiply the PML absorption coefficient by. A strength of <code>2.0</code> will ''square'' the theoretical asymptotic reflection coefficient of the PML (making it smaller), but will also increase numerical reflections. Alternatively, you can change <code>R-asymptotic</code>, below.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:; <code>R-asymptotic</code> [<code>number</code>]</td><td> </td><td style="background: #eee; font-size: smaller;">:; <code>R-asymptotic</code> [<code>number</code>]</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">::The asymptotic reflection in the limit of infinite resolution or infinite PML thickness, for refections from air (an upper bound for other media with index &gt; 1). (For a finite resolution or thickness, the reflection will be ''much larger'', due to the discretization of Maxwell's equation.) The default value is 10<sup>&minus;15</sup>, which should <span style="color: red; font-weight: bold;">be </span>suffice for most purposes. (You want to set this to be small enough so that waves propagating within the PML are attenuated sufficiently, but making <code>R-asymptotic</code> too small will increase the numerical reflection due to discretization.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">::The asymptotic reflection in the limit of infinite resolution or infinite PML thickness, for refections from air (an upper bound for other media with index &gt; 1). (For a finite resolution or thickness, the reflection will be ''much larger'', due to the discretization of Maxwell's equation.) The default value is 10<sup>&minus;15</sup>, which should suffice for most purposes. (You want to set this to be small enough so that waves propagating within the PML are attenuated sufficiently, but making <code>R-asymptotic</code> too small will increase the numerical reflection due to discretization.)</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:; <code>pml-profile</code> [<code>function</code>]</td><td> </td><td style="background: #eee; font-size: smaller;">:; <code>pml-profile</code> [<code>function</code>]</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:: By default, Meep turns on the PML conductivity quadratically within the PML layer&mdash;one doesn't want to turn it on suddenly, because that exacerbates reflections due to the discretization. More generally, with <code>pml-profile</code> one can specify an arbitrary PML "profile" function ''f''(''u'') that determines the shape of the PML absorption profile up to an overall constant factor. ''u'' goes from 0 to 1 at the start and end of the PML, and the default is ''f''(''u'')=''u''<sup>2</sup>. In some cases where a very thick PML is required, such as in a periodic medium (where there is technically no such thing as a true PML, only a pseudo-PML), it can be advantageous to turn on the PML absorption more smoothly (see [http://www.opticsinfobase.org/abstract.cfm?URI=oe-16-15-11376 Oskooi et al., 2008]). For example, one can use a cubic profile ''f''(''u'')=''u''<sup>3</sup> by specifying <code>(pml-profile (lambda (u) (* u u u)))</code>.</td><td> </td><td style="background: #eee; font-size: smaller;">:: By default, Meep turns on the PML conductivity quadratically within the PML layer&mdash;one doesn't want to turn it on suddenly, because that exacerbates reflections due to the discretization. More generally, with <code>pml-profile</code> one can specify an arbitrary PML "profile" function ''f''(''u'') that determines the shape of the PML absorption profile up to an overall constant factor. ''u'' goes from 0 to 1 at the start and end of the PML, and the default is ''f''(''u'')=''u''<sup>2</sup>. In some cases where a very thick PML is required, such as in a periodic medium (where there is technically no such thing as a true PML, only a pseudo-PML), it can be advantageous to turn on the PML absorption more smoothly (see [http://www.opticsinfobase.org/abstract.cfm?URI=oe-16-15-11376 Oskooi et al., 2008]). For example, one can use a cubic profile ''f''(''u'')=''u''<sup>3</sup> by specifying <code>(pml-profile (lambda (u) (* u u u)))</code>.</td></tr>
</table>
Ardavanhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4864&oldid=prevArdavan: /* pml */2016-08-25T06:05:41Z<p><span class="autocomment">pml</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 06:05, 25 August 2016</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 278:</strong></td>
<td colspan="2" align="left"><strong>Line 278:</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;">; <code>pml</code></td><td> </td><td style="background: #eee; font-size: smaller;">; <code>pml</code></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">: A single PML layer specification, which sets up one or more PML layers around the boundaries according to the following <span style="color: red; font-weight: bold;">four </span>properties.</td><td>+</td><td style="background: #cfc; font-size: smaller;">: A single PML layer specification, which sets up one or more PML layers around the boundaries according to the following properties.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:; <code>thickness</code> [<code>number</code>]</td><td> </td><td style="background: #eee; font-size: smaller;">:; <code>thickness</code> [<code>number</code>]</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:: The spatial thickness of the PML layer (which extends from the boundary towards the ''inside'' of the computational cell). The thinner it is, the more numerical reflections become a problem. No default value.</td><td> </td><td style="background: #eee; font-size: smaller;">:: The spatial thickness of the PML layer (which extends from the boundary towards the ''inside'' of the computational cell). The thinner it is, the more numerical reflections become a problem. No default value.</td></tr>
</table>
Ardavanhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4858&oldid=prevArdavan: /* Output file names */2016-07-14T06:09:09Z<p><span class="autocomment">Output file names</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 06:09, 14 July 2016</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 432:</strong></td>
<td colspan="2" align="left"><strong>Line 432:</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;">;<code>(use-output-directory [dirname])</code></td><td> </td><td style="background: #eee; font-size: smaller;">;<code>(use-output-directory [dirname])</code></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">:Put output in a subdirectory, which is created if necessary. If the optional argument dirname is specified, <span style="color: red; font-weight: bold;">that </span>that is the name of the directory. Otherwise, the directory name is the current ctl file name with <code>".ctl"</code> replaced by <code>"-out"</code>: e.g. <code>tst.ctl</code> implies a directory of <code>"tst-out"</code>.</td><td>+</td><td style="background: #cfc; font-size: smaller;">:Put output in a subdirectory, which is created if necessary. If the optional argument dirname is specified, that is the name of the directory. Otherwise, the directory name is the current ctl file name with <code>".ctl"</code> replaced by <code>"-out"</code>: e.g. <code>tst.ctl</code> implies a directory of <code>"tst-out"</code>.</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;">=== Misc. ===</td><td> </td><td style="background: #eee; font-size: smaller;">=== Misc. ===</td></tr>
</table>
Ardavanhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4830&oldid=prevArdavan: /* Near-to-far-field spectra */2015-04-14T06:14:53Z<p><span class="autocomment">Near-to-far-field spectra</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 06:14, 14 April 2015</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 613:</strong></td>
<td colspan="2" align="left"><strong>Line 613:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">=== Near-to-far-field spectra ===</td><td> </td><td style="background: #eee; font-size: smaller;">=== Near-to-far-field spectra ===</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;">Meep (1.3 or later) can compute a "near-to-far-field transformation" in the frequency domain: given the fields on a "near" bounding surface inside the computational cell, it can compute the fields arbitrarily far away using an analytical transformation, assuming that the "near" surface and the "far" region lie in a single homogeneous non-periodic 2d or 3d region. That is, in a simulation ''surrounded by PML'' that absorbs outgoing waves, the near-to-far-field feature can compute the fields outside the computational cell ''as if'' the outgoing waves had not been absorbed (i.e. in the fictitious infinite open volume). Moreover, this operation is performed on the Fourier-transformed fields: like the flux and force spectra above, you specify a set of desired frequencies, Meep accumulates the Fourier transforms, and then Meep computes the fields at ''each frequency'' for the desired far-field points.</td><td>+</td><td style="background: #cfc; font-size: smaller;">Meep (1.3 or later) can compute a "near-to-far-field transformation" in the frequency domain <span style="color: red; font-weight: bold;">as described in this [[Meep Tutorial/Near-to-far-field_spectra|tutorial]]</span>: given the fields on a "near" bounding surface inside the computational cell, it can compute the fields arbitrarily far away using an analytical transformation, assuming that the "near" surface and the "far" region lie in a single homogeneous non-periodic 2d or 3d region. That is, in a simulation ''surrounded by PML'' that absorbs outgoing waves, the near-to-far-field feature can compute the fields outside the computational cell ''as if'' the outgoing waves had not been absorbed (i.e. in the fictitious infinite open volume). Moreover, this operation is performed on the Fourier-transformed fields: like the flux and force spectra above, you specify a set of desired frequencies, Meep accumulates the Fourier transforms, and then Meep computes the fields at ''each frequency'' for the desired far-field points.</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;">(This is based on the [http://arxiv.org/abs/1301.5366 principle of equivalence] — given the Fourier-transformed tangential fields on the "near" surface, Meep computes equivalent currents and convolves them with the analytical Green's functions in order to compute the fields at any desired point in the "far" region.)</td><td> </td><td style="background: #eee; font-size: smaller;">(This is based on the [http://arxiv.org/abs/1301.5366 principle of equivalence] — given the Fourier-transformed tangential fields on the "near" surface, Meep computes equivalent currents and convolves them with the analytical Green's functions in order to compute the fields at any desired point in the "far" region.)</td></tr>
</table>
Ardavanhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4809&oldid=prevArdavan: /* Near-to-far-field spectra */2015-03-31T18:12:16Z<p><span class="autocomment">Near-to-far-field spectra</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:12, 31 March 2015</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 615:</strong></td>
<td colspan="2" align="left"><strong>Line 615:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Meep (1.3 or later) can compute a "near-to-far-field transformation" in the frequency domain: given the fields on a "near" bounding surface inside the computational cell, it can compute the fields arbitrarily far away using an analytical transformation, assuming that the "near" surface and the "far" region lie in a single homogeneous non-periodic 2d or 3d region. That is, in a simulation ''surrounded by PML'' that absorbs outgoing waves, the near-to-far-field feature can compute the fields outside the computational cell ''as if'' the outgoing waves had not been absorbed (i.e. in the fictitious infinite open volume). Moreover, this operation is performed on the Fourier-transformed fields: like the flux and force spectra above, you specify a set of desired frequencies, Meep accumulates the Fourier transforms, and then Meep computes the fields at ''each frequency'' for the desired far-field points.</td><td> </td><td style="background: #eee; font-size: smaller;">Meep (1.3 or later) can compute a "near-to-far-field transformation" in the frequency domain: given the fields on a "near" bounding surface inside the computational cell, it can compute the fields arbitrarily far away using an analytical transformation, assuming that the "near" surface and the "far" region lie in a single homogeneous non-periodic 2d or 3d region. That is, in a simulation ''surrounded by PML'' that absorbs outgoing waves, the near-to-far-field feature can compute the fields outside the computational cell ''as if'' the outgoing waves had not been absorbed (i.e. in the fictitious infinite open volume). Moreover, this operation is performed on the Fourier-transformed fields: like the flux and force spectra above, you specify a set of desired frequencies, Meep accumulates the Fourier transforms, and then Meep computes the fields at ''each frequency'' for the desired far-field points.</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;">(This is based on the [http://arxiv.org/abs/1301.5366 principle of equivalence] — given the Fourier-transformed tangential fields on the "near" surface, Meep computes equivalent currents and convolves them with the analytical Green's functions in order to compute the fields any desired point in the "far" region.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">(This is based on the [http://arxiv.org/abs/1301.5366 principle of equivalence] — given the Fourier-transformed tangential fields on the "near" surface, Meep computes equivalent currents and convolves them with the analytical Green's functions in order to compute the fields <span style="color: red; font-weight: bold;">at </span>any desired point in the "far" region.)</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;">There are three steps to using the near-to-far-field feature: first, define the "near" surface(s) as a set of surfaces capturing ''all'' outgoing radiation in the desired direction(s); second, run the simulation, typically with a pulsed source, to allow Meep to accumulate the Fourier transforms on the near surface(s); third, tell Meep to compute the far fields at any desired points (optionally saving the far fields from a grid of points to an HDF5 file). To define the near surfaces, use:</td><td> </td><td style="background: #eee; font-size: smaller;">There are three steps to using the near-to-far-field feature: first, define the "near" surface(s) as a set of surfaces capturing ''all'' outgoing radiation in the desired direction(s); second, run the simulation, typically with a pulsed source, to allow Meep to accumulate the Fourier transforms on the near surface(s); third, tell Meep to compute the far fields at any desired points (optionally saving the far fields from a grid of points to an HDF5 file). To define the near surfaces, use:</td></tr>
</table>
Ardavanhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4808&oldid=prevStevenj: /* Near-to-far-field spectra */2015-03-31T18:00:16Z<p><span class="autocomment">Near-to-far-field spectra</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:00, 31 March 2015</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 624:</strong></td>
<td colspan="2" align="left"><strong>Line 624:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Each <code>near2far-region</code> is identical to <code>flux-region</code> except for the name: in 3d, these give a set of planes ('''important:''' all these "near surfaces" must lie in a single ''homogeneous'' material with ''isotropic'' &epsilon; and &mu; — and they should ''not'' lie in the PML regions) surrounding the source(s) of outgoing radiation that you want to capture and convert to a far field. Ideally, these should form a closed surface, but in practice it is sufficient for the <code>near2far-region</code>s to capture all of the radiation in the direction of the far-field points. '''Important:''' as for flux computations, each <code>near2far-region</code> should be assigned a <code>weight</code> of ±1 indicating the direction of the outward normal relative to the +coordinate direction. So, for example, if you have six regions defining the six faces of a cube, i.e. the faces in the +x, -x, +y, -y, +z, and -z directions, then they should have weights +1, -1, +1, -1, +1, and -1 respectively. Note that, neglecting discretization errors, all near-field surfaces that enclose the same outgoing fields are equivalent and will yield the same far fields (with a discretization-induced difference that vanishes with increasing resolution etc.).</td><td> </td><td style="background: #eee; font-size: smaller;">Each <code>near2far-region</code> is identical to <code>flux-region</code> except for the name: in 3d, these give a set of planes ('''important:''' all these "near surfaces" must lie in a single ''homogeneous'' material with ''isotropic'' &epsilon; and &mu; — and they should ''not'' lie in the PML regions) surrounding the source(s) of outgoing radiation that you want to capture and convert to a far field. Ideally, these should form a closed surface, but in practice it is sufficient for the <code>near2far-region</code>s to capture all of the radiation in the direction of the far-field points. '''Important:''' as for flux computations, each <code>near2far-region</code> should be assigned a <code>weight</code> of ±1 indicating the direction of the outward normal relative to the +coordinate direction. So, for example, if you have six regions defining the six faces of a cube, i.e. the faces in the +x, -x, +y, -y, +z, and -z directions, then they should have weights +1, -1, +1, -1, +1, and -1 respectively. Note that, neglecting discretization errors, all near-field surfaces that enclose the same outgoing fields are equivalent and will yield the same far fields (with a discretization-induced difference that vanishes with increasing resolution etc.).</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;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far <span style="color: red; font-weight: bold;">fields</span></td><td>+</td><td style="background: #cfc; font-size: smaller;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far fields.</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"><span style="color: red; font-weight: bold;">For a scattered-field computation you often want to separate the scattered and incident </span>fields. <span style="color: red; font-weight: bold;"> Just as is described in the [[Meep tutorial]] for flux computations, you can do this by saving the Fourier-transformed incident from a "normalization" run and then load them into another run to be subtracted. This can be done via:</span></td><td>+</td><td style="background: #cfc; font-size: smaller;"></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;">;<code>(get-farfield near2far x)</code></td><td> </td><td style="background: #eee; font-size: smaller;">;<code>(get-farfield near2far x)</code></td></tr>
<tr><td colspan="2" align="left"><strong>Line 634:</strong></td>
<td colspan="2" align="left"><strong>Line 632:</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;">Note that far fields have the same units and scaling as the ''Fourier transforms'' of the fields, and hence cannot be directly compared to time-domain fields. In practice, it is easiest to use the far fields in computations where overall scaling (units) cancel out or are irrelevant, e.g. to compute the fraction of the far fields in one region vs. another region.</td><td> </td><td style="background: #eee; font-size: smaller;">Note that far fields have the same units and scaling as the ''Fourier transforms'' of the fields, and hence cannot be directly compared to time-domain fields. In practice, it is easiest to use the far fields in computations where overall scaling (units) cancel out or are irrelevant, e.g. to compute the fraction of the far fields in one region vs. another region.</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;">For a scattered-field computation, you often want to separate the scattered and incident fields. Just as is described in the [[Meep tutorial]] for flux computations, you can do this by saving the Fourier-transformed incident from a "normalization" run and then load them into another run to be subtracted. This can be done via:</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;">;<code>(save-near2far filename near2far)</code></td><td> </td><td style="background: #eee; font-size: smaller;">;<code>(save-near2far filename near2far)</code></td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4807&oldid=prevStevenj: /* Near-to-far-field spectra */2015-03-31T17:59:32Z<p><span class="autocomment">Near-to-far-field spectra</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 17:59, 31 March 2015</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 629:</strong></td>
<td colspan="2" align="left"><strong>Line 629:</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;">;<code>(get-farfield near2far x)</code></td><td> </td><td style="background: #eee; font-size: smaller;">;<code>(get-farfield near2far x)</code></td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">:Given a <code>vector3</code> point <code>x</code> (which can lie anywhere outside the near-field surface, including outside the computational cell) and a near2far object, returns the <span style="color: red; font-weight: bold;">computes </span>(Fourier-transformed) "far" fields at x as list of length 6<code>nfreq</code>, consisting of fields (Ex1,Ey1,Ez1,Hx1,Hy1,Hz1,Ex2,Ey2,Ez2,Hx2,Hy2,Hz2,...) for the frequencies 1,2,…,<code>nfreq</code>.</td><td>+</td><td style="background: #cfc; font-size: smaller;">:Given a <code>vector3</code> point <code>x</code> (which can lie anywhere outside the near-field surface, including outside the computational cell) and a near2far object, returns the <span style="color: red; font-weight: bold;">computed </span>(Fourier-transformed) "far" fields at x as list of length 6<code>nfreq</code>, consisting of fields (Ex1,Ey1,Ez1,Hx1,Hy1,Hz1,Ex2,Ey2,Ez2,Hx2,Hy2,Hz2,...) for the frequencies 1,2,…,<code>nfreq</code>.</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">;<code>(output-farfields near2far fname where resolution)</code></td><td> </td><td style="background: #eee; font-size: smaller;">;<code>(output-farfields near2far fname where resolution)</code></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:Given an HDF5 file name <code>fname</code> (does ''not'' include the <code>.h5</code> suffix), a <code>volume</code> given by <code>where</code> (may be 0d, 1d, 2d, or 3d), and a <code>resolution</code> (in grids points / distance ''a''), outputs the far fields in <code>where</code> (which may lie ''outside'' the computational cell) in a grid with the given resolution (which may differ from the FDTD grid resolution) to the HDF5 file as a set of twelve array datasets <code>ex.r</code>, <code>ex.i</code>, ..., <code>hz.r</code>, <code>hz.i</code>, giving the real and imaginary parts of the Fourier-transformed E and H fields on this grid. Each dataset is an nx&times;ny&times;nz&times;nfreq 4-dimensional array of space&times;frequency (although dimensions that =1 are omitted).</td><td> </td><td style="background: #eee; font-size: smaller;">:Given an HDF5 file name <code>fname</code> (does ''not'' include the <code>.h5</code> suffix), a <code>volume</code> given by <code>where</code> (may be 0d, 1d, 2d, or 3d), and a <code>resolution</code> (in grids points / distance ''a''), outputs the far fields in <code>where</code> (which may lie ''outside'' the computational cell) in a grid with the given resolution (which may differ from the FDTD grid resolution) to the HDF5 file as a set of twelve array datasets <code>ex.r</code>, <code>ex.i</code>, ..., <code>hz.r</code>, <code>hz.i</code>, giving the real and imaginary parts of the Fourier-transformed E and H fields on this grid. Each dataset is an nx&times;ny&times;nz&times;nfreq 4-dimensional array of space&times;frequency (although dimensions that =1 are omitted).</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4806&oldid=prevStevenj: /* Near-to-far-field spectra */2015-03-31T17:57:02Z<p><span class="autocomment">Near-to-far-field spectra</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 17:57, 31 March 2015</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 626:</strong></td>
<td colspan="2" align="left"><strong>Line 626:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far fields</td><td> </td><td style="background: #eee; font-size: smaller;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far fields</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;">For a scattered-field computation you often want to separate the scattered and incident fields. Just as is described in the [[Meep tutorial]] for flux <span style="color: red; font-weight: bold;">comptuations</span>, you can do this by saving the Fourier-transformed incident from a "normalization" run and then load them into another run to be subtracted. This can be done via:</td><td>+</td><td style="background: #cfc; font-size: smaller;">For a scattered-field computation you often want to separate the scattered and incident fields. Just as is described in the [[Meep tutorial]] for flux <span style="color: red; font-weight: bold;">computations</span>, you can do this by saving the Fourier-transformed incident from a "normalization" run and then load them into another run to be subtracted. This can be done via:</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;">;<code>(get-farfield near2far x)</code></td><td> </td><td style="background: #eee; font-size: smaller;">;<code>(get-farfield near2far x)</code></td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4805&oldid=prevStevenj: /* Near-to-far-field spectra */2015-03-31T17:55:31Z<p><span class="autocomment">Near-to-far-field spectra</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 17:55, 31 March 2015</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 622:</strong></td>
<td colspan="2" align="left"><strong>Line 622:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:Add a bunch of <code>near2far-region</code>s to the current simulation (initializing the fields if they have not yet been initialized), telling Meep to accumulate the appropriate field Fourier transforms for <code>nfreq</code> equally spaced frequencies covering the frequency range <code>fcen-df/2</code> to <code>fcen+df/2</code>. Return a ''near2far object'', which you can pass to the functions below to get the far fields.</td><td> </td><td style="background: #eee; font-size: smaller;">:Add a bunch of <code>near2far-region</code>s to the current simulation (initializing the fields if they have not yet been initialized), telling Meep to accumulate the appropriate field Fourier transforms for <code>nfreq</code> equally spaced frequencies covering the frequency range <code>fcen-df/2</code> to <code>fcen+df/2</code>. Return a ''near2far object'', which you can pass to the functions below to get the far fields.</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;">Each <code>near2far-region</code> is identical to <code>flux-region</code> except for the name: in 3d, these give a set of planes ('''important:''' all these "near surfaces" must lie in a single ''homogeneous'' material with ''isotropic'' &epsilon; and &mu; — and they should ''not'' lie in the PML regions) surrounding the source(s) of outgoing radiation that you want to capture and convert to a far field. Ideally, these should form a closed surface, but in practice it is sufficient for the <code>near2far-region</code>s to capture all of the radiation in the direction of the far-field points. '''Important:''' as for flux computations, each <code>near2far-region</code> should be assigned a <code>weight</code> of ±1 <span style="color: red; font-weight: bold;">indication </span>the direction of the outward normal relative to the +coordinate direction. So, for example, if you have six regions defining the six faces of a cube, i.e. the faces in the +x, -x, +y, -y, +z, and -z directions, then they should have weights +1, -1, +1, -1, +1, and -1 respectively. Note that, neglecting discretization errors, all near-field surfaces that enclose the same outgoing fields are equivalent and will yield the same far fields (with a discretization-induced difference that vanishes with increasing resolution etc.).</td><td>+</td><td style="background: #cfc; font-size: smaller;">Each <code>near2far-region</code> is identical to <code>flux-region</code> except for the name: in 3d, these give a set of planes ('''important:''' all these "near surfaces" must lie in a single ''homogeneous'' material with ''isotropic'' &epsilon; and &mu; — and they should ''not'' lie in the PML regions) surrounding the source(s) of outgoing radiation that you want to capture and convert to a far field. Ideally, these should form a closed surface, but in practice it is sufficient for the <code>near2far-region</code>s to capture all of the radiation in the direction of the far-field points. '''Important:''' as for flux computations, each <code>near2far-region</code> should be assigned a <code>weight</code> of ±1 <span style="color: red; font-weight: bold;">indicating </span>the direction of the outward normal relative to the +coordinate direction. So, for example, if you have six regions defining the six faces of a cube, i.e. the faces in the +x, -x, +y, -y, +z, and -z directions, then they should have weights +1, -1, +1, -1, +1, and -1 respectively. Note that, neglecting discretization errors, all near-field surfaces that enclose the same outgoing fields are equivalent and will yield the same far fields (with a discretization-induced difference that vanishes with increasing resolution etc.).</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;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far fields</td><td> </td><td style="background: #eee; font-size: smaller;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far fields</td></tr>
</table>
Stevenjhttp://ab-initio.mit.edu/wiki/index.php?title=Meep_Reference&diff=4804&oldid=prevStevenj: /* Near-to-far-field spectra */2015-03-31T17:54:59Z<p><span class="autocomment">Near-to-far-field spectra</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 17:54, 31 March 2015</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 622:</strong></td>
<td colspan="2" align="left"><strong>Line 622:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">:Add a bunch of <code>near2far-region</code>s to the current simulation (initializing the fields if they have not yet been initialized), telling Meep to accumulate the appropriate field Fourier transforms for <code>nfreq</code> equally spaced frequencies covering the frequency range <code>fcen-df/2</code> to <code>fcen+df/2</code>. Return a ''near2far object'', which you can pass to the functions below to get the far fields.</td><td> </td><td style="background: #eee; font-size: smaller;">:Add a bunch of <code>near2far-region</code>s to the current simulation (initializing the fields if they have not yet been initialized), telling Meep to accumulate the appropriate field Fourier transforms for <code>nfreq</code> equally spaced frequencies covering the frequency range <code>fcen-df/2</code> to <code>fcen+df/2</code>. Return a ''near2far object'', which you can pass to the functions below to get the far fields.</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;">Each <code>near2far-region</code> is identical to <code>flux-region</code> except for the name: in 3d, these give a set of planes ('''important:''' all <span style="color: red; font-weight: bold;">the </span>near surfaces must lie in a single ''homogeneous'' material with ''isotropic'' &epsilon; and &mu; — and they should ''not'' lie in the PML regions) surrounding the source(s) of outgoing radiation that you want to capture and convert to a far field. Ideally, these should form a closed surface, but in practice it is sufficient for the <code>near2far-region</code>s to capture all of the radiation in the direction of the far-field points. '''Important:''' as for flux computations, each <code>near2far-region</code> should be assigned a <code>weight</code> of ±1 indication the direction of the outward normal relative to the +coordinate direction. So, for example, if you have six regions defining the six faces of a cube, i.e. the faces in the +x, -x, +y, -y, +z, and -z directions, then they should have weights +1, -1, +1, -1, +1, and -1 respectively. Note that, neglecting discretization errors, all near-field surfaces that enclose the same outgoing fields are equivalent and will yield the same far fields (with a discretization-induced difference that vanishes with increasing resolution etc.).</td><td>+</td><td style="background: #cfc; font-size: smaller;">Each <code>near2far-region</code> is identical to <code>flux-region</code> except for the name: in 3d, these give a set of planes ('''important:''' all <span style="color: red; font-weight: bold;">these "</span>near surfaces<span style="color: red; font-weight: bold;">" </span>must lie in a single ''homogeneous'' material with ''isotropic'' &epsilon; and &mu; — and they should ''not'' lie in the PML regions) surrounding the source(s) of outgoing radiation that you want to capture and convert to a far field. Ideally, these should form a closed surface, but in practice it is sufficient for the <code>near2far-region</code>s to capture all of the radiation in the direction of the far-field points. '''Important:''' as for flux computations, each <code>near2far-region</code> should be assigned a <code>weight</code> of ±1 indication the direction of the outward normal relative to the +coordinate direction. So, for example, if you have six regions defining the six faces of a cube, i.e. the faces in the +x, -x, +y, -y, +z, and -z directions, then they should have weights +1, -1, +1, -1, +1, and -1 respectively. Note that, neglecting discretization errors, all near-field surfaces that enclose the same outgoing fields are equivalent and will yield the same far fields (with a discretization-induced difference that vanishes with increasing resolution etc.).</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;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far fields</td><td> </td><td style="background: #eee; font-size: smaller;">''After'' the simulation <code>run</code> (usually for a pulsed source) is complete (so that the fields have decayed away and the Fourier transforms have finished accumulating), you can compute the far fields</td></tr>
</table>
Stevenj