-
-
February 9, 2022 at 1:18 amchetheringtonSubscriber
Hi,
In Lumerical, I'm trying to use scripts to create a structure group (group B) the values of whose user parameters depend on structures created in a separate structure group A. I see two ways of doing this and neither are working so I am asking for recommendations:
One would be to nest B inside of A, so that variables in the A build script can be passed to the B build as user parameters. However, this fails because the software can't parse nested scripts. e.g. set('script', ' ... addstructuregroup; set('script', '...'); ');
Another method is to use the same script to create A first, then read out the values from A, then pass those values to B as user parameters. For example,
newproject(3); clear;
addstructuregroup; set("name","A");
adduserprop("A_z", 2, 1e-6);
set('script', '
addrect;
set("name","Arectangle");
set("z", A_z);
runsetup;
');
select("A::Arectangle");
zvalue=get("z");
#I will then pass zvalue to structuregroup B.
If I run this by pasting into the prompt, it runs fine. The problem is this: When I run this as a script, I invariably get the error: Â line 11: no objects matching that name were found.
What am I doing wrong? Can you suggest a different way of doing this dependency? B must be a structure group of its own, because I need to make an array of B's later on.
Thanks,
Craig
February 9, 2022 at 2:02 amchetheringtonSubscriberThe object "Arectangle" is selectable by script ONLY if it is in a layout group, not if it is in a structure group.
February 11, 2022 at 6:41 amchetheringtonSubscriberI am pretty sure this is a bug in the software. Lumerical staff, do you have any comment as to what I'm doing wrong, or as to how to make a structure array of structure groups whose properties depend on a different structure group? Thanks.
February 12, 2022 at 12:20 amGuilin SunAnsys EmployeeIn general, Lumerical has two methods to create nested structures groups:
1: manually create the groups in GUI, write the script to create structures, and pass the parameters from root to branches. Eg, "model" is the basic root, and it can pass all the parameters to its children (groups and objects);
2: using script: before you assign any thing to the inner group, you have to first create it.
In your illustration script:
newproject(3); clear;
addstructuregroup; set("name","A");
adduserprop("A_z", 2, 1e-6);
set('script', '
addrect;
set("name","Arectangle");
set("z", A_z);
runsetup;
');
select("A::Arectangle");
zvalue=get("z");
there is no "z" beforehand, so you have first get it from Arectangle.
Actually you should first define all parameters, and then assign them to the specific object inside that group.
I would say that, although the scripting seems efficient, if you do not check the geometry and the material properties, it has higher chance to have some mistakes. I personally prefer to use group and its script inside instead of using an independent script to create the whole simulation file.
February 17, 2022 at 5:29 pmStealthbird97SubscriberNot sure how this can be used in conjunction with other objects such as dipoles, or monitors.
For example, If I need to place a dipole relative to a object inside a structure group.
Last time I checked, structure group scripting can not access variables outside of the structure group. How would I be able to access a user variable, or a parameter of an object in the "model" inside a structure group script?
February 17, 2022 at 5:44 pmchetheringtonSubscriberThis is the practical problem I'm encountering. I am trying to use the LSF script to 'read out' the value from inside the structure group but it doesn't work if the structure group is built by an internal script. How can I do that readout?
February 17, 2022 at 6:08 pmGuilin SunAnsys EmployeeStructure group cannot access other objects outside its scope.
To do so, you have two options:
1: use analysis group. it can access its member structure group, source and monitors. Please refer this example:
Metamaterial parameter extraction - Smith
2: through "model" to access. Please refer band structure examples: Bandstructure of planar photonic crystal with a square lattice
Please read the example instructions, open the files and check related objects and scripts to see how the parameters are assigned and passed.
July 8, 2022 at 10:47 ammohamed.elshorbagySubscriberAs others have stated, the line:
select("A::Arectangle");
does not work when called from a script file, but works when entered into the script prompt. Is there a solution to this?
July 8, 2022 at 3:40 pmmohamed.elshorbagySubscriberSelecting an object inside a structure group from script works when the group is created by the addtogroup command, but not when the object is created using the setup script.
Viewing 8 reply threads- The topic ‘nesting or dependent structure groups’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- 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 .
Top Contributors-
1216
-
543
-
523
-
225
-
209
Top Rated Tags© 2024 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.
-