Random Perfection SPINS Output Verification
Closed this issue · 9 comments
Hi,
I am working on the initial SPINS example of wdm2.py and am having randomly perfected power outputs. These outputs, however, cannot be verified through Lumerical FDTD. Normally, I could verify any results from SPINS, but these are perfect results which always achieve power = 1.0. Instead, I get nearly the half of these results, power ~= 0.5.
Sometimes, I run a code and one another time I run it again, it gives completely different results than the other one, especially one is extremely perfect (output powers are all up to 1.0) no matter the two simulation runs are exactly the same.
Moreover, for the example above, the iteration count is adjusted to be 100 at the beginning, while SPINS is quite fast to reach objective. It finishes the simulation at 84th iteration.
To make sure it is not a problem of a specific SPINS folder, I downloaded another SPINS and installed it via another virtual environment, still getting the same perfect results. Also, I was normally working on Mac and then installed another SPINS on Ubuntu, still getting the same perfect results (the same run code). But none of the outputs can be verified on Lumerical, as suggested perfect outputs by SPINS.
An example of SPINS output power vs. iteration graph is attached.
Is there anyone can tell what could make SPINS persistently giving these perfect results, which seem not verifiable through FDTD? I can give more details, if needed.
Thank you.
Have you modified the gds files at all? I experienced this perfect power output a couple times and realized my background and foreground GDS files didn't line up precisely. I was also given a mismatch error at the end of the optimization resulting in unsuccessful output of the spins_design.gds file. Once I corrected the layout files I was given accurate results, hope this helps!
Hi @anthmanni, I am always changing my gds files according to my needs. I had the same error of "mismatch" as you did, too.
How did you "corrected" the layout files? Mines are basically just a bit longer than the default gds provided in wdm2.py.
Hi @iclibera, by lining up the files I mean making sure the foreground and background polygons all share the same exact points in regions where they overlap (i.e the input/output waveguides).
If you’re using KLayout, it’s good to have both files open so you can double click on each polygon to view their list of point locations and verify that they are the same for both files.
The optimization design region can be whatever shape you like (I think), but if the waveguide ports in your foreground don’t precisely match the ones in your background, you’ll get that mismatch error.
They do match well actually.
But, I do get mismatch error whenever I try a non-square design area. (This is another problem than this post, I will be getting to this one at the end of the post)
Plus, as I stated earlier, the simulation seems fine in working (it finishes and produces an output gds design), but the results it “seems” to give on jupyter notebook monitor example is just perfect. When I bring the output on Lumerical, I get completely different results than the perfect one.
While gds matching of bg and fg areas is important, it might not be the one I am looking for as for this case of perfect output I am pretty sure the points on input gds’ are fine. (an example perfect output design is simulated with sim_bg and sim_fg.gds files, which were only changed by their middle square area edges which are enlarged to be 2.5ums, instead of the lengths in the original design. note that the waveguide lengths are just adjusted according to the design area)
For clarification, can you make sim_bg and sim_fg have enlarged by length and not width to have 4x2 design area and have SPINS simulated well for this particular design?
@anthmanni it seems I can now simulate with any length of design area. Although having not understood the reason lying behind this problem, creating a fresh GDS made it work well as you suggested. Thank you!
Sorry for this addition, SPINS keeps throwing errors when I use non-square design area.
File "/Users/username/.pyenv/versions/3.7.3/lib/python3.7/site-packages/matplotlib/contour.py", line 1521, in _check_xyz
raise TypeError(f"Length of x ({nx}) must match number of "
TypeError: Length of x (202) must match number of columns in z (102)
Were you tackling with this one?
It seems I have figured the problem, which goes back to a matrix size change in "parametrization.py". I am referencing my own solution here as well: #35
But yet, I have not figured out the problem of having perfect power graphs. I am having lossy electric field distributions and yet the power vs. iteration graphs are always up to 1.0.
After simulating the output design on Lumerical FDTD, I am having pretty much the same graphs as the electric field distribution graphs out of SPINS, but the power outputs not even near to Lumerical results.
Anyone may comment on this nonsense power results? (the SPINS simulation even finishes itself earlier than the target iteration, as it arrives at the lowest objective point)
Is this still an issue?