pyprimemesh icon indicating copy to clipboard operation
pyprimemesh copied to clipboard

Plotting with many zones is slow

Open akaszynski opened this issue 3 years ago • 9 comments

Could you share an update where you are with the refactoring the graphics issues seen with PyPrime?

Absolutely.

First, thanks Ninad for helping me get started with PyPRIME. I'd like to see the install docs and packaging (of the server) to be improved so it's not a huge pain to install, and thanks @ninad-kamat for all your help.

Were you able to reproduce the issue using pyprime? If so, were you able to identify the root cause for the issue seen?

I was able to reproduce the issue and fundamentally it comes down to a limitation with VTK: https://discourse.vtk.org/t/vtk-is-slow-when-i-have-a-lot-of-actors-10000/2421

That being said, PyVista is also a contributor to the slowdown and I can improve the performance a bit, by as much as 50-60% depending on the platform. https://github.com/pyvista/pyvista/pull/2925

However, fundamentally the issue will still be on VTK's side. It's simply not designed to scale for 1000s of actors.

I'm researching a workaround. For now, pyvista #2925 will help a little bit.

akaszynski avatar Jul 01 '22 15:07 akaszynski

Solution is composite datasets: https://github.com/pyvista/pyvista/pull/2941

@ninad-kamat, how critical is it for this to be fixed? I might get this out for 0.35.0, but if not I can release a bleeding edge pyansys-pyvista with just this feature.

akaszynski avatar Jul 05 '22 05:07 akaszynski

@akaszynski It is not critical. We can wait till 0.35.0

ninad-kamat avatar Jul 05 '22 14:07 ninad-kamat

@akaszynski I was checking out the video you posted and the snippet of code as well. Based on what I understand, each block does not need to be a closed body, but just a block of facets and that can be picked. The intention here is that each edge and each face will be blocks. Also, any upper limit on the number of blocks?

ninad-kamat avatar Jul 05 '22 14:07 ninad-kamat

Scales well. 10,000 "blocks" in ~2 seconds to add and ~2 seconds. Even in pure C++, with the old approach you'd be waiting several minutes.

akaszynski avatar Jul 07 '22 19:07 akaszynski

I also have a simple geometry with a dense mesh that runs in ~30 seconds in pyprime but if I ask to see the mesh in a display, that time goes up to several minutes (445 seconds). This is probably a pyvista thing and not pyprime but users will want to see their mesh and since there is no information about what pyprime is doing, might assume it is stuck.

mcMunich avatar Sep 20 '23 14:09 mcMunich

@mcMunich Yes. We are aware of this issue. We are trying out the new multi-block feature in pyvista to see if this can speed such scenarios up. @AlejandroFernandezLuces is currently working on this. Could you share the file with him?

ninad-kamat avatar Sep 20 '23 14:09 ninad-kamat

@ninad-kamat @AlejandroFernandezLuces I was in a talk with some Mech product manager recently and they want to use a remote pydpf tool to just grab surface results for a quick display for customers. Since pyprime has the surface mesh, maybe a easy or default plot could be only surfaces? Not sure that speeds things up, but it might be less data. Just an idea. The model I am testing is attached: sherlockModel_simplified.zip

mcMunich avatar Sep 21 '23 06:09 mcMunich

I can check that out, thanks for sharing the file!

Anyway, the performance issues of PyVista for large meshes has already been raised. I just opened an specific one for PyPrime just in case the issue is different in our case.

https://github.com/ansys-internal/kitware-ansys/issues/35

AlejandroFernandezLuces avatar Sep 21 '23 08:09 AlejandroFernandezLuces