Open JamesWhitehead5 opened 3 years ago
Hi there!
Unfortunately, I think this is actually a bug in the GetFieldsOnGrid
method. Long ago, during my masters degree, I recall running into the same issue you're seeing here (a symptom of which is, the z-components of the field come out wrong for anything not normally incident). I fixed it while I was using this code. Nowadays, I think this fork of S4 is the most actively maintained fork by brilliant scientists who share their work openly.
I recommend using that fork. It's been modernized and cleaned up a lot.
Hope that helps!
Issue
When testing a simulation with a non-zero polar angle of the excitation planewave of a single "vacuum" layer, the returned field from calling the GetFieldsOnGrid is spatially uniform in magnitude and phase. (Tested on the current OSX lua binary and an old python api compiled from source)
However, sampling the field on a grid (that is normal to the z axis) using the GetFields method yields the expected results for a plane wave incident at an angle.
A possible explanation is that GetFieldsOnGrid returns the field parallel to the incident plane wave. If this were the case, then the documentation does not reflect this.
Replication of issue (Python2.7)
Solution
If this behavior is intended, then adding documentation to the API entry
GetFieldsOnGrid
would fix this issue.