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 flow"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m (Changed quality rating from "Unrated" to "Superior" using the rating script)
 
(42 intermediate revisions by 14 users not shown)
Line 1: Line 1:
'''Water Flow'''
+
{{Quality|Superior|10:53, 18 May 2015 (UTC)}}
''(Why isn't my waterwheel turning?)''
+
{{av}}
 +
'''Water flow''' is an informal term used occasionally by players to denote the ability of specific water tiles to power a [[water wheel]]. The direction of the flow '''does''' matter for purposes of powering a wheel, though most of the time it's diagonal and thus doesn't matter.
  
:What is [[water]] flow? I want to be clear that this is about water flow, not about water depth. This is about whether or not water is considered to be flowing. Since the only real tool to demonstrate water flow is the [[waterwheel]], it will naturally be mentioned periodically on this page.
+
While there obviously is a game feature at work, the mechanics are not ''completely'' understood at present. It's a bit of a black box - we know some of what happens, what will work and what won't, but not always why.
  
:The obvious answer would be moving water, but things seem more and less complicated than this in practice. A [[waterwheel]] needs flow to function, and it needs 4/7 or higher water. These are two different things. a stagnant loop of 4/7 water from a murky pond will not power a waterwheel as it is not flowing. However a dead end channel from a [[river]] or [[brook]] will. In fact twice I have tested and show that a dead end channel from a river or brook will continue to power the waterwheel after you block it off with a floodgate. Strange. Nor does distance seem to matter other than for the time it takes to fill the channel to 4/7. I went from corner to corner of the map, a nice long path on a 3x3 map, channeled directly from a river, dead end, and there at the extreme end of the dead end is a happily turning waterwheel. I blocked it off with a floodgate again and laughed. Either floodgates or sourced water seems to have a bug. Floodgates prevent water from passing, but the flow necessary to power a waterwheel seems to go straight though with a smile.
+
The simplest way to see if water is flowing is to watch for it to blink from ~ to ≈ while the game is not paused. Water blinking between ~ and ≈ is flowing, and tiles which flash white indicate the direction in which it is flowing (as they splash against the wall). If you see numbers instead you may want to set SHOW_FLOW_AMOUNTS to NO in your [[init.txt]] file. Alternatively, you can just build a [[water wheel]] and see if it turns, which again is indicated by blinking.
  
:Water that is not directly from a brook or river is much more difficult to satisfy a waterwheel with. Water that is not directly connected to a river or brook has no natural flow. This can be because you used a diagonal baffle to eliminate the pressure so you can safely take the water down to your fortress, or it can be because you pumped the water in, or it can be because you took the water from a murky pool. In any event, your water doesn't have any natural flow. Generating flow with a screw pump to satisfy a water wheel is a lot more picky. Here if all three tiles under the waterwheel are the same level i.e. 4/7 then chances are your waterwheel just stopped. On the other hand it does not seem to matter if one of those three tiles is 0/7 as long as at least one of the tiles under it are 4/7 or higher.
+
It is important to understand with flow that there are two very different things going on at the same time. The first is natural flow from a [[river]] or [[brook]] which traces a path to every tile directly connected to a natural source and sets it to be constantly flowing.
  
:Also, I find that hooking up waterwheels in series (i.e. a 1x6, 1x9 . . . ) will not generate extra power, but might prove useful to more reliably catch that elusive flow in a branch of water being pushed around only by a screw pump. If they are all hooked up together with gears and axles they will all turn together as long as any one of the wheels finds flow. While this wastes 10 power for every extra wheel you use in this manner, it can be a real useful problem solving trick for keeping your underground machinery working reliably. I personally find it ironic, since an active water pump pushed water around much faster than any river, but since the water is not sourced flow is assumed to be zero unless there is an obvious difference in the water levels.
+
The second is how all fluid mechanics in Dwarf Fortress is handled (including natural flow). In this case any time a unit of water moves from one tile to another, it sets both tiles to be flowing for a short period of time. For a good explanation of how this works you should look at [http://www.bay12games.com/forum/index.php?topic=32453.0 technical explanation by Kanddak] from the Bay12 Forum.
  
*Sourced water (river, brook, spring) behaves differently than unsourced water for powering a waterwheel.  
+
__TOC__
*Dead ends don't seem to be a problem with water flow from sourced water.
+
===Natural flow===
*Floodgates do not seem to stop flow from sourced water. Bug?
+
[[River|Rivers]] and [[Brook|brooks]] always have flow which overrides the normal rules to determine if water is flowing. Brooks require that you channel down through the surface to place a wheel, but the flow is there. With natural flow every single tile of a body of water will be constantly flowing even if it is unable to move. The test for whether a tile of water has natural flow occurs very infrequently, perhaps as rarely as once or twice a game season.
*Unsourced water is more difficult to show flow in. More testing needed.
+
 
 +
====Channeling from a Natural Source====
 +
Channeling out new area from a flowing river or brook does generate flowing water at the same [[Z-level]]. It is worth mentioning that when this channel is first connected it is quite likely that you will see it fill fully to 7/7 and stop flowing for a period of time. After some time passes (a season or so) the channel will suddenly start flowing like a natural source. The shape of this channel does not really matter. Natural sources of water will flow quite happily in a dead end on the far end of the map. Another oddity with natural flow is that a closed floodgate will not stop the flow. Diagonals also have no real effect on water flow although they do have use as a means for controlling [[Water_pressure#Diagonal_Flow|water pressure]]. Moving naturally flowing water to a different z-level has somewhat unpredictable effects. More research is needed.
 +
 
 +
====Natural water and a floodgate====
 +
This is a common case of natural flowing water doing weird things, in this case natural flowing water continues to flow despite it being isolated by a floodgate.  
 +
 
 +
    ≈  Natural flowing water as from a [[River]] or [[Brook]]
 +
    ~  non-flowing water
 +
    X  Floodgate
 +
    ▒  Solid Ground
 +
    %% Screw Pump
 +
 
 +
    ≈≈≈X≈≈≈▒▒
 +
    ▒▒▒▒▒▒▒▒▒
 +
 
 +
====Taking a natural source uphill with a screw pump====
 +
This is an example of natural flowing water doing weird stuff. With a screw pump you can pull water directly from a river, or at least from a channel connected directly to a river and generate a naturally flowing pool at one level above the river in defiance of all logic. Left alone as is this pool will continue to flow forever on every single tile. This could be used as a cheaty way to power a [[water_wheel|waterwheel]]. Covering this strange pool with another layer of water may break this effect.
 +
 
 +
 
 +
        %%≈≈≈▒
 +
    ≈≈≈▒▒▒▒▒▒
 +
 
 +
====Natural flowing water and pump stacks====
 +
Using a pump stack to pull water up from a river to a higher level yields normal water which no longer has that special natural flowing state. Once the water is taken up to a higher level like this it must be treated as still water and can only be made to flow by artificial means.
 +
 
 +
        <nowiki>▒ %%~~~~~~</nowiki>
 +
        ▒~%% ▒
 +
        ▒▒%%≈▒
 +
    ≈≈≈≈≈▒▒▒▒
 +
 
 +
        <nowiki>▒ %%~~~~~~</nowiki>
 +
        ▒~~%% ▒
 +
        ▒▒%%≈≈▒
 +
    ≈≈≈≈≈▒▒▒▒▒
 +
 
 +
===Water in Motion===
 +
This is the accepted rules for how all water moves in Dwarf Fortress. Natural water also follows this rules, but because of its own special case rule natural water is always flowing anyhow. Credit does have to go to [http://www.bay12games.com/forum/index.php?topic=32453.0 Kanddak] from the bay 12 forums for some of this information.
 +
 
 +
As every frame passes in dwarf fortress it is checking every single tile of fluid greater than a depth of 1/7 to determine how this fluid will move. This moves mostly in a manner you might expect preferring to move down first, then to the side, then up. When water is given a choice of two or more equal places to move into it will choose one completely at random. Any time water moves, it generates flow in the tile it moves from And also in the tile it moves too. This flow remains for a short period of time.
 +
 
 +
    1 -- try to move down
 +
    2 -- try to move to the side
 +
    3 -- try to move up (if under pressure)
 +
 
 +
====Water Teleportation====
 +
This is where fluid mechanics in Dwarf fortress get tricky. At each step of the way (down/side/up) water also has the potential to teleport to a distant tile. When water teleports any tiles it skips over are ignored for the purposes of creating flow. Here is an example of how this might work with water being pushed down a hall from a screw pump.
 +
 
 +
    1-7  Water Level
 +
    ≈  Natural flowing water as from a [[River]] or [[Brook]]
 +
    ~  non-flowing water
 +
    .   Open Space
 +
    X    Floodgate
 +
    ▒    Solid Ground
 +
    %%  Screw Pump
 +
 
 +
    ...%%777777777753..
 +
    742▒▒▒▒▒▒▒▒▒▒▒▒▒▒..   
 +
    ▒▒▒▒▒         
 +
 
 +
    <nowiki>...%%~~~~~~~~~~≈~..</nowiki>
 +
    <nowiki>~~.▒▒▒▒▒▒▒▒▒▒▒▒▒▒..</nowiki>
 +
    ▒▒▒▒▒         
 +
 
 +
   
 +
With a screw pump it will try to move every single unit of water from the source tile every frame. In this case it is moving 2/7 water. The obvious place to move it is directly to the output tile. However this is at 7/7 and cannot be filled. So the water traces a path forward until it finds the five. Once it does so it puts the 2/7 into the five making it 7/7 and in doing so generates flow both on the tile the 2/7 comes from, and on the 5/7 that it moved into. However the 2/7 was also removed and a 0/7 has no observable flow. The net result of all this is that one tile will now be blinking with flow.
 +
 
 +
At each frame, a similar test is done against every single tile of water in the game, each of them trying to move down, to the side, and then up. At each step if it fails to move in the desired direction it will then check to see if it can teleport to a distant tile instead. {{Verify}}
 +
 
 +
====Creating permanent artificial flow====
 +
Artificial flow can be generated either by draining from one level to another, or with [[Screw pump|pumps]]. Because a waterwheel generates 100 power and a screw pump only costs 10, it's quite possible to create a [[Water_wheel#Perpetual_motion|perpetual motion machine]].
 +
 
 +
===Accidental flow in Aquifers===
 +
Rarely, when channeling into a level with an [[aquifer]] with no adjacent pre-existing channels or water-ways, a single tile of flowing water will be created, enough to power a water wheel.  This flow continues even when surrounding tiles are channeled out. With current understanding, this is not predictable or controllable - if it happens, it happens. 
 +
 
 +
''(It is theorized that the water that initially flows in to fill that channeled tile somehow gets "stuck" in the flowing state.  This is only a theory.)''
 +
 
 +
{{Category|World}}
 +
{{Category|Physics}}

Latest revision as of 10:53, 18 May 2015

This article is about an older version of DF.

Water flow is an informal term used occasionally by players to denote the ability of specific water tiles to power a water wheel. The direction of the flow does matter for purposes of powering a wheel, though most of the time it's diagonal and thus doesn't matter.

While there obviously is a game feature at work, the mechanics are not completely understood at present. It's a bit of a black box - we know some of what happens, what will work and what won't, but not always why.

The simplest way to see if water is flowing is to watch for it to blink from ~ to ≈ while the game is not paused. Water blinking between ~ and ≈ is flowing, and tiles which flash white indicate the direction in which it is flowing (as they splash against the wall). If you see numbers instead you may want to set SHOW_FLOW_AMOUNTS to NO in your init.txt file. Alternatively, you can just build a water wheel and see if it turns, which again is indicated by blinking.

It is important to understand with flow that there are two very different things going on at the same time. The first is natural flow from a river or brook which traces a path to every tile directly connected to a natural source and sets it to be constantly flowing.

The second is how all fluid mechanics in Dwarf Fortress is handled (including natural flow). In this case any time a unit of water moves from one tile to another, it sets both tiles to be flowing for a short period of time. For a good explanation of how this works you should look at technical explanation by Kanddak from the Bay12 Forum.

Natural flow[edit]

Rivers and brooks always have flow which overrides the normal rules to determine if water is flowing. Brooks require that you channel down through the surface to place a wheel, but the flow is there. With natural flow every single tile of a body of water will be constantly flowing even if it is unable to move. The test for whether a tile of water has natural flow occurs very infrequently, perhaps as rarely as once or twice a game season.

Channeling from a Natural Source[edit]

Channeling out new area from a flowing river or brook does generate flowing water at the same Z-level. It is worth mentioning that when this channel is first connected it is quite likely that you will see it fill fully to 7/7 and stop flowing for a period of time. After some time passes (a season or so) the channel will suddenly start flowing like a natural source. The shape of this channel does not really matter. Natural sources of water will flow quite happily in a dead end on the far end of the map. Another oddity with natural flow is that a closed floodgate will not stop the flow. Diagonals also have no real effect on water flow although they do have use as a means for controlling water pressure. Moving naturally flowing water to a different z-level has somewhat unpredictable effects. More research is needed.

Natural water and a floodgate[edit]

This is a common case of natural flowing water doing weird things, in this case natural flowing water continues to flow despite it being isolated by a floodgate.

    ≈  Natural flowing water as from a River or Brook
    ~  non-flowing water
    X  Floodgate
    ▒  Solid Ground
    %% Screw Pump
    ≈≈≈X≈≈≈▒▒
    ▒▒▒▒▒▒▒▒▒

Taking a natural source uphill with a screw pump[edit]

This is an example of natural flowing water doing weird stuff. With a screw pump you can pull water directly from a river, or at least from a channel connected directly to a river and generate a naturally flowing pool at one level above the river in defiance of all logic. Left alone as is this pool will continue to flow forever on every single tile. This could be used as a cheaty way to power a waterwheel. Covering this strange pool with another layer of water may break this effect.


       %%≈≈≈▒
    ≈≈≈▒▒▒▒▒▒

Natural flowing water and pump stacks[edit]

Using a pump stack to pull water up from a river to a higher level yields normal water which no longer has that special natural flowing state. Once the water is taken up to a higher level like this it must be treated as still water and can only be made to flow by artificial means.

       ▒ %%~~~~~~
       ▒~%% ▒
       ▒▒%%≈▒
    ≈≈≈≈≈▒▒▒▒
       ▒ %%~~~~~~
       ▒~~%% ▒
       ▒▒%%≈≈▒
    ≈≈≈≈≈▒▒▒▒▒

Water in Motion[edit]

This is the accepted rules for how all water moves in Dwarf Fortress. Natural water also follows this rules, but because of its own special case rule natural water is always flowing anyhow. Credit does have to go to Kanddak from the bay 12 forums for some of this information.

As every frame passes in dwarf fortress it is checking every single tile of fluid greater than a depth of 1/7 to determine how this fluid will move. This moves mostly in a manner you might expect preferring to move down first, then to the side, then up. When water is given a choice of two or more equal places to move into it will choose one completely at random. Any time water moves, it generates flow in the tile it moves from And also in the tile it moves too. This flow remains for a short period of time.

    1 -- try to move down
    2 -- try to move to the side
    3 -- try to move up (if under pressure)

Water Teleportation[edit]

This is where fluid mechanics in Dwarf fortress get tricky. At each step of the way (down/side/up) water also has the potential to teleport to a distant tile. When water teleports any tiles it skips over are ignored for the purposes of creating flow. Here is an example of how this might work with water being pushed down a hall from a screw pump.

    1-7  Water Level
    ≈  Natural flowing water as from a River or Brook
    ~  non-flowing water
    .    Open Space
    X    Floodgate
    ▒    Solid Ground
    %%   Screw Pump
    ...%%777777777753..
    742▒▒▒▒▒▒▒▒▒▒▒▒▒▒..     
    ▒▒▒▒▒           
    ...%%~~~~~~~~~~≈~..
    ~~.▒▒▒▒▒▒▒▒▒▒▒▒▒▒..
    ▒▒▒▒▒           


With a screw pump it will try to move every single unit of water from the source tile every frame. In this case it is moving 2/7 water. The obvious place to move it is directly to the output tile. However this is at 7/7 and cannot be filled. So the water traces a path forward until it finds the five. Once it does so it puts the 2/7 into the five making it 7/7 and in doing so generates flow both on the tile the 2/7 comes from, and on the 5/7 that it moved into. However the 2/7 was also removed and a 0/7 has no observable flow. The net result of all this is that one tile will now be blinking with flow.

At each frame, a similar test is done against every single tile of water in the game, each of them trying to move down, to the side, and then up. At each step if it fails to move in the desired direction it will then check to see if it can teleport to a distant tile instead. [Verify]

Creating permanent artificial flow[edit]

Artificial flow can be generated either by draining from one level to another, or with pumps. Because a waterwheel generates 100 power and a screw pump only costs 10, it's quite possible to create a perpetual motion machine.

Accidental flow in Aquifers[edit]

Rarely, when channeling into a level with an aquifer with no adjacent pre-existing channels or water-ways, a single tile of flowing water will be created, enough to power a water wheel. This flow continues even when surrounding tiles are channeled out. With current understanding, this is not predictable or controllable - if it happens, it happens.

(It is theorized that the water that initially flows in to fill that channeled tile somehow gets "stuck" in the flowing state. This is only a theory.)