-
-
May 6, 2022 at 7:17 pm
hacha
SubscriberI would like to define some of my variables in the Model scope, but if I create a construction script there it prevents me from manually adding things like monitors (sometimes it's nice to put an arbitrary monitor in after designing a simulation).
The workaround is to create a structure group and use a separate analysis group, but sometimes I would like a monitor to rely on some variable that I specified for the construction group. Is there a way for me to access a variable stored in another group? Or can I define variables in the Model group and access them from the group's Structure or Analysis group children?
Example: I want a monitor at the end of a waveguide while I run a parameter sweep on waveguide length, 'WG_length' . I can script this all in the model group, but then it will override any attempts to add more monitors via the GUI. I could script the waveguide in a structure group, and the monitor in the analysis group, but then the monitor will no longer have access to the 'WG_length' variable and will not move with the waveguide during the parameter sweep.
May 9, 2022 at 2:50 pmGuilin Sun
Ansys EmployeeStructure groups can only be used to set up geometry, and analysis groups can be used to set up all objects, including geometry, source, monitors and simulation solvers (similar to MODEL). However, the scripts in those groups can only access the variables inside the groups and get them from MODEL (cannot be from group to MODEL). They cannot directly access other groups.
In your case, you can include the structure group inside the analysis group, or simply setup the structure and the monitors in analysis group. You can refer some online examples, such as
https://support.lumerical.com/hc/en-us/articles/360042097393
May 9, 2022 at 5:46 pmhacha
SubscriberThank you, that is super helpful! Could you share an example of a group script getting a variable from MODEL? Do you have to pass the variables to the group from the MODEL script, or can the groups pull the variables from MODEL? Hope this makes sense!
-Brandon
May 9, 2022 at 6:54 pmGuilin Sun
Ansys Employeeany group cannot pull variables in MODEL. It is the MODEL that passes the variables/parameters to the groups. The same parameters can be passed from MODEL to different groups, if they are the same. IN band structure simulations the periodicity is passed to the analysis, structure and dipole groups: Photonic crystals - list of examples
May 9, 2022 at 7:01 pmhacha
SubscriberAh, now I understand. Thanks again!
Viewing 4 reply threads- The topic ‘Is it possible to access user-defined variables from other groups/containers?’ is closed to new replies.
Ansys Innovation SpaceTrending discussionsTop Contributors-
3467
-
1057
-
1051
-
918
-
896
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-

Ansys Assistant

Welcome to Ansys Assistant!
An AI-based virtual assistant for active Ansys Academic Customers. Please login using your university issued email address.

Hey there, you are quite inquisitive! You have hit your hourly question limit. Please retry after '10' minutes. For questions, please reach out to ansyslearn@ansys.com.
RETRY