PDA

View Full Version : Container conundrum, a punless one


UncleFester
05-07-2010, 04:37 PM
Why do containers with the same resolution per unit function differently?

I was experimenting with two containers which have the same resolution per unit but different sizes, the rest of the parameters are the same between them. The wider container moves faster and the shape of itís fluid is a little narrower, maybe due to it moving faster. This happens no matter what the Boundary parms are set as. This seems to be pretty concistant across different resolutions.

Containers_Res_2x1.jpg
Containers_Res_8x1.jpg

Lower res
Narrow Container:
Resolution 10 x 20 x 10
Size 5 x 10 x 5

Wide Container:
Resolution 20 x 20 x 20
Size 10 x 10 x 10

Higher res
Narrow Container:
Resolution 40 x 80 x 40
Size 5 x 10 x 5

Wide Container:
Resolution 80 x 80 x 80
Size 10 x 10 x 10

I make my containers as small as possible to speed up iteration time but itís likely that Iím slowing down my fluids a bit. This is easily fixed with adjusting Sim Rate scale but Iíd like to understand why it does this, anybody know why?

aghawa
05-07-2010, 05:32 PM
Well, don't know the mathematical or actual reason why, but i can guess.
Since you're working with fixed-size grids, the solver knows the space it has to solve the fluid.
Hence in the smaller one, it has 10 less voxels per-axis to make the fluid expand...hereby you have the different (well, less expanded) velocities, as they are more expanded on the +10 res container.
I think that's because of this.
And also, since the fluids simulations are basically non-predictable (they may become so, but for definition they aren't), you may get slightly different result every .0001 value change you make into your fluid. Or every +5 voxels you add, you see.

EDIT: Also, by changing resolution to say 10->20, the changes are really more visible than making a change from example 100->150. See the AgentFX blog, it has a recent post about this!

Just my 2c, if i'm wrong i hope someone with better experience will chime in and clarify :bounce:

Derek Wolfe
05-07-2010, 09:39 PM
I cannot reproduce your result.

Duncan
05-07-2010, 10:34 PM
It helps to realize that the simulation is not just the opaque part where you have density but the entire fluid. The simulation solves for incompressibility of the entire volume of air in the container. Turn on display of the velocity vectors to see what is really happening. There should be less difference with open boundaries, although even then there will be differences because an open boundary is not the same as solving the flow of a volume of fluid.

Turn on the velocity display to see what is going on.

The maya fluid simulation is currently a box of fluid where the mass is constant across the entire fluid container. The density attribute is really more "optical density" (like smoke particles or dye in water) than fluid density. We typically define a buoyant force in the regions where we have more optical density, but the fluid motion is solved as a uniform material( like a tank filled with water).

EDIT: I initially chalked this up to the Venturi effect which was not quite correct... it describes how as a flow goes through a narrow region it speeds up. However this effect is still related. For a flow to move up in a container it must displace fluid which needs to move down. In a wide container there is a lot of room for the displaced fluid to move down. As the container gets more narrow the fluid moving down has to squeeze through a smaller space and requires more pressure to move at the same speed. It also has to fight the viscosity of the fluid more. Once the size is narrow enough the fluid will not be able to flow up at all in a closed container if it has any viscosity( also the voxel size on a fluid determines in part the lowest viscosity we can simulate). Think of how a bubble will get trapped inside a straw.

Duncan

UncleFester
05-08-2010, 03:45 AM
Aghawa Ė Thank you for your response. The difference happens whether I use fixed or dynamic grids, sorry I forgot to mention that. My point with the trying resolution per unit was to see if it functioned differently from a 2 resolution to 1 size vs. 8 to 1 and I didnít see much there, the wider one was always faster.

Derek Ė Interesting, this happens every time Iíve tried this, it is more pronounced with Boundaries = Both Sides. I am using Maya 7 so maybe this has since been changed. What version did you try this with?

Duncan ĖThank you, your answer was very instructive for me. I do forget about velocity draw, itís excellent at illustrating what ALL the voxels are doing. The velocity draw looks very similar with open boundaries which would be expected. With closed, thereís definitely larger downward vectors in the narrow container between the two containers.

I normally have viscosity = 0 as well as friction, a higher viscosity definitely slowed down the narrow container more.

I guess Iím kinda dense but I still donít really understand why the narrow one would be slower. To me, it wouldnít seem to be any difference in force required to displace one voxel as two if viscosity, friction and damp are all 0. Wouldnít it just need to displace Ĺ as much with the two voxels as opposed to 1? I frequently have viscosity or friction at 0 so Iíd like to understand this.

Is there away to show the numeric values of the velocities? I was thinking I might add up the velocities of the wider container more accurately compare it to the narrow one.


The attached image is of containers with X & Z Boundaries = Both Sides and Y = -Y side as this is
what I've been using the most lately. The Velocity Draw Length = 3 to accentuate the velocity differences.

Derek Wolfe
05-09-2010, 11:27 PM
I did my test with boundaries turned off. Maya 2008.
In your original post you said, "This happens no matter what the Boundary parms are set as."
This seemed interesting to me, and would have suggested an error in the solver, had there been a large difference with no boundaries on the containers.
Your result makes sense if boundaries are turned on, as Duncan has explained.

Duncan
05-10-2010, 08:13 PM
The shape of the container matters... even if the boundaries are open. With the more narrow container the solver is not computing the fluid that is missing from the wider container and this affects the simulation. We do our best to handle open boundaries, but the inflow-outflow works out differently than when pushing voxels in those regions. Basically the velocities at open boundaries are only affected by the velocity on the inside of the fluid. Also the fluid solver works through a back propagation method, which might bias the boundaries to be more damped to an outflow( a forward prop method would be more damped to an inflow... not that the new forward prop in 2011 does not apply to velocity advection). This might in part explain why the narrower fluid is slower even when the boundaries are open.

Duncan

Duncan
05-11-2010, 12:09 AM
Terry... it sounds like you are still puzzled why the skinny closed box moves upward more slowly than the wide one. I'm a little fuzzy on some of the mechanics and can't say if a zero viscosity superfluid might behave in the manner you describe(superfluids are weird), but I don't think it would. At any rate the zero viscosity setting with maya fluids is not truly zero and the size of the fluid voxels represents a min viscosity of sorts.

Basically in the bounded fluid the air has less room to squeeze through to move from the top to the bottom, so it must move faster which uses up some of the energy from the hot buoyant region. Just as adding a constriction to a hose will slow the flow of water, the skinnier box constricts your example's return flow.

Duncan

pixelmangler
05-11-2010, 02:55 AM
Thank you Duncan for all your help, your explanations and comments are most instructive.

I guess I should not take some of the settings so literally, I had originally figured 0 viscosity and friction would mean voxel displacement wouldn't require any effort or get slowed down but obvously that isn't true. I have seen the Venturi effect in real life and something similar sounds like a goood explanation of what's going on in the container even if the boundaries are open.

Thanks again everyone, this discussion definitely helped my understanding of Maya Fluids.

Duncan
05-11-2010, 06:09 PM
I had originally figured 0 viscosity and friction would mean voxel displacement wouldn't require any effort



Viscosity affects more shearing motions. Even with zero viscosity when a particle moves upward it must displace other particles and satisfy f=ma. (we don't solve fluids with particles but it is essentially simulating a collection of moving particles)

A common confusion is that the visible parts of the fluid are like particles and the rest is simply empty space. In fact it is more like a box filled with colliding particles where most of the particles are totally transparent. In terms of our fluid solve all the voxels have equal mass in terms of velocity transfer. This is one of the main reasons why it is not yet suitable for pouring liquid simualtions. (mass of air is much less than water)

Duncan

CGTalk Moderation
05-11-2010, 06:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.