Closed oskooi closed 2 months ago
Turns out there is no bug after all in the flux calculation in $-z$. I just needed to specify weight=-1.0
in the FluxRegion
object for the $-z$ flux which had been left out by mistake.
With this change, the results are as expected: method (2), independent of the orientation of the flux monitors enclosing the point dipole, produces the same flux as (1). The relative error in the two methods seems to converge to zero with increasing resolution.
dipole_power:, 3.691984 (LDOS), 3.686698 (2a: flux-closed), 3.755602 (2b: flux-open-plus-z), 3.617795 (2c: flux-open-minus-z)
flux_mon_closed = sim.add_flux(
frequency,
0,
1,
mp.FluxRegion(
center=mp.Vector3(0.5 * (sr - PML_UM), 0, 0.5 * sz - PML_UM),
size=mp.Vector3(sr - PML_UM, 0, 0),
),
mp.FluxRegion(
center=mp.Vector3(sr - PML_UM, 0, 0),
size=mp.Vector3(0, 0, sz - 2 * PML_UM),
),
mp.FluxRegion(
center=mp.Vector3(0.5 * (sr - PML_UM), 0, -0.5 * sz + PML_UM),
size=mp.Vector3(sr - PML_UM, 0, 0),
weight=-1.0 # -z direction
),
)
flux_mon_open_plus_z = sim.add_flux(
frequency,
0,
1,
mp.FluxRegion(
center=mp.Vector3(0.5 * (sr - PML_UM), 0, 0.5 * sz - PML_UM),
size=mp.Vector3(sr - PML_UM, 0, 0),
),
mp.FluxRegion(
center=mp.Vector3(sr - PML_UM, 0, 0.5 * sz - PML_UM - 0.125 * (sz - PML_UM)),
size=mp.Vector3(0, 0, 0.25 * (sz - PML_UM)),
),
)
flux_mon_open_minus_z = sim.add_flux(
frequency,
0,
1,
mp.FluxRegion(
center=mp.Vector3(0.5 * (sr - PML_UM), 0, -0.5 * sz + PML_UM),
size=mp.Vector3(sr - PML_UM, 0, 0),
weight=-1.0 # -z direction
),
mp.FluxRegion(
center=mp.Vector3(sr - PML_UM, 0, -0.5 * sz + PML_UM + 0.125 * (sz - PML_UM)),
size=mp.Vector3(0, 0, 0.25 * (sz - PML_UM)),
),
)
There seems to be a bug in the calculation of the Poynting flux in the $-z$ direction in cylindrical coordinates. This is demonstrated using a simple test case involving a point-dipole source for $E_r$ at $r \approx 0$ for $m = -1$. The radiated flux from the point dipole is computed using two different methods: (1) LDOS and (2) DFT flux monitors. The radiated flux should be the same (up to discretization error) using both approaches.
The test seems to be valid only when method (2) involves computing the flux in the $+z$ direction. Whenever the flux is computed in the $-z$ direction, the result is incorrect. This is demonstrated in several test cases shown below.
DFT flux monitor in $r$ and $+z$. PML in $r$ and $+z$.
2a. DFT flux monitor in $r$, $+z$ and $-z$. PML in $r$, $+z$, and $-z$. [INCORRECT]
2b. DFT flux monitor in $r$ and $+z$. PML in $r$, $+z$, and $-z$. [CORRECT]
note: flux is multiplied by two because it is being collected in half the necessary area.
2c. DFT flux monitor in $r$ and $-z$. PML in $r$, $+z$, and $-z$. [INCORRECT]
note: flux is multiplied by two because it is being collected in half the necessary area.