facebookresearch / fmmax

Fourier modal method with Jax
MIT License
95 stars 9 forks source link

Twisted photonic bilayer crystal slabs #109

Closed Kaeryv closed 5 months ago

Kaeryv commented 5 months ago

Nice work on FMMAX!

I'm interested in implementing twisted PhCs in FMMAX, following the paper of B. Lou.

In particular I'm interested in coupling this extension with you BZI sources (Lagrange-Gaussian beams). Are you open to external contributors? I already have a WIP version in a code of mine.

Cheers

mfschubert commented 5 months ago

Hi @Kaeryv , thanks! Yes, we welcome (and hope for) contributions. This sounds like a very interesting project that could make for a great example and probably also require some additions to the core fmmax modules? If major changes are required we can address those during review or discussions as you proceed.

Kaeryv commented 5 months ago

I can write an example out of it for sure. I've got two in mind related to my current work :)

From my current implementation, the extension requires two stacks whose expansions should be twisted at angle $\theta$. Each stack is evaluated at each-other's expansion vectors (as in-plane wavevector). Extended matrices are then built by element assignation of those two stacks's scattering matrices. For this, I think no change is required since access to the whole stack of S matrices is possible. Explicit ordering of Fourier components is also available using _standard_toeplitz_indices, which helps in building the extended Ss. The rest of the implementation should be also fine if the 'extended expansion' is built properly. This way we get already a lot of thing such as R/T/A...

For the fields FMMAX uses FFT while in my code (only for extension) I use naïve DFT as we only know a subset of g-vectors in the extension, this is both faster numerically (given the sparsity) and more accurate than a scheme where we build a dense fft grid using interpolation. If you have suggestions, I would be happy to hear!

Finally, while BZI sources work perfectly in my code for standard RCWA, I struggle with the extension. I still need to see of this comes from a bug in my fields or something more fundamental linked to the use of quasi-periodicity. I can elaborate on this in a discussion thread. This is the last shady area where I would welcome some input as I'm not familiar with BZI.

mfschubert commented 5 months ago

Sounds like you are off in a good direction. If you have some code that might help us catch up to where you are---I'm not sure I can add much without spending some more time thinking about this.

Nevertheless, I would be interested to understand the fields you are attempting to compute. And, if you could, please do elaborate on the issue you are seeing with BZI. We occasionally observe some oddities in simulation results, and need to do a better job documenting them and their mitigation. It may be that your problem is one that is already familiar to us.