Hello,
I am trying to run a fenicsx code from last year but the pyvista interface seems outdated. Here is the code I am running
import dolfinx
import pyvista
L = 1. # total length
d = L/10. # thickness
h = d/6. # size of a cell
my_domain = dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD,
points=((0.0, -0.5*d), (L, 0.5*d)), n=(int(L/h), int(d/h)),
cell_type=dolfinx.mesh.CellType.triangle)
topology, cell_types, geometry_for_plotting = dolfinx.plot.create_vtk_mesh(my_domain, 2)
grid = pyvista.UnstructuredGrid(topology, cell_types, geometry_for_plotting)
pyvista.set_jupyter_backend("none")
plotter = pyvista.Plotter()
plotter.add_mesh(grid, show_edges=True)
if not pyvista.OFF_SCREEN:
plotter.show()
else:
pyvista.start_xvfb()
figure = plotter.screenshot("fundamentals_mesh.png")
I get the following error message:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[8], line 22
19 plotter.add_mesh(grid, show_edges=True)
21 if not pyvista.OFF_SCREEN:
---> 22 plotter.show()
23 else:
24 pyvista.start_xvfb()
File ~/anaconda3/envs/fenicsx-env/lib/python3.10/site-packages/pyvista/plotting/plotter.py:6673, in Plotter.show(self, title, window_size, interactive, auto_close, interactive_update, full_screen, screenshot, return_img, cpos, jupyter_backend, return_viewer, return_cpos, before_close_callback, **kwargs)
6670 if jupyter_backend is None:
6671 jupyter_backend = self._theme.jupyter_backend
-> 6673 if jupyter_backend.lower() != 'none':
6674 jupyter_disp = handle_plotter(self, backend=jupyter_backend, **jupyter_kwargs)
6676 self.render()
AttributeError: 'NoneType' object has no attribute 'lower'
Many thanks in advance for your help!
Claire