Question

Fresnel lens optimization wizard issue

  • 29 November 2021
  • 10 replies
  • 331 views

Hi, 

I am trying to calculate and optimize a Fresnel lens in NS. I have the following design, where I have made variable the radius of curvature and the first 2 coefficients on the even radial power in the lens editor:

 

I have created a simple merit function to minimize the RMS so that it could calculate the values I made variable in order to keep a constant focal distance (that here I am assuming it is the distance of the detector from the lens):

When I run the optimization nothing happens! Am I forgetting something in the wizard editor?

Thank you to anybody will reply me!

 


10 replies

Userlevel 7
Badge +2

Hi Giulia,

 

You are missing a NSTR operand. Probably after you clear your detectors in operand 4.

Excerpt from the Help File (The Optimize Tab (sequential ui mode) > Automatic Optimization Group > Merit Function Editor (automatic optimization group) > Optimization Operands by Category > Non-sequential Ray Tracing and Detector Operands):

Non-sequential trace. Src# refers to the object number of the desired source. If Src# is zero, all sources will be traced. If Splt? is non-zero, then splitting is on. If Scat? is non-zero, then scattering is on. If Pol? is non-zero then polarization will be used. If splitting is on polarization is automatically selected. If IgEr? is non-zero, then errors will be ignored. See “Optimizing with sources and detectors in non-sequential mode” for complete details.

An NSDD, NSDE, or NSDP operand with Det# set equal to 0 must be included in the merit function prior to this operand.

See also NSST.

 

Did you actually generate this Merit Function with the Wizard?

Let me know if this helps.

Take care,

 

David

Dear David, 

thank you so much for your fast reply! I have optimized then my system in order to have the minimum RMS on the detector and found focal length, periodicity and coefficients for the Fresnel lens:

I am not sure about the spot appearance… are these hot pixels normal..?

I will look around for some articles/tutorials!

Best,

Giulia.

Userlevel 7
Badge +2

Hi Giulia,

 

No problem. Just to make sure I understand correctly. The Detector Viewer is zoomed in on a particular hot pixel, is that right? To me, it looks more like a spot where some rays were concentrated somehow. Is it possible to see the whole Detector?

One thing I can say from your Detector Viewer window is that your detector is 1000 x 1000 or 1 million pixels, and the number of hits is 977398, close to 1 million as well.

This means that you are probably undersampling your pixels in some regions of the Detector. Usually, I think Zemax recommends at least 100 hits per pixel, even better would be 1000 hits per pixels. One way to check if you have undersampling issues is to run consecutive raytraces and look at the Detector Viewer after each raytrace. If the image you see changes between raytraces, you probably want to increase the number of rays you trace, or try to minimize the losses during the raytrace. These are the rays that are launched from the source, but get lost in your system.

Does that make sense?

Take care,

 

David

Hi David! Sure, the whole detector looks like this: 

So, this means that almost everything falls on the detector right? And the power I am losing is not that high, right?

Should I reduce the number of pixels then to get more rays hitting one single pixel? I am running already 1000000 rays..

Best,

Giulia.

Userlevel 7
Badge +2

Hi Giulia,

 

You are right, I could have noticed it from your screenshot as well. From the 1 million ray you trace, only a few get lost on the way. But this doesn’t change the fact that on average you have 1 ray per pixel. We can see from your image that most pixels don’t recieve any energy. The two things that would be interesting to know is where the rays land, and what density of rays per pixel you achieve in those regions. As I said before, I would try to have at least 100 rays per pixels. The other thing to try is what happens to your “hot spots” when you run consecutive raytraces? Are they always in the same location?

Take care,

 

David

Dear David,

thank you again.

100 rays per pixel means, for example, 10000 ray trace on a detector having 10 x 10 pixels:

It doesn’t make much sense…

Regarding the consecutive ray trace, should I do it by writing a routine or is there a way to do it directly in the Zemax interface? (again, these might be basic questions, sorry for that),

best 

Giulia.

Userlevel 7
Badge +2

Dear Giulia,

 

The 100 rays per pixel is a rule of thumb. It does not apply universally, but is a good starting point.

I think I didn’t explain what I meant carefully. Let me show you what I had in mind with an example (also attached to my post).

I’ve used a Source Gaussian that I shine onto a 100 x 100 Detector Rectangle, and I’m manually increasing the number of rays from 100 to 1000000.

Since the rays are drawn randomly from a Gaussian distribution I need to make sure I draw enough of these rays to get an accurate representation of my source. As you can see in my screenshot above, with 100 rays it is clearly not enough. To me, only after 100000 rays do I get a representation I’m satisfied with. This would be 10 rays per pixel. In this particular case, I needed less than the 100 rays per pixels but it is also because everything is relatively “smooth”. My source doesn’t fall onto an object with a high density of features, such as a Fresnel lens. The point is, I’m not sure if it is what is causing your hot spots, but you definitely want to check your sampling (how many rays per pixels).

For that purpose, I would suggest to manually run a couple of raytraces, and just check how the detector viewer looks like. Does it changes a lot between raytraces? You don’t really need the API to do that. You could open two detector viewers, run a raytrace, lock one of the detector viewers (using the “Lock” icon), then run a second raytrace. How do the images look like? Are the hot pixels in the same location?

Let me know if this makes sense.

Take care,

 

David

Hi David, I have tried (attached), 100, 1000, 10000 and 100000 rays /pix. From what I see the result doesn’t change.

Looking around I found this posted article:

If you take a look at the detector encompassed in this file, you will see the same spot geometry… Should I consider it correct, then?

Take care,

Giulia.

Userlevel 7
Badge +2

Hi Giulia,

 

Sorry, I think I was confused. The hot spot you are talking about is only the bright spot in the center of your detector, is that right?

I think it is just the Fresnel lens focusing the rays according to your Merit Function. Nothing to worry aobut, I think this is correct indeed.

Take care,

 

David

Dear David,

thank you very much again for your precious help.

I wish you all the best,

take care,

Giulia.

Reply