Help with undergraduate thesis

152 views
Skip to first unread message

R

unread,
Mar 12, 2018, 11:05:48 AM3/12/18
to mantaflow Forum
Hello everyone,

I'm trying to use mantaflow for my undergraduate thesis at the moment, and I've run into a host of problems.

It involves simulating the flow of water as caused by some object moving through water and then reading the velocities of the fluid (water) at some equally spaced locations in the grid and the location of the object every time step.

As a start I tried editing one of the example files to have a moving obstacle sphere move through a liquid.

This doesn't seem right though, as that just seems to cause the water to be moved away from behind the object, and the sphere doesn't seem to cause any effect on the water in front of it.

Am I right in thinking that doing what I want completely within mantaflow itself is not actually possible? That being having a proper simulation of a sphere moving through a basin of water.

For example, I have found many videos of people doing close to what I'd need in Blender together with mantaflow.


Especially the second sphere's movement through the water is extremely close to what I'd like.

The problem with Blender, however, is that I cannot find any information on whether I can define some scene in Blender and then export the fluid simulations to a Python scene file as used by mantaflow or somehow access and print fluid velocities from the grid to a file somehow through Blender itself.

Please let me know if you know of any way to help me get my data or if I was unclear in any way.

I'd hugely appreciate any help.

Thanks in advance,

Jonathan

Nils Thuerey

unread,
Mar 13, 2018, 4:45:48 PM3/13/18
to mantaflow Forum
Hi Jonathan, the mantaflow solver does support moving obstacles, but unfortunatley right now there's no ready-to-use scene file that would run such a case. The blender examples that you mentioned also use mantaflow, only with grid data exported from blender. The main difficulty is setting the right obstacle flags and intialising velocities for all obstacle faces. So you'll need some C code there for a custom plugin ... It's not overly difficult, but for flexibly using moving obstacles, you'll need some tool to generate the geometry like Blender in any case.

Exporting the data from Blender actually should be possible, let me check with Sebastian (our Blender expert).

Cheers, Nils
Message has been deleted

R

unread,
Mar 16, 2018, 3:49:45 PM3/16/18
to mantaflow Forum
Thank you for your reply Nils!

With regards to the plugin route, would the code resemble that of the moveLinear function of the movingObstacle class? 

I did get the movingObstacle working with moveLinear, and, after inspecting its definition, it seems to at least set obstacle flags correctly, and also tries to apply velocities. I suppose if the object has no initial velocity, then this doesn't work properly? I'm trying to look around for how to initialise obstactly velocities, but I can't find any function to do it for me. Should I then write a plugin that sets the velocity cells that correspond to the obstacle cells to some value as an initialisation? (I deleted my initial post because I made a mistake)

As for flexible movement of geometry, at the moment I'd be extremely happy with movement and objects (mainly spheres at the moment) such as moveLinear with movingObstacle provides right now, but just so that it actually interacts with the liquid.

I hope the Blender integration could teach me how to properly create the plugin you mention. We're looking to generate lots of data for training some neural networks, and so using Blender to generate lots of data quickly and cleanly doesn't seem feasible. For example, having a sphere move along many different linear paths seems like it would be time consuming in Blender, as we would just be moving the sphere one cell and then running it again, etc. I'd much rather loop through all possible paths directly in a mantaflow python file. If looping like this could be done in Blender while also exporting the data, that'd be amazing.

Have you been able to reach Sebastian about this yet? Should I maybe contact him myself directly?

Sorry for all the questions. I'd be really glad if you could help me.

Thanks again for the response!

Nils Thuerey

unread,
Mar 25, 2018, 2:14:58 PM3/25/18
to mantaflow Forum
Sorry for the slow reply! The MovingObstacle code you mention is quite out of date, unfortunately. The Blender version uses an additional obstacle velocity grid, and the "setObstacleVelocity" plugin from source/plugin/extforces.cpp to set the right velocities at obstacle faces.

As a simple test, you could e.g. reinitialize the flag grid with a translating obstacle object in the python script, and use a constant vec3 grid with the corresponding velocity. The pressure solve should then respect the velocities it find at the obstacle boundary. I'll also try to put together a small example for that.

Cheers,
-> Nils 



R

unread,
Mar 26, 2018, 5:02:34 PM3/26/18
to mantaflow Forum
Thanks for any reply at all!

I tried something like what you suggest, but I wasn't able to get that to work properly either. In the meantime I'll try again, but I very much look forward to your example.

Thanks again,

Jon

Nils Thuerey

unread,
Mar 27, 2018, 3:59:02 AM3/27/18
to mantaflow Forum
I noticed that the Blender code was not even fully up to date, and it's a good idea anyway to have an example with a moving obstacle. I just pushed a bunch of updates in the bitbucket repo. There you could find the latest moving obstacle code, and a small example "scenes/movingObstacle.py". That should be a good starting point for further tests.

Cheers, Nils 
Reply all
Reply to author
Forward
0 new messages