Skip to main content
edited title
Link
Qmechanic
  • 213.1k
  • 48
  • 590
  • 2.3k

How does (air) pressure balance under constraints?

Source Link

How does (air) pressure balance under constraints

I'm playing around with building a very basic simulation of (air) pressure in a grid environment. The idea is that I have this 2d (or 3d) grid of cells. Each cell has a certain atmosphere. Between the cells there may be walls, doors, nothing.

To keep it simple let's say each cell only has pressure (between 0 and 5).

Walls have a certain level or airtightness, so a half open door between two cells would be 0.5 airtight. A full wall would be 1.0 airtight.

I am simulating this step by step, so let's say each step is 1 second.

So let's look at an example:

_______
|0|0|0| # the numbers stand for the current pressure in this cell
|_____|
|2=5=0| # the = stand for open doors (0.0 airtightness)
|__H__| # the H stands for a half open door (0.5 airtightness)
|0|2|0| # everything else are walls
_______

To now calculate what happens in the first step (1 second) I probably need to decide how much flow 0.0 airtightness allow per step, so let's say 0.5 airtightness mean 0.5 flow per second.

So my main question is, how does a pressure difference behave/even itself out. I think to remember, that pressure only flows one way, but might be mixing that up with temperature.

Is it just as simple as taking the average between all pressures and then moving all of the cells closer to that (with a max delta based on the respective airtightness)? Or does a 0.5 airtightness influence the pressure difference somehow (like a tight gap "pretending" there is less pressure behind there)?

Or is it really just taking the mean of all pressures, and for each calculating how much delta it needs to get there and if it's more than the airtightness allows per step, do less?

I hope I could make this clear somehow and would really appreciate some clarity myself.