-
Notifications
You must be signed in to change notification settings - Fork 641
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
tutorial for oblique planewave in cylindrical coordinate #2663
Conversation
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 for putting this together.
It would be good to provide some comments on the rate of convergence of the result with
dfrq = 0.2 | ||
nfrq = 1 | ||
resolution, dair_fac, mrange = 50, 10, 5 | ||
src_offset = 3/resolution # a small offset in source size |
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.
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.
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.
Based on the workaround described in #2704, would you try using src_offset = 1.5 / resolution
? This should hopefully improve the accuracy of your results.
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 tried that before but there wasn't much improvement. Due to #2644, additional pixels have to be excluded for |m|>1, and the larger |m| is, the more pixels needed to be excluded, which also implies that having more terms in the expansion may not help.
Ensuring stability(#2644) and forcing complex fields (inspired by #2726 (comment)) produce much better agreement:
Also notice that the size of source is increased to more accurately represent a planewave, since we don't have real planewave in cylindrical coordinate: |
Good to see this is finally working as expected. A few comments and questions:
|
Thanks! I fixed the value.
I chose
There might be a correspondence between m and -m terms; I will go through the math and make sure I have the correct signs and factor.
Thanks! I can make it as a function of m.
For Cartesian cells, sources extending into the PML with the periodic BC will generate planewave; but in cylindrical coordinate that is not the case. I am not sure which way would be better. |
In the radial direction, it would be good to make the computation converge faster with the cell radius R so that you can use a smaller cell. A basic issue is that you are just truncating the current source at R, so you are introducing an error that converges as 1/R. One way to get faster convergence would be to make the source decay smoothly in R, similar to the windowed-Green's function approach (#1952), e.g. by multiplying it by a bump function. (The trick of extending the source into the PML and using periodic boundary conditions, which we do in Cartesian coordinates, doesn't seem applicable here since the problem cannot be periodic in r. Although maybe for the planewave you could use an appropriate PEC or PMC boundary condition in r? In any case this wouldn't work for the Bessel sources.) However, an even more efficient approach would be to use the principle of equivalence: have a current source surface that completely surrounds the object. Then you should be able to make the computational cell quite small (the only limitation being the inexactness of our PML in the r direction). |
(Eventually, we would like a plot of the error vs. m, and/or the magnitude of the contributions vs m. I would naively expect that it will converge with a power law, so plot on a log–log scale, but it will get worse for increasingly oblique angles.) |
It should be exactly a factor of 2 smaller if you had an infinite line source, with just an electric current equal to the planewave amplitude — i.e. if you start with an infinite line equivalent-current source and then set the magnetic currents to zero. For an oblique planewave, you would:
(Unlike Cartesian coordinates, I'm not sure that there is any way to get planar wavefronts with just a line source, even if it extends into the PML, except in the limit as the cell radius goes to infinity. The reason is that a finite cylinder with any of the boundary conditions currently in Meep does not support a planewave solution, even along the z direction. One might be able to construct boundary conditions for which this works, however.) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2663 +/- ##
==========================================
- Coverage 73.81% 73.81% -0.01%
==========================================
Files 18 18
Lines 5294 5423 +129
==========================================
+ Hits 3908 4003 +95
- Misses 1386 1420 +34 |
Might be worth doubling the resolution to see if that reduces the angle dependence of the results. |
Here are the results at resolution=100 and the agreement looks pretty good with relative error less than 1%
|
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.
LGTM.
Documentation and tutorial for how to have oblique incident planewave in cylindrical coordinate. Compared the scattering flux of a sphere under different angles of incidence. Closes #2630.
The setup of the tutorial looks like
Part of the source around$r=0$ is currently excluded for $|m|>1$ due to #2644. In addition, as noted in #2538 (comment), source at $r=0$ for $|m|=1$ may also not be accurate. On the other hand, both issues should only introduce 1st order errors, which should go away with resolution.
Here is a table of the results at various incidence angles at various cutoff of
|m|
atresolution=100
.A higher cutoff should have better convergence, but as mentioned in #2644 (comment), a higher cutoff currently required excluding more pixels around$r=0$ .