-
Notifications
You must be signed in to change notification settings - Fork 13
add tutorial about source normalization #301
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
base: develop
Are you sure you want to change the base?
Conversation
Spell check passed successfully for 1 notebook(s). |
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.
Excellent work @Filipe, this will be a super useful resource - this answers a number of my questions as well!
A couple comments:
-
Above cell 5, it might help to plot a couple of these simulations, so the user can quickly visualize what you're measuring
-
For the plot in cell 21, maybe connect the data points with a line to better illustrate the behavior
-
Above cell 22, a bit more explanation of what the simulation will do will be helpful
Other than that, I think this is great - super clear, illustrative, and useful!
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.
Thanks @FilipeFcp . Very helpful content, especially the error on the monitor position, which I didn't realize before.
-
Consider adding doc string to the
get_sim
function since it's relatively long with many arguments. -
For plane wave, "|E_0| is proportional to the source plane area" is incorrect right? |E_0| should be proportional to the area**(-1/2) as the figure below shows?
-
Since we are on this topic, shall we spend some time on custom field source and current source normalization just to make the tutorial complete?
Thanks @FilipeFcp, great stuff! A few comments from my side too:
|
Hi all. @momchil-flex, I did some tests with more angles, and it seems odd. Using 2.9rc, for a plane size of 1 µm: Changing the plane size to 1.5 µm: Is it some issue with the monitor, or should I adapt something in the simulation? The |
Ok, yeah, this is pretty interesting. In some sense it is showing exactly what I wanted to show: that in some cases, especially when the DiffractionMonitor has to differentiate between roughly equal powers going in both directions, the accuracy can get degraded. Notice that the problems are happening exactly beyond TIR when reflection hits 1, meaning that there's exactly equal powers going in each direction, and the flux at that location is 0. The problem is that numerically the flux is rather numerical noise on the scale of Understanding now how everything fits together, my suggestion is to preserve the current behavior. I think the increased accuracy in the "correct" setup is worth the potential decrease in the specific case of a DiffractionMonitor placed in a region with (almost) 0 flux. |
Note that my original comment on the issue was exactly that I would expect DiffractionMonitor to have a large error when there is full reflection, there I was suggesting PEC, but here it is the same once TIR is hit. So yeah while not ideal that this gets exacerbated by the "fixes", I think it's a good opportunity to discuss this point exactly! |
@momchil-flex. Seems good. I will wrap up this discussion in the notebook. Also, I think it could be good to add a few comments regarding this in the DiffractionMonitor docs. I work on it today |
Hi all, I’m less confident about the section on the current source. I found an analytical expression in the Balanis book: It seems to work well for small-area sources, which fits the approximation. However, I’m not sure about the normalization for a 1D source. Sorry, @momchil-flex, I recall we had a brief discussion about this on Slack earlier this year, but I couldn’t locate it. We do apply some normalization when the source 1D right? |
Thanks @FilipeFcp! In this figure, maybe still keep the diffraction monitor result in the right panel? It's zoomed in but for small angles maybe it will show good agreement? Regarding source normalization of the uniform current source, it's nice to see that the result approximately matches the analytical result you've found! I am not really sure about it honestly, for this type of source (as well as CustomCurrent and CustomField) my thinking has generally been that some normalization run is needed as it's hard to nail down an exact result a priori. Regarding normalization when the source is smaller than 3D, basically for every dimension that is 0-size, we divide by the cell size at the pixel at which the source is injected, so we get a result that is independent of the exact discretization. If we weren't doing this, the source would have an effective size that is given by the pixel size. This also means that the amplitude units of what the user is defining change from A / um**2 to A / um to A to A * um going from 3D to 2D to 1D to 0D. In other words, when e.g. defining a point dipole of a given amplitude, the user is defining the electric current moment Note that your last plots seem to be messed up in their axis labels. In both of them it says "theta [degrees]" but you're plotting source size in the next-to-last, and resolution in the last one. |
Thanks @momchil-flex! I corrected the plots and labels and added a small discussion in the current source section. |
Hi all,
This is the example of source normalization related to issue #900.
Let me know if you think we should add, remove, or modify anything.
It was run using version 2.9-rc.1, with the fixes to the diffraction monitor included.