You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#2103 described a procedure to compute the mode coefficients of a triangular lattice using a normally incident source for which k_point = 0. However, it is not possible to extend this procedure to an oblique source involving a nonzero k_point. This is because, as shown in the code snippet below, there is a bug in fields::get_eigenmode of src/mpb.cpp which occurs whenever the cell volume is modified internally from whatever the user had originally specified due to: (1) rounding of the cell dimensions to an integer number of pixels and/or (2) applying a symmetry operator which changes the cell dimensions (and may also involve padding the cell by a voxel).
Any change to the cell dimensions (v) in the periodic directions causes the check on line 339 against the dimensions of the DFT monitor (eig_vol) which extends the entire length of the unmodified cell in the periodic directions to fail: float(eig_vol.in_direction(dd)) == float(v.in_direction(dd). As a result, the variable kpoint is 0 rather than the k_point of the Simulation object. The wrong modes are therefore used to compute the mode coefficients.
// if the mode region extends over the full computational grid and we are bloch-periodic
// in any direction, set the corresponding component of the eigenmode initial-guess
// k-vector to be the (real part of the) bloch vector in that direction.
vec kpoint(_kpoint);
LOOP_OVER_DIRECTIONS(v.dim, dd) {
if (dd != d && float(eig_vol.in_direction(dd)) == float(v.in_direction(dd)))
if (boundaries[High][dd] == Periodic && boundaries[Low][dd] == Periodic)
kpoint.set_direction(dd, real(k[dd]));
}
To demonstrate this bug, we set up a test involving computing the diffraction orders of a 2D binary grating with triangular lattice. The test involves verifying that the sum of the power in all the reflected and transmitted diffraction orders (computing using mode decomposition) is equivalent to the total reflected and transmitted Poynting flux, respectively. There are two test cases: the incident planewave source is either (1) normal or (2) oblique. Results for (1) are correct but not (2).
The data shows the output of running the script below. There are two rows for the reflected (refl) and transmitted (tran) orders. The three numerical columns in each row are the (1) Poynting flux (flux), (2) sum of the flux of all the diffraction orders (orders), and (3) the relative error (error). The error is small for (1) but not (2).
#2103 described a procedure to compute the mode coefficients of a triangular lattice using a normally incident source for which
k_point = 0
. However, it is not possible to extend this procedure to an oblique source involving a nonzerok_point
. This is because, as shown in the code snippet below, there is a bug infields::get_eigenmode
ofsrc/mpb.cpp
which occurs whenever the cell volume is modified internally from whatever the user had originally specified due to: (1) rounding of the cell dimensions to an integer number of pixels and/or (2) applying a symmetry operator which changes the cell dimensions (and may also involve padding the cell by a voxel).Any change to the cell dimensions (
v
) in the periodic directions causes the check on line 339 against the dimensions of the DFT monitor (eig_vol
) which extends the entire length of the unmodified cell in the periodic directions to fail:float(eig_vol.in_direction(dd)) == float(v.in_direction(dd)
. As a result, the variablekpoint
is 0 rather than thek_point
of theSimulation
object. The wrong modes are therefore used to compute the mode coefficients.meep/src/mpb.cpp
Lines 334 to 342 in 619c879
To demonstrate this bug, we set up a test involving computing the diffraction orders of a 2D binary grating with triangular lattice. The test involves verifying that the sum of the power in all the reflected and transmitted diffraction orders (computing using mode decomposition) is equivalent to the total reflected and transmitted Poynting flux, respectively. There are two test cases: the incident planewave source is either (1) normal or (2) oblique. Results for (1) are correct but not (2).
The data shows the output of running the script below. There are two rows for the reflected (
refl
) and transmitted (tran
) orders. The three numerical columns in each row are the (1) Poynting flux (flux
), (2) sum of the flux of all the diffraction orders (orders
), and (3) the relative error (error
). The error is small for (1) but not (2).theta = 0
theta = math.radians(50.0)
The text was updated successfully, but these errors were encountered: