Skip to content
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

Make the EigenmodeCoefficient adjont solver accept a DiffractedPlanewave object #2332

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mawc2019
Copy link
Contributor

@mawc2019 mawc2019 commented Dec 7, 2022

The mode argument of the EigenmodeCoefficient adjont solver cannot be a DiffractedPlanewave object. This PR allows this mode argument to be a DiffractedPlanewave object.

@oskooi
Copy link
Collaborator

oskooi commented Dec 7, 2022

Note that #2054 (unfinished) is identical to this PR. Unfortunately, enabling this feature requires more than simply modifying the API for EigenmodeCoefficient as explained in this comment.

@mawc2019
Copy link
Contributor Author

mawc2019 commented Dec 7, 2022

I see. Is there a temporary expedient for the DiffractedPlanewave adjoint solver? The Metagrating3D optimization problem would need the DiffractedPlanewave adjoint solver.

@oskooi
Copy link
Collaborator

oskooi commented Dec 8, 2022

Is there a temporary expedient for the DiffractedPlanewave adjoint solver?

The workaround is to specify the wavevector of the diffracted order manually using the kpoint_func parameter of the EigenmodeCoefficient object. See the example in #2235(comment). This also requires the hack in mpb.cpp in #2285.

@mawc2019
Copy link
Contributor Author

mawc2019 commented Dec 12, 2022

I specified the wave vector of the diffracted order manually using kpoint_func and used the hack in #2285, but the results given by get_eigenmode_coefficients or the forward run of the EigenmodeCoefficient adjoint solver is different from that given by the DiffractedPlanewave object. For example, at resolution=20, using device1.csv in Metagrating3D, the deflection efficiency given by DiffractedPlanewave is 83% while the result given by get_eigenmode_coefficients is only 51%. (Without the hack in #2285, the result given by get_eigenmode_coefficients is only 3%.)
Did you compare this get_eigenmode_coefficients approach mentioned above with the DiffractedPlanewave approach?

@oskooi
Copy link
Collaborator

oskooi commented Dec 12, 2022

Did you compare this get_eigenmode_coefficients approach mentioned above with the DiffractedPlanewave approach?

We already have a unit test (test_diffracted_planewave.py) which verifies, using a 2d binary grating, that get_eigenmode_coefficients produces the same result when called with either a band_num/eig_parity (but not kpoint_func) or DiffractedPlanewave object. Once #2285 is resolved, I was planning to add a separate test involving kpoint_func.

Anyhow, since the 2d metagrating is a 3d simulation, you need to be careful about specifying the correct symmetry of the mode. I think it should be: eig_parity = mp.EVEN_Y if P_pol else mp.ODD_Y.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants