Jump to content

ONIversity: Hydrodynamics - High Mass Single Bead Liquid Expansion - Part 1

Recommended Posts

I can summarize this entire post with an animated GIF. We will predict this.


When a high mass single bead lies on insulated insulation, where does the liquid go after 1 tick (0.2s) of the game. In this post we’ll learn to perfectly predict the shape, and masses of each cell, when a single high pressure bead is placed on an insulated insulation tile. Of course, I'll provide a spreadsheet to do all this for you, at the end. The end goal is to completely predict liquid flow in all situations in the game. Focusing on a single bead is the start. 

Needed Variables

Liquids have the following variables: 

  • Mass (m) - the starting mass
  • Max Mass (MM) - Water MM=1000 
  • Max Compression (C) - All liquids have C=1.01
  • Viscosity (V) - Water V=125
  • Min Horizontal Flow (MHF) - Water MHF=0.01.  (This is used in low pressure settings)
  • Min Vertical Flow (MVF) - Water MVF=0.01. (This will not be used - it is used when liquids send mass downwards, but not in upwards expansion.)

For the initial discussion, we’ll ignore ViscoGel (the only liquid with MHF>V), and then discuss the modification to the computations needed because of this interesting quirk. 

The Computations 

With each configuration, we now give and upper and lower bound on the starting mass needed to create the given configuration, with the appropriate “<“or “<=” sign, though realize that floating point arithmetic comes with its own quirks. We’ll give formulas to compute the mass of each cell in the configuration, and then discuss some heuristics. Let’s begin.
Configuration A ( (40/3)MHF <= m < MM + 2V + 0.02 ) 


This configuration results in a single layer of liquid. The details for single layer liquids are in another thread. Since this post is about high mass liquids, we’ll assume that the mass is greater than the max mass (so M > MM). With this much liquid, we’ll see the following amounts in each spot: 

  • a = V
  • b = m - 2V

The 0.02 you see above is because the smallest amount of liquid that can exist in a tile is 10g (0.01kg). We need twice this so that half can go up, and half can remain (described in the next configuration). 

Configuration B ( MM + 2V + 0.02 <= m <= 1.5MM + 3V )


We finally see a single bump upwards in liquid. You’ll see the viscosity always flow left and right from here on out, so -2V shows up quite a bit. The amount of liquid that heads upwards will be half the mass above MM + 2 V, capped at the viscosity. We have

  • a=V
  • b=minimum ( V , (m - MM - 2 V) / 2 ) - This cannot exceed V, hence a minimum is used. 
  • c= m - 2V - b

The minimum function does not change the shape of this configuration, but it does mean that the computations change once the mass passes m= MM + 4 V

Configuration C ( 1.5 MM + 3 V< m < 2 MM + 2 V)


When the single bump central tile’s mass passes 1.5 MM, another bump upwards occurs. We get a double bump. 

  • a = V 
  • b = V/4
  • c = (m-2 a-3 b)*(C)/(1+C) (recall MaxCompression = C = 1.01 for all liquids)
  • d = (m-2 a-3 b)*(1)/(1+C) = c / C

Basically, V goes left and right, the 3 fringe cells each get V/4, and then what remains is distributed to the center cells with a 1 to 1.01 ratio. The max compression constant shows up for the first time.  I’d love to see a mod change this value, and see what it affects in game. 

Configuration D ( m = 2 ( MM + V ) the Magic Number (plus or minus some small value such as .00005))


I call this the “Magic Number”, as it shows up again several times. The double bump configuration drops to a single bump, for exactly this number, and then returns to a double bump, but the computations are different for the next double bump.

  • a = V
  • b = m-MM/2
  • c = m+MM/2

Essentially, after shooting liquid left and right, the remain liquid splits evenly, with one change - half of the max mass (MM) is taken from the top and sent down. This is the exact same behavior as the final configuration. 

Configuration E ( 2 MM + 2 V < m <= MM(9+12 C)/5 - 2 V - yeah, weird…)


The masses for this double bump follow:

  • a = V
  • b = MM / 8 + (m-2(MM+V))/8 = (m-MM-2V)/8  - This part changed
  • c = (m-2 a-3 b)*(C)/(1+C)
  • d = (m-2 a-3 b)*(1)/(1+C) = c / C

The difference in these double bumps is 3 top fringe cells no longer depend on V, but on MM. I gave two formulas for this. The first formula shows that the value starts at MM/8, and then every kg over the magic number 2(MM+V) results in another 1 / 8 increase in mass.  This means that 3 / 8 of every additional kg are sent to the top 3 cells.  Whatever mass remains is divided up with the same 1 to 1.01 ratio. This configuration remains in place till cell d exceeds 1.5 MM. So to find the value where this configuration stops requires we solve 1.5MM = (m-2 a-3 b)*(1)/(1+C) for m. The solution is the weird formula given above (and below). I’ve checked this value, with debug, and it matches for 6 different tested liquids (even when the value is not an integer, out to 4 decimal places). 

Configuration F ( MM(9+12 C)/5 - 2 V < m <= 5 MM +2 V )

Once the previous double bump’s central cell hits 1.5MM, any extra fluid creates this triple bump. 

  • a = V
  • b = MM / 8 + (m-2(MM+V))/8 = (m-MM-2V)/8 - same as before
  • c =  (m - MM - 2 V ) / 32 = b / 4
  • d = (m - 2 a - 3 b)*(C)/(1+C) - (same as c before)
  • e = (m - 2 a - 2 b - 3 c - d)*(C)/(1+C) 
  • f = (m - 2 a - 2 b - 3 c - d)*(1)/(1+C) = e / C

The new top 3 fringe tiles have 1 / 4 the mass of the previous fringe tiles (which still appear on the edges of the second row up). The bottom middle cell (d) uses the exact same formula as the previous configuration. Any remaining mass not accounted for is then split in cells (f) and (e) with a 1 to 1.01 ratio. 

Configuration G ( 5 MM + 2V < m )


The extra bumps disappear when we pass this value.  At this point, after removing 2V for the flow left and right, the remaining mass is split in half, and then one half of the max mass is sent from the top tile down.  

  • a = V
  • b = (m - 2V)/2 - MM/2
  • c = (m - 2V)/2 + MM/2

This configuration remains indefinitely (stopped testing after 300000 kg). This is the final configuration (when above insulated insulation).

What About Viscogel?
With viscogel, no liquid will flow left or right on the bottom layer. This means that a -2V that occurs in tons of places above must be removed, however the viscosity of V=1kg does get used (as some fringes depend on it, such as 250 g = 1kg/4 in the first double bump). The first double bump occurs after 151 (instead of 153).  The magic number is 200 (instead of 202). The first triple bump occurs at 422.4 (instead of 424.4). The triple bump disappears after 500 (instead of 502).  All computations that depended on subtracting the two side flowing V’s, before distributing the remaining liquid with a 1 to 1.01 ratio, have to be updated.  This can all be accomplished by adding an “if” condition to the computations.  I’ll skip that for now. 

Does the surface we are on make a difference?
Yes. These computations were all done on insulated insulation.  Swap to insulated ceramic, and it changes (fewer configurations). Put the liquid over a layer of some other liquid, and several more configurations appears, with new patterns to explore (though the principles in this sheet will make figuring these new configurations easier).  @BLACKBERREST3, we can build fountains/geysers with the following configuration, by creating high pressure liquids over another liquid, and then releasing the liquid. 


I may put up a non “ONI University” post that shows a fun contraption that utilizes this fountain configuration, for routine (or maybe booby trapped) explosions in base. When a critter walks over a specific spot, we could open a magma flare on it (frying the poor soul instantly). Mwhahaha!!!!! Sounds like the geyser traps from Terraria. Oh the fun we can have. 

What exactly determines the number and types of configurations? Where to from here?

My best guess is that the “hardness” property has something to do with it, where liquids would have infinite hardness (liquids cannot destroy other liquids), and the larger the hardness, the more configurations appear.  I’ll do more testing, or someone else can beat me to it (if this posts looks interesting).  I only discovered the differences based on materials when getting this post put together. I wanted to use Ceramic for the white background to write on, but everything fell apart with a different material. 

Where is the Promised Spreadsheet? Common man, I'm dying to play with this!!!

Follow this link to a googledocs spreadsheet with all the computations encoded. This spreadsheet is not compatible with Viscogel, but can easily be modified.

Could I get a summary of the key numbers for several common liquids?


Link to comment
Share on other sites

Now we just have to find a trick to contain and release high pressure liquids. I wonder what effect airflow tiles will have. hmmm, more testing will done. It could be the first time we use planned destruction of a tile under pressure.

13 minutes ago, mathmanican said:

I may put up a non “ONI University” post that shows a fun contraption that utilizes this fountain configuration, for routine (or maybe booby trapped) explosions in base.

Almost done with that, I just need to find some more vids and other examples. Also, that would be a fantastic way to end a base.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...