TAGGED: design-optimization, fdtd, lumerical, Lumerical-FDTD, lumerical-script, optimization, script
-
-
October 19, 2023 at 10:03 pmminusunnySubscriber
Hi,
   I am trying to optimize multiple parameters using the PSO algorithm as given in the lumerical for a multimode interference device with four outputs. Is there any other method to optimize multiple parameters, like using MATLAB?
 I tried to modify the script given on the website as an example:
Grating coupler - Matlab-driven optimization (2D) – Ansys Optics Â
But have a doubt regarding the parameter optimization:
I want to optimize the output at four ports, so what should i change here?
Â
Thank you
Â
-
October 19, 2023 at 10:14 pmAmrita PatiAnsys Employee
Hello,
Lumerical uses PSO algorithm whereby it only optimizes a single objective function. So, you won't be able to optimize multiple results. There are a few approaches to how multi-objective optimization can be incorportated. I answered a similar post this morning, please refer to this for information:Â ALF Post on Optimization.
Please let me know if you have any further questions.
Regards,
Amrita -
October 19, 2023 at 11:45 pmminusunnySubscriber
Is there any example for the script to apply user defined figure of merit? How about the MATLAB part?
Â
-
October 19, 2023 at 11:56 pmAmrita PatiAnsys Employee
As far as I know there is no published example script. Also, it is hard to have a general script to create such a single objective function from multiple ones. How you frame the function would be very specific to the simulation you are looking at. And sometimes in my experience you might have to reformulate the function depending upon the how the optimization behaves. I will check internally to see if we have some examples.
I will look into the MATLAB optimization and also see if there are any other options.Regards,
Amrita -
October 20, 2023 at 12:01 amminusunnySubscriber
That would be great., Thanks
-
October 24, 2023 at 7:31 pmminusunnySubscriber
Hi,Â
I am trying to optimize with MATLAB with this example : https://optics.ansys.com/hc/en-us/articles/360042304834-Grating-coupler-Matlab-driven-optimization-2D-
I am trying to extract the Transmission from the ports of FDTD. Is this the right way ? Do i need to use a transmission monitor separately for that?
-
October 24, 2023 at 7:44 pmAmrita PatiAnsys Employee
Hi,
Sorry I didn't get back to you earlier. I looked at a few optimization options on the Python end but didn't have time to look into MATLAB.Â
The answer to your question is no. The ports are a combination of Mode source, mode expansion monitor, and DFT monitor and returns the transmission "T" by default. So, you don't need to setup additional monitors.Regards,
Amrita -
October 24, 2023 at 7:54 pmminusunnySubscriber
So, may i know how can i correct the code  given in the screenshot? Apparently, it is not reading the results from the ports and the program gets halted because of this?
-
October 24, 2023 at 7:59 pmAmrita PatiAnsys Employee
Please copy and paste the code here. And also share a screenshot of the Lumerical objects tree with atleast one of the ports fully expanded.
Regards,
Amrita -
October 24, 2023 at 8:03 pmminusunnySubscriber
Â
code=strcat('switchtolayout;',...Â
'groupscope("::model");',...
'set("N",',num2str(N,16),');',...
'set("W_2",',num2str(W2*1e-6,16),');',...
'set("factor",',num2str(factor,16),');',...
'for(0;layoutmode>0; 0) {run;}');
appevalscript(h,code);%Get the coupled power from T monitor to
%FDTD workspace as variable 'T_avg_FDTD'
code=strcat(['T_1_FDTD=getresult("FDTD","ports","Out1,"T"");' ...
  'T_2_FDTD=getresult("FDTD","ports","Out2,"T"");' ...
  'T_3_FDTD=getresult("FDTD","ports","Out3,"T"");' ...
  'T_4_FDTD=getresult("FDTD","ports","Out4,"T"");']);
appevalscript(h,code);%Get the average transmission(figure of merit) from FDTD workspace to
%Matlab workspace
T_MatlabFun_1=appgetvar(h,'T_1_FDTD');
T_MatlabFun_2=appgetvar(h,'T_2_FDTD');
T_MatlabFun_3=appgetvar(h,'T_3_FDTD');
T_MatlabFun_4=appgetvar(h,'T_4_FDTD');Â
Â
Â
-
October 24, 2023 at 8:22 pmAmrita PatiAnsys Employee
The syntax for getresult is incorrect. Try using this instead and let me know what hapens:
code=strcat('T_1_FDTD=getresult("FDTD::ports::Out1","T");',...
  'T_2_FDTD=getresult("FDTD::ports::Out2","T");',...
  'T_3_FDTD=getresult("FDTD::ports::Out3","T");',...
  'T_4_FDTD=getresult("FDTD::ports::Out4","T");');Also, since I won't be able to test the whole script as I don't have the simulation file I recommend you to look at the syntax in the file "Coupler_Optimization_Main_Script.m' in the MATALB driven optimization link you shared earlier.
Regards,
Amrita -
October 24, 2023 at 9:22 pm
-
October 24, 2023 at 9:32 pm
-
October 24, 2023 at 9:42 pm
-
October 25, 2023 at 12:20 amAmrita PatiAnsys Employee
Does it mean you are not able to see the variables T_MatlabFun_1, T_MatlabFun_2, T_MatlabFun_3, and T_MatlabFun_4 in the MATLAB workspace?
Regards,
Amrita
-
- The topic ‘Lumerical optimization for multiple parameters’ is closed to new replies.
- Difference between answers in version 2024 and 2017 lumerical mode solution
- Errors Running Ring Modulator Example on Cluster
- INTERCONNECT – No results unless rerun simulation until it gives any
- Import material .txt file with script
- Help for qINTERCONNECT
- Trapezoidal ring
- Issues with getting result from interconnent analysis script
- How to measure transmission coefficients on a given plane .
- Topology Optimization Error
- Edge Coupler EME Example Issue
-
1281
-
591
-
544
-
524
-
366
© 2024 Copyright ANSYS, Inc. All rights reserved.