TAGGED: Lumerical-Mode, monitor, script, scripting
-
-
November 24, 2023 at 12:05 pmJoshua WorrallSubscriber
I'm trying to add a frequency domain field profile to a structure group using the addprofile; command, however I get the following error when testing:
Error: prompt line 99: addprofile is not a valid function or variable name
I've tried adding other simulation monitors and they don't seem to work either, does any have any advice on how to fix this? Have I missed a step in order to be able to add monitors within a script?
I'm using Lumerical 2023 R2.1 Mode -
November 24, 2023 at 4:47 pmDevAnsys Employee
Hello, Can you share the whole script?
For me, addprofile command is working fine and there is no error..
Note: addprofile only works for Mode and FDTD. addprofile - Script command – Ansys Optics
Regards
Devika
-
November 25, 2023 at 12:09 pmJoshua WorrallSubscriber
Hi Devika,
I've added a copy of the script along with an image of the parameters I've set in the structure group below. I've also attached an image of the produced structure.The script is just a modified version of the included script to produce a photonic crystal with a square lattice. I've added extra functionality to add input and output waveguides and change the structure of the crystal. Now I want to add a frequency domain field profile to the output waveguide. I've used the example script for the "addprofile" command but it seems to be not valid in my case.
I'm new to scripting in Lumerical Mode so please let me know if I've missed anything thank you.
deleteall;
####################################################
# Rectangular lattice PC array
# A periodic array of photonic crystals in a rectangular lattice.
#
# Input properties
# z span: height of crystals
# nx, ny: the number of columns and rows
# a: lattice constant
# index: index of refraction
# material
# alength, blength, ylength: length of input and output waveguides
#
# Tags: square rectangular lattice pc photonic crystal array
#
# Copyright 2012 Lumerical Solutions Inc
###################################################### simplify variable names by removing spaces
z_span = %z span%;
n_rows = ny-1;
n_cols = nx-1;
even_flag = 0;
radius1 = 0.36*a;
radius2 = 0.24*a;for(i=-n_rows/2:n_rows/2) {
for(j=-n_cols/2:n_cols/2) {
if( (j<=i+nx/2) and (-j>=i-nx/2) and ((-round(j+2) != round(i)) or (j <= -1 and j >= -4))) {
addcircle;
set("radius",radius1);
set("x",(j)*a);
set("y",(i)*a);
set("z span",z_span);
set("material",material);
if(get("material")=="# Input A
addrect;
set("name","input_A");
set("x",-((nx/2)*a)-alength/2);
set("x span",alength);
set("y",5*a);
set("y span",2*a);
set("z",0);
set("z span",z_span);
set("material","Si (Silicon) - Palik");# Input B
addrect;
set("name","input_B");
set("x",-((nx/2)*a)-blength/2);
set("x span",blength);
set("y",-5*a);
set("y span",2*a);
set("z",0);
set("z span",z_span);
set("material","Si (Silicon) - Palik");# Output Y
addrect;
set("name","output_Y");
set("x",((nx/2)*a)+ylength/2);
set("x span",ylength);
set("y",5*a);
set("y span",4*a);
set("z",0);
set("z span",z_span);
set("material","Si (Silicon) - Palik");# Silicon
addrect;
set("name","Silicon");
set("x",0);
set("x span",(nx+1)*a);
set("y",0);
set("y span",(ny+1)*a);
set("z",0);
set("z span",z_span);
set("material","Si (Silicon) - Palik");# Output Monitor
addprofile;
set("name","field_profile");
set("monitor type",7); # 2D z-normal
set("x",0);
set("x span",5e-6);
set("y",0);
set("y span",5e-6);
set("z",0);-
November 27, 2023 at 11:01 pmDevAnsys Employee
Thanks for shairing more details:
Are you adding
”addprofile” in
Structure group? That could be the reason of error.
You won’t be able to add the profile monitor there. Its only for the structure . You can add monitors in analysis group. Or you can use any of the following options.
Option 1:
You can create an lsf file from Script file Editor on the right side of window and add profile monitor
Option 2:
add the monitor inside the model script.
I will recommend this course material: Ansys Lumerical Scripting – Learning Track | Ansys Innovation Courses
Please let me know this solve the problem.
Thanks and regards
Devika
-
November 28, 2023 at 6:29 amlixingSubscriber
Actually you can not add any monitor into structure group,you can try analysis group.
-
-
-
November 28, 2023 at 2:21 pmJoshua WorrallSubscriber
Thank you both Devika and Chris for the replies, I realise now that I can't add the monitors using a structure group. I tried again using an analysis group as suggested by Chris and I can now get the monitors placed with the scripts.
-
- The topic ‘Can’t add frequency domain field profile into structure group using script’ 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
- Topology Optimization Error
- Edge Coupler EME Example Issue
- How to measure transmission coefficients on a given plane .
-
1241
-
543
-
523
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.