Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: complex refractive index of medium #19

Open
Melowa opened this issue May 15, 2018 · 3 comments
Open

Error: complex refractive index of medium #19

Melowa opened this issue May 15, 2018 · 3 comments
Labels

Comments

@Melowa
Copy link

Melowa commented May 15, 2018

Running the example file CELES_MAIN.m with a non-zero imaginary part of 'mediumRefractiveIndex' causes the execution to terminate with an error right after it says
"compute scattered field plane wave pattern:"
The error is:
"Error using celes_planeWavePattern/validatePropertiesImpl (line 123) invalid k value: Expected input to be real."
the refractive index I used was 1.2 + 0.01i and the light wavelength 500. Also, output.initialFieldPower is complex, with large imaginary part, in my case 3.7e6 + 3.1e4i.
Does anyone else have this issue?

@AmosEgel
Copy link
Contributor

Hi Melowa!

Unfortunately, the case of a surrounding medium with absorption is currently not implemented. This is why the code complains when you try to define a complex refractive index.

According to @lpattelli You can tweak the code to run also with a complex refractive index of the surrounding medium by commenting lines 122 and 123 of the file celes/src/classes/celes_planeWavePattern.m (the lines that check for real refractive index and throw the error you get). However, I don't know if the fields that you compute that way will be correct. Also, I don't see how the far field power of the initial field or the scattered field could be defined in a meaningful way if you have an absorbing surrounding medium.

As @lpattelli has further pointed out, the MSTM code by Daniel Mackowski has a setting for medium_imag_ref_index, so maybe you can consider using that code instead of CELES.

@AmosEgel
Copy link
Contributor

Maybe we should leave it open such that people who obtain the same error can see this.

@AmosEgel AmosEgel reopened this May 15, 2018
@Melowa
Copy link
Author

Melowa commented May 15, 2018

Thanks, this is very helpful! I was simulating particles in water. For my wavelength of interest the imaginary part of the medium refractive index is anyway small, so I will neglect it. In principle I am only interested in a finite region of space (without far field).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants