I have been developing animations involving fluid dynamics, and have had a lot of questions surrounding the process. Below is a walkthrough for how this is done (some basic Blender knowledge is presumed).
The techniques described were used to create the below animation tests.
The settings for the domain are shown below. Most is fairly self explanatory if you read the tooltips that appear when you hover over the UI elements.
Essentially, we enable fluid dynamics in the physics panel for our domain (big cube), then set the type to "Liquid"
The settings for our water source object (top small cube) are shown below.
And lastly, our obstacle (bottom small cube) settings are shown below.
With everything set up, back on the domain object we can now bake the simulation. Enable the mesh setting to convert the calculated phsyics into 3D mesh data.
Set type to "All" and press "Bake All" to calculate the sim (this can take a while to process)
If everything went smoothly, you should have something like the below.
From here, it's a matter of refining and testing. Press the "Free All" button to clear the bake, after which you can adjust settings and then bake again.
The resolution setting on the domain lets you quickly test low res calculations, then when everything is looking good, you can start to increase the resultion.