-
Notifications
You must be signed in to change notification settings - Fork 637
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
Fix bug for z-PML in cylindrical coordinates for m
= 0, ±1
#2383
Conversation
Doesn't the Yee grid for Bz put the Bz component at r=Δr/2? Since it is at r≠0, why should it be set to zero? |
m
= ±1
No, still doesn't make sense to me — for m = ±1, the radial component can be nonzero at r=0. By setting Br to zero at r=0, you are introducing a first-order error — it should still converge with resolution, and may coincidentally be circumventing some other problem with the z PML, but it doesn't seem like the right solution to the latter problem. |
If the flux in the R direction is not going to zero with increasing radial cell size, I'd like to see a picture of the fields for a large-radius simulation — how are the waves even reaching the R boundary? The fields of a point source should decay with 1/r (so that the flux goes like 1/r^2) |
You could also look at Ez as a function of r for z ≠ 0 (since it =0 at z=0 by symmetry), since that is what creates the Poynting flux. It would also be good to simply plot the Poynting flux (through a plane) vs r. |
For an empty cell and a CW source, the steady-state For reference, the scripts used to generate these results are provided in two gists: 1 (flux) and 2 (fields). Summary When using a pulsed source, the only way to ensure that Unfortunately, this imposes a major computational cost because computing the flux for an Unless we figure out how to improve the |
A useful reference from Prof. Douglas H. Werner's group at Penn State EE which provides the discretized equations for FDTD in cylindrical coordinates is Radio Science, Vol. 48, pp. 232-47, (2013). The Yee grid shown in Figure 1 of this paper is identical to our Yee grid. Section 2.2 "Singularity Issues of Electric and Magnetic Fields on the Axis of Symmetry" states: "Due to the singularity of the field components ( This seems to be consistent with our implementation in Additionally, Appendix B of the paper provides the update equations for the special case of It would be good to compare these equations with our implementation in |
edit (5/26/2023): the Looks like all that is required to fix this bug is to remove the special case of With this one change, the |
m
= ±1m
= 0, ±1
Can you check that the field output for Er and Ep looks okay at r=0 after this PR? The comment on the code says this was originally for visualization, but maybe it was superseded by some later change. |
The ( Here are plots of the steady-state fields at Based on these results, I think we can go ahead and merge this PR. |
An addendum in case the results in this PR are referenced in the future. It is important to note that As a check, I verified that the raw values of the |
Closes #2182.
It turns out there is a bug in the$z$ -PML at $r=0$ for $m=\pm 1$ . This is due to the current setup of step-db which involves manually zeroing the $D_z$ fields at $r=0$ :
meep/src/step_db.cpp
Lines 342 to 347 in d370f1a
The$B_r$ fields had been omitted. This meant that the $z$ -PML at $r=0$ was incorrect and thus the incident fields were bouncing around indefinitely as reported in #2182.
This PR also includes a new unit test based on the results in #2182. The test verifies that the flux radiated by an$E_r$ point source at $r=z=0$ in vacuum (schematic below) converges with the simulation runtime. This test is currently failing on master.