NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.24k stars 626 forks source link

bug in splitting 2d cell with cylindrical coordinates and z-mirror symmetry into multiple chunks #1506

Open oskooi opened 3 years ago

oskooi commented 3 years ago

1499 seems to have revealed a latent bug when splitting a 2d cell with cylindrical coordinates and z-mirror symmetry into multiple chunks. There are two separate tests in tests/symmetry.cpp which involve a cylindrical cell with z-mirror symmetry: test_cyl_metal_mirror and test_cyl_metal_mirror_nonlinear. Both of these tests fail whenever the cell size is changed slightly from the existing volcyl(1.0, 1.0, a) to e.g. volcyl(1.0, 1.1, a) or volcyl(1.0, 0.8, a), or alternatively the resolution a is changed slightly from 8 to e.g. 9 (for test_cyl_metal_mirror) or from 16 to e.g. 17 (for test_cyl_metal_mirror_nonlinear). The test failure is also independent of the chunk division: it does not matter whether the cell is split in either the r or z directions.

It is just a coincidence that the current choice of the cell size and resolution in these tests cause them both to pass. As a result, these two tests should be disabled until this bug is resolved.

stevengj commented 3 years ago

Does it depend on whether the cell is an even or odd number of pixels in the mirror direction?

oskooi commented 3 years ago

Yes, it seems that whenever the size of the chunk in the z-direction with no mirror symmetry is an odd number of pixels the test fails and whenever the size is an even number of pixels, it passes.