http://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&action=history&feed=atomSynchronizing the magnetic and electric fields - Revision history2024-03-29T06:27:56ZRevision history for this page on the wikiMediaWiki 1.7.3http://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3226&oldid=prevStevenj: /* Synchronization functions */ note handling of nestings, non-restored fields2008-07-20T18:46:55Z<p><span class="autocomment">Synchronization functions -</span> note handling of nestings, non-restored fields</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:46, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 21:</strong></td>
<td colspan="2" align="left"><strong>Line 21:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">it will output the same quantities, but more accurately because the fields will be synchronized. (Of course, '''there is a price''': synchronizing the fields takes time, and also increases the memory usage in order to backup the unsynchronized fields.)</td><td> </td><td style="background: #eee; font-size: smaller;">it will output the same quantities, but more accurately because the fields will be synchronized. (Of course, '''there is a price''': synchronizing the fields takes time, and also increases the memory usage in order to backup the unsynchronized 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;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.) <span style="color: red; font-weight: bold;"> If you ''don't'' call <code>meep-fields-restore-magnetic-fields</code> before timestepping, then the fields will be re-synchronized after ''every'' timestep, which will greatly increase the cost of timestepping.</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: #ffa; font-size: smaller;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do another field computation that involves both magnetic and electric fields, but currently you must do this manually. The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized, however.</td><td>+</td><td style="background: #cfc; font-size: smaller;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do another field computation that involves both magnetic and electric fields, but currently you must do this manually. <span style="color: red; font-weight: bold;"> (In any case, Meep does no additional work when you nest synchronization calls, so it is harmless to insert redundant field synchronizations.) </span> The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized, however.</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://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3217&oldid=prevStevenj at 16:22, 20 July 20082008-07-20T16:22:46Z<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 16:22, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 6:</strong></td>
<td colspan="2" align="left"><strong>Line 6:</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;">To improve the accuracy for computations involving both electric and magnetic fields, Meep provides a facility to synchronize the '''H''' and '''B''' fields with the '''E''' and '''D''' fields in time. Technically, what it does is to compute the magnetic fields at time <math>t+\Delta t/2</math> by performing part of a timestep, and then averaging those fields with the fields at time <math>t-\Delta t/2</math>. This produces the magnetic fields at time ''t'' to second-order accuracy <math>O(\Delta t^2)</math>, which is the best we can do in second-order FDTD. Meep also saves a copy of the magnetic fields at <math>t-\Delta t/2</math>, so that it can restore those fields for subsequent timestepping.</td><td> </td><td style="background: #eee; font-size: smaller;">To improve the accuracy for computations involving both electric and magnetic fields, Meep provides a facility to synchronize the '''H''' and '''B''' fields with the '''E''' and '''D''' fields in time. Technically, what it does is to compute the magnetic fields at time <math>t+\Delta t/2</math> by performing part of a timestep, and then averaging those fields with the fields at time <math>t-\Delta t/2</math>. This produces the magnetic fields at time ''t'' to second-order accuracy <math>O(\Delta t^2)</math>, which is the best we can do in second-order FDTD. Meep also saves a copy of the magnetic fields at <math>t-\Delta t/2</math>, so that it can restore those fields for subsequent timestepping.</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;">==Synchronization functions==</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;">All of this process is handled for you in Meep by a single step function: <code>synchronized-magnetic</code>. By wrapping this around your step functions, it ensures that those step functions are called with synchronized electric and magnetic fields (to second-order accuracy), while restoring the magnetic fields automatically for subsequent timestepping.</td><td> </td><td style="background: #eee; font-size: smaller;">All of this process is handled for you in Meep by a single step function: <code>synchronized-magnetic</code>. By wrapping this around your step functions, it ensures that those step functions are called with synchronized electric and magnetic fields (to second-order accuracy), while restoring the magnetic fields automatically for subsequent timestepping.</td></tr>
<tr><td colspan="2" align="left"><strong>Line 17:</strong></td>
<td colspan="2" align="left"><strong>Line 19:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> (run-until 200 (synchronized-magnetic output-poynting output-tot-pwr))</td><td> </td><td style="background: #eee; font-size: smaller;"> (run-until 200 (synchronized-magnetic output-poynting output-tot-pwr))</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;">it will output the same quantities, but more accurately because the fields will be synchronized. (Of course, there is a price: synchronizing the fields takes time, and also increases the memory usage in order to backup the unsynchronized fields.)</td><td>+</td><td style="background: #cfc; font-size: smaller;">it will output the same quantities, but more accurately because the fields will be synchronized. (Of course, <span style="color: red; font-weight: bold;">'''</span>there is a price<span style="color: red; font-weight: bold;">'''</span>: synchronizing the fields takes time, and also increases the memory usage in order to backup the unsynchronized 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: #eee; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</td><td> </td><td style="background: #eee; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</td></tr>
</table>
Stevenjhttp://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3216&oldid=prevStevenj at 16:21, 20 July 20082008-07-20T16:21:15Z<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 16:21, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 17:</strong></td>
<td colspan="2" align="left"><strong>Line 17:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> (run-until 200 (synchronized-magnetic output-poynting output-tot-pwr))</td><td> </td><td style="background: #eee; font-size: smaller;"> (run-until 200 (synchronized-magnetic output-poynting output-tot-pwr))</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;">it will output the same quantities, but more accurately because the fields will be synchronized.</td><td>+</td><td style="background: #cfc; font-size: smaller;">it will output the same quantities, but more accurately because the fields will be synchronized. <span style="color: red; font-weight: bold;"> (Of course, there is a price: synchronizing the fields takes time, and also increases the memory usage in order to backup the unsynchronized fields.)</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;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</td><td> </td><td style="background: #eee; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</td></tr>
</table>
Stevenjhttp://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3215&oldid=prevStevenj at 16:19, 20 July 20082008-07-20T16:19:38Z<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 16:19, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 21:</strong></td>
<td colspan="2" align="left"><strong>Line 21:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</td><td> </td><td style="background: #eee; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</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: #ffa; font-size: smaller;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do another field computation that involves both magnetic and electric fields, but currently you must do this manually. <span style="color: red; font-weight: bold;"> (It doesn't hurt to nest the synchronization calls, so it is harmless to insert redundant field-synchronization calls.) </span> The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized, however.</td><td>+</td><td style="background: #cfc; font-size: smaller;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do another field computation that involves both magnetic and electric fields, but currently you must do this manually. The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized, however.</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://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3214&oldid=prevStevenj at 16:19, 20 July 20082008-07-20T16:19:19Z<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 16:19, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 21:</strong></td>
<td colspan="2" align="left"><strong>Line 21:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</td><td> </td><td style="background: #eee; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</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: #ffa; font-size: smaller;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do <span style="color: red; font-weight: bold;">a </span>field <span style="color: red; font-weight: bold;">integration </span>that involves both magnetic and electric fields, but currently you must do this manually. (It doesn't hurt to nest the synchronization calls, so it is harmless to insert redundant field-synchronization calls.) The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized.</td><td>+</td><td style="background: #cfc; font-size: smaller;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do <span style="color: red; font-weight: bold;">another </span>field <span style="color: red; font-weight: bold;">computation </span>that involves both magnetic and electric fields, but currently you must do this manually. (It doesn't hurt to nest the synchronization calls, so it is harmless to insert redundant field-synchronization calls.) The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized<span style="color: red; font-weight: bold;">, however</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;">[[Category:Meep]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Meep]]</td></tr>
</table>
Stevenjhttp://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3213&oldid=prevStevenj at 16:17, 20 July 20082008-07-20T16:17:38Z<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 16:17, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 19:</strong></td>
<td colspan="2" align="left"><strong>Line 19:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">it will output the same quantities, but more accurately because the fields will be synchronized.</td><td> </td><td style="background: #eee; font-size: smaller;">it will output the same quantities, but more accurately because the fields will be synchronized.</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;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping.</td><td>+</td><td style="background: #cfc; font-size: smaller;">Alternatively, if you want to synchronize the magnetic and electric fields in some context other than that of a step function, e.g. you are doing some computation like <code>integrate-field-function</code> outside of the timestepping, you can instead call two lower-level functions. Before doing your computations, you should call <code>(meep-fields-synchronize-magnetic-fields fields)</code> to synchronize the magnetic fields with the electric fields, and after your computation you should call <code>(meep-fields-restore-magnetic-fields fields)</code> to restore the fields to their unsynchronized state for timestepping. <span style="color: red; font-weight: bold;"> (In the C++ interface, these correspond to <code>fields::synchronize_magnetic_fields</code> and <code>fields::restore_magnetic_fields</code>.)</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;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do a field integration that involves both magnetic and electric fields, but currently you must do this manually. (It doesn't hurt to nest the synchronization calls, so it is harmless to insert redundant field-synchronization calls.) The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized.</td><td> </td><td style="background: #eee; font-size: smaller;">'''Note''': in future versions of Meep, we may decide to synchronize the fields automatically whenever you output something like the Poynting vector or do a field integration that involves both magnetic and electric fields, but currently you must do this manually. (It doesn't hurt to nest the synchronization calls, so it is harmless to insert redundant field-synchronization calls.) The <code>flux-in-box</code> and <code>field-energy-in-box</code> routines are already automatically synchronized.</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://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3212&oldid=prevStevenj at 16:16, 20 July 20082008-07-20T16:16:23Z<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 16:16, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 5:</strong></td>
<td colspan="2" align="left"><strong>Line 5:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">This means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</td><td> </td><td style="background: #eee; font-size: smaller;">This means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</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;">To improve the accuracy for computations involving both electric and magnetic fields, Meep provides a facility to synchronize the '''H''' and '''B''' fields with the '''E''' and '''D''' fields in time. Technically, what it does is to compute the magnetic fields at time <math>t+\Delta t/2</math> by performing part of a timestep, and then averaging those fields with the fields at time <math>t-\Delta t/2</math>. This produces the magnetic fields at time ''t'' to <span style="color: red; font-weight: bold;">a </span>second-order accuracy <span style="color: red; font-weight: bold;">of </span><math>O(\Delta t^2)</math>, which is the best we can do in second-order FDTD. Meep also saves a copy of the magnetic fields at <math>t-\Delta t/2</math>, so that it can restore those fields for subsequent timestepping.</td><td>+</td><td style="background: #cfc; font-size: smaller;">To improve the accuracy for computations involving both electric and magnetic fields, Meep provides a facility to synchronize the '''H''' and '''B''' fields with the '''E''' and '''D''' fields in time. Technically, what it does is to compute the magnetic fields at time <math>t+\Delta t/2</math> by performing part of a timestep, and then averaging those fields with the fields at time <math>t-\Delta t/2</math>. This produces the magnetic fields at time ''t'' to second-order accuracy <math>O(\Delta t^2)</math>, which is the best we can do in second-order FDTD. Meep also saves a copy of the magnetic fields at <math>t-\Delta t/2</math>, so that it can restore those fields for subsequent timestepping.</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;">All of this process is handled for you in Meep by a single step function: <code>synchronized-magnetic</code>. By wrapping this around your step functions, it ensures that those step functions are called with synchronized electric and magnetic fields (to second-order accuracy), while restoring the magnetic fields automatically for subsequent timestepping.</td><td> </td><td style="background: #eee; font-size: smaller;">All of this process is handled for you in Meep by a single step function: <code>synchronized-magnetic</code>. By wrapping this around your step functions, it ensures that those step functions are called with synchronized electric and magnetic fields (to second-order accuracy), while restoring the magnetic fields automatically for subsequent timestepping.</td></tr>
</table>
Stevenjhttp://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3211&oldid=prevStevenj at 16:15, 20 July 20082008-07-20T16:15:52Z<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 16:15, 20 July 2008</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 5:</strong></td>
<td colspan="2" align="left"><strong>Line 5:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">This means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</td><td> </td><td style="background: #eee; font-size: smaller;">This means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</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;">To improve the accuracy for computations involving both electric and magnetic fields, Meep provides a facility to synchronize the '''H''' and '''B''' fields with the '''E''' and '''D''' fields in time. Technically, what it does is to compute the magnetic fields at time <math>t+\Delta t/2</math> by performing a timestep, and then averaging those fields with the fields at time <math>t-\Delta t/2</math>. This produces the magnetic fields at time ''t'' to a second-order accuracy of <math>O(\Delta t^2)</math>, which is the best we can do in second-order FDTD. Meep also saves a copy of the magnetic fields at <math>t-\Delta t/2</math>, so that it can restore those fields for subsequent timestepping.</td><td>+</td><td style="background: #cfc; font-size: smaller;">To improve the accuracy for computations involving both electric and magnetic fields, Meep provides a facility to synchronize the '''H''' and '''B''' fields with the '''E''' and '''D''' fields in time. Technically, what it does is to compute the magnetic fields at time <math>t+\Delta t/2</math> by performing <span style="color: red; font-weight: bold;">part of </span>a timestep, and then averaging those fields with the fields at time <math>t-\Delta t/2</math>. This produces the magnetic fields at time ''t'' to a second-order accuracy of <math>O(\Delta t^2)</math>, which is the best we can do in second-order FDTD. Meep also saves a copy of the magnetic fields at <math>t-\Delta t/2</math>, so that it can restore those fields for subsequent timestepping.</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;">All of this process is handled for you in Meep by a single step function: <code>synchronized-magnetic</code>. By wrapping this around your step functions, it ensures that those step functions are called with synchronized electric and magnetic fields (to second-order accuracy), while restoring the magnetic fields automatically for subsequent timestepping.</td><td> </td><td style="background: #eee; font-size: smaller;">All of this process is handled for you in Meep by a single step function: <code>synchronized-magnetic</code>. By wrapping this around your step functions, it ensures that those step functions are called with synchronized electric and magnetic fields (to second-order accuracy), while restoring the magnetic fields automatically for subsequent timestepping.</td></tr>
</table>
Stevenjhttp://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3210&oldid=prevStevenj at 16:14, 20 July 20082008-07-20T16:14:32Z<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 16:14, 20 July 2008</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;">In the finite-difference time-domain method, the electric and magnetic fields are stored at ''different times'' (and different positions<span style="color: red; font-weight: bold;">) </span>in space, in a "[[w:Leapfrog integration|leap-frog]]" fashion. At any given time-step <math>t</math> during the simulation, the '''E''' and '''D''' fields are stored at time <math>t</math>, but the '''H''' and '''B''' fields are stored at time <math>t-\Delta t/2</math> (where <math>\Delta t</math> is the time-step size).</td><td>+</td><td style="background: #cfc; font-size: smaller;">In the finite-difference time-domain method, the electric and magnetic fields are stored at ''different times'' (and different positions in space<span style="color: red; font-weight: bold;">)</span>, in a "[[w:Leapfrog integration|leap-frog]]" fashion. At any given time-step <math>t</math> during the simulation, the '''E''' and '''D''' fields are stored at time <math>t</math>, but the '''H''' and '''B''' fields are stored at time <math>t-\Delta t/2</math> (where <math>\Delta t</math> is the time-step size).</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 means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</td><td> </td><td style="background: #eee; font-size: smaller;">This means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</td></tr>
</table>
Stevenjhttp://jdj.mit.edu/wiki/index.php?title=Synchronizing_the_magnetic_and_electric_fields&diff=3209&oldid=prevStevenj at 16:14, 20 July 20082008-07-20T16:14:16Z<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 16:14, 20 July 2008</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;">In the <span style="color: red; font-weight: bold;">FDTD </span>time-domain method, the electric and magnetic fields are stored at ''different times'' (and different positions) in space, in a "[[w:Leapfrog integration|leap-frog]]" fashion. At any given time-step <math>t</math> during the simulation, the '''E''' and '''D''' fields are stored at time <math>t</math>, but the '''H''' and '''B''' fields are stored at time <math>t-\Delta t/2</math> (where <math>\Delta t</math> is the time-step size).</td><td>+</td><td style="background: #cfc; font-size: smaller;">In the <span style="color: red; font-weight: bold;">finite-difference </span>time-domain method, the electric and magnetic fields are stored at ''different times'' (and different positions) in space, in a "[[w:Leapfrog integration|leap-frog]]" fashion. At any given time-step <math>t</math> during the simulation, the '''E''' and '''D''' fields are stored at time <math>t</math>, but the '''H''' and '''B''' fields are stored at time <math>t-\Delta t/2</math> (where <math>\Delta t</math> is the time-step size).</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 means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</td><td> </td><td style="background: #eee; font-size: smaller;">This means that when you output the electric and magnetic fields from a given time step, for example, the fields actually correspond to times <math>\Delta t/2</math> apart. For most purposes, this slight difference in time doesn't actually matter much, but it makes a difference when you compute quantities like the Poynting flux <math>\mathbf{E}\times\mathbf{H}</math> that combine electric and magnetic fields together, e.g. for the <code>output-poynting</code> function. If what you really want is the Poynting flux <math>\mathbf{S}(t)</math> at time ''t'', then computing <math>\mathbf{E}(t)\times\mathbf{H}(t-\Delta t/2)</math> is slightly off from this &mdash; the error is of order <math>O(\Delta t)</math>, or first-order accuracy. This is unfortunate, because the underlying FDTD method ideally can have second-order accuracy.</td></tr>
</table>
Stevenj