flexcompute / tidy3d

Fast electromagnetic solver (FDTD) at scale.
https://docs.flexcompute.com/projects/tidy3d/en/latest/
GNU Lesser General Public License v2.1
186 stars 40 forks source link

Unify and test `eps_model` #1372

Open momchil-flex opened 9 months ago

momchil-flex commented 9 months ago

Currently eps_model works for a list of frequencies in some cases, and not in others. I encountered this before as well, in fact I think I fixed it for anisotropic media, but it's still an issue for custom media. The method docstring actually suggests that only a float should be passed, but I believe there are many instances where we pass an array instead. Ideally we should make this consistent across all media, or it will keep popping up. We can discuss whether to make it work for a list of frequencies or not (I am not sure what would make most sense for CustomMedium), but basically we should either

tylerflex commented 9 months ago

probably a good idea to nail this down yea.

I dont think it should be too hard to make things work with floats and arrays, and if we can get that to work, we can probably refactor things to take lists too (convert to arrays, run, and convert back), but if this doesn't work, I think it wouldn't be too bad as long as we're explicit.

For testing purposes we could just utilize SIM_FULL, which should have all mediums in it ideally.

Just iterate through the structures in SIM_FULL and call structure.medium.eps_model() passing a float, list, and array?