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
(→‎Anomalies: these are all from old versions and have since been fixed)
(→‎Current best pressure model: Recent observations have come up with a much simpler model)
Line 68: Line 68:
 
Note: this may not be correct.  See [http://www.gamasutra.com/view/feature/3549/interview_the_making_of_dwarf_.php?page=9] and [http://www.gamasutra.com/view/feature/3549/interview_the_making_of_dwarf_.php?page=10] for info from Toady.
 
Note: this may not be correct.  See [http://www.gamasutra.com/view/feature/3549/interview_the_making_of_dwarf_.php?page=9] and [http://www.gamasutra.com/view/feature/3549/interview_the_making_of_dwarf_.php?page=10] for info from Toady.
  
# Water normally has 0 pressure.
+
* If a tile containing water has a tile of 7/7 water immediately below it (and no floor is present between them), the water in the upper Z-level will be pushed downward and moved to the nearest orthogonal (not diagonal) tile on the lowest available Z-level, up to the Z-level just below the top. Each tile of liquid performs this check once every few steps. This type of pressure applies only to water, and is what causes large bodies of water multiple Z-levels deep to rapidly drain when opened.
# If a water source (including pumps) attempts to create water in its output tile but cannot due to it being full already, it will pressurize the output tile (it remains pressure 0, but this allows it to pressurize the tile below it and give it pressure 1).
+
* If a liquid source (river/brook source, underground river waterfall tile, map edge, or [[screw pump]] output) attempts to create liquid in its output tile but cannot due to it being full already, the liquid will be created in the nearest orthogonal (not diagonal) tile on the lowest available Z-level, up to the ''same'' Z-level as the source. This applies to both water and magma, and can be observed by damming a river.
# Water sources attempt to generate water in tiles adjacent to pressurized tiles. They will not generate water in tiles above pressurized tiles unless the water source has '''nowhere''' else to generate '''any''' water, and they will never generate water above the water source's z-level.
+
* Liquids adjacent (both orthogonally and diagonally) to non-full tiles will flow into them and average their depths, pushing lightweight objects and creating flow (which will power [[water wheel]]s) if the depth difference was 2 or more.
# The amount of water generated per tick does NOT appear to increase as the radius of the water blob increases. Water being generated on two z-levels at once has been observed to generate faster on the lower level, but it is unclear if this actually means that lower levels have more water generated, or if some other factor was at work.
 
# For water sources, seemingly random valid pressurized tiles are chosen to generate water at each tick. However, tiles closer to the source are preferred (This may or may not be due to how pressurization spreads?).
 
# The pressurization state spreads from a tile to adjacent, above, or below tiles only if both are 7/7, and only if the pressurized tile has no tiles adjacent, above, or below itself which it could generate water in.
 
# Pressure which is transmitted downward is increased by 1. 7/7 water which falls and remains 7/7 also increases in pressure {{verify}}.
 
# Pressure which is transmitted upward is decreased by 1.
 
# Tiles with 0 pressure can be considered 'pressurized' for the purpose of generating water (they have no speed bonus).
 
# Pumps do not transmit pressure. Water which comes out of pumps has 0 pressure. (Note that you must ensure that output water does not contact input water, or pressure WILL be transmitted through the connection)
 
# Water tiles which drop below 7/7 density become 0 pressure and unpressurized.
 
# Pressure makes water moves faster, with each level of pressure seemingly providing greater speed.
 
# Falling water which falls onto 7/7 water acts as a 'source' (but is destroyed when its water is re-created elsewhere).
 
  
 
===Anomalies===
 
===Anomalies===

Revision as of 15:20, 9 September 2009

Dwarf Fortress attempts to replicate hydrostatic water pressure.

There are, however, other mechanisms at work too that try to simulate water pressure, so never think you are on the safe side, especially when trying to trick the game.

hydrostatic water pressure

In layman's terms, if you have a tall body of water (such as a lake or a tower you have pumped full of water) then the water at the lowest z-level is being 'squeezed' by the weight of the water above it. If it is released it will move with remarkable speed and can flow up stairs, ramps, and over channels. It will continue flowing until it runs out of space or it fills to a z-level one level lower than the source, as stated by Toady. This does not exactly match natural hydrostatic water pressure.

As another model, think of a pipe shaped like a "J". If you pour water in the taller end of the pipe, it will come "up" out of the lower end until the water levels on both sides are equal. Until all the water in the tall part is at the same level as the lower part, water will continue to come out that lower end. This is one part of Dwarf Fortress "water pressure".

Dwarf Fortress does not model surface friction nor air pressure, so the water will not slow in transit nor will 'trapped air bubbles' form. Magma does not have pressure (it cannot flow up, and doesn't appear to move at greater speeds).

Pumps do not create pressure. They simply pull water from one level below on end and dump it out at the other. There is no "force" behind a pump. However, water pumped to a high level will, as normal, have pressure compared to a lower level.

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.

Waterfalls

Waterfalls are of special concern. If you tap or even channel a water source that is downstream from a waterfall, the pressure will be equal to the level at the top of the waterfall. It is absolutely critical to reduce the pressure in such a system if you do not wish flooding, the easiest way being diverting the water diagonally - although if used solely for a complex drowning trap or other purpose, flooding may be desirable.

Mitigating dangers

Diagonal Flow

When water flows through two tiles that are diagonally adjacent, it loses all pressure from higher levels.

Top View
###### ################# Direction-> # -> of -> # -> Flow -> # -> #################### ###
# = wall, constructed or undug = pressurized water = neutral/normal water pressure

This does not work on a vertical basis - water only travels vertically to a different z-level, never diagonally.

If you wish to maintain the rate of flow after de-pressurizing, it's recommended that you have more diagonals than water tiles - that is, if the source is 3-tiles wide, you may wish 4 or more diagonal passages.

Hatches

Hatches can be placed over channels, stairs, ramps etc to prevent water moving vertically but still allow the tile to be used, even as a water source (and possibly still for fishing too).

Pumps

When water is passed through pumps, the pressure is re-set to that of the exit tile. Of course, there is a downside - you still have to run the pumps and due to the source water's pressure the pump must be powered instead of run by a dwarf (the tile the dwarf needs to stand on is filled by water). Furthermore the power cannot be transmitted by a gear placed next to the pump, because the water will simply flow down the passage the gear comes from!

Your vertical axles or gear assemblies need to 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.) Multiple adjacent pumps will also transfer power between themselves automatically.

Side view
                      
    Power  Water      Key
      ↓    ↓↓↓↓↓      # = Normal wall
##########≈≈≈≈≈      # = Wall that pressurised water would flow into if it were to be dug out
###########≈≈≈≈       = Regular water
_ ___########≈≈       = Pressurised water
#≈≈≈≈≈%%≈≈≈≈≈≈≈≈      %% = Pump
###############       = Axle
################      _ = Floor

Theory

What follows here are several rules which specify how water pressure affects water's behavior. These were written to fit experimentally observed behavior as best as possible. (There used to be two models here, but the second one couldn't be reconciled with the observed results of the water-overpressure-in-river experiment, though the first also had to be extensively rewritten. The chief problem with the second one was that it was essentially "water pressure in a 7/7 water tile is determined by the difference in z-level between it and the highest 7/7 water tile it's connected to," and that pressure wasn't something to be transmitted between tiles. This would mean an entire river overpressurized should overflow along the entire river length simultaneously. It didn't.)

Current best pressure model

Note: this may not be correct. See [1] and [2] for info from Toady.

  • If a tile containing water has a tile of 7/7 water immediately below it (and no floor is present between them), the water in the upper Z-level will be pushed downward and moved to the nearest orthogonal (not diagonal) tile on the lowest available Z-level, up to the Z-level just below the top. Each tile of liquid performs this check once every few steps. This type of pressure applies only to water, and is what causes large bodies of water multiple Z-levels deep to rapidly drain when opened.
  • If a liquid source (river/brook source, underground river waterfall tile, map edge, or screw pump output) attempts to create liquid in its output tile but cannot due to it being full already, the liquid will be created in the nearest orthogonal (not diagonal) tile on the lowest available Z-level, up to the same Z-level as the source. This applies to both water and magma, and can be observed by damming a river.
  • Liquids adjacent (both orthogonally and diagonally) to non-full tiles will flow into them and average their depths, pushing lightweight objects and creating flow (which will power water wheels) if the depth difference was 2 or more.

Anomalies

  • When dealing with a Waterfall, water keeps the pressure of the highest z-level, no matter the height of the waterfall. This means if a channel is dug after the waterfall, it will have the pressure as if there was water above it to the original z-level of the water.

Movies of pressure experiments

  • [3] - Showing that pressure is not transmitted through non-7/7 tiles.
  • [4] - 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
  • [5] - Pump turned into infinite water generator, but still provided useful information on how overpressure causes upward flooding.
  • [6] - Uses three pumps connected to different tunnel layouts to test a few of these rules: One tunnel has three accessible z-levels. The second tunnel has one accessible z level and periodic shafts up. The third has only one accessible z level with no shafts. The bottom level of all three filled first, and the shafts did not fill until the bottom was filled. The second level of the three-high tunnel did not begin filling until the first was full. They did not all fill the bottom at once, but this is believed to be due to the order in which their pumps are placed on the river.

Possible future experiments

  • Have a pump pumping water into a 3-wide tunnel with a 1-wide tunnel below it. Have another pump pumping water into a 1-wide tunnel with a 3-wide tunnel below it. Observe whether the bottom tunnel's water spreads faster in both cases or just in the smaller tunnel.
  • From a pump, fill a cistern which is several levels lower. Shut off the pump and the higher level tiles with hatches once the whole thing is 7/7. Open other hatches above the cistern, combine water with unpressurized water, and see what happens.