-
Notifications
You must be signed in to change notification settings - Fork 66
more polyslab gradient bug fixes #2020
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule notebooks
updated
7 files
+1,389 −0 | MultipoleExpansion.ipynb | |
+ − | img/errorAnalysisME.png | |
+ − | img/multipoleExpansion.png | |
+101 −0 | misc/mie_electric_dipole | |
+101 −0 | misc/mie_electric_quadrupole | |
+101 −0 | misc/mie_magnetic_dipole | |
+101 −0 | misc/mie_magnetic_quadrupole |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that seems pretty arbitrary :D why
33
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the honest answer is because I tested the PointDipole sources against every structure combination and the gradients were consistently 33x smaller than numerical ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little worrying then. Have you tested different grid sizes at the monitor location? And the monitor being in different materials?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to test everything, I already had like a 10 x 4 grid of different combinations of things to test, but no I did not test grid size and medium. The grid size should be handled by using
interp
in the source, the medium could have an effect but I think it would be some scaling by the refractive index, the overall constant might still be the same. I can look into it some more if it would be usefulThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm just trying to think about things that this "constant" might actually depend on, like the mesh step around the dipole for some reason, or the material epsilon.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's very possible the gradients depend on these things in some way. This PR resolve the gradient direction and corrects the overall normalization so that the un-normalized gradients match pretty well (typically under 10% unnormalized and around 1% normalized), but under my test conditions. So There's another dimension to explore which is how these norms change under different background permittivity and grid resolution.. which gets pretty complicated. I think for sake of practical optimization what we have here is a good improvement, but I'll do a few more tests today to see if I can find some low hanging fruit to improve it
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested a few different Simulation.medium and also a few different grid sizes. The grad norms were constant across each, maybe a tiny bit of variation with dl, but didnt seem linear with dl and could be due to many things. Ultimately feel confident that these constants are good to give adj ~ numerical grads without normalization for a range of situations, and if not, we can revisit later. So I'll go ahead and merge this