I get the impression that a lot of people don't understand how fluids work, and when I read the wiki articles about water and pressure, it's not hard to see why. The water pressure article still lists buggy behaviors from older versions. The "current best pressure model" is overly complex, and can be replaced by one simple rule which I am about to present.
A couple times I posted in threads explaining fluid behavior to people, but it seems like if there were better documentation of this behavior in the first place, a lot of these questions might be avoided.
Therefore I am writing this post, with the intention of linking to it from water-questions threads, and the hope that some of this material makes its way to the wiki.
This is my current understanding of water:
For each frame, a loop runs through every tile with water in it, and determines, one at a time, what each tile of water is going to do, according to the following three rules:
1. If water is in open space above a tile which is not full of water, it falls into the space until the space is full or there is no water left to fall. This sometimes generates mist.
2. If water is in open space above a tile which is full of water to 7/7, it finds a path through tiles of 7/7 water to the nearest non-full space on a lower z-level, and then teleports there until the space is full or there is no water left to teleport. It only pathfinds north, east, south, west, up, and down; not diagonally. It does not move creatures or objects.
This one rule is "pressure".3. If water is unable to fall or move under pressure, because it is resting on a floor or because it is on top of more water but all connected spaces on lower z-levels are full, it will spread out to adjacent tiles (including diagonally) which have a lower level of water in them. This may move creatures and objects. (I don't know exact rules for where it will go if there are multiple tiles to spread into, though observation of partly-full reservoirs suggests there is some pattern. I also don't know whether objects' masses affects whether they will move.)
This is illustrated by the following flow flowchart:
Magma is exactly the same as water
with the omission of rule 2. It can fall, or spread out, but not move under pressure. If magma is in a 1x1 chute over a mostly-full reservoir, it has to wait for a 6 in the reservoir to line up under it so that it can fall in.
Pumps are the last thing that need explanation.
When there is a fluid in the tile from which a pump pumps, the pump tries to pump the fluid as follows:
1. If there is space in the pump's output tile (the one next to the solid tile of the pump, in the line of the pump), it puts fluid there.
2. If the output tile is full, the pump attempts to find a path through 7/7 fluids to the nearest empty space on
the same or a lower z-level, and puts fluid there. As with water-pressure pathing, pump output cannot path through diagonals.
3. If there is no available connected output space on the pump's z-level or lower, nothing happens.
This applies equally for water or magma,
which explains all magma-pressure phenomena. Pumps do not "give magma pressure"; the pump moves the magma according to the rules of pumping, which can span z-levels, but after it has been placed by the pump, the magma moves only according to its own rules, which do not include pressure.
A couple relevant posts I've made:
http://www.bay12games.com/forum/index.php?topic=31425.msg439298#msg439298http://www.bay12games.com/forum/index.php?topic=31312.msg438288#msg438288See also Akhler's application of the inextinguishable-flaming-lignite-blocks-in-a-bin trick:
http://mkv25.net/dfma/movie-1124-itwinssohardThings I still don't know:
Suppose a pump is merrily pumping magma, and someone pulls a lever that closes the door allowing magma under the pump intake, then opens a source of water. Will the pump path through the magma to find a place to put the water?
What's up with that one flood-the-world pump experiment? I tried unsuccessfully to recreate that once but it was a pretty casual attempt. Does that work in 40d, and if so, how exactly do you do it? I do have one power plant that drains into the same cave river it pumps out of (drain is downstream of intake), and that river flooded nicely.
How do waterwheels really work? I've heard "it has to be less than 7/7 water" but that's definitely an oversimplification, because I've designed power plants that were constantly at 7/7 water and
ran fine. I was about to conclude that "when water at 4/7 or above spreads-out under a waterwheel, or a pump (and possibly water pressure) paths through a tile under a waterwheel, the waterwheel runs" when I built a power plant that should have worked if that were true, but only generated 500 power instead of 3000. I'll have to take the thing apart to figure out which five of the thirty wheels are running, and see if I can figure out why.