### From BlenderWiki

# Blender 2.66: Particle Fluid Dynamics

## Physically-based SPH Solver

A new particle fluid solver has been added that provides more physically-accurate simulations (r52989). The new solver is based on early SPH research, so it is called the Classical solver.

The new solver uses the same parameters as the old one, but it is important to note that the units are quite different. For example, a 1x1x1m cube of water containing 1000 particles should have approximately the following parameters:

- Particle mass: 1 (kg)
- Stiffness: 300 (m/s)
- Viscosity: 0.01
- Interaction radius: 0.225 (m)
- Rest density: 1000 (kg/m
^{3})

The new solver results in a more regular spacing of particles. The spacing can be calculated before the simulation runs, and is shown in the UI. Use this value to guide the initial conditions of the simulation, e.g. the resolution of the emission grid. With the settings above, the spacing will be approximately 0.1m - because 1kg of water fills a 10cm cube.

*Stiffness* is a measure of how incompressible the fluid is. This is related to the scale of the simulation; for smaller-scale simulations this should be decreased, e.g. for a spacing of 0.01m the stiffness might be set to 500.

In comparison, the old solver would have used parameters more like this:

- Mass: 4
- Stiffness: 1
- Viscosity: 2
- Repulsion: 1
- Stiff viscosity: 0.1
- Interaction radius: 0.225
- Rest density: 1

Note that the old solver does not use any particular units, but the new solver can accept SI units.

The old solver is in some ways more artistically expressive, and is still available. It is now called the double-density relaxation solver.

### Stability Improvements

The simulation advances in discrete steps. There are three parameters that control the size of the steps:

- Timestep: The amount of real time that passes during each frame.
- Subframes: The number of simulation steps per frame.
- Threshold: A tolerance value that allows the number of subframes to vary automatically.

In Blender 2.66, both the *Subframes* and *Threshold* parameters can be set (r52948). In this case, the number of steps per frame will be at least *Subframes + 1*. More subframes may be simulated if the fluid becomes turbulent, according to *Threshold*. Previously, only one of these could be set - sometimes resulting in unstable fluids at rest or unstable fluids in motion.

For the 1m cube example given above, reasonable values are:

- Timestep: 0.04 (seconds per frame)
- Subframes: 3
- Threshold: 0.1

### Troubleshooting

If the simulation behaves badly (explodes):

- Ensure the calculated spacing matches the desired particle spacing.
- Set the interaction radius to roughly (spacing * 2.25).
- Increase the number of subframes or decrease the threshold (see above). Note that smaller scale simulations require a smaller timestep.
- Reduce stiffness or increase viscosity.