# Understanding Fluid dynamics - ridiculously large tmp folder

Recently, I've received access to a high-performance PC; I wanted to check on its capability with Blender's fluid dynamics. First, I set simple system of fluid domain, fluid inflow, etc., with Final Resolution: 200, time from 0.000 to 4.000, and 1000 frames of animation. Blender told me, that it will get 770 Mb of space. After this, I made a script to run by the CLI through SSH:

import bpy
bpy.ops.fluid.bake()
bpy.ops.render.render(animation=True)


Then I ran a command:

nohup ./blender -b ../u3.blend --python script.py &


After 48 hours of computing, I received this from my tmp folder:

179G    /tmp/blender_lFkZps/


Animation looked great, though - below I present single frame:

Now for the questions.

1. Why the /tmp/blender_*** took so much space?
2. Why, even if fluid simulation had only 4 seconds - which gives 4*24=96 frames - it lasts for all 1000 frames? Does it mean that if I would change setting to 2000 frames it would be 2x slower?

# Cache size

Fluid cashes are BIG. Blender must store the entire mesh (which is considerably dense at higher resolutions) for every frame.

If your fluid mesh comes out to an average of say 500K verts, well, you've seen for yourself what happens when you need to store 1000 versions of a mesh of that density.
It only gets worse if you want to store additional data such as velocity vectors.

Instead of putting all of it in /tmp you probably want to configure this to go somewhere else by setting the path in Properties > Physics > Fluid:

# Simulation time

The way blender's current fluid simulator works with time is rather confusing.

Based on my tests, it seems the fluid simulation always goes from frame 0 to the scene end frame (set in the timeline or in Properties > Render > Dimensions > Frame Range)

The start and end time settings in the fluid panel influence the speed of the simulation. If you want the fluid to move in "real time", you'll have to manually calculate how long the range from frame 0 to the scene end frame is in seconds, at the desired framerate (you can change the scene framerate in Properties > Render > Dimensions).
For 251 frames (counting from 0) at 24 frames/second, that works out to 251/24 ≅ 10.46. So, set the start time to 0 and the end time to 10.46.

Setting the start time to something other than 0 simulates up to that point, but discards prior frames and sets the fluid frame at that time to the scene frame 0. In other words, with a start time of 1 the simulation will appear to "start" one second in, but in order to do this the previous second must still be simulated behind the scenes.

All of this is made even sillier by the fact that you can also adjust the speed of the simulation much more easily with the fluid speed factor, just below the start and end time settings.

This is admittedly a spectacularly messy example of one of the darker sides of Blender's UI. The good news is that the current (ancient) fluid simulator is being replaced in one of the upcoming GSoC 2016 projects (hopefully the UI will be going too).