0
$\begingroup$

I have been given a few numerical simulations regarding fluid mixing and have been asked to extract a few parameters from them using C++. Altogether there are about 1000 VTK files per simulation, and there is one simulation per time step, each to be analyzed separately. Regarding the problem itself, as a result of fluid mixing bubbles begin to form in the mixture. I would like to find the position, penetration height, and width of all these bubbles. I am rather new to CFD and scientific computing so I am a bit lost on where to start.

The only coding background I have is rather basic and mostly regarding procedural programming. What comes to mind is a sort of "divide and conquer" approach for locating the bubbles, but I'm not sure if this would be most appropriate. Perhaps I can use the varying densities to find these parameter? Hoping someone can chime in on this.

Thanks.

$\endgroup$
  • $\begingroup$ Try using Visit to read the VTK files. wci.llnl.gov/simulation/computer-codes/visit. You can use the python interface to extract derived information. $\endgroup$ – Biswajit Banerjee Aug 10 at 23:05
  • $\begingroup$ @BiswajitBanerjee Thank you for the link I will check it out. How can I get the program to determine what is and isn't a bubble? $\endgroup$ – WBSS Aug 11 at 0:53
  • $\begingroup$ One way is to extract isosurfaces of the density and then use image processing tools to threshold and segment the images. Then you can count the pixels to find the quantities of interest. It will take some work to automate. $\endgroup$ – Biswajit Banerjee Aug 11 at 6:00
  • $\begingroup$ @BiswajitBanerjee Thank you for the suggestion, that is a very interesting idea. However my advisor insists it is possible to do this using C++ and that's how he wants me to do it. $\endgroup$ – WBSS Aug 11 at 6:54
  • $\begingroup$ I would load the files in Paraview and click around until I had a good idea of what I wanted. Then you can use (say) VTK-m to automate the process in C++. $\endgroup$ – user14717 Aug 11 at 13:07
0
$\begingroup$

You can read VTK files using the VTK library in C++, but there are as far as I know also interfaces to Python and maybe other languages.

So that already gets the data into memory. The question is then how to process it. What you're describing sounds like you want to use a thresholding algorithm where you're wondering what part of the domain has a value above or below some threshold. VTK -- being used to visualize data -- has these kinds of operations built in.

So I would start with reading the documentation of the VTK library and seeing whether it is easiest to use them from C++ or any other language you may be familiar with.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ If I were to use a thresholding algorithm to process the data, how would it quantitatively determine what is and isn't a bubble? $\endgroup$ – WBSS Aug 11 at 0:53
  • $\begingroup$ @WBSS That depends on how exactly you describe the bubbles in these VTK files. We don't know that as you haven't described in your post. I suspect that there must be a phase field or some something like that, but I can only speculate of course. $\endgroup$ – Wolfgang Bangerth Aug 11 at 3:26
  • $\begingroup$ My apologies I should have been more specific. What I have are density values in 3D at various points. When I visualize the data using Visit I can see differences in density, and as a result I can see the less dense fluid penetrating the denser one in the form of bubbles. Look at the VTK file itself it seems to be a 3 dimensional tensor. $\endgroup$ – WBSS Aug 11 at 3:58
  • $\begingroup$ So then you would threshold based on the density, and call everything that is below a certain density a "bubble". $\endgroup$ – Wolfgang Bangerth Aug 11 at 17:38
  • $\begingroup$ This is a great idea, I think this is what I will do. The only question I have left is there may be some bits of the fluid which penetrate but aren't bubbles, these will also have significant density differences and so the code might falsely pick them up as a bubble. Do you have any suggestion to prevent this from happening? $\endgroup$ – WBSS Aug 11 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.