edmundsj / rcwa

Rigorous Coupled Wave Analysis for the calculation of Photonic Crystal R/T spectra
MIT License
93 stars 29 forks source link

Wrong efficiencies for large periods #68

Open hag174 opened 1 month ago

hag174 commented 1 month ago

The RCWA delivers wrong efficiencies for large periods compared to the wavelength. I'm using a dielectric rectangular linear grating. The wavelength is 0.5 microns, the period ist 50 microns and the groove width is 25 microns. 301 harmonics are used and the source is a plane wave with theta = 0.00001 and phi = 0 degrees angle. The transmission efficiency looks like that: image Reducing the the period to 10 microns and a groove width of 5 microns leads to good results: image

hag174 commented 1 month ago

This problem seems to be caused by almost singular matrices which appear in matrices.py especially in functions MatrixCalculator._S_matrix_internal(self) and D_matrix(Ai, Bi, Xi). Replacing np.linalg.inv by np.linalp.pinv significant improves the results but still the efficiencies are not correct. The energy conservation is still violated. That means reflected + transmitted + absorbed power is not equal to one. Any ideas to further improve that?