tiagoecmagalhaes / PyWolf

PyWolf is a software to perform simulations of partially coherent light propagation using parallel computing devices through PyOpenCL
GNU Lesser General Public License v3.0
3 stars 1 forks source link

spatial resolution of the source plane #6

Open hfdihfd opened 1 year ago

hfdihfd commented 1 year ago

Thank you so much. It is a great job and has inspired me a lot. But I would like to ask why the spatial resolution of the source plane has a big impact on the spectral density of the image plane? How should I choose the right resolution for a particular problem?

tiagoecmagalhaes commented 1 year ago

Thank you! This is one of the biggest issue of PyWolf and it is something that I will try to improve in the next version. The simulation is based on the Fast Fourier Transform algorithm, which means that the spatial resolution in the observation plane is determined by the spatial resolution of the source plane (and also the distance, frequency and matrix size). This equation is in the paper of PyWolf (Eq. 40 of the open-access paper). To choose the right resolution, you need to go "the other way around" and see if you can "adjust" the frequency, source spatial resolution, matrix size, distance or frequency so that you get your desired spatial resolution in the observation plane.

What I am planning to do in the next version is to "remove" this dependence so that one can specify the spatial resolution in both planes without any impact between them.

Paper [Eq. (40)]: https://doi.org/10.1016/j.cpc.2022.108336

hfdihfd commented 1 year ago

Thank you very much for your reply. I still have a question, why is the coherence degree of the source obtained when calculating the annular coherent source all 0? I'm learning the coherent stuff of coherent optics and I don't understand why it's not a ring?

tiagoecmagalhaes commented 1 year ago

It depends. If it's coherent, the spectral degree of coherence should be approximately one. Example: image image image Note that to see the source spectral degree of coherence (SDC) you need to update your point on top (e.g., x_1,y_1 = 107)

In this case, since the source is coherent, the image is just the Fourier transform of the source (a Bessel-like function), which is the Fourier optics case (I think this example is also on the paper). And the degree of coherence is 1. Note that the value on the y-axis for the SDC (2D & 1D) can be misleading (e.g. 0.6 x1E-7 +1 is approximately 1). See images below:

prop_image prop_sdc_2d prop_sdc

hfdihfd commented 1 year ago

image It turns out that I didn't know before that I still need to update x_1 and y_1 at the top. But there may be a problem with my python, and the update will not make any changes.

tiagoecmagalhaes commented 1 year ago

The number "107" depends on the matrix size. Mine is 200, so the center of the ring is 100. Since the inner radius is 7 pixels, I added 100+7. Example: If you are using N=64, you can select 64/2 + 7.

I forgot to mention the following. The spatial resolution may play a key role. In my case, the spatial resolution of the observation plane is about 5 micrometers, while the source spatial resolution is 1 mm. This means that if we do get a ring-like result, we should take into account what would be its dimensions, otherwise we will be "inside it" or too far away.

Furthermore, if we want to simulate coherent beams to see, for example, if they spread or not, we should use models like the Gaussian Schell-model beam and turn off the far-field approximation. Otherwise, we will just be using the classical wave optics approach.

hfdihfd commented 1 year ago

Thank you very much for your answer. I feel I gained a lot.