Initial States

Imagine a scene, where you have to simulate 100 frames to wait until the fluid particles have settled or have reached a certain point in space. These 100 frames will not be used, because the really interesting part starts at frame 101. Instead of deleting the surplus files and struggle with offsets, you can create an initial state from the last frame. When "Use Initial State" is enabled this saved state will be shown at frame 0 and be used as a starting point for the next simulation cycle. Now you have exactly the frames you really need, because the previous frames will be overwritten at cache time.

Other, typical fields of applications are, for example

  • the creation of puddles (see below) in conjunction with the "Crown" daemon

  • emitters and daemons like "Spline" and "DSpline"

  • calm fluid surfaces.

  • filled tanks and containers.

 

Creating an initial state is a matter of a few clicks:

  • Simulate (click on the timeline's "Play" button)

  • Go to Scene > Cache and specify the "Cache Folder" where the initial state will be saved.

  • Stop the simulation at any time and press "Create Initial State under Fluid > Fluid.

  • Set “Use Initial State” to “Yes” if necessary.

  • Rewind the timeline to frame 0 – the initial state is shown.

  • Simulate.

Creating a Puddle

Start with a cube and attach a "Collider" tag with the following settings – high "Friction" prevents the particles from spreading out, a low "Bounce" value avoids "elastic" particles:

  • Add a "Sphere" emitter. Enable "Fill sphere", set "Speed" to 0, and "Randomness" to 0.2.

  • Go to Fluid > Fluid, and enter 100 for "Resolution" and 2 for "Surface Tension",

  • Create a "Gravity" daemon.

  • Next, create a "Drag" daemon and animate its "Drag Strength" from 0 to 400.0 between frame 0 and 200. This helps to slow down the fluid and make it rest.

  • Simulate for 250 - 300 frames.

You will observe that the particles slow down and create a circular puddle. The puddle's diameter and height depends on how fast the particles are being decelerated.

Once the particles have come to rest you can create an initial state as described above. This state can then be used for further simulations, but please disable or remove the "Drag" daemon.

 

Using initial states to extend a simulation and resume caching from the last cached frame.

If you have already cached your simulation but you want to extend it for some frames without having to recalculate your already cached frames, you can do so.

In order for the "Cache Simulation" button not to overwrite your already cached frames, you have to move the frame selector to your last cached frame and then go to each fluid's node, click on the "Create Initial State" button (so the fluid state is stored at that point) and activate the "Use Initial State" checkbox (when you do this, the initial state will be used for the first frame of the animation).

Then go to the timeline and change it so the active range of frames goes from the last cached frame till the new last frame.

You can now press the "Cache Simulation" button and it will be calculated starting from the stored "Initial State" from the last cached frame till the new last frame without having to recalculate everything again.

 

Here you have a video showing the process in a simple scene: 

Resume caching.mp4