I. Setting Up FLIP

First things first. Set your desktop to Technical
Windows > Desktop > Technical


A. Creating a Water Tank
Navigate to the Particle Fluid tab in the upper right hand corner of your screen.
Left click on the FLIP Tank Solver [Fig. 1]

Houdini will ask you to place it. Just go ahead and place it anywhere and then in the parameters window reset the center parameters to 0,0,0.

Go up one level in the node window to the obj level and drop into the AutoDopNetwork node by double clicking on it.

Make sure the fliptank node is selected.

In the second half of the parameter window click on the Guides tab.
Once that is select click on the Particles tab below it. [Fig. 2]
Change the Visualization parameter to Particles.

Now take a look at the Particle Separation parameter in the properties tab.
This number determines the spacing in between the particles. For a more impressive simulation choose a lower number. The lower the number the greater the amount of particles, so the sim will be a higher resolution.  Right now we want to develop the look of the effect so I suggest a higher number. This means fewer particles and much faster sim times. Don't worry once we get the look, speed and motion down I'll show you my settings for a higher resolution sim that will get you a beautiful result by the end of this chapter.

Quick Note: Particle Separation
Higher Number = Less Particles = Lower Resolution = Faster Sims [Use for look development]
Lower Number = More Particles = Higher Resolution = Slower Sims [Use later for final output]

For now set the value to 2.


Go back to the obj level of the node window.
Drill into the fluidtank_initial node by double clicking on it.

In this node we can change the size of the fluid container to cover the area and size we need for our objects to move through.

Go ahead and change the Size parameters to 150, 5, 150
This should give us some nice coverage.

Now follow with me This might seem a little strange but right-click and copy the Size: Y parameter (Copy Parameter)

Right click on the Center: Y parameter and select Paste Copied Relative Reference and then add /2 to the expression. In the end the box should look like this: ch("sizey")/2    [Fig. 3] 

Now change the Size parameter to 85. Notice how our center now stays in the actual center of the fluid volume. 

Now change the Water Level Parameter to 15. This value tell us how deep the fluid will be in the fluid container.  So right now we have an 85 unit high tank with water filled up to 15 units.

So this is a pretty big tank filled with a fairly large volume of liquid.  We want to make this scale as close to life sized as possible. In Houdini the simulations are extremely accurate so the closer we get to a real world scale the more real world life like the water will appear to be in our final renders.

B. Set-up a Collision Object
To see how large the scale of our water tank is let's add a default sphere to the scene.
Now go back to the obj level of the node window.
Hit [Tab] and type: Sphere to drop a sphere into the scene.
Pretty small isn't it.

Let's scale up the sphere by 10. 
Double click on the Sphere node to drill into it.
Set the Radius parameter of the sphere to 10, 10, 10.
Change the Primitive type to Polygon Mesh 
Set both the Rows and Columns parameters to 20.

Hit [Tab] and type: transform to drop a transform node into the scene below the sphere1 node.
We are still inside the Sphere geometry object.
Connect the Sphere1 output to the input on the transform1 node.

Let's translate the sphere down to about -30 in the Y-axis.
Let's also scale the sphere in the X-axis by 2, the Y-axis by 0.5, and  Z-axis by 5.
[Fig. 4]

So now we have a nice flat object we can use to collide with the water in the tank. So let's get to it and see some magic.

C. Colliding with a Dynamic Object
Go back to the obj level of the node panel.
Make sure you have the sphere Geo selected.
Navigate to the Rigid Bodies tab and click on the RBD Object button. [Fig. 5]

Double click on the AutoDopNetwork node to drill inside.
We see that Houdini has created some nodes for us.  It is calling the sphere object, telling the sphere object to be processed, and feeding this knowledge into the rigidbodysolver. [Fig. 6]

You can hit play if you want on the timeline and it's not very exciting so far.  
Right now the sphere begins to fall with gravity.  At least we know the rigidbodysolver is doing its job.

Select the sphere node seen in [Fig. 6] and give it some velocity in the Y-Axis. I'm going to give it a velocity of 30. Feel free to play with the values. Hit play on the timeline and see the results.

We get a nice looking effect here when the object comes out of the water.  It's even pretty cool to look at when the object falls back down into the tank and creates a secondary splash.  However maybe this is not the effect we are looking for and may want to have more control over the object and the sim.

D. Colliding with a Static Object

Let's revert back to our previous setup before we introduced a rigid body solver.
In the AutoDopNetwork go ahead and delete the three nodes seen in [Fig. 6] The sphere, the merge, and the rigidbodysolver.

Go back up to the top level obj window and double-click on the sphere object to drill inside.
Go ahead and delete the rest1 and dopimport1 nodes.

This will revert us back to where we were before we added the rigidbodysolver.

Hit [Tab] and type: transform to drop a transform node into our sphere object.
Connect the output of the previous transform to the input in the new one.

Rename the first transform to Initial_State to remind us of its purpose; to provide the scaling and translation we needed to get the object into its initial state prior to animation.

Rename the new second transform to Animation_Transform so we remember this node controls the animation of the object.

Make sure your animation slider is set back to frame 1. 
Now hold down [Alt] and left-click on the Y-Axis box in the Translate parameter.
This will add a keyframe. As a little side not if you want to remove this keyframe hold down [Ctrl] and left-click to remove it.

Go to frame 100 and set the Y-Axis to 100 and set a key frame.

Hit play on the timeline and you can see we have a simple animation on our sphere, but nothing is colliding. Let's fix that.

Go back to the obj level of the Node window.  
Select the sphere geo object. 
Now instead of clicking on the RBD Object in the Rigid Bodies tab, click on the Static Object button instead. [Fig. 7]

Drill into the AutoDopNetwork and notice the three nodes this function created for us. Just like with the RBD Object. Except this time we see the staticsolver.

If we press play now we still do not see any fluid simulation.
Take a look down in the parameters of our sphere in the AutoDopNetwork [Fig. 7]
Check the box next to the Use Deforming Geometry so this attribute is On.
It was broken before because the solver was simulating from what was essentially a non-moving piece of geometry. The solver could only 'see' the sphere.  By turning Use Deforming Geometry on the solver will now check the geometry and all of its deformations every frame and call that information back to the solver.

Now run the simulation again by pressing play. We have a nice splash.

We do have a problem with this new method however. The particles aren't inheriting any of the velocity of the object.  The particles are not really sticking to the sphere, and it doesn't look like there is very much friction.  The splash is there, but doesn't look very realistic.  It can look nicer so let's see what we can do to improve the simulation.

Select the fliptank node in the AutoDopNetwork and change the Particle Separation parameter to a value of 1.5. This is one of the first parameters we set at the very beginning of the tutorial in section A.  

This is a little weird so follow with me and I'll post a picture of the attribute. [Fig. 9]
Select the flipsolver node in the AutoDopNetwork.
In the parameters window select the Volume Motion tab.  This will reveal more tabs below in the secondary row of tabs select the Collisions tab.
This tab will have an attribute called Stick on Collision. Check this box On.

This parameter, if we hover over it, causes the fluid's velocity to match the collision velocity of the collision objects in proximity to it.

Set the Stick Scale to .5.
Set the Normal Scale to 3.

The normal scale is telling the flipsolver is try to match the direction and velocity of the normal while sticking to the object. 

Change the Velocity Type to Point.

At the top row of the parameter tabs select the Particle Motion tab. Then in the secondary row of tabs select the Reseeding tab. Uncheck the Reseed Particles parameter.

When this box is checked the solver will create more particles in the sim where it sees a scarcity of particles. This is usually used to avoid pockets of air and to provide a smoother surface.