Open Andeloth opened 1 year ago
or EigenmodeSources
With an Eigenmode source, you just specify a k-vector pointing in the direction you want (as described in that tutorial you linked). You can do the same with a Gaussian beam source etc. In fact, you can do the same with any source using the Principle of Equivalence.
It would be good to implement monitors in arbitrary directions
Just place monitors in all orthogonal directions (x,y,z) and the relative powers will describe the final vector. This is how commercial codes tend to do it under the hood (from what I've seen). They "draw" a diagonal monitor in their GUI, but they "trace" a projection of it along the yee grid using orthogonal monitors and do a quick post-processing step (e.g. a simple inner product).
I see, that makes sense. Is that included somewhere in the documentation? If not, this issue could be converted to a documentation issue and it would be nice to post this info somewhere on readthedocs.
It's not documented AFAIK.
It might be nice to add a wrapper function that places the projected monitors for you (the user could just supply two opposite corner locations of the plane, and the routine does the rest under the hood).
See the tutorial on eigenmode sources for oblique waveguides; mode monitors should be essentially the same.
Currently there is no way in meep to place monitors (or EigenmodeSources, see https://meep.readthedocs.io/en/latest/Python_Tutorials/Eigenmode_Source/, though the source part is not that important), since FluxRegions don't have a Vector3Type argument for direction, just an int for the Cartesian axis to use as the direction (See https://github.com/NanoComp/meep/blob/c376694f8b094d9aa50499ee4667d4388f98f6dd/python/simulation.py#L499.)
It would be good to implement monitors in arbitrary directions for cases where the flux should be computed normal to a direction which is not a Cartesian axis direction. Technically one could use a DFT Monitor in the same dimensionality as the simulation (1 more than would be needed for a flux plane/line) and calculate the flux at arbitrary angles along a "diagonal" of the region, but that is quite annoying. If I'm wrong and there is a way to calculate flux along a non-Cartesian direction with the current flux monitor implementation then please correct me, I'd like to know.
That being said, I expect this would have relatively rare use cases, but I wanted to post this while I was thinking of it. I'm mostly leaving this here for future reference so that eventually if I get to it I will remember to work on this.