IhmeGroup / quail

A lightweight discontinuous Galerkin code for teaching and prototyping
GNU General Public License v3.0
52 stars 20 forks source link

Feature Request: Add capability to post process with external tools to overcome Matplotlib's slow contour plot generation #5

Open alilasemi opened 3 years ago

alilasemi commented 3 years ago

Problem

Generating contour plots with Matplotlib, specifically with tricontourf on nonregular domains, can be extremely slow on 2D meshes with a few thousand elements. On the isentropic vortex case, with 50x50 rectangles (total of 5000 triangles), Matplotlib takes 4 mins to post process if the regular mesh setting is used, and about 30 mins if regular mesh is set to false. Since certain 2D problems of interest (such as oblique shocks) cannot be post processed with a regular mesh, it is desired to find an alternative tool chain to produce these plots more efficiently.

Some profiling was done to verify that this is a Matplotlib issue, not a Quail issue. Attached is an icicle plot from cProfile/Snakeviz that shows that almost all of the run time for this case was spent in Matplotlib's tricontourf function.

post_profile

Suggested Solutions

There are several potential options for post processing. Paraview is a commonly used CFD post processing library that is free and open source, and has a Python interface. Other potential libraries of interest may be VTK or Mayavi. Software such as Tecplot may not be desirable, since it is not open source.