NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.19k stars 610 forks source link

sim.plot3D() don't work in my pycharm APP #2575

Closed liujw1007 closed 1 year ago

liujw1007 commented 1 year ago

I want to show the structure in the official example below:

import meep as mp import numpy as np import math

cell_size = mp.Vector3(2,2,2)

A hexagon is defined as a prism with six vertices centered on the origin

vertices = [mp.Vector3(-1,0), mp.Vector3(-0.5,math.sqrt(3)/2), mp.Vector3(0.5,math.sqrt(3)/2), mp.Vector3(1,0), mp.Vector3(0.5,-math.sqrt(3)/2), mp.Vector3(-0.5,-math.sqrt(3)/2)]

geometry = [mp.Prism(vertices, height=1.0, material=mp.Medium(index=3.5)), mp.Cone(radius=1.0, radius2=0.1, height=2.0, material=mp.air)]

sim = mp.Simulation(resolution=50, cell_size=cell_size, geometry=geometry)

sim.plot3D()

but it seems that the command ‘sim.plot3D()’ don't work for me. Here is the information in the run window:

/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/numpy/core/getlimits.py:518: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero. setattr(self, word, getattr(machar, word).flat[0]) /home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero. return self._float_to_str(self.smallest_subnormal) /home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/numpy/core/getlimits.py:518: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero. setattr(self, word, getattr(machar, word).flat[0]) /home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero. return self._float_to_str(self.smallest_subnormal) prism, center = (0,0,0.5) height 1, axis (0,0,1), sidewall angle: 0 radians, 6 vertices: (-1,0,0) (-0.5,0.866025,0) (0.5,0.866025,0) (1,0,0) (0.5,-0.866025,0) (-0.5,-0.866025,0) dielectric constant epsilon diagonal = (12.25,12.25,12.25) cone, center = (0,0,0) radius 1, height 2, axis (0, 0, 1) radius2 0.1 dielectric constant epsilon diagonal = (1,1,1)

Elapsed run time = 29.9131 s Traceback (most recent call last): File "/home/admin/Documents/meep/h5.py", line 23, in sim.plot3D() File "/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/meep/simulation.py", line 4724, in plot3D return vis.plot3D(self, save_to_image, image_name, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/meep/visualization.py", line 1144, in plot3D canvas.show(run=True) File "/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/vispy/app/canvas.py", line 437, in show self.app.run() File "/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/vispy/app/application.py", line 160, in run return self._backend._vispy_run() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/vispy/app/backends/_egl.py", line 110, in _vispy_run self._vispy_process_events() File "/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/vispy/app/backends/_egl.py", line 101, in _vispy_process_events wins = _get_egl_windows() ^^^^^^^^^^^^^^^^^^ File "/home/admin/Downloads/miniconda/envs/mp/lib/python3.11/site-packages/vispy/app/backends/_egl.py", line -1, in _get_egl_windows KeyboardInterrupt

Process finished with exit code 130 (interrupted by signal 2: SIGINT)