February 9, 2022 at 1:18 amchetheringtonSubscriber
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,
adduserprop("A_z", 2, 1e-6);
#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.
CraigFebruary 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:
adduserprop("A_z", 2, 1e-6);
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.elshorbagySubscriber
As others have stated, the line:
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.elshorbagySubscriber
Selecting 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
Ansys Innovation Space
- You must be logged in to reply to this topic.
Simulation World 2022
Check out more than 70 different sessions now available on demand. Get inspired as you hear from visionary companies, leading researchers and educators from around the globe on a variety of topics from life-saving improvements in healthcare, to bold new realities of space travel. Take a leap of certainty and check out a session today here.
Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.Trending discussions
- “Import optical generation” or “delta generation rate”?
- Error on Lumerical device
- Why am I getting “process exited without calling finalize”, and how do I fix it?
- Using a license file on a new license server
- Ansys Insight: Convergence issues in CHARGE
- Ansys Insight: Diverging Simulations
- Ansys Insight: About override mesh in FDTD: its use and settings
- Lumerical support has moved to the Ansys Learning Forum (ALF)
- Is there a Lumerical script command to output the Simulation and Memory requirements?
- focusing efficiency
Top Rated Tags