kinnala / scikit-fem

Simple finite element assemblers
https://scikit-fem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
512 stars 80 forks source link

vedo, formerly known as vtkplotter #361

Closed gdmcbain closed 3 years ago

gdmcbain commented 4 years ago

As noted in #44, matplotlib distorts three-dimensional views uncontrollably. Some very nice plots were added to #357 using vtkplotter. It might be a worthwhile addition to skfem.visuals #286. (I haven't looked at the licence or portability.)

kinnala commented 4 years ago

License seems to be MIT. I don't oppose this, the plots look great. I'll try to get it working on my Python setup and try it out.

gdmcbain commented 4 years ago

A quick experiment went well.

On a laptop running Microsoft Windows 10

pip install vtkplotter

Then after having run ex32.py from #342, run

from vtkplotter import Plotter

vp = Plotter()
vp.load('ex32.vtk')
vp.show()

This pops up a 'Visualization Toolkit Win32OpenGL' showing a green triangulated ellipsoid which can be rotated, translated, and zoomed with the mouse.

screenshot

This does nicely show the p ~xy pattern expected from creeping convection in a horizontally heated ellipsoid.

I assume this could be scripted, once I read the docs.

gdmcbain commented 4 years ago

To generate a PNG rather than a window,

from vtkplotter import Plotter, screenshot

vp = Plotter(offscreen=True)
...
screenshot('ex32.png')

See marcomusy/vtkplotter#55.

That saves the PNG without throwing up a window; however, it doesn't colour by pressure. The answer to that might be in marcomusy/vtkplotter#131.

gdmcbain commented 4 years ago

Here we go:

from vtkplotter import Plotter, screenshot

Plotter(offscreen=True).load("ex32.vtk").pointColors("pressure").show()
screenshot("ex32.png")
gdmcbain commented 4 years ago

I'd deferred this as it wasn't working on my Ubuntu 19.10 desktop (something about nvidia nouveau); as mentioned the previous work had been done under Microsoft Windows 10.

Yesterday I updated the desktop to Ubuntu 20.04 LTS and it's working fine. Here's a recipe.

kinnala commented 4 years ago

I've been encountering issues trying to run this in a docker container, I'm only developing inside containers nowadays.

I think I have to next try it out in a Ubuntu 20.04 virtual machine.