fancompute / legume

🌱 Guided-mode expansion of photonic crystal slabs
https://legume.readthedocs.io/
MIT License
102 stars 27 forks source link

Calculation of E/D Fields via Curl of H Field #50

Open Alex-Meek opened 1 year ago

Alex-Meek commented 1 year ago

Regarding taking the curl of the H field in real space to get E/D fields: #24 @momchilmm

I'm currently trying to implement the method of taking the curl of the H field in real space to first get the dielectric field and then the electric field - but I'm getting some odd results and wanted to make sure I'm not on a fools errand with the method I'm using.

To get the D field in xz plane at y1, I call get_eps_xz to get the H field in three xz planes at y1, y1+step, y1-step. Then with that data I calculate the curl at all the points in the y1 plane, with the derivatives in the y direction taken across these planes. Is this what you had in mind in #24?

Thanks

momchil-flex commented 1 year ago

Yeah, that sounds like what I had in mind. However I'm really not sure if that can lead to any improvement. I think the H fields are not "obviously" wrong in that at least they don't have spurious discontinuities, but in reality they are probably similarly wrong and this may just be a limitation of the method, especially in cases when the field is localized in air, as mentioned in the other issue. Basically, the expansion basis is not complete and it does not have functions that can capture the true field dependence. Interestingly though in many cases the frequencies and Q factors are very close to correct even for modes localized in the holes...

Alex-Meek commented 1 year ago

Okay, makes sense. So far I haven't been able to get decent results, but I'll probably return to this in future. Not sure whether this should remain open or not, so I'll leave it to your discretion. Thanks!