Before diving into the water simulation (haha, puns are fun) it is usually best to do some research and planning first, since there is a lot of theory involved in a nice looking water simulation and there are many ways you can tackle the problem. Having a clear design and direction in mind is key to making good progress, rather than going round and round in circles. It's hard to explain how, but I personally like to visualize what I want the water to look and feel in my mind's eye before starting any programming. Knowing beforehand how you want your water to look and feel helps with the technical side of things too, since you can mold your technical solution towards a specific goal you have in mind for certain problems.
That probably isn't the best explanation so I will try to explain the actual steps that I went through before making my water simulation:
Some great theory articles to read first before doing any programming:
Another good way to visualize how you wold like your water to look and feel is to take note of how other people have tackled the problem. If you can see what your 'competition' is doing, not only does this give you a great quality bar to set for yourself, but it will also give you great insight into how others have tackled the problem before you, Here is some information on other water simulation produced for other games:
These lists are by no means extensive, and just by doing simple Google searches for "Water Simulation" you get tons of resources and stuff to read. In fact I would recommend you spend at least a couple of days reading and gathering resources, jotting down designs and useful notes BEFORE doing even one line of coding.
The rest of this article is going to be dedicated to showing how I personally tackled water in my voxel engine and the way my water simulation works. I am in no way saying this is the best approach or even that I do certain things correct, I just found certain things that work well for me and fit into my voxel engine nicely.
Here is a video demonstrating my water simulation:
Water in my voxel engine is completely separate from the other voxel rendering. Doing it this way offers some advantages and also some disadvantages. The biggest disadvantage to separating the water away from my other voxel organisation and rendering is that I lose all the previous optimization and performance gains that other chunks and voxels have. I could have just made water a different 'block type' and handled it the same as all the other voxel types in my chunks. (This is how a lot of other voxel engines currently handle water).
...
...
...
...
...
..
...