RealFlow Glossary: Time Steps and Fluid-Object Collision

November 30, 2016 Dyverso, Technology, Tips 0 Comments

It is a phenomenon you have certainly seen already: a fluid goes through a solid wall, glasses and bottles have leaks, isolated particles leave closed objects, and thin objects appear as if they are not there.

A few stray particles are no problem, because RealFlow provides a wide range of daemons like “k Volume” to delete them, but sometimes the loss of particles is so high that it will affect the final result. The question is what can be done to avoid this behavior, and what is the reason for a failing collision detection? The answer lies in the way how computer simulations work.

Time and Time Steps

When we start a computer simulation we basically want to see how things move and behave over time. In reality, time appears to be continuous, like a stream. This means that events do not happen suddenly. When you travel by car, for example, then you have to go the entire way from A to B – you do not start at point A and all of a sudden you arrive at point B:

What appears to be impossible in daily life is exactly what computer simulations do. Simulation programs subdivide time into small steps and calculate how the involved objects behave. In RealFlow, these time steps are known as “sub-steps”. Between these steps there is nothing and an object literally jumps from point A to B:

Put together, all these time steps create the impression of a motion. As you can imagine, the number of steps makes the difference. More steps give better, more accurate results, but at the cost of longer simulation times. It is not the same if we simulate 5 time steps per frame or 500.

But these mentioned jumps make it so difficult to get watertight bodies and prevent particles from going through an object, especially when it is very thin:

The illustration shows a particle at point A at 0 m. After a simulation step, the particle has moved (jumped) to point B at 1 m. The distance, covered during the time step, is exactly 1 m. The problem is that the simulation did not consider intermediate distances of, lets say, 0.25 m, 0.50 m, and 0.75 m.

Problems and Solutions

And now imagine an object in the middle between A and B with a thickness of 0.1 m. The consequence of our simulation with a single time step is that the object literally does not exist for the particle. In order to see what is happening at these positions we need more time steps.

RealFlow’s “Simulation Options” is where sub-steps can be changed:

Increasing time steps is a very good solution, but at the cost of longer simulation times. Fortunately, you have some more options:

  1. Make the object thicker. This is not always possible, but for objects like ground areas it is definitely a good idea. In other words: avoid very thin planes as floors and always make your objects as thick as you can.
  2. Reduce the particle’s speed, because then the covered distance will be smaller. Instead of 1 m/frame, decrease speed to 0.2 m/frame, for example.
  3. Create a virtual offset around the object without changing its physical dimensions. This way, the object will appear inflated and the particle will “see” the object earlier. As a consequence there is always a gap between particle and object.
  4. Change scale to make the object appear bigger.

RealFlow provides tools and solutions for all four options:

• With an object’s “Scale” parameter is possible to change its physical dimensions.
• Speed can be limited with a “k Speed” or a “Drag Force” daemon.
• An object’s “Surface offset” lets you create a virtual buffer around an object.
• The “Geometry scale” option is used to adjust simulation scale.

Here is where to find the “Geometry scale” parameter:

RealFlow’s Dyverso and Hybrido simulation engines work with very large sub-steps by default. This makes them extremely fast, but also vulnerable to errors in terms of fluid-object collision.

For Dyverso there is another way to improve the collision between particles and objects: “Continuous Collision Detection”. This option is available for any object in the “DY – Particles Collision” tab (only visible when there is at least one Dyverso domain in the scene):

Turning on “Continuous Collision Detection” is the first thing you should do when you experience problems with Dyverso and objects.