Pressure Cells

  • QuanTech
    14th Nov 2016 Member 0 Permalink

    Hello. Today I came across:

    pv[y/cell][x/cell]; Since TPT uses 4x4 pressure grid, should 'cell' be 4? I found this on the forums before, but I can't find it anymore :)

  • Simon
    14th Nov 2016 Administrator 1 Permalink
    Yes. You can find various constants in the source:
    https://github.com/simtr/The-Powder-Toy/blob/master/src/Config.h#L134
  • QuanTech
    14th Nov 2016 Member 0 Permalink

    Also, does pressure propagate the same way for all elements that produce pressure? If so, how does it propagate
    e.g:

    pressure -= ([x/CELL]-i); //for every [x/CELL] away from the source, the pressure decreases by 1

    Edited 2 times by QuanTech. Last: 14th Nov 2016
  • mark2222
    15th Nov 2016 Member 0 Permalink

    @QuanTech (View Post)

     

    The way pressure in TPT works is that a particle only updates the pressure of the cell it's in (or, in some cases apparently, cells immediately adjacent). Pressure is propagated via rudimentary fluid simulation, where velocity and pressure are updated simultaneously based on their values in neighbouring cells.

     

    Ctrl-F "pv" in Simulation.cpp to find places where particles update pressure, and check out update_air in Air.cpp for the fluid simulation code.

  • QuanTech
    15th Nov 2016 Member 0 Permalink

    ohhhhhh thanks a lot!