cburstedde / p4est

The "p4est" forest-of-octrees library

Home Page:www.p4est.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

disconnected contour lines

xinyu722 opened this issue · comments

Hello,
I wirte my output with p4est_vtk_write_point_dataf and p4est_vtk_write_cell_dataf. To draw contour lines, p4est_vtk_context_set_scale(context, 1) and p4est_vtk_context_set_continuous(context, 1) are used. However, the result is unsatisfactory for the lines are disconnnected where 2:1 happened. The p4est_step3 has the same problem as shown below.
How is it happen? Any suggestions to make it prettier?
P1
P2

@xinyu722 can you try applying the paraview filter: cell data to point data on the vtk that you created using the p4est_vtk_write_cell_dataf api? After this try applying the contour and see if that helps.

When you write point data from p4est the points are essentially the data written on the quadrant (or octant) corners. On the contrary, when you use the Paraview filter to convert the cell data to point data it uses interpolation to bring values on points laid out in a Cartesian grid. Hence I believe you should get much smoother contours (on the flip side now, it's not your simulation raw data but the interpolated values that you are looking at).

Thanks.
I tried the filter with p4est_vtk_write_cell_dataf but it didn't work. Then I tried to use interpolatation to bring values on points before p4est_vtk_write_point_dataf. The contours gets smoother, but still not good enough.
Is there any other filters which might help?

@xinyu722 is there a way you can share a link to download the vtk and the quantity whose contours you are trying to plot. I can try some possiblities! Also try checking the filter called "resample to image" which allows you to specify the nx ny of the cartesian grid on which this interpolation will happen. Maybe that can help you a bit more.

Things get bad when 2:1 happened.
The lines could be alittle bit smoother after I refine the mesh, change the countour levels and make interpolations. But sometimes these operations are not allowed, and it's not supposed to be like that, is it?
62.zip

Things get bad when 2:1 happened. The lines could be alittle bit smoother after I refine the mesh, change the countour levels and make interpolations. But sometimes these operations are not allowed, and it's not supposed to be like that, is it? 62.zip
If your simulation data lives at cell centers, then there is no expectation for contour lines to work. I'd be surprised if the paraview filters handle hanging faces well enough (there is no explicit neighbor association in the VTK file). A well-defined interpolation from cell centers to continuous nodal piecewise linears is described in: https://ins.uni-bonn.de/publication/cpu-ray-tracing-of-tree-based-adaptive-mesh-refinement-data-1494.bib?pk=1494 but it's fairly well hidden in the paper and considerable work to redo. Alternatively, you may use p4est_lnodes_new (degree = 1) to setup a continuous point-based field and write your own code to convert your cell data to the point data according to that structure/convention. You'd do this looping through elements first and then nodes of each element. Check the step examples for using lnodes.

I have been told to try tecplot and it works! The function "2D triangulation" can divide the grids into triangles, and a kind of filter "smooth" makes the contour lines good.
Thanks anyway!
1

Thanks for sharing.