Obtaining Solved Solution Data in vtk Format

Hello,

I am working on simulating Laplace’s equation with Dirichlet Boundary Conditions, specifying the electric potential on the surface. I’m importing a grid I generated in .vtk format and following the documentation for Bempp on “Solving your first problem with Bempp”. My solution is stored in “sol” after calling bempp.api.linalg.gmres (sol, info = bempp.api.linalg.gmres(slp, rhs)), and I would like to obtain data on the calculated vector fields (electric field) in 3D space. Is there a way to obtain this data, perhaps a collection of arrays that store numbers representing vector components in a lattice?

In addition, I’m trying to export the solution to a .msh or .vtk file using bempp.api.export(‘grid_function.vtk’, grid_function=sol), but I’m obtaining “TypeError: write() got multiple values for keyword argument ‘binary’”. I included the full error message below. I’m using Python 3.7.6 and Jupyter Notebook.

Thank you very much.


TypeError Traceback (most recent call last)
in
----> 1 bempp.api.export(‘grid_function.vtk’, grid_function=sol)

/opt/anaconda3/lib/python3.7/site-packages/bempp/api/grid/io.py in export(filename, grid, grid_function, data_type, transformation, write_binary)
141 cell_data=cell_data,
142 binary=write_binary,
–> 143 file_format=file_format,
144 )
145

/opt/anaconda3/lib/python3.7/site-packages/meshio/_helpers.py in write_points_cells(filename, points, cells, point_data, cell_data, field_data, file_format, **kwargs)
83 points, cells, point_data=point_data, cell_data=cell_data, field_data=field_data
84 )
—> 85 return write(filename, mesh, file_format=file_format, **kwargs)
86
87

/opt/anaconda3/lib/python3.7/site-packages/meshio/_helpers.py in write(filename, mesh, file_format, **kwargs)
131
132 # Write
–> 133 return writer(filename, mesh, **kwargs)

/opt/anaconda3/lib/python3.7/site-packages/meshio/vtk/_vtk.py in (f, m, **kwargs)
724 read,
725 {
–> 726 “vtk”: lambda f, m, **kwargs: write(f, m, **kwargs, binary=True),
727 “vtk-ascii”: lambda f, m, **kwargs: write(f, m, **kwargs, binary=False),
728 “vtk-binary”: lambda f, m, **kwargs: write(f, m, **kwargs, binary=True),

TypeError: write() got multiple values for keyword argument ‘binary’

Hi. Are you running the newest version Bempp-cl 0.2.2? We had this issue. But it should be fixed. Let me know if it isn’t and I will check this again.

Timo

If you’re using the latest Bempp, this issue is caused by an old version of meshio. Can you update meshio and see if that fixes it?