Fluids

Using Fluids, you can simulate the physical properties of such liquids as water, oil, honey, and lava as well as replicate the effect of gravity, collisions with objects, and disruptions by motion fields in order to achieve your desired result.

Introductory Concepts

Fluid simulations are constructed from the following components:

Optimizing Performance

When working on any fluid simulation, the aim is to create a visually-pleasing result as quickly as possible. To do this, it's important to understand the available options for balancing detail and accuracy detail with memory and computation time.

The main setting for controlling simulation detail is the Base Voxel Size option in the Solver Properties group of the Solver Parameters panel. This setting also has a major effect on accuracy. Typically you would use a higher value for a quick, less-detailed preview of your work, and then a lower value for a more detailed simulation once you are satisfied with the effect.

At any base voxel size, the Transport and Time Stepping attributes in the Simulation Parameters group of the Solver Parameters panel can increase the accuracy of a simulation. This however, will require extra computation and will take more time. See the Adaptivity Settings section below for more information.

Achieving a good combination of base voxel size and adaptivity settings depends on the speed of particles relative to the scale of the modeled scene. For example, if particle speeds are so high that they move from one side of a collider to the other in a single time step, then it will appear as if no collision has taken place. In addition, if the particles penetrate a collider too deeply, they may get moved to the wrong side as if 'leaking'. To help diagnose these issues, you can examine the particle speeds by setting the velocity channel to display as a color gradient using the Display Settings panel.

When working with an extremely small scale, for example when simulating of a single drop of water, you may need to increase the frame rate of the scene due to the very high velocities relative to the small distances and short time scales.

Adaptivity Settings

Use the adaptivity-related settings in the Simulation Parameters panel of the Simulation View window to automatically adjust the resolution in order to provide the most detail when and where needed without wasting memory and computation time. There are four sets of options available to control this:

Spacial Adaptivity

The Spacial Adaptivity option is used to create lower-resolution voxels in the center of the fluid where detail is least needed. The maximum resolution set by the base voxel size is still maintained in regions of fast movement, along the boundaries with collision objects and along the free surface (the boundary with the air).

This option is usually enabled for most simulations.

Delete Exceeding Particles

The Delete Exceeding Particles option removes some particles when the number per voxel in low-resolution regions exceeds a threshold. Disable this option if you experience volume loss or other large differences between spacially adaptive and non-adaptive simulations.

Transport and Time Stepping

The Transport Steps and Time Steps options on the Simulation Parameters panel control the number of times that calculations are performed at each frame. More iterations will result in greater accuracy but will require more time to compute. Try adjusting these settings if you experience problems such as volume loss, particle bunching, spontaneous bursts, and leaks through colliders.

  • Transport Steps controls the number of iterations used to advect the particles along the voxel velocity field, after the pressure calculations have been performed. Try adjusting these settings first if you are experiencing problems such as particles passing through static colliders as this may solve the problem without much extra computation time. However, since the pressure is not recalculated and the colliders and other solids are not re-voxelized with each iteration, Transport Steps probably won't help with fast-moving colliders and other more complicated situations.
  • Time Steps controls the number of iterations of the whole simulation per frame, including the voxelization, pressure, and transport phases. These settings can greatly increase the accuracy especially with high velocities, but can also result in much longer computation times.

Both controls work together, with Transport Steps controlling the number of iterations of the transport phase within each time step. In other words, each frame might contain multiple time steps depending on the Time Steps settings, and each time step might contain multiple transport steps depending on the Transport Step settings.

Adaptivity controls whether or not additional substeps are triggered. A different number of iterations may be performed per frame depending on how far and how fast the particles are moving in that frame. The values are on a non-linear scale:
  • At 0.0, particles can move an effectively unlimited distance without triggering further substeps.
  • At 0.1, particles can move up to 10 voxel lengths before triggering further substeps.
  • At 0.32, particles can move about 5 voxel lengths before triggering further substeps.
  • At 0.5, particles can move up to 1.0 voxel length before triggering further substeps.
  • At 0.75, particles can move about 0.5 voxel lengths before triggering further substeps.
  • At 1.0, particles can move up to 0.001 voxel lengths before triggering further substeps.
Min Transport/Time Steps iterations are always performed per frame. This means you can force a certain number of substeps even if particles are not moving very fast. However, it is usually better to adjust Adaptivity instead to avoid unnecessary computation.
Note: Only one iteration is performed on the first frame of a simulation.

Max Steps sets the total number of iterations ever performed per frame, providing a limit on the amount of computation performed. However, particles will always move the entire distance required by their velocity and the frame length. This means that particles might not always obey the limit set by Adaptivity. For example, if Adaptivity is set to 0.5 but Max Steps is very low, then fast particles may not be able to cover the entire distance in steps of 1 voxel length. In this case, each step will be longer than 1 voxel length in order to move the whole distance.

Time Scale is a setting available for Transport Steps only that changes the speed of the particle flow. Values greater than 1.0 will speed up the flow without introducing any new velocities or accelerations, while values between 0.0 and 1.0 will slow it down. The result may not be physically correct, but it can be useful if you just want to quickly retime a simulation. Be careful however as this setting may introduce unwanted side-effects, especially at extreme values.

Scale Considerations

Scale is very important when working in on fluid simulations as they directly affect the believability of the final result. For example, consider how the physical scaled-down models of lakes and pools used in old movies never look quite right. This is because in reality a one meter wave in a body of water looks different than a one centimeter wave. It is therefore important to give proper consideration to your units in order to get the best results while using a reasonable amount of memory and computation time.

There are three important parameters to consider when constructing a simulation:

Voxel Size helps determine how accurate the simulation will be. The smaller this value in centimeters, the more accurate the solve will be, however at the cost of more memory and resources. A larger value is less accurate: you may see no particles generated, particles may float above collision surfaces, or not flow through holes. Voxel Size is used when transferring all meshes to the simulation so it affects mesh accuracy and is also the minimum particle size.
Warning: Very small voxel sizes can consume a lot of memory and cause your system to become unstable.

Max Unit Setup is important since that determines how fluids behave and how much memory they consume. When working with fluids you always need to aware of your real world dimensions of your scene, so you should never use generic units. Ideally you should set your Display Units Scale to Meters so you have an idea of the size of your scene in the "real world". Max Fluids will also take into account custom units but you need to be careful when changing what your default unit is. Ideally you should keep a tape measure around so you can measure things and see how big your objects really are. Units will also affect how your scene looks since a 15cm wave will look different than a 15 meter wave. The Liquid Solver custom override of units should only be used when you are artificially constrained by your units for instance a game engine or you need a special effect like rendering realistic water at doll house scale size.

Scene Size is how big your scene with real world dimensions which is defined by your Units Setup. Your scene size will directly affect how you set your Voxel Size. For instance if your liquid scene bounds is 10km by 10km setting your Voxel size to 0.05 cm will mostly never solve since the memory requirement will be so huge. Ideally you should start with a very large Voxel Size and work your way down til you get reasonable results inside a reasonable memory footprint. Also the denser the voxel grid the longer the simulation will take to calculate.

The Transport Step and Time options both also determine simulation quality, however have more impact on how fast particles are moving rather than overall quality.

Note: Never use the Scale tool on either the Liquid Object or Motion Field as this will throw off the calculations.

Working with Small Scales

When simulating with small scales, there are some extra considerations because of the high velocities relative to the small distances and voxel sizes involved. In particular, you may need to increase the Time Step and Transport Step settings in order to achieve a good result. In some cases, it may even be necessary to increase the frame rate of the scene to emulate a high-speed camera.

At extremely small scales such as when simulating a single drop of water, there may be some additional adjustments to make. Surface Tension for example does not always give accurate results even with many time steps, so it may be more efficient to use non-physically accurate values in order to approximate a realistic result. In some instances, reducing Gravity Magnitude may help.

You can also deactivate such settings as vorticity and droplets to avoid performing calculations that have no effect at these scales.

Meshes

The mesh is another representation of the result. In addition to being rendered, it can be exported as an Alembic or other cache for use in another scene or software. It has no polygons unless you activate meshing on the shape.