victorliu / S4

Stanford Stratified Structure Solver - Electromagnetic simulator for layered periodic structures
http://www.stanford.edu/group/fan/S4/
GNU General Public License v2.0
131 stars 149 forks source link

Cannot produce simple Talbot carpet #106

Open matt8s opened 2 years ago

matt8s commented 2 years ago

Thank you to Victor Liu, Phoebe Pearce, and others for this great code.

Unfortunately, I have some issues doing relatively simple things with this code. I tried to produce a simple Talbot carpet pattern, but the code (which is only slightly modified from the PythonTest.py in Phoebe-P's version), does not work. I have attached this test code, Talbot_S4.py, as well as an equivalent, working code, talbot_fields_inkstone.py, that runs with the inkstone port. (Both codes are uploaded as .txt files as GitHub does not allow .py file uploads.)

phoebe-p commented 2 years ago

This is very strange. I downloaded your code and tried to run it and had the same issue, but if I change the number of Fourier orders from 100 to 9 I no longer get NaN (although I don't know if the results are reasonable). I realise this does not solve the issue but perhaps it gives a starting point for further investigation...

P.S. Thank you very much for making me aware of Inkstone, I did not know about it before

matt8s commented 2 years ago

Thank you for your prompt response. Yes, the code does run for me with up to 12 Fourier orders, but not for 13 or higher. The code seems to converge with this number of orders, so while it would be nice to enable arbitrarily large numbers of Fourier orders, I think this is good enough for my purposes!