Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Technical question: How does DF determine aquifers and aquifer depth?  (Read 1518 times)

PatrikLundell

  • Bay Watcher
    • View Profile

DF provides an aquifer indicator pre embark, which indicates DF "knows" where aquifers should appear without actually generating the embark. Is it known what criteria DF uses to determine this?
The follow on question is how DF determines at which depth to place an aquifer. The bottom is obviously determined by "just" flooding the volume below the top of the aquifer to wherever the aquifer can propagate to an aquifer supporting layer (stopping at biome boundaries), but what about the top? Material properties specify whether the material supports an aquifer, so the flood filling part is just an application of the aquifer to to the geo biome makeup.
And can the aquifer reach the very top, so that any digging into the ground results in hitting the aquifer (I've heard rumors that it can happen in swamps, but have never seen it)?
Summary:
1. How does DF determine at which locations to place aquifers?
2. How does DF determine at which level below ground the aquifer starts?
3. Can an aquifer start at the very top soil level?
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile

You probably already know everything in this post, but jsyk/for completeness...

Aquifers on flat ground, I've noticed, tend to start on third soil wall layer, barring clay being in the way (don't recall off the top of my head if you can still get stone aquifer then, but I'd guess yes) - I always assume first 2z is safe, and I suspect it is a limit to provide you some digging room.

Having the  embark z-1 (or higher) area be an aquifer is something I've seen happen with uneven terrain; where the aquifer biome geolayer is sheared to be part of it.

They're also reduced with elevation, as you've posted.

PatrikLundell

  • Bay Watcher
    • View Profile

I've certainly seen aquifers at both the third and fourth soil level, and I think I've seen it at the second as well, and I almost always embark on flat ground. However, if the aquifer level is fixed relative to the nominal geo biome soil level, you ought to get top level aquifers, and given that the maximum soil depth is 10 at the sea level, that should result in rampant top level aquifers, so it's not a simple case of just shearing off the top, as that isn't happening.
Logged

lethosor

  • Bay Watcher
    • View Profile

DF doesn't necessarily know where aquifers will be before you embark. It does know what layers there are, and whether they support aquifers, so it'll indicate that on the world map, then generate them when you embark. (It should use a consistent seed to determine where aquifers end up, so if you kill DF and re-embark in the same place, the aquifers should be in the same place.)
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

PatrikLundell

  • Bay Watcher
    • View Profile

It may be as you say lethosor, that it's RNG:ed based on seeds. If so, we're out of luck trying to determine it beforehand. However, DF does mark many places as NOT having aquifers despite these places having sufficient soil for normal depth aquifers to form, so I suspect there's something else involved either before the seed based RNG kicking in or making an RNG determination needless. However, the fact that there are reports of aquifers where there shouldn't be and no aquifers where they should be present points towards an RNG determination (unless these reports are based on reports from geo biomes within the embark different from the one(s) used by DF for its pre embark report).
Logged

Sanctume

  • Bay Watcher
    • View Profile

A recent embark in Pale has an aquifer z-1 (or was is z-2) of my usual dry moat.  Quite unusual.

lethosor

  • Bay Watcher
    • View Profile

However, DF does mark many places as NOT having aquifers despite these places having sufficient soil for normal depth aquifers to form
Is it a type of soil that supports aquifers? Not all soil types do.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

PatrikLundell

  • Bay Watcher
    • View Profile

However, DF does mark many places as NOT having aquifers despite these places having sufficient soil for normal depth aquifers to form
Is it a type of soil that supports aquifers? Not all soil types do.
True. Clay doesn't, but it seems as if there are too many non aquifer areas for that to be the reason. I guess it's time to write a script to make a comparison. I'll report back when done.
Logged

lethosor

  • Bay Watcher
    • View Profile

It's determined by the [AQUIFER] tag in the raws.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

PatrikLundell

  • Bay Watcher
    • View Profile

Yes, I know where the aquifer material property support comes from. The future script would attempt to scan the world and compare DF's aquifer indicator with the geo biomes' contents to locate potential places that ought to support an aquifer but doesn't according to DF's prediction (provided I can get at that prediction, but I think I can). It would also have to take the elevation effect on soil depth into consideration.

Edit: I failed at creating a script since I couldn't get hold of the aquifer flag from DF reliably. However, eyeballing it indicates it's just a matter of soil depth being at least "deep", which seems to be a thickness of 3. I failed to find any case of deep or very deep soil without an aquifer indication. Hacking the geo biome of a 4 soil layer deep potential embark did not cause DF to remove the aquifer indicator, so it might not even take clay into account (or it may have cached the results, so the changes weren't registered).
« Last Edit: July 21, 2017, 06:19:54 am by PatrikLundell »
Logged

gchristopher

  • Bay Watcher
    • View Profile
Re: Technical question: How does DF determine aquifers and aquifer depth?
« Reply #10 on: July 22, 2017, 02:49:25 pm »

This is a good question. I've done some playing with it and the elevation values in the embark tiles seem to play a role, (higher elevation = higher aquifer top z-level), but the actual aquifer boundaries tend to be rectangular instead of aligned with the fuzzy borders of the sub-biomes in an embark.

I think I was able to get weird aquifer - rock - aquifer vertical striations by changing the embark geology to put an aquifer-supporting sedimentary layer underneath a layer of other rock, so you could have a soil aquifer, some dry rock z-levels, and then a second sedimentary layer aquifer with the usual non-aquifer mineral deposits. It's been a while so I'm not sure anymore.

I'd be really interested if you can find something explaining why aquifers tend to have rectangular boundaries inside an embark!
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Technical question: How does DF determine aquifers and aquifer depth?
« Reply #11 on: July 22, 2017, 04:34:44 pm »

Interesting observation that the aquifer boundary tends to be higher at higher elevation. I guess that is something that might warrant some additional investigation.

Hm, my experience is that aquifers follow the biome boundaries, rather than tile boundaries?

Interesting results with the dual aquifer. It might be investigated as well.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Technical question: How does DF determine aquifers and aquifer depth?
« Reply #12 on: July 22, 2017, 06:27:33 pm »

I've seen both block and biome boundaries, even on same contiguous area. I find the biome one more common, but ymmv.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Technical question: How does DF determine aquifers and aquifer depth?
« Reply #13 on: July 23, 2017, 04:40:07 am »

I've done some elevation related aquifer investigations, but I haven't found aquifers shallower than the 3:rd level (not claiming it doesn't happen: only that I didn't encounter it). However, I've also found DF lying about aquifer presence (claiming they're there when they're not) in the pre embark info, as reported here http://www.bay12games.com/dwarves/mantisbt/view.php?id=10268.

The presence of both biome and line aquifer boundaries is interesting. It might be of interest to examine a couple of cases of line boundaries to come up with a theory for when and where they occur (and also to provide info for a bug report, as it's probably not intended).

It would also be interesting to examine some cases of shallow (i.e. in the top two ground levels) aquifers and presence of aquifers where DF claimed there were none (i.e. where aquifers appear in the main embark biomes, not the cases where nearby "imported" biomes presence also brings aquifers with them).

Edit:
Further investigations: I've tried to find some logic for when aquifer supporting layers will contain aquifers and when they do not. What I've seen so far is that Conglomerate gets aquifers as long as it's deep enough (i.e. 3 levels below the surface or lower). I've tried shielding it with thick layers of basalt (more than 10), burying it deep in the ground (30 levels or so), and I've tried interleaving shale and conglomerate in both single and double level thicknesss, and all the conglomerate gets aquifers everywhere.
I haven't tried mountains, only various kinds of normal terrain at max elevation (149) and min elevation (100).
« Last Edit: August 01, 2017, 03:29:22 am by PatrikLundell »
Logged