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.

Difference between revisions of "40d:Water pressure"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
Line 43: Line 43:
  
 
===Movies of experiments, and save files for them===
 
===Movies of experiments, and save files for them===
* [http://mkv25.net/dfma/movie-284-firstwaterpressureexperimentreproduced] - Showing that pressure is not transmitted through 7/7 tiles.
+
* [http://mkv25.net/dfma/movie-284-firstwaterpressureexperimentreproduced] - Showing that pressure is not transmitted through non-7/7 tiles.
 
* [http://mkv25.net/dfma/movie-283-grandwaterpressureexperiment] - Showing that pumps output 0-pressure water even from a high-pressure source, that water will not flow up and to the side at the same time (has to flow straight up), and a few other things
 
* [http://mkv25.net/dfma/movie-283-grandwaterpressureexperiment] - Showing that pumps output 0-pressure water even from a high-pressure source, that water will not flow up and to the side at the same time (has to flow straight up), and a few other things
 
* [http://mkv25.net/dfma/movie-285-waterpressureinriverexperiment] -- I'm not quite sure what this indicates. Quite probably both models as they are written now are wrong, but they are still decent simplifications of DF's water pressure model except in extreme cases, perhaps. We should be able to correct model 1, at least, if we can figure out what caused the occurances in the movie.
 
* [http://mkv25.net/dfma/movie-285-waterpressureinriverexperiment] -- I'm not quite sure what this indicates. Quite probably both models as they are written now are wrong, but they are still decent simplifications of DF's water pressure model except in extreme cases, perhaps. We should be able to correct model 1, at least, if we can figure out what caused the occurances in the movie.

Revision as of 01:32, 4 January 2008

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 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. You can 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. Due to the source water's pressure, the pump must be powered instead of dwarf-run (the tile the dwarf would stand on is filled by the pressurized water). Additionally, the power cannot be hooked up to the walkable tile of the pump, because the water will simply flow directly up it! Your vertical axles or gear assemblies should be placed above the unwalkable tile of the pump, and there must not be a channel over the walkable pump tile. (Water can only flow straight upward, not up and to the side at the same time)

Water Pressure Theory

Here are two possible models for DF's water pressure.

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.
  • 7. Water tiles which drop below 7/7 density become 0 pressure.

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.

Further experiments, or asking Toady, may be needed to determine which is correct. The first model would probably 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 could be identical in results to the second model if pressure was transmitted instantaneously to all connected tiles, and if falling water does not retain its pressure (and has to be re-pressurized by higher water once it has stopped falling).

To determine which model is more accurate:

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.

This has been 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. The water filled to 7/7 but did not flow upward, showing that it had not retained its pressure. [1]. This is a point in favor of model #2, but model #1 could still be true if water loses its pressure if it drops below 7/7, so an additional rule has been added to model #1's rules to account for this.

Movies of experiments, and save files for them

  • [2] - Showing that pressure is not transmitted through non-7/7 tiles.
  • [3] - Showing that pumps output 0-pressure water even from a high-pressure source, that water will not flow up and to the side at the same time (has to flow straight up), and a few other things
  • [4] -- I'm not quite sure what this indicates. Quite probably both models as they are written now are wrong, but they are still decent simplifications of DF's water pressure model except in extreme cases, perhaps. We should be able to correct model 1, at least, if we can figure out what caused the occurances in the movie.