Regarding paraview and AMR

629 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 AMJan 25
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 AMMar 10
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 AMMar 10
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 PMMar 12
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 AMMar 14
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 PMMar 14
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 PMMar 14
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
Reply all
Reply to author
Forward
0 new messages