Discussion:
[Meep-discuss] Does get_array(...) synchronize the magnetic field?
Thomas AUZINGER
2018-09-18 15:21:11 UTC
Permalink
Hi,

As in the subject, I just want to know if calls to get_array(...)
synchronize the magnetic field. If not, how would I ensure that before
calling get_array(...)?

All the best,
Thomas
Christopher Hogan
2018-09-18 15:44:26 UTC
Permalink
Hi Thomas,
I just want to know if calls to get_array(...) synchronize the magnetic
field.

Looking at the code, it appears the answer is no. You can use the
synchronization functions described here:

https://meep.readthedocs.io/en/latest/Synchronizing_the_Magnetic_and_Electric_Fields/#synchronization-functions

Chris
Hi,
As in the subject, I just want to know if calls to get_array(...)
synchronize the magnetic field. If not, how would I ensure that before
calling get_array(...)?
All the best,
Thomas
_______________________________________________
meep-discuss mailing list
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
Thomas AUZINGER
2018-09-18 15:50:03 UTC
Permalink
Hi Chris,

Thanks for the info. This does not fully fit my use case, as I am
calling get_array(...) after the sim already finished. So not inside a
step function.
So far, this seems to work but your answer cast some doubt on this.

Just to be sure: Is the usage of sim.get_array(...) permitted after
sim.run(...) already finished?

In any case, I guess I need to pack my code into a step function that
runs at the end of the simulation.

All the best,
Thomas
Post by Christopher Hogan
Hi Thomas,
I just want to know if calls to get_array(...) synchronize the
magnetic field.
Looking at the code, it appears the answer is no. You can use the
https://meep.readthedocs.io/en/latest/Synchronizing_the_Magnetic_and_Electric_Fields/#synchronization-functions
Chris
On Tue, Sep 18, 2018 at 10:21 AM, Thomas AUZINGER
Hi,
As in the subject, I just want to know if calls to get_array(...)
synchronize the magnetic field. If not, how would I ensure that
before calling get_array(...)?
All the best,
Thomas
_______________________________________________
meep-discuss mailing list
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
<http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss>
Christopher Hogan
2018-09-18 15:55:05 UTC
Permalink
Hi Thomas,

Yes, you can use sim.get_array() after the run has finished. If you read
farther down in the link above, the docs describe two low-level
synchronization functions that don't need to be used in a step function.
So, you should be able to do something like

sim.run()
sim.fields.synchronize_magnetic_fields()
sim.get_array()
sim.fields.restore_magnetic_fields()

Chris
Post by Thomas AUZINGER
Hi Chris,
Thanks for the info. This does not fully fit my use case, as I am calling
get_array(...) after the sim already finished. So not inside a step
function.
So far, this seems to work but your answer cast some doubt on this.
Just to be sure: Is the usage of sim.get_array(...) permitted after
sim.run(...) already finished?
In any case, I guess I need to pack my code into a step function that runs
at the end of the simulation.
All the best,
Thomas
Hi Thomas,
I just want to know if calls to get_array(...) synchronize the magnetic
field.
Looking at the code, it appears the answer is no. You can use the
https://meep.readthedocs.io/en/latest/Synchronizing_the_
Magnetic_and_Electric_Fields/#synchronization-functions
Chris
Hi,
As in the subject, I just want to know if calls to get_array(...)
synchronize the magnetic field. If not, how would I ensure that before
calling get_array(...)?
All the best,
Thomas
_______________________________________________
meep-discuss mailing list
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
Continue reading on narkive:
Loading...