-
Notifications
You must be signed in to change notification settings - Fork 629
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
bug in z-PML in cylindrical coordinates at r=0 for m
=0, ±1
#2182
Comments
Lines 291 to 293 in 2aa9164
Use Make sure that one field value is not incorrect |
Here is a plot of the (magnitude of the complex) time-domain fields
For comparison, the same computation for fields at
|
I suspect this has nothing to do with the PML. In fact, you should be able to remove the PML in the z direction completely since the radial absorbers should still cause the field to decay. It seems like there is a problem with timestepping E_φ? |
It's a bit confusing to me that you show the fields going to a constant and somehow that's affecting the DTFT at a nonzero frequency? Can you look at the time dependence of E_φ more carefully? |
Removing the PML in the
In this example, the field oscillations are apparent unlike the previous example with PML in |
Some additional information related to #2076 and #2082 which also involved an sim.run(mp.dft_ldos(fcen,0,1),
until_after_sources=mp.stop_when_fields_decayed(20,
mp.Er,
mp.Vector3(),
1e-6)) Here, it turns out that using |
Would be good to review some papers on cylindrical FDTD and check that our equations match the ones in the literature for m = ±1. |
For reference in this discussion, the (non-discretized) Maxwell's equations in cylindrical coordinates implemented in an early version of Meep including a figure showing the Yee cylindrical lattice are provided in Section 1.2 and Figure 1.1 of this March 2005 document by David Roundy: http://ab-initio.mit.edu/~meep/meep.pdf. While that document does not contain any discussion of the special case of Lines 281 to 282 in 63cd51f
Lines 313 to 315 in 63cd51f
|
Looks like there is no bug after all in the step-curl update at Here is a comparison of two sources showing the flux values as a function of simulation time (after the source has turned off). The five data columns are: simulation time, flux +z, flux +r, flux -r, and total flux. Case 1 uses the same 1.
2.
import meep as mp
import numpy as np
resolution = 30 # pixels/um
s = 5.
dpml = 4.
cell_size = mp.Vector3(s+dpml,0,s)
pml_layers = [mp.PML(dpml,direction=mp.R)]
fcen = 1.
sources = [mp.Source(
src=mp.GaussianSource(fcen,fwidth=0.02*fcen,cutoff=10.0),
center=mp.Vector3(),
component=mp.Er
)]
sim = mp.Simulation(
resolution=resolution,
cell_size=cell_size,
dimensions=mp.CYLINDRICAL,
m=-1,
sources=sources,
boundary_layers=pml_layers
)
flux_plus_z = sim.add_flux(
fcen,
0,
1,
mp.FluxRegion(
center=mp.Vector3(0.5*s,0,0.5*s),
size=mp.Vector3(s,0,0)
)
)
flux_plus_r = sim.add_flux(
fcen,
0,
1,
mp.FluxRegion(
center=mp.Vector3(s,0,0),
size=mp.Vector3(0,0,s)
)
)
flux_minus_z = sim.add_flux(
fcen,
0,
1,
mp.FluxRegion(
center=mp.Vector3(0.5*s,0,-0.5*s),
size=mp.Vector3(s,0,0),
weight=-1.0
)
)
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
sim.plot2D()
plt.savefig('cyl_sim.png',dpi=150,bbox_inches='tight')
for t in [0, 100, 200, 400, 800]:
sim.run(until_after_sources=t)
flux_plusz = mp.get_fluxes(flux_plus_z)[0]
flux_plusr = mp.get_fluxes(flux_plus_r)[0]
flux_minusz = mp.get_fluxes(flux_minus_z)[0]
flux_tot = flux_plusz + flux_plusr + flux_minusz
print(f"flux:, {sim.meep_time():5.1f}, {flux_plusz:.10f}, "
f"{flux_plusr:.10f}, {flux_minusz:.10f}, {flux_tot:.10f}") |
I'm not sure it's the quasi-PML either. The basic issue is that at the Nyquist frequency the group velocity is zero, so the fields have a hard time decaying and escaping. I'm guessing that the problem at the Nyquist frequency is even worse in cylindrical coordinates, e.g. there might be a "waveguiding" effect that traps waves near r=0 around the Nyquist frequency, due to the r-varying discretization and numerical dispersion. So, the solution is just to be extra careful of exciting Nyquist-frequency waves in cylindrical coordinates. |
|
Looks like the bug is in the update The reason this bug has gone undetected until now is because it only affects the voxels at Lines 200 to 226 in 6abb8b3
|
The comment claims "this really only matters for field output", i.e. the curl equations don't depend on those components? |
From Section 2.3 "Absorbing Boundary Condition" of Radio Science, Vol. 48, pp. 232-47, (2013): "Here a generalized un-split field PML technique [Gedney, 1996; Taflove and Hagness, 2005] was employed to maximize the absorption of the outgoing waves in the PML regions in cylindrical coordinates for efficiently modeling BOR lenses within or on top of a layered medium. The detailed information and the derived formulas can be found in the reference [Taflove and Hagness, 2005]. Note that the choice of parameters used in the PML region depends on the local material properties." There is no mention of special PML update equations at |
m
=0, ±1
Based on the discussion in #2148 (comment).
In cylindrical coordinates, for a simulation with$m=\pm 1$ in vacuum with PMLs on all sides and an $E_r$ source at $r=0$ , the $E_r$ fields at $r=0$ are not absorbed by the PMLs in the $z$ direction. The fields therefore bounce around indefinitely and the total flux emitted by the source measured using a closed three-sided box of DFT monitors never converges with run time.
More details are provided in this gist.
The text was updated successfully, but these errors were encountered: