Hello,
I’m new to BEMpp and I’m trying to run the first Laplace problem in Jupyter Notebook (Python 3.7) on the “Solving your first problem” page in the documentation. The import statement works, but the following line
grid = bempp.api.shapes.sphere(h=0.1)
returns a TypeError.
Could someone advise me on how to solve this issue? I’ve included the full error statement below.
When I modify my code from sphere to other shapes that also rely on line 390 in shapes.py, and therefore line 22 in io.py, I get the same error. On the other hand, calling regular_sphere (which doesn’t rely on the generate_grid_from_geo_string method) instead of sphere runs without a problem, and I’m able to proceed with the solved Laplace problem together with the visualization.
Thank you!
George
P.S.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-8ea91180c722> in <module>
----> 1 grid = bempp.api.shapes.sphere(h=0.1)
2 grid.plot()
/opt/anaconda3/lib/python3.7/site-packages/bempp/api/shapes/shapes.py in sphere(r, origin, h)
404
405 """
--> 406 return ellipsoid(r1=r, r2=r, r3=r, origin=origin, h=h)
407
408
/opt/anaconda3/lib/python3.7/site-packages/bempp/api/shapes/shapes.py in ellipsoid(r1, r2, r3, origin, h)
388 "cl = " + str(h) + ";\n" + stub)
389
--> 390 return __generate_grid_from_geo_string(geometry)
391
392 def sphere(r=1, origin=(0, 0, 0), h=0.1):
/opt/anaconda3/lib/python3.7/site-packages/bempp/api/shapes/shapes.py in __generate_grid_from_geo_string(geo_string)
72
73 msh_name = msh_from_string(geo_string)
---> 74 grid = bempp.api.import_grid(msh_name)
75 os.remove(msh_name)
76 return grid
/opt/anaconda3/lib/python3.7/site-packages/bempp/api/grid/io.py in import_grid(filename)
20
21 vertices = mesh.points.T
---> 22 elements = mesh.cells["triangle"].T.astype("uint32")
23
24 try:
TypeError: list indices must be integers or slices, not str