Skip to content

Domain Advanced Settings

Ryan Guy edited this page Mar 29, 2024 · 35 revisions

This page documents the domain settings for the FLIP Fluid Advanced panel. Although it may be intimidating the adjust settings labelled as Advanced, we do recommend learning about some of these settings and understanding how they can affect the simulation. We recommend paying attention to the Min/Max Substeps, Safety Factor (CFL Number), and PIC/FLIP Ratio parameters especially.

Parameters

All parameters in this panel must be set before baking for changes in the simulation to take effect.

image

Frame Substeps

See the What are substeps? topic for a more detailed explanation on these settings.

Tip: The number of simulation substeps that the simulator ran during a frame can be viewed in the Domain Stats > Frame Info panel.

image

Min Substeps Minimum number of substeps per frame calculatation.
Max Substeps Maximum number of substeps per frame calculatation.
CFL Condition Number (Safety Factor) The maximum number of voxels that a particle may travel in a single time step. A larger number may speed up simulation computation time by reducing the number of required substeps at the cost of accuracy. A smaller number may slow down simulation computation time by increasing the number of required substeps, but may produce a more accurate simulation.
Enable Adaptive Time Stepping for Obstacles Take into account obstacle velocities when calculating the number of frame substeps. Enabling may improve the accuracy of fluid-solid interactions for fast moving obstacles.

Note: You may not want to enable this option if the obstacle is a fracture simulation. Fracture simulations can often have pieces with unnaturally high velocities which can greatly slow down the liquid simulation. Instead, you may want to manually tune the frame substep values.
Enable Adaptive Time Stepping for Force Fields Take into account force field velocities when calculating the number of frame substeps. Enabling may improve the accuracy of fluid-forcefield interactions for fast moving animated forces objects, or animated force field parameters.

Note: This option is rarely needed and can add a lot of extra time to the simulation. The force field physics are often quite forgiving for fast moving force fields, unlike fast moving obstacles.

Simulation Method

See the FLIP vs APIC topic for a more detailed explanation on the differences between the FLIP and APIC method.

image

Simulation Method Which simulation method to use.
FLIP
    Use the FLIP (FLuid Implicit Particle) simulation method. Choose FLIP for high energy, noisy, and chaotic simulations. Generally better for large scale simulations where noisy splashes are desirable.
APIC
    Use the APIC (Affine Particle-In-Cell) simulation method. Choose APIC for high vorticity, swirly, and stable simulations. Generally better for small scale simulations where reduced surface noise is desirable or for viscous simulations.
PIC/FLIP Ratio The ratio of PIC velocity to FLIP velocity to use when updating particle velocities. The PIC method is not very accurate, but stable. The FLIP velocity method is very accurate, but less stable. Using a value of 0.0 results in a completely FLIP simulation, while using a value of 1.0 results in a completely PIC simulation. By default, a small amount of PIC velocity is mixed with the FLIP velocity to slightly dampen the fluid motion and keep the simulation stable. This setting is only available if the Simulation Method is set to FLIP.

TIP: If you are simulating a very low viscosity fluid, try increasing this value instead of using the viscosity solver in the World Panel. For very low viscosity or thin fluids, enabling the viscosity solver can be overkill. A trick to bypass the solver for very low viscosity fluids is to instead increase the PIC/FLIP Ratio. This will lower the accuracy of the simulation which naturally results in a more viscous looking fluid. Try comparing the default value of 0.05 with a value of 1.0 to get an idea for how this changes the behavior of the fluid.

TIP: If your simulation is too splashy, try increasing this value. A higher PIC/FLIP Ratio will damp/dissipate the motion of the fluid which will help the fluid settle more quickly. The default value of 0.05 is good for a large splashy ocean, but you may want to increase this value to 0.5 or higher for simulating a small scale glass of water.

Simulation Stability

image

Particle Jitter The amount of random jitter that is added to newly spawned fluid particles. Higher values may improve simulation accuracy. Lower values may introduce symmetric artifacts into the resulting simulation.
Jitter Surface Particles If disabled, a random jitter position will only be added to particles within the interior of the Inflow or Fluid object. If enabled, all emitted particles will be jittered. Enabling may cause bumpy mesh artifacts on the initial surface mesh shape and may require additional smoothing. Enabling is recommended for fluid particles effects and results in more natural fluid particle generation.
Remove Particles With Extreme Velocities Attempt to remove particles with extreme velocities that would cause the simulator to exceed the maximum number of allowed frame substeps. Enabling this option may prevent simulation blow-up in extreme cases. It is not recommended to disable this option outside of experimentation and testing. Disabling this option can result in unstable simulations. Disabling this option can prevent fast moving fluid from being removed from the simulation, however a better solution is to increase the Max Frame Substeps value instead to allow for faster moving fluid.
Pressure Solver Max Iterations Set the maximum number of iterations that the pressure solver is allowed to run during a substep. The default value is often a good choice and does not need to be changed. This value may need to be increased if running very large simulations containing large volumes of liquid where the solver is reaching maximum stress. For more information about how the solvers work and how to monitor solver stress, refer to the Domain Stats > Additional Solver Notes documentation.
Viscosity Solver Max Iterations Set the maximum number of iterations that the viscosity solver is allowed to run during a substep. The default value is often a good choice and does not need to be changed. This value may need to be increased if running simulations containing large volumes of viscous liquid where the solver is reaching maximum stress, or in complex variable viscosity simulations. For more information about how the solvers work and how to monitor solver stress, refer to the Domain Stats > Additional Solver Notes documentation.

Multithreading and Performance

image

The multithreading settings are also available in the FLIP Fluids Sidebar > Bake Simulation menu to allow for quick adjustment of these settings.

Tip: When changing the number of threads, check the Performance Score stat in the Domain > Stats > Cache/Frame Info as the simulation is running to view if the change is increasing or decreasing the simulation performance. See Performance Notes and Tips > Performance Score.

Threading Mode Specify how to choose the number of simulation threads.
Auto-detect
    Use the maximum number of threads available on the CPU for simulation. Tip: Running smaller low resolution simulation with too many threads may actually harm performance due to overhead of thread management - this mode may be more performant for running medium to high resolution simulations.
Fixed
    Use a specified number of threads for the simulation. Tip: Running smaller low resolution simulations with less threads may boost baking speed due to reducing overhead from thread management - try values around 4 thread for default lower resolution simulations.
Enable Fracture Optimizations Enable fracture optimizations when using certain animated fracture simulations as FLIP obstacles. These optimizations can greatly improve simulation performance where there are a large number of small separate FLIP obstacle objects, such as in Cell Fracture and RBDLab simulations. This option should not be enabled for fracture simulations where all pieces are contained within a single FLIP Obstacle as this can harm performance - these types of fracture obstacles are already optimized. Enabling this option can increase memory requirements.

Related Topics

Warnings and Errors

image

Disable Changing Topology Warning If attempting to use an animated mesh that changes topology between frames, the addon will display a warning and stop the baking process. Enable this option to bypass the changing topology warning.
Warning: Mesh data velocity cannot and will not be computed for meshes that change topology between frames. This may result in inaccurate fluid-solid interaction since these objects will not be able to effectively push around the fluid. This warning will only be displayed if dynamic topology can affect the simulation and will ignore situations where dynamic topology is okay.

What are substeps, and how do the min, max, and CFL parameters relate to each other?

Substeps are the number of times that the fluid solver will perform calculations during a frame. Sometimes the fluid solver will only require one substep during a frame. Sometimes multiple substeps will be needed in order to keep the simulation accurate and stable. The number of simulation substeps that the simulator ran during a frame can be viewed in the Domain Stats > Frame Info panel.

The number of substeps that the simulator runs is dynamic and the simulator will automatically determine how many substeps to calculate during a frame in order to keep the simulation stable. The number of substeps required is based on the velocity of the fluid, the density of the simulation grid, and the amount of surface tension. The faster the fluid particles, the more substeps the simulator will take. The more surface tension int he simulation, the more substeps the simulator will take in order to keep the fluid stable.

The simulator calculates the fluid physics equations on a grid and if fluid particles are moving fast, they will be traveling over multiple voxels during a frame. The voxels that the particles travel over are 'skipped' in calculations and this is what leads to decreased accuracy. The skipped voxels could have important data that would have altered the trajectory of the particle, such as velocity data telling the particle to move away from an obstacle instead of passing through it. Taking more substeps leads to particles skipping less voxels and also leads to more consistent physics.

In general, more substeps during a frame increases simulation accuracy. The Min Substeps and Max Substeps parameters are guidelines for the simulator on the range of substeps it should take during a frame.

  • The Min Substeps parameter is like a minimum threshold of accuracy that will force the simulator to take at least this many substeps during a frame.
  • The Max Substeps parameter sets the limit for how many substeps the simulator is allowed to take during a frame. If some fluid particles are moving fast enough so that the required number of substeps exceeds this parameter, the simulator will remove these particles from the simulation. The reason for having this parameter is to prevent simulation 'blow ups' in extreme cases. There is a chance that a particle may become unstable and take on an extremely high velocity. This could cause the simulator to require a very large number of substeps during a frame, blowing up the baking time. There is also a chance this particle could affect the data of other particles leading to a chain reaction. Having a limit for the number of substeps will eliminate this unstable particle before it can cause any trouble.
  • The CFL Number (which is short for Courant–Friedrichs–Lewy condition number and is a common parameter in simulation) is a constraint on how the simulator figures out how many substeps to take during a frame. This number is the maximum number of voxels that a particle can travel in a single substep. So if the CFL is set to two, the simulator will perform enough substeps so that the fastest moving particle travels no more than two voxels during a single substep.
    • Tip: for large scale simulations, such as oceans, beaches, or other slow moving bodies of water, you can often get away with a higher CFL number such as 10 or 15 without affecting results. This can greatly improve simulation baking time, and even double or triple the speed in high resolution simulations. However, if you have thin obstacles or very quick moving obstacles, this may affect accuracy or result in leakage. A thick obstacle, such as a ship's hull moving through the water is a good situation for increasing the CFL number.

Substep Side Effects

Changing the simulation substep settings between simulations can cause side effects that affect the simulation result. Changes in these settings will affect the frequency of physics calculations which affect the accuracy of the simulation.

The number of substeps run in order to keep the simulation stable is dynamic based on the simulation settings and set up. Due to this fact, other simulation settings can affect the number of substeps that are computed during a frame. Increased resolution, increased surface tension, and faster moving fluid (either through natural motion or emission velocity of fluid/inflow sources) can increase the number of substeps.

For more information, see this topic: Scene Troubleshooting: Fluid behaviour changes when changing Frame Rate, Speed, or Substeps.

FLIP vs APIC

In these examples, we will compare some of the differences between the PIC, FLIP, and APIC simulation methods:

  • PIC (Particle-In-Cell) - The PIC simulation method is stable, but not very accurate. Energy in PIC simulations quickly dissipate over time and can end up looking viscous. In this section, when we refer to PIC, this will mean that the simulation method is set to FLIP and the PIC/FLIP Ratio is set to 1.0.
  • FLIP (FLuid Implicit Particle) - The FLIP simulation method is unstable, but has an improved accuracy compared to PIC. FLIP simulations are energetic and do not quickly dissipate, unlike PIC. FLIP simulations are good for high energy, noisy, and chaotic simulations. Generally better for large scale simulations where noisy splashes are desirable. Due to being unstable, we mix in a small amount of PIC simulation to tame the chaos. In this section, when we refer to FLIP, this will mean that the Simulation Method is set to FLIP and the PIC/FLIP Ratio is set to 0.05.
  • APIC (Affine Particle-In-Cell) - The APIC simulation method is both stable and has an improved accuracy compared to PIC. APIC simulations are energetic, do not dissipate energy as much as PIC, and are also able to better preserve vorticity (rotational energy) compared to FLIP. APIC simulations are good for high vorticity, swirly, and stable simulations. Generally better for small scale simulations where reduced surface noise is desirable or for viscous simulations. In this section, when we refer to APIC, this will mean that the Simulation Method is set to APIC.

For a more technical overview of PIC vs FLIP vs APIC simulation, see this video created by the researchers of the APIC method: The Affine Particle-In-Cell Method.

Fountain Comparison

This comparison shows how APIC can generate smoother sheets of fluid compared to FLIP.

flip_apic_fountain.mp4
  • FLIP (left): FLIP is naturally chaotic and part of this causes fluid motion to ripple back and forth, resulting in dimples on the surface. This is what is preventing the smooth curved flow compared to APIC. These noisy sheets can make FLIP a good choice for large scale fountains where noisy behavior is more expected.
  • APIC (right): APIC improves on motion stability, leading to smoother thin sheets, even at low resolutions (res = 150). These smooth sheets make APIC a good choice for a small scale fountain.

Vortex Ring Comparison

This comparison is a cross section visualization the underwater movement of a vortex ring.

flip_apic_vortex_ring.mp4
  • FLIP (top): Due to the noise of FLIP and the dissipation of PIC that is mixed in, the vortex ring become disorganized in its rolling motion and rotational energy dissipates over time.
  • APIC (bottom): APIC is better at conserving the rotation in both direction and energy. Is able to maintain rolling vortex ring within the fluid for a longer amount of time compared to FLIP.

Stream Comparison

This comparison shows how the underwater motion of PIC, FLIP, and APIC affects motion of whitewater bubbles.

flip_apic_stream.mp4
  • PIC (Left): Rotational energy dissipates quite quickly, leading to low amounts of swirling motion. Dissipation results in the fluid looking a bit viscous.
  • FLIP (middle): FLIP is more energetic and able to capture more rotational detail compared to PIC. But due to FLIP being mixed with PIC, some energy ends up dissipating over time.
  • APIC (right): Very good at preserving rotational energy compared to PIC and FLIP. Able to capture smaller motion details and complex motion that expand into a larger area of the fluid. Due to the increased turbulence, this results in whitewater particles being generating in more areas of the fluid.

Note: APIC can be good for effects where underwater bubbles are the focus, but in our tests, we found that APIC is not as good as FLIP for generating foam particles on the fluid surface. The high amount of rotation of APIC tends to concentrate foam into thinner lines on the fluid surface. The more chaotic motion of FLIP seems to be better for breaking up foam.

Dam Break Comparison

This comparison displays the differences between PIC, FLIP, and APIC for a classic Dam Break setup (A block of fluid dropping on one side of the domain). This shows how APIC can be energetic like FLIP, while also taking less time to compute. FLIP and APIC require very similar amounts of computation, but due to the increased stability and reduced noise in the velocities of APIC, this can result in quicker baking times due to requiring fewer substeps.

flip_apic_dam_break.mp4
  • PIC (Left):
    • Energy of PIC dissipates quickly and doesn't result in large splashes like FLIP and APIC.
    • Due to the dampened motion, whitewater particles are more clumped together and do not get spread out through the fluid as much as the others.
    • Due to the generally slower and stable velocities of PIC, this is the quickest to compute and required 1118 total timesteps to compute.
  • FLIP (middle):
    • FLIP is very energetic and creates large splashes. The slow motion section shows how FLIP creates more chaotic and noisy splashes compared to APIC.
    • Due to FLIP being naturally chaotic and less stable than PIC, this results in larger velocities and was the slowest to compute. Required 1427 total timesteps to compute.
  • APIC (right):
    • APIC preserves a similar energy as FLIP and also creates large splashes. The slow motion section shows how APIC creates more stable, but still energetic splashes compared to FLIP.
    • More turbulent detail of APIC results in more whitewater particles.
    • APIC motion creates more stable velocities and results in a quicker baking time. Required 1221 total timesteps to compute.

High Impact Comparison

This comparison shows how a high impact splash can differ between FLIP and APIC.

flip_apic_high_impact.mp4
  • FLIP (left): The chaotic and noisy nature of FLIP causes impacted fluid to spread out into a large number of droplets in a large area.
  • APIC (right): The more stable nature of APIC causes impacted fluid to spread out into more uniform and cohesive splashes compared to FLIP.
Clone this wiki locally