Regarding paraview and AMR

1,383 views
Skip to first unread message

Vitor Machado

unread,
Jun 16, 2021, 8:54:56 AM6/16/21
to basilisk-fr
Hi everyone! I would like to know if someone who also faced my problem found any way to resolve it.
I'm using the VTU output to analyze my data, but when I try to evaluate vorticity, or velocity contours it looks all broken where the mesh changes its refinement. 
Is there a filter on Paraview that can interpolate, or do a resample in order to provide a clean view in this differnt mesh size interface? Or there is something that i have to export from the basilisk simulation in order to get better results.

I've done a little search but nothing that i've tried work.

Thanks in advance!

Øystein Lande

unread,
Jun 17, 2021, 2:56:04 AM6/17/21
to basilisk-fr
Hi,
This is a known problem if you write your basilisk quadtree/octree grid data as Unstructured mesh to paraview.
They way to get around this is to use the fairly new hypertree grid in paraview (which essentially is the same as quad/octree). These grids have special filters for creating contours, slices etc without holes.
I made a writer for this some time ago (see http://www.basilisk.fr/sandbox/oystelan/output_htg.h), however it should be noted that the hypertree grid at the time was under development, so you may need to modify the script slightly in order to produce working files for the latest version of paraview. (i think i used version 5.7 at the time).

good luck.

br, Øystein  

Vitor Machado

unread,
Jun 17, 2021, 7:23:10 AM6/17/21
to basilisk-fr
Thanks  Øystein, I'll try it latter and if it works, I come back here to give you the news!

Christophe Josserand

unread,
Jun 18, 2021, 5:59:38 AM6/18/21
to basilisk-fr, Daniel Weisz-Patrault, Eric Charkaluk
Dear Basilisk users,

please find below a post-doc offer on the SOFIA project to use basilisk for modeling additive manufacturing.
The post-doc is funded until march 2022 with potential possibilty of extension.
Do not hesitate to contact us (Christophe...@ladhyx.polytechnique.fr) if you want more informations.
Best regards,
Eric Charkaluk, Christophe Josserand and Daniel Weisz-Patrault



post_doc_sofia_en.pdf

Maxi Sa

unread,
Jun 18, 2021, 6:09:21 AM6/18/21
to basilisk-fr
Hi,
you could try to use the "CleanToGrid"-Filter and then the "ResampleToImage"-Filter in Paraview.

Inspired by the htg-exporter by Øystein I developed a MPI-compatible htg-exporter for the current Paraview Version (Paraview v5.9.0 & v5.9.1)

The easiest way to get sandbox code is via the download skript from Antoon:

Good luck!

- Maximilian

Vitor Machado

unread,
Jun 18, 2021, 6:56:32 PM6/18/21
to basilisk-fr
Hi Maximilian, you don't imagine how thankfull I am for you sharing those files! 

If I'm not bothering you, I faced some problems trying to use your htg exporter.

I manage to put them to work in basilisk, I manage to make my simulation export the files, I managed to open in Paraview, but when in Paraview, I at first tryed to use the Hyper tree functions to process the contours and such, but I noticed that when in Hyper tree I could not make a clip of a scalar, I'm working with bubbles and I need to be able to separate the bubble from the remaining domain, so I used the filter HyperTree to UnstructuredGrid, everythin looked fine, i ploted the  volume fraction, pressure and velocity field in a slice and none of them seems broken, it seemed to work perfectly.

But here is the problem, when I tried to plot some contours of velocity, volume fraction, vorticity, etc, the contours didn't showed up! It didn't showed up in the HyperTree grid neither in the UnstructuredGrid. Am I doing something wrong?

Again, I'm very thankfull for the help of all of you!

Maxi Sa

unread,
Jun 19, 2021, 8:04:57 AM6/19/21
to basilisk-fr
Hi,
I am glad you can use it!
Are you working on a Quadtree or on a Octree?
The "Clip by Scalar"-Filter should work, even though only on cell data.
The contour problem is a problem,  that also occurs to me. I am not sure, if this is an exporter problem or a *.htg problem. HTG is still under development.
But a workaround exists:
Resample the unstructured grid to an Image with the "ResampleToImage" Filter (be aware of the correct sampling dimensions).
If you use only 1 timestep, try using the "HyperTreeGridToDualGrid" -Filter instead of the "HyperTreeGridToUnstructuredGrid" -Filter

Let me know if this works!
 
- Maximilian

Vitor Machado

unread,
Jun 22, 2021, 11:31:14 PM6/22/21
to basilisk-fr
Sorry for taking to long to give you the news Maximilian, but I still think that the results are a bit strange. I tried to use the  HyperTreeGridToDualGrid and ploted the vorticity iso curves, and still looked all broken (i put a image in anex so that you can see what i'm talking about)
Maybe i'm doing something wrong. I saw that there are two kind of saved files, on that is a hypertree.pdv and the htg files, i have to do something with the hypertree.pdv?
Maybe this is a problem that arise due to the vorticity calculation...
And regarding the ResampleToImage i didn't really get how it works and how to set properly the sampling dimensions.

Thank you so much for your help and patience!


Contour.png

Maxi Sa

unread,
Jun 30, 2021, 4:39:04 PM6/30/21
to basilisk-fr
Hi,
the *.pvd file is just a collection file to keep track of different time steps. This should not be a problem.
The ResampleToImage sampling dimensions should be (not really sure) "number of cells per axis (+1?)".
Hopefully the work on the HTG file format progresses.

HUI WANG

unread,
Nov 25, 2021, 10:50:01 AM11/25/21
to basilisk-fr
Hello Maximilian,

I outputted the .htg file and made it work for my case in 2D using your code. 
After doing HyperTreeGridToUnstructuredGrid--ResampleToImage, nothing is shown in the rendering view, what I am missing? I tried to modify the dimensions, but nothing changes
By the way, how can I plot the streamline? This filter is always unfunctional even I convert HyperTreeGridToUnstructuredGrid or HyperTreeGridToDualGrid or CelldatatoPointdata

Thanks a lot
Hui

Maxi Sa

unread,
Nov 26, 2021, 9:17:36 AM11/26/21
to basilisk-fr
Hello Hui, I think there might be something broken with my exporter. Keep in mind that HTG format is somewhat still in development. I  suggest you try to use another paraview exporter instead. I will update this thread when it is fixed.
- Maximilian

Maxi Sa

unread,
Nov 26, 2021, 4:24:06 PM11/26/21
to basilisk-fr
Hello Hui,

please try using http://basilisk.fr/sandbox/sander/output_htg.h and let me know if it works (better?) !

-- Maximilian

HUI WANG

unread,
Nov 29, 2021, 11:20:47 AM11/29/21
to basilisk-fr
Hello Maximilian,

I tried the new version and it works fine now for me. Thanks for this development.
Now streamline and ResampleToImage works fine. 

Hui

HUI WANG

unread,
Jan 25, 2022, 5:48:02 AM1/25/22
to basilisk-fr
Hello Maximilian,

I tried the output_htg.h in Paraview v5.10, but I can not open the .htg file outputted using http://basilisk.fr/sandbox/sander/output_htg.h. Does it work for version v5.10 on your side?
By the way, it works fine in  Paraview v5.9.1

Hui

Maxi Sa

unread,
Mar 10, 2022, 6:02:49 AM3/10/22
to basilisk-fr
Hello Hui,
can you verify you are using an actual Paraview release (like 5.10.0) and not a release candidate (5.10-RC1).

I cannot observe any problems.

-- Maximilian

Maxi Sa

unread,
Mar 10, 2022, 6:39:05 AM3/10/22
to basilisk-fr
Hello Hui,
I have to revise my previous statement. Paraview 5.10.0 fails when opening a *.htg directly. But it does not fail, if you open it as part of a collection (*.pvd). So as a quick workaround, use the *.pvd file to open your simulation data. You can modify the collection file by hand to point to other files.

I will look into this.

-- Maximilian

Maxi Sa

unread,
Mar 12, 2022, 2:34:59 PM3/12/22
to basilisk-fr
Hello Hui,

I found the error, it looks like the data type for the coordinates should be a "Float64" instead of a "Float32".

I will publish a new version soon, thanks for reporting the error!

--Maximilian

HUI WANG

unread,
Mar 14, 2022, 5:11:31 AM3/14/22
to basilisk-fr
Hello Maximilian,

Thanks for your help. At this moment I am using 5.9.1. That would be great if you can send a reminder after the update for version 5.10.0.

Best
Hui

Maxi Sa

unread,
Mar 14, 2022, 5:32:31 PM3/14/22
to basilisk-fr
Hello Hui,
you can find the updated code under output_htg.h, you have to use the updated output_pvd.h as well!
The old files reside under the "_old.h" appendix, if the new ones do not work.

Please let me know, if those work with Paraview 5.10 for you!
If you like you can use the VTKFile version 2.0 (changed XML syntax) with flag "#define VTK_FILE_VERSION 20"

-- Maximilian

Maxi Sa

unread,
Mar 14, 2022, 5:50:51 PM3/14/22
to basilisk-fr
Small comment,
the "output_htg_old.h" version is fixed as well.

For the new output_htg.h: Your path variable should not contain a slash at the end.

-- Maximilian

Pengyu shi

unread,
Oct 11, 2022, 5:05:09 AM10/11/22
to basilisk-fr
Hey all,


First of all, thank you, Maximilian, for sharing the the output script. 
By loading the output_htg.h, did you expericence any problem when trying to restart the run from a previous dump file? This seems not working in my case, and I would always get the error "Segmentation fault".
I would be appropriate for comments and suggestions.

Best regards,
Pengyu


HUI WANG

unread,
Oct 12, 2022, 4:10:47 AM10/12/22
to basilisk-fr
Hello Pengyu,

From my experience, "Segmentation fault" happens when the dump file is not "correctly" saved. You can try to load the dump file using bview to check if the dump file works. Hope it helps.

Best
Hui

Maxi Sa

unread,
Oct 12, 2022, 4:19:15 AM10/12/22
to basilisk-fr
Hello Pengyu,

I will have a look at it next week. But I suspect, like Hui, a problem with a "not correct" dump file.

However, I will try to reproduce an error next week.

Best,
-- Maximilian

Pengyu shi

unread,
Oct 21, 2022, 5:03:58 AM10/21/22
to basilisk-fr
Dear Maximilian and Hui, dear all,

I  prepared a simple test case to replicate the problem (see attached bubble.c). The case is based on the example "Bubble rising in a large tank (http://basilisk.fr/src/examples/bubble.c)". I did the following to get the dump file which seems problematic to be used as a restart:
1) CC99='mpicc -std=c99'  ./qcc -Wall -O2 -D_MPI=1 -grid=octree bubble.c -o bubble1 -lm 
2) mpirun -np 32 ./bubble1
3) cp dump-001 restart
4) mpirun -np 32 ./bubble1
From 4) I get the error: "Segmentation fault". 
The dump file works fine as a new restart if the output_htg event ("snapshot2" in the attached bubble.c) is commented out before procedure 1).
Unfortunately, I cannot check the different dump files using bview, as I am working on a HPC and am unable to install bview on the cluster. 
I thank you for your time and look forward to your reply.

Best regards,
Pengyu 

output_htg.h
bubble.c
output_pvd.h

Pengyu shi

unread,
Oct 21, 2022, 8:01:18 AM10/21/22
to basilisk-fr
The problem is resolved following the suggestion by Linkai :
i.e., instead of using output_htg(..., (vector *) {u}, ...) ,
one needs to use output_htg(..., (vector *) {uf}, ...)  
@Linkai: thank you very much for kindly pointing out the solution! 

Carlos Andrés del Valle

unread,
Dec 12, 2022, 12:50:49 PM12/12/22
to basilisk-fr
Hi everyone. Using this conversation, I used  http://basilisk.fr/sandbox/sander/output_htg.h to output to Paraview on a parallel 3D simulation. It works great, but I can't create contours. If I use the filter HyperTreeGrid To DualGrid I can create the contours but as soon as I change the time step the fields disappear. If I apply the filter HyperTreeGrid To UnstructuredGrid and then Cell Data to Point Data to the unstructured grid the contour does not appear in the render view. 

 Does some one know how to sort this issue out?

Thanks.

Maxi Sa

unread,
Dec 12, 2022, 2:47:42 PM12/12/22
to Carlos Andrés del Valle, basilisk-fr
Hello Carlos,
these are actually VTK HTG issues. I reported them but Kitware seem to be in no rush to fix them 😅
The non-working contour filter is not working because only a single HTG tree is generated, and Paraview cannot handle only one tree (this is a bug).
So at the moment there is no (easy) way to fix this issues other than using another vtk exporter for unstructured grids (e.g. http://basilisk.fr/sandbox/weugene/output_vtu_foreach.h) at the cost of higher memory requirements.
-- Maximilian

--
You received this message because you are subscribed to a topic in the Google Groups "basilisk-fr" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/basilisk-fr/m0mfHqgrn70/unsubscribe.
To unsubscribe from this group and all its topics, send an email to basilisk-fr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/basilisk-fr/269b6943-22c9-4d66-b0cf-5347dd1516dan%40googlegroups.com.

Carlos Andrés del Valle

unread,
Dec 12, 2022, 3:11:21 PM12/12/22
to basilisk-fr
Thanks for your answer, Maximilian. That's a shame, your exporter works great. I have been trying output_vtu_foreach.h but I can't seem to make it work. When I compile there are a lot of errors and warnings. (I'm using MPI). Do you know if there's a solution?

I will report the Paraview bug too, may be with a little bit of pressure the will fix it.

Best regards.

Reply all
Reply to author
Forward
0 new messages