Jump to content

Phase changes due to temperature AND pressure.


Recommended Posts

This is really the only way IMO that lots of strange behavior can be fixed in ONI. If gases could be turned into solids and liquids under high pressure, it prevents things like having an infinite water storage be available; the gas next to the vent will eventually liquefy, blocking the vent. E.g. if you put 100,000kg of water into 1 tile (100x normal pressure) next to a square of 2kg CO2, that 100x should liquefy it, blocking the vent. On the flip side if you have water open to vaccuum it should be creating cold steam, which is useful for e.g. cleaning Polluted water without adding heat. 

The algorithm shouldn't even be that complex:

Make a phase diagram for each element, with lines between the origin and triple point, a line from the triple point through critical point, and a vertical line above the triple point. This linearization of the phase diagram should create a Voronoi diagram, because the cells are all similarly sized and convex. If one can find the Voronoi sites that generate this diagram, then we have 3 points who are closer to every point in their phase than the other 2. This means we can easily check which phase the element should be in by checking the distance in the (phase, temperature) space to the phase 'centers'. Whichever center is closest indicates the phase the element should be in. In terms of real-time calculations it's not very arduous. 

The tricky part is finding the Voronoi diagram's 3 sites that generate the approximately correct phase diagram. A little bit of trial and error might work, since strictly speaking a linearization of the phase diagram might not be a Voronoi diagram, so it might have to be fudged a bit with some of the points moved. However since this value can be stored and need not be calculated in real-time this is a non-issue. 

 

This will fix some of the exploits but will create a lot of problems in return. The game isn`t conserving mass in many basic mechanics like duppes breathing for example. Without sufficient oxygen generation the presure will fall drastically and it could lead to water pools turning into steam in the early game. I believe that with the simplified physics the game is using allowing pressure to alter melting points will cause more harm than good. Not to mention the codex data becoming useless with the pressures being all over the place.

The exploits need to be handled individually. Infinite storage can be fixed by providing proper pressure damage for things like airlocks and airflow tiles, there should even be a threshold for bunker tiles. It should be calculated for each kilogram over the natual max amout of liquid per tile. It would be tricky for gasses just so steam turbines are usable but they can just make any amout of liquid block a gas vent amd gas canister emptier have a max pressure.

6 hours ago, dfountain62 said:

Make a phase diagram for each element

There's a much bigger problem that blocks this: there's no real concept of pressure in the game as of now. There are admittedly proxies for pressure, but they're not really pressure. For gases, there's something akin to the ideal gas law, with the pressure directly proportional to the density, but it only works well in homogeneous gases. For example, I've got a swamp biome filled with chlorine gas at 7.8 kg. There's a pocket of oxygen near the top (with a deodorizer) and even away from the gas interface zone it's at 6.9 kg. It's been that way for hundreds of cycles. If there were anything like a real notion of pressure, the volume of oxygen would have shifted so that the pressures would equalize to one of the two best approximations (round up or round down) to ambient pressure.

For liquids the problem is even more apparent. I learned in a very surprising way that oil can generate in pockets of "density" 12 kg that act like they have the corresponding pressure; it'll break rock if you tunnel too close. Liquids are (nearly) incompressible IRL, so that's some more game physics for you. This game does fog-of-war merely by proximity, but it would be pretty great if you had to hydraulically fracture the bedrock before tunneling into it, not knowing exactly was down there beforehand. Lots of surprises. I'm calling dibs on writing the "discover an entombed Elder God" mod.

The situation with pressure between gas and liquid is even more lacking. You may have seen all the various gradations of whinging about liquid locks. Yes, 10 g of liquid will resist the delta-P between a maxed out 20 kg high pressure vent and vacuum. (FYI: Delta-P in engineering-speak for the pressure difference between one place and another.)

And while I'm on it, another piece of the no-pressure picture is how gas and liquid pipes work. They're built around unidirectional flow (that is, hard-coded sources and sinks), where IRL flow in pipe is all about Delta-P. It took me quite a while when first playing to realize that air vents could not be used for intake, and that there were no inline pumps anywhere.

My real point is that considering phase diagrams is premature before you even have pressure to plug into the phase diagram. Personally, I'd love to be able to have supercritical CO2 and an Allam cycle furnace, but that's not on the horizon. Also in this category: catastrophic steam implosions. Maybe ONI 2.

I for one would love having the ability to model adiabatic cooling/heating. I long for it with all my heart lol.

Here are the problems I can see it causing:

  1. What pressure is used in liquid/gas pipes?
    1. If multiple pumps are connected to the same pipe, now how is the pressure figured?
    2. Can pressure cause backflow?
    3. How should pressure propagate through pipes?
    4. Pressure limits for various materials?
    5. Temperature changes in pipes would create corresponding pressure changes... how should this affect the flow?
  2. A tile is an indivisible unit of volume, this can create weird behavior when considering PV=nRT.
  3. Should pressure be ignored for liquids? (probably)
  4. Liquids are more compressible than they should be, if you ignore pressure for liquids but not gasses... you could make some truly outlandish things by abusing the fact that liquids are compressible.
  5. So many builds break, gas cooling becomes way more tricky.

Here are the advantages I can see:

  1. Cooling/heating on industrial scale become more doable, though these builds would be pretty power hungry I think.
  2. Liquid gasses become a bit easier to create (if you can build high pressure rooms), but cooling becomes much more important.
  3. Some of the funkiness about heating/cooling gasses goes away... since heat energy is preserved when it is compressed.
  4. You could implement gas flow without needing pumps, allow use of a vent as both input and output.

From the coding side, I can imagine it'd be quite a bit of work.

Generally, I am in favor of a more accurate physics simulation.

For example, I would be in favor of partial pressure being simulated, so that a single tile could contain multiple gases/liquids with different partial pressures. Then ONI could have an accurate pressure simulation.

Also, regarding phase changes, I think it would be important if the evaporation energy and melting energy were simulated.

That way, in order to boil 1000 kg of water that is 50°C, you will need to invest only 209 MJ to heat up the water to its boiling point of 100°C, but 2257 MJ (ten times more energy) to actually boil it, i.e. to make the actual phase change.

Since the energy requirement due to the phase difference is so much higher than the energy requirement due to the heat difference, it does not make sense that ONI neglects it completely.

If the evaporation energy were simulated, then phase changes would also be much more gradual, due to the massive amounts of heat energy required for the phase change.

That would be great, but if Klei chose to implement that, they would also have to send a 2000 dollars check with every copy of the game, so the buyer can afford a computer that can make the game run for at least 10 cycles, maybe 20 before the simulation melts the said computer. The good thing is that we get a new computer every few hours for the price of ONI, the bad thing is that Klei will soon be drowning in various debts. Tough choice !

I concur with the OP, as this is probably the most glaring physics abnormality in the game.  Because the game lacks the concept of pressure, gasses also don't heat up when they are compressed, or cool when being decompressed.

On the other hand, you can do some interesting things due to the inaccuracy.  For instance, before you can build transit tubes, you can build "waterlocks" (water trapped in a 'U' shaped area) to separate a room with a vacuum from another filled with a gas.  This lets you keep refrigerators in a vacuum very early on, which keeps your food fresh indefinitely.

I already posted once an explanation why this is simply impossible 

When I was a student, I worked on a system that simulated phase transitions. The processes are very complex, and are very hard to simulate with any kind of precision. So unless you want this game to require a supercomputer to calculate the thermodynamic processes, this won't ever happen.

Archived

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...