In this example we will use optiSLang to set up an automated optomechanical workflow coupling Mechanical & Ansys Zemax OpticStudio for analysis of non-uniform deformation and temperature distributions affecting the optical performance.
To be able to use this example, the following tools and assets needs to be installed on your computer:
- Ansys optiSLang 2023 R1 (any older version requires an on-demand Custom Integration, please contact firstname.lastname@example.org)
Ansys Mechanical 2023 R1
- Load “Export to STAR.wbex” per default within Workbench
- Set units in Mechanical & in WB onto mm
- Ansys Zemax OpticStudio 23.1, Zemax OpticStudio STAR module (requires Enterprise licensing) & ACT (can be downloaded from this article OpticStudio STAR Module: Ansys Data Export Extension – Knowledgebase (zemax.com)
Understand the simulation workflow and key results
The optical product development process requires the optical performance under real-world conditions to be checked and understood. One specialized case is optomechanical analysis, which means to consider the combination and interactions of optical and mechanical components. In this example, the optical performance of a three-lens system is analyzed with consideration of the structural and thermal analysis of its housing. The goal is to avoid mechanical and thermal impacts reducing the system’s optical performance dramatically. The thermal-mechanical system and the optical system will be coupled in an automated workflow to be used for design exploration.
Step 1: Mechanical Model
Demonstrates the structural and thermal analysis for the determination of lens temperature and deformation distribution due to thermal impact and lens mounting.
Step 2: OpticStudio Model
Demonstrates the optical simulation. OpticStudio solves the optical simulation with and without considering deformations.
Step 3: optiSLang Project
Demonstrates the automated optomechanical analysis coupling Mechanical inside Workbench and Zemax OpticStudio and STAR module and design exploration capabilities of optiSLang. This is reached by performing a Sensitivity study to identify important input parameters and to get a design understanding by creating Metamodels showing the relationship between input and output parameters.
This article focuses on step 3. It is assumed that steps 1 and 2 have already been completed. Step 3 automates the stage of applying calculated deformations onto the optical model for analysis of interactions between different physics. For this reason, optiSLang is used to automate this complex workflow. We can achieve this by creating linked nodes which each represent a stage of the workflow. Optical and mechanical simulations are accessed through nodes utilizing dedicated Zemax and Mechanical integrations. These integrations receive inputs, launch the simulation in the corresponding tool, and deliver outputs. Further information regarding workflow automation and design optimization with optiSLang can be found here: Ansys optiSLang Getting Started
Running an automated workflow with optiSLang, connecting different physics, leads to one results file for combined analysis. For this example, a Sensitivity Analysis has been performed by running 300 designs automatically for comparison of optical performance with and without deformations. In this way, we can quantitatively determine how mechanical components affect optical performance.
Run and Results
Instructions for running the model and discussion of key results
When you want to re-run the example, make sure that the paths, where the simulation files are located, are as short as possible (e.g. “C:\...”)! Excessively long paths can cause errors in the workflow.
In the 1 st and 2 nd steps, no actual analysis happens. We are just opening the models to understand how they are set up and what constitutes inputs and outputs from these systems. Actual analysis happens in step 3, where these predefined inputs are varied from optiSLang, sent to the corresponding solver to launch simulation, and read back the results.
Step 1: Mechanical Model
- Open the Workbench project archive “3LensSystem.wbpz” containing the Mechanical model (located in “.\01_reference\”) and save it as “3LensSystem.wbpj”.
- Notice the defined input and output parameters in the Parameter Set. This can be accessed by double-clicking “Parameter Set” in the Project Schematic. In addition to the optical parameters like surface curvatures, thickness and distance, internal heat generation magnitude in W/mm 3 is defined as mechanical input. To be evaluated as an output the equivalent stress maximum is defined.
- In the project tab double-click on the “Results” block of static structural analysis (cell C7) to open Mechanical. In the model tree, notice all the steps performed during the simulation. The geometry is updated with a new parameter set and thermal and structural analysis is performed.
- APDL scripting (Ansys Parametric Design Language - a scripting language that is used to communicate with the Ansys Mechanical APDL program) below static structural solution (C6) delivers plots of deformation- and temperature distribution.
- Export Lens to STAR module will write the calculated thermal and structural loads as text files which will be mapped on optical surfaces with OpticStudio STAR module as the next step.
Step 2: OpticStudio Model
- Open the Zemax OpticStudio model “Laser Diode Collimation Example.zmx” (located in “.\01_reference\”). This is our nominal, or reference, optical design without any modifications or any thermal and mechanical effects applied.
- Notice that the same input parameters (surface curvatures, thicknesses, distances) are defined, as variables, in the Lens Data Editor and identical global coordinate systems positions are used as for mechanical simulation within Mechanical. The outputs are predefined within the Merit Function Editor. As outputs RMS wavefront error with respect to the centroid (RWCE), the beam pointing error as deviation from the rays intended path (REAX/Y & BSER) for collimated light on the image surface should be evaluated. In addition, by using the operand DSAG we can see how much each lens is affected by the heat generation, and how the deformation magnitude affects the optical performance. The OpticStudio node only performs the optical simulation without deformations.
- The Python script called within the OS_STAR node performs the optical simulation with consideration of the deformations coming from the mechanical simulation. To distinguish the results from those without deformations, the result names with deformations end with “_new_STAR”. The Python script utilizes the Zemax API (ZOS-API) to perform simulations in OpticStudio. An introduction to ZOS-API can be found here: Getting Started with ZOS-API - Zemax .
Step 3: optiSLang project
- Open the optiSLang project file “optomech_WF.opf” file located in “.\optiSLang_project_with_reference”. You will be asked for file relocation. Select “Relocate files automatically”.
- The “AMOP”-system shows the necessary solver chain to perform the optomechanical analysis and is used to run the Sensitivity Analysis, get a design understanding and identify important input parameters.
- Double-click on the AMOP Module to see the defined sampling method and parameter ranges. The system is defined to include pictures, coming from the APDL script, and to keep the result files of each simulation. Due to the size these pictures and result files are not delivered with this example. To regenerate them you can rerun the study.
- The AMOP (1) system shows the same solver chain as the AMOP system. It still represents a Sensitivity study as above and has been added to sample further designs locally in the design space where it’s needed to improve the prediction quality of unknown data points (Coefficient of Prognosis - CoP). Double-click on the AMOP (1) module to see the defined sampling method. It uses the designs from AMOP as start designs for further Sensitivity Analysis.
- Optional : To re-run the sensitivity study right-click on AMOP and select “Start from here”.
- To review the results of the full Sensitivity Analysis, open the “AMOP (1).omdb” in the results folder. The file already contains the results for the metamodels.
Sensitivity Analysis is performed to get a good design understanding of the simulation model and reduce its complexity by identifying the important parameters. optiSLang creates metamodels, which represent the system’s behaviour with varying input parameters. In that way, what-if studies can be performed where the metamodel predicts the outputs based on new given input values. For a good prediction quality, it must have a high Coefficient of Prognosis (CoP) value. The best way to review the sensitivity study is to review the CoP matrix. The CoP matrix shows that all values except for the “REAX_5_new_STAR” are well predicted (shown in the column “Total”). Possible reasons for the reduced CoP value are too few samples to catch non-linearities sufficiently and solver noise. The models with high CoP > 90% can be used to optimize as an optional next step. For “REAX_5_new_STAR” please recognize that the results values only vary very slightly, which equals more or less 0.
The Metamodel of Optimal Prognosis (MOP) approximates the response as a function of all important input parameters. Clicking on one of the “Total” fields in the CoP matrix updates the Response surface 3D plot. This plot is the representation of the Metamodel based on the two most important parameters. As the OpticStudio system is analyzed both with and without consideration of the deformations, a comparison between the behaviour of both systems is enabled. Furthermore, due to the connection of mechanical and optical simulation, evaluation of the impact of mechanical inputs on optical outputs is possible as well as the interactions of the mechanical parameters with the optical ones. In this example, we can recognize that the heat generation magnitude as mechanical input is affecting 8 optical responses as one of the two most important parameters, e.g. REAY_4_new_STAR.
If you don’t see this plot, search under visuals on the right side for “Coefficient of Prognosis”. This view shows that the interactions can be turned on by activating the plot by clicking on it and selecting “Show interactions” in the plot’s settings on the left.
The RMS wavefront error is not affected by internal heat generation magnitude.
With a variation of the RMS sag value over the surface of 0.05 to 0.14 within the predefined design space the rear radius of lens 1 is most affected by heat generation of all radii.
With the help of the Parallel Coordinates Plot, which represents every design as one line, we can better understand the overall system performance.
We notice that the RMS wavefront error with and without deformations are strongly correlated with each other since the colors are same order from top to bottom. For a better understanding, the clustering is adapted to the 2D Anthill plot, where we can see, that both responses are positively linear correlated with a value of 0.989. This is understandable because our research indicates that the RMS wavefront is only minimally affected by internal heat generation.
The Parallel Coordinates plot also shows us that with deformations there is a small trade-off between the RMS wavefront error (RWCE) and the beam point error (REAY). The minimized blue lines for REAY_4_new_STAR are not the most minimized ones for RWCE_2_new_STAR. That means with optimization there will be no ideal design found, but a decision between those two responses will need to be taken.
Since REAX_5_new_STAR is almost 0, this is going to be neglected in the next step.
By moving the sliders of REAY_4_new_STAR and RWCE_2_new_STAR down, suitable start designs for optimization can be found. Furthermore, as we follow the progression of these lines, we can gain insight into the potential location of the optimized design within the design space. The optimized design will probably have an increased rear radius of lens 1 (R2_Lens1) and understandably will perform best with the lowest internal heat generation.
E.g. design #275 already shows a good starting point for optimization and makes the trade-off visible again.
In summary, we have learned how to connect optical and mechanical analysis within one automated workflow for combined analysis. It has been shown which quantitative effect mechanical inputs have on optical performance and in which way parameters interact with each other. This gives a better understanding not only of how the system will perform in real-world conditions but also why it behaves as it does. The results can be used for optimization to design systems that are less sensitive to the effects of heating and other additional inputs.
Important Model Settings
Description of important objects and settings used in this model
Mechanical model settings
- The mechanical model meshing for optical analysis requires approximately 10,000 nodes per surface.
- The ACT extension “Export to STAR.wbex” to export the deformations needs to be loaded per default.
optiSLang: S olver settings
- Access by double-clicking on the Workbench node.
- To re-run the Mechanical analysis by exporting the deformation files, make sure the settings are defined as follows in the Workbench node “3LensSystem”.
optiSLang: Sensitivity settings
- Access by double-clicking on the “AMOP” – system
- to change the parameter ranges in the “Parameter” tab.
- to add optimization criteria in the “Criteria” tab.
- to change maximum number of samples in the “Adaption” tab.
- to view the results in the “result designs” tab.
Updating the Model With Your Parameters
Instructions for updating the model based on your device parameters
Add additional Parameters to the optiSLang model
Further Mechanical parameters can be considered by including them in the Workbench Parameter Set, e.g. by publishing them from the DesignModeler.
The same needs to be defined as “Variable” within the OpticStudio model (“Laser Diode Collimation Example.zmx”) and parametrized as dependent within optiSLang.
Bring your own part
Make sure to create a Mechanical and OpticStudio project separately from each other with the same geometry and identical global coordinates as reference. Both geometries will be varied identically to each other through dependent parametrization as shown in the examples parameter table. These are accessible via double-clicking on the systems head and choosing the tab “parameter”.
Taking the Model Further
Information and tips for users that want to further customize the model
After the Sensitivity Analysis and achieving design understanding an optimization can be conducted. This can be either performed directly on the MOP or as direct optimization with a real solver run.
- If the mechanical model fails or no text files are written into the “reffildir” folder (before it is deleted in the last node), make sure, that the paths are as short as possible and the ACT extension is loaded per default.
- If the deformed results are identical to the undeformed ones, make sure, that the STAR module is enabled (Enterprise license accessible).
- If the STAR node fails make sure that the Python module PythonNET is installed in your Python environment, otherwise install it with “-m pip install pythonnet” with your cmd.exe:
Additional documentation, examples and training material
- OpticStudio STAR Module: Ansys Data Export Extension – Knowledgebase (zemax.com)
- Getting started with Python – Knowledgebase (zemax.com)