TAGGED: error, mode-expansion
-
-
May 14, 2024 at 7:09 pmVincent LetourneauSubscriberHi, I'm getting this error, can you help identify its cause? I get it if running from a computer cluster but not on my local machine where it returns the correct values without problem.Â│ERROR:root:unable to calcualte mode expansion.
│Traceback (most recent call last):
│  File "/home/mila/l/letournv/repos/nanophoto/lumerical.py", line 87, in FDTD_FOM_computations
│   foms.append(fom.get_fom(sim))
│  File "/home/mila/l/letournv/opt/lumerical/v241/api/python/lumopt/figures_of_merit/modematch.py", line 2
│07, in get_fom
│   trans_coeff, self.wavelengths = ModeMatch.get_transmission_coefficient(sim, self.direction, self.moni
│tor_name, self.mode_expansion_monitor_name)
│  File "/home/mila/l/letournv/opt/lumerical/v241/api/python/lumopt/figures_of_merit/modematch.py", line 2
│34, in get_transmission_coefficient
│   raise UserWarning('unable to calcualte mode expansion.')
│UserWarning: unable to calcualte mode expansion. -
May 15, 2024 at 6:09 pmGuilin SunAnsys Employee
It is difficult to give solutions based on the error message from Python. Maybe it is due to the difference of opration system? what OS you are using? what kind of device is this? does the mode expansion work directly from the file wihtout using python? I would suggest that you use a simple straight waveguide with ports, first do direct simulation, then use Python script. Â we need to isolate the possible issues.
-
May 15, 2024 at 8:41 pmLitoAnsys Employee
@Vincent,Â
From your message,Â
I get it if running from a computer cluster but not on my local machine where it returns the correct values without problem.
How are you running the Python/API script (requires a GUI connection) on the cluster? Are you connecting to the cluster with a GUI/desktop connection like VNC, OpenText ETX, X11 forwarding, etc? Â
-
May 15, 2024 at 9:17 pmVincent LetourneauSubscriber
@Guilin, I'm unfortunately quite unfamiliar with the rest of Lumerical. Could you give me instructions to run my simulation without the python api? The code launching the simulation is copied below.
@Lito, I am connecting to the cluster with ssh + X11 forwarding.
from lumopt.utilities.simulation import SimulationÂ
from lumopt.figures_of_merit.modematch import ModeMatchÂsim = Simulation('.', False, False)Â
fom = ModeMatch(monitor_name = 'fom', mode_number = 'Fundamental TE mode', direction = 'Forward', norm_p = 2)Â
sim.fdtd.load("./files/forward_0.fsp")
size_x = 2000
delta_x = 20
size_y = 1800
delta_y = 20
x_points = int(size_x / delta_x) + 1Â
y_points = int(size_y / delta_y) + 1Â
x_pos = np.linspace(-size_x / 2, size_x / 2, x_points) * 1e-9Â
y_pos = np.linspace(0, size_y, y_points) * 1e-9
sim.fdtd.switchtolayout()Â
sim.fdtd.putv('x_geo',x_pos)Â
sim.fdtd.putv('y_geo',y_pos)Â
\sim.fdtd.putv('z_geo',np.array([0-110e-9,0+110e-9]))Â
sim.fdtd.putv('eps_geo',eps_for_sim)Â
script=('select("import");'Â
'delete;'Â
'addimport;'Â
'temp=zeros(length(x_geo),length(y_geo),2);'Â
'temp(:,:,1)=eps_geo;'Â
'temp(:,:,2)=eps_geo;'Â
'importnk2(sqrt(temp),x_geo,y_geo,z_geo);')Â
sim.fdtd.eval(script)Â
fdtd.run()Â
print(fom.get_fom(sim)) -
May 15, 2024 at 11:03 pmGuilin SunAnsys Employee
Before "fdtd.run() "
you should be able to see the FDTD file, and save it to a fsp file on you local machine. Then directly run it on your local computer, and then move to the cluster and run it. If the cluster has GUI you can open and run the file. If not, please refer to this link: https://optics.ansys.com/hc/en-us/articles/360024974033-Running-simulations-using-terminal-on-LinuxÂ
You can also use one of the online examples with port objects, such as this one  https://api.lumerical.com/app-gallery/fetch-download-web?id=c118296f-waveguide-crossingÂ
run the example file on the cluster and try to get the result. See what happens.
-
May 16, 2024 at 2:56 pmVincent LetourneauSubscriber
So far I am able to open fdtd with a specific simulation file
$ /opt/lumerical/v241/bin/fdtd-solutions simulationfile.fsp
but I dont understand how to run the simulation from the CLI. -
May 16, 2024 at 3:13 pmVincent LetourneauSubscriber
Ok I think I got it. If I run
fdtd-engine -log-stdout forward_0.fsp
I getÂ
fdtd-engine: error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory                      Â
this library is definitely installed. Can you tell me where it should be located for lumerical to find it? freeglut was installed with conda and I have created a symbolic link /opt/lumerical/v241/lib/intoconda to the conda env library dir that contains the libglut.so.3 file. Is that a good solution? -
May 16, 2024 at 3:33 pmVincent LetourneauSubscriber
I have also just tried to create a symbolic link to libglut.so.3 directly into /opt/lumerical/v241/lib/ but get the same error message "error while loading shared libraries: libglut.so.3"
-
May 16, 2024 at 4:03 pmLitoAnsys Employee
@Vincent Letourneau,
Can you open ‘fdtd-solutions’ directly from the terminal on the cluster?Â
/opt/lumerical/v241/bin/fdtd-solutions &
If so, then you can run the python script from the GUI. Try running the sample script that is shown in the image below.Â
You can run the simulationfile.fsp directly from the terminal.
e.g. run with 32 threads on the machine (-t 32)
/opt/lumerical/v241/bin/fdtd-engine -t 32 simulationfile.fspSee this KB for more information >>Running simulations using terminal on Linux – Ansys OpticsÂ
-
May 16, 2024 at 5:06 pmVincent LetourneauSubscriber
I do not have access to a graphical interface. If I runÂ
/opt/lumerical/v241/bin/fdtd-engine forward_0.fsp
I get
/opt/lumerical/v241/bin/fdtd-engine: error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory                      Â
-
May 17, 2024 at 7:40 pmVincent LetourneauSubscriber
Hi, are there other tests i can do to identify the bug? Do you guys know ho to fix that libglut.so.3 error that was returned both from the python api call and the direct fdtd-engine call?
-
May 17, 2024 at 7:46 pmLitoAnsys Employee
Running Lumerical script or Python API scripts will always require a GUI/Desktop connection to the Linux machine. GUI/CAD related computations cannot be done without a GUI connection/interface. You can only run the simulationfile.fsp directly from the terminal/command line in Linux.
The error indicates that you are missing the library, ‘libglut.so.3’ — required by Lumerical on Linux systems. Please install the required libraries/packages for your system.Â
See this KB for a complete list of the required packages for your Linux distribution. >> Required libraries for Ansys Lumerical on Linux – Ansys OpticsÂ
-
May 20, 2024 at 5:09 pmVincent LetourneauSubscriber
I know Lumerical "thinks" Im missing the package but its really installed in my conda env directory. Im asking for help about how to make Lumerical see it correctly. I made a symbolic link in /opt/lumerical/v241/lib/ to the conda directory containing the library libglut.so.3 but that does not seem to be enough. I cannot install stuff directly with "sudo apt install ..." because this is an installation on a computer cluster and can only install stuff through conda.
-
May 21, 2024 at 5:29 pmVincent LetourneauSubscriber
Hi, I seem to have fixed the libglut.so.3 problem with patchelf. Now if I call
fdtd-engine forward.fsp
I getÂ
Messages file /ansys_inc/shared_files/licensing/language/en-us/ansysli_msgs.xml does not exist.
0.224167% complete. Elapsed simulation time: 2.24167e-15 secs. Max time remaining: 6 secs. Auto Shutoff: 1
2.31639% complete. Elapsed simulation time: 2.31639e-14 secs. Max time remaining: 6 secs. Auto Shutoff: 1
4.7075% complete. Elapsed simulation time: 4.7075e-14 secs. Max time remaining: 6 secs. Auto Shutoff: 1
9.48972% complete. Elapsed simulation time: 9.48972e-14 secs. Max time remaining: 6 secs. Auto Shutoff: 0.0011975
19.0542% complete. Elapsed simulation time: 1.90542e-13 secs. Max time remaining: 5 secs. Auto Shutoff: 2.17561e-07So Lumerical seems to be working fine directly from the terminal (with the exception of the missing message file), but im still getting errors when using the python API. If run my script I get
CONFIGURATION FILE {'root': '/home/mila/l/letournv/opt/lumerical/v241/api/python', 'lumapi': '/home/mila/l/letournv/opt/lumerical/v241/api/python'}
Traceback (most recent call last):
 File "/home/mila/l/letournv/repos/nanophoto/lumtest.py", line 42, in
  print(fom.get_fom(sim))
 File "/home/mila/l/letournv/opt/lumerical/v241/api/python/lumopt/figures_of_merit/modematch.py", line 207, in get_fom
  trans_coeff, self.wavelengths = ModeMatch.get_transmission_coefficient(sim, self.direction, self.monitor_name, self.mode_expansion_monitor_name)
 File "/home/mila/l/letournv/opt/lumerical/v241/api/python/lumopt/figures_of_merit/modematch.py", line 234, in get_transmission_coefficient
  raise UserWarning('unable to calcualte mode expansion.')
UserWarning: unable to calcualte mode expansion.
Any help on this would be appreciated -
May 21, 2024 at 11:08 pmLitoAnsys Employee
@Vincent Letourneau,Â
We shall continue with your support case via email. I will be closing this post for now.Â
-
- The topic ‘unable to calcualte mode expansion’ 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
- Trapezoidal ring
- Help for qINTERCONNECT
- Issues with getting result from interconnent analysis script
- Absorption cross-section of AuNR excited by prism-based TIR
- How to measure transmission coefficients on a given plane .
- Topology Optimization Error
-
1406
-
599
-
591
-
550
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.