Better air.cpp & air.h documentation?

  • Plantguy
    16th May 2020 Member 0 Permalink

    Where can I find better documentation for air.cpp & air.h? The code seems to be a pretty simple time step calculation for pressure and velocity, but I would like a little more detail as to how it was made and about some fo the abbreviations. For example, dx, dy and dp are all pretty obviously self-explanatory, but ovx, ovy, etc. is less so. Thanks!

  • moonheart08
    16th May 2020 Member 0 Permalink

    Simply put, no-one really dares try and document it (as far as i'm aware). Stuff prefixed with 'o', I believe, stands for "old", the old version of some piece of data.

  • jacob1
    16th May 2020 Developer 1 Permalink
    Hmm, it would be easier to just explain the specific questions you have.

    I don't actually know about the "why" of this code. I only know the "what". I understand how it works and what it is doing, but I'm not the one who wrote it.

    ovx and ovy are used as secondary maps while we reference the original pressure / velocity from the primary maps. vx / vy will refer to the original (mostly ...) velocity at each position. We use this to calculate the new velocity in the main "//update velocity and pressure" loop. Then at the end, we copy it back over to vx / vy.
    You'll see that technically oxv and ovy are never copied from vx / vy, it's just generated as we loop through every cell and calculate the new dx/dy based on the surrounding values to each cell. We store dx/dy into ovx/ovy until the end, so that the next dx/dy calculations can still refer to the original velocities.
  • Plantguy
    16th May 2020 Member 0 Permalink

    @jacob1 (View Post)

     Thanks! I'm not trying to anything specific at the moment, I'm just an aerospace engineering student with a splash of programming knowledge curious about how the simulations were created. I might tinker with it down the road, but I'm trying to figure out how everything fits in. This script is obviously called for each frame of the simulation, and also updates pressure/velocity to account for and alter particle motion, as well as stationary solids. Do you know where it's called in the main simulation?