TAGGED: Lumerical-Mode, optislang
-
-
August 22, 2024 at 5:48 pm
AaronHuang
SubscriberHi,
I am currently working on optimizing an athermal waveguide in Lumerical FDE (2024R2) using Optislang (2024R1). To facilitate this, I’ve draft a custom script intended to extract several key parameters, such as the figure of merit (FoM), mode numbers, loss, group index (ng), and effective index (neff), which are then used as inputs/results in Optislang.
Here is the script:
#returns a list of results this script producesfunction listScriptResults(){return {'neff_slope': 0, 'FoM': 0, 'mode_no': 0, 'loss': 0, 'ng_300K': 0, 'neff_300K': 0};}#returns a list of parameters this script producesfunction listScriptParameters(){return {'start_temp': 300, 'end_temp': 400, 'temp_spacing': 10};}#returns resultsfunction computeScriptResults(parameters){ #argument is a struct with fields giving values of different parameters# Temperature range and spacingstart_temp = parameters.start_temp;end_temp = parameters.end_temp;temp_spacing = parameters.temp_spacing;temps = linspace(start_temp, end_temp, (end_temp - start_temp)/temp_spacing + 1);# Create a matrix to store temperature, effective index, loss, and group index valuesdata_matrix = matrix(length(temps), 4);# Loop over the temperature rangefor (i = 1:length(temps)) {temp = temps(i);# Set the temperatureswitchtolayout;setnamed("::model", "temperature", temp);# Run the FDE simulationfindmodes;# Get the effective index, loss, and group index of the fundamental modeneff = getdata('mode1', "neff");loss = getdata('mode1', "loss");ng = getdata('mode1', "ng");# Store the temperature, effective index, loss, and group index in the matrixdata_matrix(i, 1) = temp;data_matrix(i, 2) = neff;data_matrix(i, 3) = loss;data_matrix(i, 4) = ng;}# Extract temperature, effective index, loss, and group index arrays from the matrixtemps = data_matrix(:, 1);neff_values = data_matrix(:, 2);neff_300K = data_matrix(1, 2);loss_values = data_matrix(:, 3);ng_300K = data_matrix(1, 4);# Perform a polynomial fit (linear fit) to the real part of the neff valuesp = polyfit(temps, real(neff_values), 1); # Linear fit# The slope of the linear fit is the second coefficientneff_slope = p(2);FoM = abs(neff_slope);FoM_loss = mean(abs(loss_values));mode_no = nummodes;return {'neff_slope': neff_slope, 'FoM': FoM, 'mode_no': mode_no, 'loss': FoM_loss, 'ng_300K': ng_300K, 'neff_300K': neff_300K};}I’ve validated the execution of this code in Lumerical FDE, and it returns the correct values as expected. However, when I attempted to integrate this script within a parametric system in Optislang, I encountered an error message: "ERROR: 'XXXXX' could not be evaluated: Object 'script.XXXXX' not known."
Could you advise on how I might resolve this issue? It seems that the script may not be recognized correctly by Optislang, and I am unsure how to address this.
Thank you in advance for your assistance!
-
August 23, 2024 at 7:07 pm
Guilin Sun
Ansys EmployeeI have little experience using this optimization. But give the following suggestions:
The error message "ERROR: Object not known" could be indicative of various issues. One possible reason for this error could be a corrupted optislang.ini file. To resolve this, you can locate the optislang.ini file atC:\Users\yourusername\AppData\Roaming\Dynardo
, delete it, and restart Optislang. If this does not resolve the issue, you may need to delete the file again and reinstall Optislang .You may also refer to this example https://optics.ansys.com/hc/en-us/articles/4404715023251-Optimizing-Wire-Grid-Polarizer-optiSLang-Interoperabilityand the documentation https://www.ansys.com/products/connect/ansys-optislang
-
- You must be logged in to reply to this topic.
-
3882
-
1414
-
1241
-
1118
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.