v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

40d:Water pressure

From Dwarf Fortress Wiki
Revision as of 05:22, 3 January 2008 by SL (talk | contribs)
Jump to navigation Jump to search

Water pressure is a phenomenon apparently exhibited by some, but not all, water in Dwarf Fortress (Murky pools seem pressureless unless connected to another water source, but this is probably because pressure is only transmitted by 7/7 water).

Water which is pumped up high into an enclosed tower and then allowed to flow to the bottom, at least if pumping continues, will have tremendous pressure at the bottom of the tower. This causes the water, if released, to move with remarkable speed and to even flow up stairs, ramps, or channels. Any water which flows down will tend to flow back up, until it has equalized.

Dwarf Fortress does not model air pressure or surface friction, and magma does not have pressure.

Water Pressure Dangers

It is easy to flood your fortress accidentally by not accounting for water pressure. For example:

  • It is safe to dig out a cistern one level below a murky pool, and to channel above a few tiles of the cistern so that your dwarves can get water from it without having to go outside.
  • It is safe to refill a murky pool with water from a pump or brook/river/etc on the same level.
  • It is not safe to do both to the same pool! The water from the pump/brook/river/whatever will fill the pool to 7/7, and will then pressurize the water in the cistern, which will then flow up out of your channels and flood your fort.

Mitigating the Dangers

Hatches placed over channels prevent water pressure from spewing water up out of the channels, and still allow the tiles to be used as a water source (and possibly still for fishing too).

Pumps can theoretically be used to eliminate pressure. If you allow water to fall two levels down into an enclosed area, and then pump it from one level above that, the water which comes out of the pump should have 0 pressure, rather than 1 pressure. In theory you could even deliver water to the second-lowest level of your fortress safely in this manner. Of course, there is a downside - you still have to power the pumps.

Water Pressure Theory

It appears that DF's water pressure can be modelled by the following rules (Model #1):

  • 1. Water normally has 0 pressure.
  • 2. 7/7 water tiles transmit their pressure to adjacent tiles, with higher pressure values replacing lower pressure values when they meet. (but how fast is it transmitted?)
  • 3. Pressure which is transmitted downward is increased by 1.
  • 4. Pressure which is transmitted upward is decreased by 1.
  • 5. 7/7 water tiles with more than 0 pressure can flow or spread water upward.
  • 6. Pumps do not transmit pressure. Water which comes out of pumps has 0 pressure.

An alternate model (further experiments, or asking Toady, may be needed to determine which is correct) (Model #2):

  • 1. Any given 7/7 water tile determines the highest z-level of 7/7 water which it is connected to, and can drain water from said connected tiles to spread upward so long as it does not spread above that level.
  • 2. For this model, rule #6 would likely still be true, since pumps do not form a connection between input and output water.

The chief reason that's presented as an alternate model instead of the most likely one, despite appearing simpler in concept, is that the first model would be simpler to code, and would probably run faster (would take less CPU time to perform fluid pressure logic, provided pressure is only transmitted one or two tiles per tick). In theory, the first model would be identical to the second model if pressure was transmitted instantaneously to all connected tiles and if falling water does not retain its pressure, but has to be re-pressurized by higher water once it has stopped falling.

To test this:

  • If you drop a small amount of water a large distance downward, what pressure does it have afterwards? With model #1, it would have very high pressure. With model #2, it would have low pressure.

Theoretically this could be tested by allowing pressureless water from a pump on that level to flow into the same space as the small amount of theoretically high-pressure water. If the water fills to 7/7 and then flows up the shaft, model #1 is correct. If not, either model #2 is correct, or falling water does not retain pressure.