OpticStudio grating tools beta function update history

  • 5 February 2021
  • 9 replies
  • 1357 views

Userlevel 6
Badge +2

This forum post is a place to collect update history of diffractive tools beta functions, which includes all RCWA DLLs (and visualization API), polygon DLL, and Zemax Grating Data (ZGD) DLL.

 

Content:

1. Overview
2. Resources
3. Change history

 

Overview

Currently in OpticStudio, we are adding some useful DLLs to enhance the ability of fully simualting gratings. They allow OpticStudio to consider the efficiency when rays pass through diffractive optical elements (DOE), such like 1D/2D gratings, binary optics, or volume holograms. These extensions can be found in OpticStudio installations.

These tools improve frequently based on users’ feedback. We decide to provide functions with DLL so it can be updaetd fast upon users' request. Between each OpticStudio public releases, there might be several minor updates and bug fixes. This forum post is a place for changes history.

Note all tools provided here are only available with OpticStudio Premium Subscription. If users are interested in these functions, they can wait stable version until next the OpticStudio release. Or they can send an email to support inbox to request for latest beta DLLs.

 

Resources

  1. Simulating diffraction efficiency of surface-relief grating using the RCWA method
  2. Simulating diffraction efficiency of a volume holographic grating using Kogelnik's method
  3. How to simulate exit pupil expander (EPE) with diffractive optics for augmented reality (AR) system in OpticStudio: part 1 (part 2, part3)
  4. EMPossible
  5. Kogelnik, H., 'Coupled wave theory for thick hologram gratings, ' Bell Syst. Tech. J. 48, 2909-2947 (1969).
  6. Elias N. Glytsis and Thomas K. Gaylord, 'Rigorous 3-D coupled wave diffraction analysis of multiple superposed gratings in anisotropic media,' Appl. Opt. 28, 2401-2421 (1989)
  7. M. G. Moharam, Drew A. Pommet, Eric B. Grann, and T. K. Gaylord, 'Stable implementation of the rigorous coupled-wave analysis for surface-relief gratings: enhanced transmittance matrix approach,' J. Opt. Soc. Am. A 12, 1077-1086 (1995)
  8. Han-Hsiang Cheng and Xiaochaoran Tian 'An advanced ray-tracing model for multi-color holographic optical elements', Proc. SPIE 11188, Holography, Diffractive Optics, and Applications IX, 1118817 (18 November 2019); https://doi.org/10.1117/12.2537762

 

Change history

2023-08-07

  • The maximum of parameter Max Order now supports up to 50. It’s limited mainly for fool-proof, but it’s realized to be too low.
  • The DLL now allows more grating cache data in the memory. It was set low to avoid memory accumulation too high during optimization. However, it’s realized this can slow down the optimization when multi-wavelength is used as the cache can be deleted too often.

2023-07-04

There is not update to the DLLs, but here we want to update explanations for srg_step2_RCWA.dll. The parameters in the geometry looks as following picutre. If the refractive index of any layer is set to zero, the refractive index will use what ever the background is, which is similar to you trun off the layer itself.

2022-12-21

The previous change to 2022-10-28 for srg_step2_RCWA.dll is not correctly implemented and is fixed now

2022-10-28

srg_step2_RCWA.dll has changed its rule. Before when setting parameters “Index Grate 2 (R)”, “Index Grate 3 (R)”, “Index Grate 4 (R)” to 0, it means the refractive index at these 3 layers are copied from layer 1. Now they will have the same refractive index as the substrate. This is same rule as the “Index Grate 1 (R)”.

2022-9-26 & 2022-9-30

Fixed an issue of loading dispersion file (coating_xx.dat) for RCWA 1D and 2D DLLs.

2022-9-13

Fix a bug that the parameter Grate Index 2~4 in the “srg_step2_RCWA220209.dll” are not considered correctly.

2022-5-13

There was a bug in Stochastic mode. When calculating power of each order, the power is wrongly calculated as Ex^2+Ey^2+Ex^2. This is fixed now.

2022-2-9

Fixed a bug in “srg_step2_RCWA220209.dll”. The bug behavior was that if you change a value for a parameter of the DLL, the change will actually be applied to the other parameter and the value of the original parameter that you want to change keeps same.2021-11-1

When using Stochastic mode, there was a bug where the diffracted ray’s power is larger than expected when metal is used in the grating. Note this is fixed.

Note from this version, the Stochastic mode 1 and 2 are deprecated and it’s always same as mode 3 in old version as long as this parameter is set as non-zero.

2021-11-1

When using Stochastic mode, there was a bug where the diffracted ray’s power is larger than expected when metal is used in the grating. Note this is fixed.

Note from this version, the Stochastic mode 1 and 2 are deprecated and it’s always same as mode 3 in old version as long as this parameter is set as non-zero.2021-08-25
Now FFF is by default turned on. To turn it off, see the following explanations for the parameter “Test Mode”.
A new parameter “Test Mode” is added. By default, it should be zero, which means normal system. If it’s a positive value, some testing functions are triggered as below.

  • Adding the value by 2^0 = 1: the DLL will report any coreerrors in a log text file.
  • Adding the value by 2^1 = 2: the DLL will report more information mainly for debug.
  • Adding the value by 2^2 = 4: the DLL will turn off Fourier Factorization Factor.
  • Adding the value by 2^3 = 8: the DLL will turn on another algorithm T-Matrix. Note this is not yet ready at this timing with some bugs.

2021-08-25

A benchmark has been done for FFF. The tested structure is from the following reference.

Convergence of the coupled-wave method for metallic lamellar diffraction gratings, Lifeng Li and Charles W. Haggans, Journal of the Optical Society of America A Vol. 10, Issue 6, pp. 1184-1189 (1993)

2021-08-23

Implement Fast Fourier Factorization to improve the convergence of metal material.

Some other minor stability improvements.

2021-07-14

The function of manual sizing of visualization tool window was broken and now is back.

2021-06-23

The efficiency plot in visualization tool doesn’t show correct data. Now it’s fixed.

2021-06-14

All DLLs are added with a new parameters “FFF”. When this parameter is set to non-zero, a method called “Fast Fourier Factorization” is used to calculate. Theoretically, this can make the convergence faster when there is a metal layer in the grating. In other words, less number is required for “Max Order” when metal material exists in the grating. This is still in experiment and should be used carefully.

2021-04-28

Tow bug fixes.

  1. In some cases, if the PC has more than 10 cores, the calculation speed would be very slow because all threads compete for getting shared resources. This is fixed now.
  2. When the given parameter period is negative, it means frequency in micron^-1. However, the period was wrongly multiplied by 1e6 times. This is fixed now.

Polygon grating DLL has been updated to include Scale X and Scale Y.

2021-04-20

The DLLs didn’t consider the linear phase introduced by grating and now it’s fixed. This only affects if designers what to calculate Huygens PSF a shown below.

210420-152414-image.png

2021-04-07

Now if Outside material is not specified, when click “Calculate” button, there will be an error message to warn the calculation would be wrong.

210414-182457-image.png

2021-04-05

Fixed a bug that editing thickness and section data in layers & section table would fail.

210405-214913-image.png

2021-03-19

A bug is fixed in visualization tool. If a section in a layer has Width = 1, this section would not be drawn. Now it works correctly.

210319-164838-image.png

2021-03-17

Two bug fixes.

  1. When the input grating data for User defined DLL includes non-zero imaginary refractive index, the DLL stops work. Now it’s fixed.
  2. When using dispersion data (COAT_x.dat) to define grating material, if that includes non-zero imaginary refractive index, the DLL stops work. Now it’s fixed.

2021-02-19
A checking code is added. If defined order filter includes orders that is outside of the range between Start Order and Stop Order Object Property, the DLL stops working. In visualization tool, there is an error message shows.

210219-163238-image.png

2021-02-02
Polygon grating DLL added a new parameter “Diffract back face”. When it’s set to non-zero, the grating will be on Face 2 instead of on Face 1.

2021-01-28
Polygon grating DLL now supports up to 30 points. The download link is included above

2021-01-24

Visualization tool has two slight changes in UI

  1. Now it’s possible to change DLL from UI. Note this will directly modify settings in OpticStudio.
  2. Mark text to red if Outside material has never been changed manually. By default it’s 1.0 but it need users to correctly set up.

210205-235859-image.png

2021-01-22

Bug fix: all DLLs were wrongly set with an expire date after 2021-01-21. Now this is removed.

If you see the following error message when opening your design file. Please fix it with selecting new DLLs.

210206-000004-image.png

To make the design file work again, either one of the following methods would work.

Method 1

(1) Copy the beta DLLs, for example the srg_trapezoid_RCWA210122.dll, from zip file to \Documents\Zemax\DLL\Diffractive\

(2) Remove the old DLLs, which is srg_trapezoid_RCWA.dll in this case.

(3) Rename this DLL srg_trapezoid_RCWA210122.dll to srg_trapezoid_RCWA.dll.

(4) Now open the design file. And that should work.

Method 2

(1) Copy the beta DLLs, for example the srg_trapezoid_RCWA210122.dll, from zip file to \Documents\Zemax\DLL\Diffractive\

(2) Open your design file.

(3) You will see the following message. Click OK.

210206-000054-image.png

(4) Then go to your grating object > Diffraction Property.  You should see as below. The DLL is wrong.

210206-000051-image.png

(5) Select the srg_trapezoid_RCWA210122.dll and the file should work again.

210206-000102-image.png

2021-01-13

1. Visualization tool now calculated Filling and Wedge and shows the value if the DLL is trapezoid 2 and a or b is not zero. If both a and b are zero, a and b are calculated, using Filling and Wedge data and shows.

210206-000127-image.png

2. Polygon grating adding two parameters

---  “Scale”: all x and y points will be multiplied by this value to scale. If it’s zero, it’s converted to 1.0 internally.

---  “Z Center Mode”: If it’s 0, the local origin (0,0,0) is on the Face 1 as usual. If it’s 1, the local origin is shifted by -0.5*Thickness so it’s between the Face 1 and Face 2.

2021-01-12

Bug fix:

Wedge in trapezoid 2 is negative when b > a. Exchange a and b to make Wedge positive.

 

 

210206-000227-image.png

 

2021-01-11

New grating shape (srg_trapezoid2_RCWA.DLL). The shape is defined as following picture. Note that:

  1. If parameters Filling or Wedge are non-zero, then a and b are ignored. Otherwise, a and b are used for the shape definition.
  2. Coating thickness in this DLL can be separately defined for top, left side, and right side.
  3. The speed of interpolation mode is improved by about 15%~20%.

 

210206-000247-image.png

 

 

210206-000242-image.png

 

2021-01-06

Visualization tool

1. Incident angle is now defined by polar and azimuthal angles (theta and phi). This matches the convention more in both academic and industry.

2. Add a button to calculate efficiency data. The data is saved in RAM and can be plotted by “Plot” button or exported by “Export ZGD” button.

3. Add a button to plot efficiency data.

---  There 3 dimensions, wavelength, polar angle, azimuthal angle, but we need to choose one of them as the X-axis.

---  For the rest dimensions, the data is calculated for those cells with a “*” mark. The “*” mark can be set to other cell by selecting the cell and press Ctrl + Z.

4. Add a button to export Zemax Grating Data (ZGD) file. More information about ZGD can be found by the download link above.

5. Note new DLLs are required in order to use new functions in the visualization tool.

6. Now if the window is resized by user, a scroll bar will appear when needed. This helps users who use notebook.

210206-000315-image.png

 

210206-000321-image.png

7. Now the following DLLs support NIL layer: srg_blaze_RCWA, srg_gridwirepolarizer_RCWA, srg_step_RCWA, srg_trapezoid_RCWA. The thickness of this layer can be set by new parameter “NIL sub thick”.

210206-000458-image.png

8. The number of output rays when Stochastic mode is used is now fixed to only 1 and is regardless to the value in Start/Stop Order settings in the UI. This makes the settings easier and less confusing. If multiple output rays are desired, please send feedback to support team.

9. Speed of interpolation mode is improved by 15%.

10. A new DLL is created for reading pre-calculated efficiency data for 1D/2D gratings. Lumerical data input is also supported. Check the document in the download link for more information.

 

 

210206-000516-image.png

 

 

2020-12-17

A new User Defined Object DLL is created for polygon grating.

210206-000541-image.png

2020-12-04

Now the DLL compile date can be checked in the visualization tool. Note this will only work with newer DLLs.

210206-000553-image.png

2020-11-06

Add a new parameter “Coat mode” for us_blaze_RCWA.dll. When it’s set to “1”, the grating now can be shaped as below.

210206-000608-image.png

210206-000611-image.png210206-000615-image.png

 


9 replies

Hi Michael,

Great updates.

Is it possible for you to add a small tutorial part in this article < Simulating diffraction efficiency of surface-relief grating using the RCWA method >about how to input multiple input angles and wavelength in Step 4?

I have figured out the solution is by pressing “insert key”. This is just to help new users.

Thanks,

Yuyu

 

Userlevel 6
Badge +2

Thank you for suggestion, Yuyu!

Yes, I will find time to update the article. The step 4 function has relatively fewer users to use. I would also suggest you use Universal Plot to double check when it’s important data. I’m sorry for the confusion and please let me know if you find any unclear things that I can explain. Thank you!

Best regards,

Hi Michael,

Yes. I have three questions.

  1. What is universal plot?
  2. I see convergent warnings many times. What value suggests a bad calculation?
  3. Is it possible to output the datasets from this RCWA calculations?

Thanks for your quick replies.

 

Yuyu

Userlevel 6
Badge +2

 

 

Hi Yuyu,

Thankyou! Please find my answers below.

1.

It’s a tool in OpticStudio to let you scan for a parameter and calculate specified result, and then show data on a 2D or 3D plot.

For example, if you open the first example in the article: Simulating diffraction efficiency of surface-relief grating using the RCWA method, you will see it calculate the efficiency in this way.

This method is a little cumbersome as you need to set up a source ray, a grating, and a detector in the system but it’s most accurate. The step 4 in the visualization tool is supposed to make this easier but it’s not heavily tested and is with less confidence.

 

2.

Do you mean message like “Error: Power conservation.(error = ….)”? In the code, I stop raytracing when the error is larger than 0.1%.  You can turn off this check by set Test Mode parameter to 16. Note if you have set up a metal (no-zero imaginary index) in the system, the check will be ignored anyway.

 

3.

The easiest way to do it is by using Universal Plot and click Text as below.

 

 

Or, the Export ZGD in the step 4 is supposed to do this task too. However, the data format is a little complicated becuase it includes fully the electric response.

 

 

A final solution I would like to suggest is the Lumerical RCWA solver. It’s another software other than Zemax OpticStudio.

https://optics.ansys.com/hc/en-us/articles/4414575008787-RCWA-Solver-Introduction

It’s more powerful when you want to have a deep analysis to the grating. The RCWA DLL here is mainly to provide a neat tool for users who only want to simulate 1D grating in Zemax OpticStudio.

We even have another solution to dynamically link to Luemrical RCWA solver too. You can check the following webinar for more information.

https://www.zemax.com/blogs/webinars/ar-waveguide-design-and-optimization-based-on-dynamic-linking-between-zemax-opticstudio-and-lumerical-rcwa

Just for your reference!

Hi Michael,

In the article “How to simulate exit pupil expander (EPE) with diffractive optics for augmented reality (AR) system in OpticStudio: part 4”, you mentioned:

1.Up to the time (2021-04-24) of writing this article, the built-in Paraxial Lens object in non-sequential mode does not calculate phase for output rays correctly,

2.Up to the time (2021-04-24) of writing this article, there is a bug where Boolean Native/CAD cannot handle the phase of rays correctly.

Do you know if these phase calculations with paraxial lens and Boolean objects are fixed in current versions of Zemax? 

Thanks,

Lang

Userlevel 6
Badge +2

Hi Fintol,

Thank you for the discussion!

For Paraxial, we still don’t support phase calculation, but you can either use the attached DLL (NSC_Paraxial.dll) in that article or use a real lens to handl this issue.

For the bug about phase handling in Boolean object, it’s already solved, but please let us know if you see any problems again.

Thank you!

Hi Michael,

Thanks for these helpful tutorial explanation.

I am reading the post with title: “Simulating diffraction efficiency of surface-relief grating using the RCWA method” and wanna give a shot by opening the zar-file called ”verify_1997_Design_and_fabrication.zar” with Ansys ZMX2022R2.01. But I CANNOT find the all other four Dlls excep ONLY the “srg_trapezoid_RCWA.dll”.

Where are the other four and how to get them?

Best wishes,

Keven 

Userlevel 6
Badge +2

Hi Sky,

Thank you for reply. May I know which version of OpticStudio you install? The DLLs are supposed to be provided in the folder \Documents\Zemax\DLL\Diffractive after you install them.

If you still cannot find those DLLs in the above folder, could you help to create a ticket in the system and our team can have a look? You can create a ticket in this webpage: https://support.zemax.com/hc/requests/new

Thank you.

Hi,

I just updated my Optic Studio version, but I still can’t use the DLLs mentioned in this article. I get an error message saying I need OS 20.1 or later which is the case. But apparently my DLL files are older.

I don’t understand where do I get updated DLLs.

Thanks

Julien

Reply