• Confluence is currently running with all non-system plugins disabled, some functionality may be missing
Child pages
  • HyFLIP - Volumes and Distance Fields
Skip to end of metadata
Go to start of metadata

In this chapter we want to familiarise you with the concepts behind the interaction between Hybrido fluids and objects. As you probably know, the Hybrido solver works with grids and cells. This means that the simulation space is subdivided into a grid and the solver calculates the interactions between the cells of this grid. Objects are also rasterised to make them visible to the fluid solver. The number of cells does not only play an important role in terms of simulation time, fluid resolution and memory consumption, but also accuracy. The size of the Hybrido fluid and object cells are adjusted separately:

HY_Domain > Fluid > Cell size

Object > Volume Cell size

Please take a look at the image below. It shows the traditional, completely grid-based approach we had in RealFlow 2012. The view represents a 2D view of a domain with an interacting object. As you can see, there are gaps. These gaps occur, because the object is rasterised as well and it is not possible to fill cells only by half or one third. The size of the cells also control the distance between the object's surface and the fluid's surface. If the interacting object is positioned incorrectly you will observe a rather large gap:

 

 

RealFlow 2014 uses a completely different approach. There, the outlines of an object are represented as a distance field. The quality, or better resolution, of this field depends on the number of grid cells you have determined for the object in its “Cell size” parameter. As illustrated below, the domain's particles follow this distance field and create a rounded surface matching the object's shape:

 

 

This means that Hybrido works with two different cell sizes: one for the domain and another for the object. It is important to know that the domain's “Cell size” is the higher-ranking parameter. So, even if you use very small “Cell size” values for the object, you will not achieve any improvements with regards accuracy, because the solver cannot “see” these small cells. Values of 0.1 (object) and 0.2 (domain), for example, do not have any influence and you only waste memory. The result in terms of fluid-object interaction remains the same:

 

 

If the object cells are too big, on the other hand, you might see penetration effects. There are also cases where the cells of both the domain and the object are overlapping in a particular way and there penetration effects can appear as well. Very complex surfaces can also be problematic, because there are often small details where particles can become trapped or slip inside the colliding object.

 

 

To avoid these issues we have added two helpers: the “Surface offset” parameter and the “Display Volume” panel. With “Surface offset” you can virtually “inflate” the object or create a buffer around it, but without changing its physical dimensions or properties. The “Surface offset” value is given in metres and – this is important – can be made visible with the object's “Display Volume” feature.

Display Volume

Add a basic sphere object to a fresh scene and activate one of the “Slice plane [axis]” options. What you will see is a coloured map representing the object's so-called distance field. The colour indicates the distance to the object's surface. When you take all the points within the same distance you will get an iso-surface. If the distance to the surface is 0 then this iso-surface represents the object's surface directly – the red parts of the map. The map's size and resolution depends on the object's adjusted “Cell size” value directly and also influences the map's look. With the default value of 0.3, the map looks jaggy and coarse. When you take a close look you will even be able to detect the individual grid cells.

 

 

When you switch the associated “@ Type [axis]” parameter to “Mask” you get a two-coloured map, showing the inside and outside of the object. Of course, this representation is influenced by “Cell size” and “Surface offset” in the same way as its “Ramp” counterpart.

Now change the viewport's so you can see the map from above. In this view, the distance map is shifted. To do this, use the “@ Offset [axis]” parameter under “Display volume”. You will see that only some values have an effect on the map's position. This is another side-effect of the currently adjusted “Cell size” value and the map can only be moved along the grid in steps of 0.3. The reason, you can shift the colour plane at all, is simply that objects are not always symmetrical and you might want to evaluate the distance in other regions or cross-sections as well.

When you decrease “Cell size” to, let's say, 0.05: the map is shrinking, but it is also much smoother. Additionally, the red ring is much thinner. With even smaller values, the map almost fits the object's surface. But, the object's “Cell size” parameter is not the only value that can be used to adjust the distance and the already-mentioned “Surface offset” is of, at least, same importance. When you enter a value of 1, for example, the map will be enlarged by 1 meter at each side. Another thing you will observe is a smoothing effect. This can be seen clearly with edged objects:

 

 

The offset depends on the object's "Cell size" value and the map can only follow the grid in steps of "Cell size", e.g. 0.3, although it is possible to enter any value. An example:

Imagine an object with a "Cell size" of 0.1 and an activated "Slice plane" option. To shrink the field and fit it to the object's borders exactly you enter a negative value, e.g. -0.085. Now you start the simulation, but the particles still have a slight offset, and it seems as if your settings did not have the desired effect. The reason is that object is subdivided into cells of 0.1 metres and this is your step size for the "@ Offset [XY|XZ|YZ]" parameters. In other words, the only working values are integer multiples of the current "Cell size": 0.2, 0.1, -0.1, or -0.2 etc. So, if you want to adjust the SDF, take a look at the current "Cell size" and work with this value to adjust the SDF. Values, different from the step/cell size, are rounded by RealFlow.

Evaluating Objects with Distance Fields

So far you have read a lot of things about grids, cells, and fields, but the main question is:”How does all this go together?”

The visualization of an object's distance field helps you to evaluate the node's interaction with Hybrido fluids. You will see directly how the field around the object is changed and smoothed with different “Cell size” and “Surface offset” parameters. With a visible distance field it is possible to adjust the field exactly to achieve a smooth surface and iron out all the problematic areas. The red ring around the object is the relevant zone for this process.

As previously mentioned, the object's “Cell size” value should not be smaller than the domain's “Cell size” as it has no effect. The best solution is to increase “Surface offset”, because it does not only inflate (virtually) the object, but it smoothes its surface as well.

Substeps vs. Surface Offset

Penetrating or leaking particles are also very common with fast moving fluids. The reason this happens requires a little bit of technical know-how about the backgrounds:

In computer simulations, time steps are used to describe a motion. The more time steps, the better the final result and the higher the simulation's accuracy. In RealFlow, these time steps are called substeps. When you perform a simulation with standard particles then you use a maximum value of 333 substeps, by default. HyFLIP fluids, on the other hand, use just a few substeps – the standard maximum value is just 3. In RealFlow, substeps are normally adaptive, but here we assume that they are fixed (N.B: they really can be fixed):

In a SPH simulation, a fluid particle should move 0.1 m, for example. The distance covered per step is 0.1 m /333 or 0.00003 m. Here, the solver has enough time/subdivisions to check for collisions and obstacles in the particle's way. With Hybrido, things are completely different, because in this case the distance is 0.1 m / 3 or 0.03 m per step. So, when a fluid particle is moving very fast, the solver might not be able to detect objects in the particle's way anymore – the object is leaking.

As you can see from the description above, this problem gets even worse when you work with very thin objects or when the “Volume” mode is set to “Shell”. In these situations, there is a very high probability that the object's surface is not recognized. One solution is to make the interacting object thicker. But, you know that this is only possible in exceptional cases.

Another solution seems to be to increase the Hybrido solver's number of substeps. Finally, this is an accepted method of increasing accuracy. This is correct, but can be problematic for two reasons:

  • When you change substeps, you also change the behaviour of the fluid

  • Simulation times can drastically increase

Therefore it is much better and easier to adjust “Surface offset” to avoid leaking. If possible, you should also use thick objects and change “Volume mode” to “Solid inside” or “Solid outside” – according to the object's role in the simulation.


Related content:
Error formatting macro: contentbylabel: com.atlassian.confluence.api.service.exceptions.BadRequestException: Could not parse cql : null