Add symmetry axes in invdes optplan
Opened this issue · 4 comments
Hello,
Would it be possible to add two more symmetry constraints to the invdes optplan? I've been trying to find how the symmetry condition is actually applied in the algorithm with no luck. I'd basically like to add ±45° rotated axes as mirror symmetry planes along with the X and Y mirror symmetries, to have 4 total symmetry constraints.
If it's not possible in invdes, could it be done in goos?
Thank you,
Anthony
For anyone who comes across this, I have added this capability to my fork here.
The symmetry array now takes 4 bits, representing (respectively) vertical, horizontal, primary diagonal, and secondary diagonal symmetry. See the comments in spins/invdes/parametrization/cubic_utils.py for more info.
Is this symmetry for the device structure or only for the EM solver? I.e., does it mirror the structure or does it just simplify the simulations on the solver's end? I've added a symmetric structure functionality to my code, where it mirrors the dielectric distribution across different axes and takes the average (similar to how MEEP's inverse design package implements design symmetry). However, I'm having an issue with the GDS file that spins produces. The final permittivity distribution (LEFT) looks perfectly symmetric as I want, but the resulting "spins_design.gds" file (RIGHT) does not show this symmetry...
Some details regarding the simulation - I'm designing a "polarization demultiplexer," which separates the emission from x- and y- oriented electric dipole into distinct output waveguides (maximizing the coupling to the desired single mode waveguide while suppressing coupling into the undesired one).
Apologies if this issue isn't relevant to the symmetry capability that @cschwarze1 added to their fork, but any insight into this would be appreciated. I haven't successfully figured out how spins is generating this GDS file to fix myself.
Thanks!
Hi @WillE9a . Here is a little background on how the symmetry code works. The symmetry settings modify way the device structure is parametrized. In particular, the permittivity tensor is internally represented as a column vector, and with assumed symmetry constraints, that vector can be losslessly compressed and uncompressed using linear transformations that map between spaces of different dimensions. The optimization methods update the compressed form of the vector, but the full uncompressed system is still simulated with the EM solver. So in short, the code reduces the parameter space, but does not reduce the EM solver complexity.
For your issue, I'm assuming you only have diagonal symmetry constraints selected. Are you sure the dielectric distribution shown on the left is the one being passed to the gds code? It may be that the distribution converted to a gds file is the final distribution, which wasn't yet mirrored/averaged.
Thanks for the reply @cschwarze1. Yes this was a device with only diagonal symmetry, and I have the GDS issue fixed now though. In my symmetry implementation I used the "get_structure()" method in my parametrization class to mirror the structure across a chosen axis or diagonal. Spins, however, does not use this method to access the structure when producing the GDS. It seemed reasonable to assume spins was using the "get_structure()" method to, well, get the structure to convert to the GDS file... To fix, I simply added the structure mirroring capability to the "generate_polygons()" method. A quick test optimization shows the expected symmetry now!