TAGGED: Lumerical-Mode, optislang
-
-
August 22, 2024 at 5:48 pmAaronHuangSubscriber
Hi,
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 spacing  start_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 values  data_matrix = matrix(length(temps), 4);  # Loop over the temperature range  for (i = 1:length(temps)) {    temp = temps(i);    # Set the temperature    switchtolayout;    setnamed("::model", "temperature", temp);    # Run the FDE simulation    findmodes;    # Get the effective index, loss, and group index of the fundamental mode    neff = getdata('mode1', "neff");    loss = getdata('mode1', "loss");    ng = getdata('mode1', "ng");    Â    # Store the temperature, effective index, loss, and group index in the matrix    data_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 matrix  temps = 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 values  p = polyfit(temps, real(neff_values), 1); # Linear fit  # The slope of the linear fit is the second coefficient  neff_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 pmGuilin SunAnsys Employee
I 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-InteroperabilityÂand the documentation https://www.ansys.com/products/connect/ansys-optislangÂ
-
- You must be logged in to reply to this topic.
- Multi-Objective Shape Optimisation of Tesla Valve
- Creating Fluent Web Apps using optiSLang 2021R2.mp4
- Adjoint Method for Optimising Diodicity of Tesla Valve
- How to access “OSL_DESIGN_DIR” Environmental variable?
- Setup Optimetrics at HFSS 3D Layout Design
- Response constraint not allowing structural optimization to solve.
- Material parameter optimization
- Output parameter as an exported text data file
-
1191
-
513
-
488
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.