NanoComp / meep

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

Missing unit test for adjoint gradients in 3D #2661

Open oskooi opened 9 months ago

oskooi commented 9 months ago

Currently, all of the unit tests for the adjoint gradients in test_adjoint_solver.py are based on a 2D simulation. Even though we have used the adjoint solver for 3D simulations (e.g., optimizing 2D gratings), there are no such unit tests.

The 3D tests should check two different configurations of the design region via the MaterialGrid:

  1. a 2D topology in the $xy$ plane which is extruded in $z$ such as a cylinder.
  2. a fully 3D topology such as a sphere or cuboid.

We should also test the single and multifrequency case. For the latter, we should test narrow and broad bandwidths (similar to #2307).

Given the generally larger size and runtime of 3D tests, we may want to separate these tests from the existing suite in make check.

stevengj commented 9 months ago

A quicker test of essentially the same functionality would be a 2d calculation with a 1d material grid.

MarkMa1990 commented 8 months ago

looking forward to have such test