May 13, 2023 at 5:14 amCoulson JiangSubscriber
I'm trying to inversely design a structure of waveguide by using lumopt, and i follow the example of Y splitter to determine the base structure.Then i modified the python code for topology optimization, but i receive the following error, which i cannot deal with. Can you give me some useful advice? Thanks so much.
File "C:\Program Files\Lumerical\v202\api\python\lumopt\optimization.py", line 469, in run
File "C:\Program Files\Lumerical\v202\api\python\lumopt\optimization.py", line 543, in initialize
File "C:\Program Files\Lumerical\v202\api\python\lumopt\utilities\base_script.py", line 42, in __call__
File "C:\Program Files\Lumerical\v202\api\python\lumopt\utilities\base_script.py", line 52, in eval
File "C:\Program Files\Lumerical\v202\api\python\lumapi.py", line 1184, in eval
File "C:\Program Files\Lumerical\v202\api\python\lumapi.py", line 248, in evalScript
raise LumApiError("Failed to evaluate code")
lumapi.LumApiError: 'Failed to evaluate code'
May 14, 2023 at 11:29 amCoulson JiangSubscriber
I found that the problem lies in the lumerical script I wrote, mainly because I called 'addimportedsource' command and wrote Ex and other source parameters by myself. The code is as follows, I wanna ask how to modify this to make the python file run? What's more, is a topology optimization must has a initial guess?
# define position vectors
w0 = 0.5e-6;
x = linspace(-3*w0,3*w0,200);
y = linspace(-3*w0,3*w0,200);
z = 0;
X = meshgridx(x,y);
Y = meshgridy(x,y);
lambda0 = 0.632e-6;
f = c/lambda0;
w = 2*pi*f;
k = 2*pi/lambda0;
Ex = sin(pi)*M;
Ey = cos(pi)*M;
Ez = 0*M;
EM = rectilineardataset("EM fields",x,y,z);
May 29, 2023 at 9:49 pmTaylor RobertsonAnsys Employee
Your script is written in LSF, I would try and debug this in Lumerical before trying to call the script from python. Pay attention to the fsp file that this will run in, because many of these commands refer to objects in the fsp tree. If you are using lumopt it will likely start with a blank file, which is why this is called the set-up script. One thing I notice is that it is importing files which may be in a different directory then where python is running.
To use initial conditions in toplogy optimization I would direct you to the initialization section of this article.
- You must be logged in to reply to this topic.
Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.
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.
- Why am I getting “process exited without calling finalize”, and how do I fix it?
- “Import optical generation” or “delta generation rate”?
- Error: addfdtd is not a valid function or a variable name
- Error on Lumerical device
- Using a license file on a new license server
- Ansys Insight: Transmission results greater than one
- Ansys Insight: Diverging Simulations
- Finding your Ansys (or Lumerical) account number
- Is there a Lumerical script command to output the Simulation and Memory requirements?
- Ansys Insight: Why my simulation result is different from published paper or experiment?
© 2023 Copyright ANSYS, Inc. All rights reserved.