-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inconsistent DFT fields monitors of the adjoint solver #1793
Comments
Beyond consistency, are there reasons to favor monitors on the centered grid over monitors on the Yee grid? The current implementation of monitors on the centered grid is inefficient because it performs interpolation whenever the monitor data is updated during time stepping. It would be more efficient to place DFT monitors on the Yee grid and conditionally perform interpolation when returning data to the user. This is supported by a linearity argument for the DFT and the interpolation step. |
The basic idea here is that the centered grid is much easier for the user to deal with than the Yee grid. And However, it would be good to have the option to get FourierFields directly on the Yee grid, e.g. the version that @mawc2019 is working on. Whereas the DFT fields for the eigenmode coefficients and the near2far transformations are mainly for use by Meep, and Meep knows how to handle Yee-grid data.
I agree: it would be mathematically equivalent to do the DFT accumulation on the Yee grid and only convert to the centered grid when we output to the user. |
Setting
@smartalecH, why was it necessary to override the Line 3027 in c65a149
|
Yes that's expected... we must evaluate on the yee grid. |
(...to continue using a flipped eigenmode source as our adjoint source. We can restrict the fields, in theory, if we store the field profiles at the monitors and process those accordingly, just like we do with the Near2Far. Although we still need to finish #1547 before we can proceed with that approach.) |
Currently, the
EigenmodeCoefficient
class of the adjoint solver defines the DFT field monitors on the Yee grid:meep/python/adjoint/objective.py
Lines 154 to 162 in 434f3fb
However, the
FourierFields
class defines the DFT field monitors at the voxel centers:meep/python/adjoint/objective.py
Lines 239 to 248 in 434f3fb
And yet, the
Near2FarFields
class defines the DFT field monitors on the Yee grid:meep/python/adjoint/objective.py
Lines 340 to 347 in 434f3fb
Note: for
Near2FarFields
, theyee_grid
option is not defined here butuse_centered_grid
(third last argument) is set tofalse
infields::add_near2far
:meep/src/near2far.cpp
Line 635 in 849bf3d
meep/src/meep.hpp
Lines 1961 to 1966 in 434f3fb
When defining an objective function as part of an adjoint simulation, the user therefore needs to be consistent with these definitions. This is similar to the set up used in the unit test for the adjoint solver where the
yee_grid
option is explicitly defined:meep/python/tests/test_adjoint_solver.py
Lines 79 to 91 in 434f3fb
Ensuring this type of consistency (particularly for the mode coefficients which does not use the default option) can be problematic and a source of error for the average user. It would be useful if the DFT fields monitors for all objective classes were always defined at the voxel centers.
The text was updated successfully, but these errors were encountered: