modesolverpy icon indicating copy to clipboard operation
modesolverpy copied to clipboard

Fixed minor bugs and added functionality.

Open AlexanderSchlager opened this issue 1 year ago • 0 comments

Thank you very much for the code, it has been a big help in my studies and research! I fixed some minor bugs, which might cause problems in very specific cases and added some functionality, if you want to include that.

(1) In structure_base.py on line 136, I changed a y_step to x_step (which has been mentioned in an issue as well), as it is inconsistent. The initial code causes errors if you use a non-uniform grid. There is also the fact that another stepsize is added to x, but not to y. I tried to fix this, but it caused further errors, so I assume this is on purpose.

(2) In structure_base.py on line 372, I removed a +1 stepsize for the discretized height. Even if you choose a stepsize for the layers, such that is correctly discretised (e.g. 10nm stepsize for a 100nm layer), this line of code will still add another self.y_step (in this case 10nm) to the layer thickness and cause it to be larger (110nm) instead. While this might not be an issue for small stepsizes or a low amount of layers, this causes problems for larger stepsizes or many layers, such as in Bragg-mirror structures.

(3) In mode_solver.py I added the functionality to save the x, y values in addition to the electric field amplitude. This was very useful for me in further simulations and I thought it might be useful for others. For now, it's very crude and simply overwrites the initially saved data, such that plotting still works the same, but it works.

If there is any reason as to why (1) and (2) have been done this way, please let me know! Thanks a lot!

Best regards Alex

AlexanderSchlager avatar Aug 01 '22 11:08 AlexanderSchlager