Fluid pressure / viscosity?

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
cicatrix
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Feb 27, 2017 9:43 am
Contact:

Fluid pressure / viscosity?

Post by cicatrix »

From what I understood about fluids in the game, the fluid flow model relies on the difference in levels between adjacent pipe segments.
I got an idea to model somewhat more realistic fluid flow model based on pressure / viscosity of the liquid (or gas).

As I am not very familiar with the game API, I want to ask if it's even possible to mod at all?

My goal is to enable efficient way to transport liquids over long distances through pipes (not by train/barrels) by introducing pressure.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Fluid pressure / viscosity?

Post by bobingabout »

Not as far as I know, that sort of thing is pretty much internal, and not really open to being modified.

But that's what the pumps are for.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: Fluid pressure / viscosity?

Post by Aeternus »

Pumps can boost the pressure, but if you want to alter viscosity, it is a property of the fluid itself. So it is possible to set different flow rates for gases/liquids. I believe vanilla factorio has those values set to the same amount gamewide though... which is odd, steam should flow much easier then heavy oil.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Fluid pressure / viscosity?

Post by Ranakastrasz »

Aeternus wrote:Pumps can boost the pressure, but if you want to alter viscosity, it is a property of the fluid itself. So it is possible to set different flow rates for gases/liquids. I believe vanilla factorio has those values set to the same amount gamewide though... which is odd, steam should flow much easier then heavy oil.
I think they tried, or at least someone did, and it had rather wierd results due to how the fluid simulation works. It wasn't ideal, so they reverted it.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
DerivePi
Filter Inserter
Filter Inserter
Posts: 505
Joined: Thu May 29, 2014 4:51 pm
Contact:

Re: Fluid pressure / viscosity?

Post by DerivePi »

Current fluid mechanics is based on a flow to energy factor(FTE), a pressure to speed factor(PTS) and a base area (BA). The FTE and PTS factors are fluid defined where the BA is pipe defined. There is also a base elevation factor, but we ARE "in Kansas" and the elevation remains constant. You could mess around with the FTE and PTS factors but they are not independent and messing with them can give you undefined behavior. In fact, the base area is also not an independent variable, but currently works as long as you don't go less than a base are of 1.0 for any pipes you implement.

You could try :
FTE = 0.599 and PTS = 0.4 ---OR--- FTE = 0.59 and PTS = 0.409 for a less viscous material. The breaking point is (1 - FTE) / PTS > min(BA).

Of course all this is moot since the fluid implementation is going to be greatly changed in the near future. I think Wube is looking to collect all of the fluid boxes into its own Array structure and deal with each pipe line as a junction to junction system instead of a stepwise tile by tile system.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Fluid pressure / viscosity?

Post by bobingabout »

Ranakastrasz wrote:I think they tried, or at least someone did, and it had rather wierd results due to how the fluid simulation works. It wasn't ideal, so they reverted it.
that was me.

Making the fluids thicker, so that they don't flow as easily works fine, but when you try to make a fluid flow easier, it creates an effect where the fluid ripples back and forth along the pipe.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: Fluid pressure / viscosity?

Post by Aeternus »

Only if you go too far with it. Fluid tries to flow from high pressure to lower, to all adjacent tiles it connects to with different pressure. You only get the wave effect if the amount of fluid transferred ends up being more then half of the pressure difference - when that happens, the next tick the stuff flows back into the "vacuum" left behind by the flow. If the flow is less then half the pressure difference, then the oscillation will still occur, but is dampened each tick until smoothed out.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Fluid pressure / viscosity?

Post by bobingabout »

which pretty much means that whatever the current settings are is already configured for the best flow without breaking anything.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding discussion”