Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Some fluid dynamics questions  (Read 3814 times)

TSTwizby

  • Bay Watcher
    • View Profile
Some fluid dynamics questions
« on: March 07, 2012, 09:03:46 pm »

Below I will be referring to both water and magma. If I don't want to make a distinction, I will just say 'liquid' or 'fluid'.

I know there are a couple threads on the subject floating around, but most of the ones I've seen are either horribly out of date or else self contradictory. I've done a few experiments myself, but I wanted to know what if anything people have figured out how to do, and whether or not I'm wrong about anything.

First, can liquids evaporate while falling?
It's easy to see that liquid, unlike walls, falls at a fairly slow rate, often taking several ticks to drop a z-level. I am fairly certain that liquid does not spread out while falling, and that all water in a tile will fall at the same rate (that is, you never see a 7 turning into a 3 and a 4 on the z-level below) and thus, if it lands in a pool of its opposite (magma into water or vice versa) it forms exactly one block of obsidian, replacing the magma and water which were there before.

Second, is it possible to use pumps to form blocks of obsidian?
I'm pretty sure the answer to this is no, but I want to see if other people have had different experience from me. I tried setting up a pump that took water and pumped it directly into a magma reservoir, in the hopes of forming a plug directly in front of the pump. This just resulted in a lot of steam and seemed to drain both the magma and the water.

Third, is there any way to find exactly how much liquid will be pumped in a given amount of time?
Specifically, assuming that you have a huge reservoir of liquid with a pump at the bottom of it filling directly into a smaller reservoir, probably several z-levels below, can you say that (provided you are filling the reservoir enough to avoid any evaporation) the reservoir will be exactly filled to the 4/7 mark, or something like that? Tied into this are two smaller questions, which are the first question I asked and 'is there any minimum amount of time which must take place before there is any chance of liquid evaporating?'

Also, there are a few things which I'm pretty sure are true, but about which I may be mistaken.

First, liquid cannot spread in midair. Speaks for itself.

Second, if water falls into magma (or vice versa) as a single block, then it will form a single block of obsidian, whereas if it falls off of a ledge it will fall 1/7 at a time and potentially form several blocks placed unpredictably around the first block, as water falls onto the newly formed obsidian and then pours off to the side.

Third, and this is the weirdest one. If water is dropped onto magma from any height of at least one z-level, while the magma is on the ground, then obsidian will form. If water is pushed directly into magma, from a pump or just plain from flowing under some circumstances which I haven't quite figured out, then there is steam and no obsidian, though the magma and water vanish. If water and magma are both falling, presumably from any heights reasonably close together, (tested for differences of up to five z-levels) there is steam but no obsidian, and some of the magma is used up while the rest spreads out.

Some of the above behavior is documented in the wiki and in other places, but I couldn't find any explanation for some of the other stuff I saw and I could find no clear answer to any of my questions. If there is some kind of liquid megathread that I passed over, please let me know and I apologize for not searching more thoroughly.


In case you're wondering, I'm trying to make a large scale precision automatic casting apparatus, and am having problems in getting magma/water to fall in a straight line without spilling and making extra obsidian. My most recent plan is to build a set of bridges and hatches to control where magma gets to fall into the water, but it's stupidly hard to prevent too much magma from spilling through the hatches after you open them. Any advice, related or unrelated to the fluid dynamics aspects of the project, would be appreciated.
Logged
I got a female and male dragon on my embark. I got cagetraps on the exits but im struggling to find a way to make them path into it.
Live bait.
3 dwarfs out of 7 dead so far

NecroRebel

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #1 on: March 07, 2012, 09:23:50 pm »

Liquids that are in 1/7-depth blobs can evaporate when falling. Liquids don't spread when falling unless they attempt to fall into a space that's already full of the same type of fluid. This actually can happen when both the lower and higher blobs are falling; each tile of liquid falls at a different time. If you're dropping a single-z-thick area of liquid, though, it will usually just fall straight down.

I think that if a water pump and magma pump pump into the same tile at the same time that obsidian can form there, but I could be wrong. Usually people who try to make automatic obsidian-drop systems put the actual drop out a tile or two from the pump, but that's more so the walls and floors around the pump don't support the obsidian.

For every step that there is at least 2/7 liquid in a pump's intake, all of the liquid in that tile will move to the pump's output. If you've got 7/7 depth liquid in the intake, the output will never be at 1 through 6 depth; it will be at 0, then 7, instantly. Magma and water fall at the same rate, but when water attempts to fall through water it teleports to the nearest open space it can, so water in the situation you described would be pumped vastly faster than magma in the same situation, but both would be irregular due to the irregular falling speed of liquids.

I'm pretty sure that liquids can evaporate in the first tick after they're at 1/7 depth, but it's pretty improbable.
Logged
A Better Magma Pump Stack: For all your high-FPS surface-level magma installation needs!

Nil Eyeglazed

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #2 on: March 07, 2012, 10:04:53 pm »

This film demonstrates an obsidian cave-in generator.  In order to form the cave-in, it's necessary that obsidian is forming in air, although it may be possible that obsidian is treated differently just BEFORE it begins to fall, ie, in the tile adjacent to the bridges in that movie.  People have reported pump-formed blocks of obsidian, but while I believe them, I retain a little bit of skepticism in the absence of personal experience or a movie.

NecroR's right, to the extent that I know, and the implications of what NecroR is saying indicate that to eliminate any possibility of evaporation, it is necessary to pump full stacks of fluid (7/7) into an area 3 tiles at most.  That prevents any tile from ever having a single unit of fluid on it.  Note that 1/7 fluids will evaporate even if they're sitting on 7/7 fluid, so there is no way to eliminate the risk of evaporation from pumping into a 3-tile wide pit, as you will eventually create 1/7 on top of the existing fluid.  However, if you can guarantee a 7/7 source, perhaps with pressure-based-teleportation, you can pump into a 1-tile pit without risk of evaporation.

For an automated casting apparatus, I would recommend a large bridge that dumps, at most, a single z-level of water, onto a magma plain containing at most a single z-level of magma.  By limiting the z-level of the water, you guarantee that only a single stack of water hits any given stack of magma, protecting against runaway spillage.  Doing this means measuring your water, probably with pressure plates, and using that to regulate your pumps, rather than running a pump non-stop.
Logged
He he he.  Yeah, it almost looks done...  alas...  those who are in your teens, hold on until your twenties...  those in your twenties, your thirties...  others, cling to life as you are able...<P>It should be pretty fun though.

TSTwizby

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #3 on: March 08, 2012, 12:44:23 am »

Thank you for your answers and advice, though I think you misunderstand what I am trying to do. If at all possible, I want to be able to choose any particular group of tiles (within some area) and cast obsidian only on those particular tiles. So I could, for example, by setting up my levers/floodgates/whatever right, make a

Code: [Select]
++#
+#+
+#+
(not quite sure what to use for walls, so using #)

or a

Code: [Select]
#+#
##+
+++

just by flipping around levers and stuff. It's simple to do in theory, but in practice the only workable methods I've come up with have the danger of either evaporation (basically cover an area with 1/7 deep magma and drop it where you want it) or too much magma falling and spilling where I don't want it (same, but with 2/7 deep magma. The problem is that the magma over the holes which aren't being opened will flow after the magma which is being dropped, and then spread once it lands on the newly cast obsidian, causing chaos). If I can't think of anything else then evaporation is probably the risk to take, as you can minimize that without too much difficulty (have 3/7 reservoirs next to the hole through which you drop the magma; arranging these tiny reservoirs is tricky, but doable for any given nxn rectangle) whereas the potential for spilling in the other case is very unpredictable. The downside to this method is that it takes much more work to design and doesn't allow you to easily handle the corners of the rectangle without taking up huge amounts of space, which pumps could fix at the cost of being ugly. In this case, the tricky part comes from making the reservoirs fill to exactly 3/7. Since magma doesn't seem to flow at a constant rate, maybe the only way to do this is to dump 3 7/7 of magma into a 7-tile reservoir?

Something like this, with magma falling onto the x (pressure plate), the left X (floodgate) used to seal off the 3/7 magma over the pressure plate and the right X (floodgate) used to let 1/7 of magma fall over the . (open space)

Code: [Select]
########
#+++XxX.
#++#####
########

Sorry, I'm kind of rambling a bit.
Logged
I got a female and male dragon on my embark. I got cagetraps on the exits but im struggling to find a way to make them path into it.
Live bait.
3 dwarfs out of 7 dead so far

Nil Eyeglazed

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #4 on: March 08, 2012, 01:06:56 am »

Like an LCD screen with cast obsidian?  Sounds interesting, and right at the border of possibility.

Let's see...  If you could manage to drop 1, and exactly 1, stack of either water or magma into a sea of the other magic ingredient, you could do this.  So the trick is to limit yourself to a single pump action, which should be possible, by limiting your supply to a single tile.

Let's consider first dousing the area in magma, then dropping water exactly where we want it.  The following structure will deposit exactly 1 (one) stack of water on the tile below it:

Code: [Select]

## %%
S+_##

side view, where S is an unpressurized water source, %% is a pump, + is a door

Here, you open the door in anticipation, let the water flow, close the door, then activate the pump.  Exactly one tile's worth (7/7) of water falls, creating a single obsidian tile, without any spillage.

One problem with this design is that the pumps themselves block off access to the ground, so you have to build them so that the innermost tiles receive water from the highest pumps.  Depending on your design, another problem may be that you have to first flood the drawing area with magma.  You could, of course, reverse it, using water on the drawing field and dropping magma.

Of course, this is untested, purely theoretical.
Logged
He he he.  Yeah, it almost looks done...  alas...  those who are in your teens, hold on until your twenties...  those in your twenties, your thirties...  others, cling to life as you are able...<P>It should be pretty fun though.

NecroRebel

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #5 on: March 08, 2012, 01:20:35 am »

That might be doable with the hanging-floodgates trick, assuming it still works. In the past, if you constructed a wall, built a building on top of the wall, then deconstructed the wall, the building wouldn't deconstruct, but would instead just sit there in open space. It only worked for buildings that didn't give support and wouldn't normally be built over open space IIRC, but you should be able to use it to open single tiles wherever you want. That assumes it still works, though I'd guess it does; I'm testing it now. Will report back.

Edit: Testing completed. I've got a door-building sitting on open space and surrounded by exactly 0 supporting structures on any side. The hanging-floodgates trick still works.
« Last Edit: March 08, 2012, 01:24:12 am by NecroRebel »
Logged
A Better Magma Pump Stack: For all your high-FPS surface-level magma installation needs!

Nil Eyeglazed

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #6 on: March 08, 2012, 01:26:17 am »

Oh right-- the walls on either side of the reservoir block off adjacent structures, and you can't get around it by building over or under.

This is actually a really interesting problem, I'll have to think on it a while.

EDIT: Oh wait, it still works, you just need to stagger the z-level.  You need 4 z levels of pumps and reservoirs to make a 2x2 drawing area.  You can manage a central square with a single tile retracting bridge on top, so 5 z levels to make a 3x3, 9 levels to make a 5x5, 13 levels to make a 7x7.  You couldn't do the whole map though-- your "pen" would always cast a shadow, plus you need a source somewhere.
« Last Edit: March 08, 2012, 01:39:31 am by Nil Eyeglazed »
Logged
He he he.  Yeah, it almost looks done...  alas...  those who are in your teens, hold on until your twenties...  those in your twenties, your thirties...  others, cling to life as you are able...<P>It should be pretty fun though.

TSTwizby

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #7 on: March 08, 2012, 01:38:23 am »

Nil Eyeglazed- I'm not sure exactly why that would be a problem. I don't really see why you need the door, since you would need to keep opening and closing it. Better to fill it from above, as I describe below. I may be misunderstanding you though.

The hanging floodgate trick would still have the same spilling problem I think. I can't believe I didn't think of the pump solution, it would almost certainly work though it would need to be very tall. And it would take absurd amounts of power. But power is relatively easy to set up. Pumps always put the water directly in front of their output, so no worries about it falling in the wrong place. I'm thinking of trying something like this:

Code: [Select]
z = 0
.####
.#+##
.####
.#+##

Code: [Select]
z = 1
.####
.+.%%
.####
.+.%%

Code: [Select]
z = 2
.##|#
.##*#
.##|#
===*#

<= to power

Code: [Select]
z = 3
.#+##
.####
.#+##
.####

Code: [Select]
z = 4
.+.%%
.####
.+.%%
.####

Code: [Select]
z = 5
.##*#
.##|#
===*#
.####

This should, I think, allow me to pick out any particular cells from the row, and refill the pumps by filling in the gap on the left and then redraining it and waiting a bit for evaporation to take care of the extra couple 1/7 puddles. By having more layers of these above and one square to the right, I could set up any rectangle I wanted.

In fact, if there's 1/7 above 7/7, doesn't that automatically try to move off of the liquid if possible? That would make it possible to automate the waiting process as well, I think, by placing some pressure plates next to the pumps.

For now, I'll try setting up a basic 2x2 space filling pump setup like above.
Logged
I got a female and male dragon on my embark. I got cagetraps on the exits but im struggling to find a way to make them path into it.
Live bait.
3 dwarfs out of 7 dead so far

NecroRebel

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #8 on: March 08, 2012, 01:42:51 am »

This is an interesting engineering problem, but I think I have a plan in mind.

I'm thinking a 6-level structure is required for this. The top four levels are composed entirely of hanging doors or floodgates, all magma-safe and linked to levers. The lowest level is where the obsidian settles. The second level from the bottom is open by necessity, else it would screw up the hanging floodgates. There would be water and magma pumps that lead to the top and third from the top levels. The floodgates on the second and fourth levels from the top would be linked to the same lever as the one in the same vertical line as them.

To operate the device, you would pull levers to make paths from the pumps to the point you wanted the obsidian cast on the pumps' levels, then let those points fill before closing all but the gates on the points themselves. In this way, you would get exactly one tile of water and exactly one tile of magma in the same vertical line, both completely cut off from further fluid sources. You would then pull the lever that opened the floodgates below the fluids, allowing the fluids to fall, and if all goes well they should meet and harden before they spread at all and without inadvertently destroying any of the floodgates, which would be a bitch to set up again.

...I realize that that might not be the best explanation. I've got the layout all set in my head and could probably build it, but my current fort isn't really practical for it, even for a trial system (no ready water source :-\).
Logged
A Better Magma Pump Stack: For all your high-FPS surface-level magma installation needs!

TSTwizby

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #9 on: March 08, 2012, 01:51:46 am »

I'm not sure what you're suggesting exactly. It sounds like what I'm trying, only with a bunch of hanging hatches added.

I've got an extra DF folder where I've modified everything to be as easy to experiment with as possible (all abilities instantly maxed, speed set stupidly high, no need to eat/sleep/breath/get sick/etc, most dangerous things erased, some convenient custom reactions...) and a couple backup worlds with convenient combinations of volcano/aquifer/ice/river/etc. It took like seven hours to set up, but it was worth it.
Logged
I got a female and male dragon on my embark. I got cagetraps on the exits but im struggling to find a way to make them path into it.
Live bait.
3 dwarfs out of 7 dead so far

Nil Eyeglazed

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #10 on: March 08, 2012, 01:57:30 am »

Sorry Twiz, you might want to check out the edit I made, wasn't thinking straight :)  Your design is what I was thinking, except that you need to source the fluid someway such that you don't end up with 2 tiles worth.  You can do that with unpressurized fluid blocked by a door, or you could do it with a feeder pump that you turn off before activating your drawing pump.

If you can do the hanging floodgate trick, then I think NecroR's onto a much better solution, although he's setting up both the magma and the water at the same time.  If you flood your field with one fluid, you can do it more simply.

Code: [Select]

bbb
XXX
XXX

side view: b is retracting bridge, X is hanging floodgate

Here's the algorithm:

1) Flood top level with magma.

2) Close all floodgates except floodgates ON THE MIDDLE LEVEL that you want to draw with.

4) Retract top bridge and wait a few ticks for the fluid to drop into the open spaces.

5) Close top bridge, blocking access to the fluid

6) Open the bottom level of floodgates.  You don't have to worry about which ones you open, so I bet there's room for optimization on this level.

7) Exactly one tile of fluid drops from the structure, where you want it to drop.

Any problems with that?
Logged
He he he.  Yeah, it almost looks done...  alas...  those who are in your teens, hold on until your twenties...  those in your twenties, your thirties...  others, cling to life as you are able...<P>It should be pretty fun though.

NecroRebel

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #11 on: March 08, 2012, 02:38:48 am »

Nil seems to have understood my intent, though his refinement of my idea is vastly more efficient. I had thought that you wanted the place you were making obsidian to be dry, so that's why I suggested it the way I did. Basically, the advantage is that you get arbitrarily-placed pockets of fluid in an arbitrarily-large field without needing as much power or as many z-levels as your pump-using design would. My original suggestion basically had the ducts' positions be completely malleable with lever pulls and using those movable ducts to place fluids where you wanted them, and then using that same malleability to shut the ducts off entirely. There's no spilling problem because when it's dropped the fluid is a single tile, totally isolated from the source and with no tiles to for the fluid to fill from further or empty into until the lever is pulled to drop it, at which point it has nowhere to go but down.
Logged
A Better Magma Pump Stack: For all your high-FPS surface-level magma installation needs!

TSTwizby

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #12 on: March 08, 2012, 04:23:15 am »

Alright, I just tested my basic design, and it worked perfectly, though it was a pain to set up. Once I have more time I'll try Nil's method, if I can figure out what it is exactly. I hadn't realised you could make floating doors? So they'd alternate between being open space and a wall or between being a floor and a wall? I don't really like the exploit involved, but it seems like all that that's doing is making the basic idea (using pumps to direct the flow) more efficient.
Logged
I got a female and male dragon on my embark. I got cagetraps on the exits but im struggling to find a way to make them path into it.
Live bait.
3 dwarfs out of 7 dead so far

Nil Eyeglazed

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #13 on: March 08, 2012, 04:32:16 am »

I just tested the floating floodgate thing-- turns out they hang just fine.  (Not totally sure about doors, but floodgates would work fine.)

Yeah, the point is to use floodgates (or doors) to alternate between being open space and being a wall, so that you can constrain your fluid to a single tile.

I'm excited to see what you make-- it sounds pretty cool.  You could do crazy things like set up a randomly generated obsidian maze.
Logged
He he he.  Yeah, it almost looks done...  alas...  those who are in your teens, hold on until your twenties...  those in your twenties, your thirties...  others, cling to life as you are able...<P>It should be pretty fun though.

TSTwizby

  • Bay Watcher
    • View Profile
Re: Some fluid dynamics questions
« Reply #14 on: March 08, 2012, 04:52:04 am »

Random numbers is somewhat tricky. It's hard to find things that aren't biased. Once I get a better idea of exactly what I'm doing, I intend to hook this thing up to a computer of some kind and automate the whole thing, so all I need to do is set the shape I want and then hit the big lever. Also, its very simple to get this to work over multiple z-levels, though figuring out exactly what you'll make is harder. So basically, I'm aiming for a generic 3-D obsidian shape generator.

My next step is to build the system you're describing, to make sure I understand how its supposed to work, and then decide the exact system I'm going to use (depends mainly on how much power/mechanisms they each use. Power is easy, the map I'm on is kind of low on magma safe rock. Though of course I can always just make a new world). Then I'll build the computer, do the whole planning/diagramming thing to make sure I know what I'm doing, build the thing and hook them up. It's too bad you can't somehow cast obsidian ramps, or else things would get really interesting.
Logged
I got a female and male dragon on my embark. I got cagetraps on the exits but im struggling to find a way to make them path into it.
Live bait.
3 dwarfs out of 7 dead so far
Pages: [1] 2