Going to try putting a gif in a devlog again(Edit: I have replaced it with a video(Edit yet again: It seems that stardance REFUSES to let me put in any functional media besides a still image, so I suppose that is what I must put)).
It turns out, temperature is kind of hard to add! I sorta had to re-examine most of what I’ve been doing so far in order to get it remotely stable.
I’ve also somewhat standardized the units used in the various equations in my code, so that my values somewhat make sense.
One of the things that I realized after doing this is that gases would realistically accelerate to absurd speeds in a vacuum, so I have had to make each cell much larger (now they are each ~1 meter in size).
Of course the main reason I had to re-examine the logical consistency of my code was because I wanted to add temperature to the simulation. Though it would not be accurate to call it ‘temperature’; instead it would be ‘heat’. Really just the internal energy of the gas particles. It turns out that the pressure of a gas in a given area can be written to be directly proportional to the internal energy of the gas in that area, with no regard for the number of particles(it makes sense if you think about it for a while). This pretty much lead me to add in a new value to each cell to correspond to the total internal energy of all of the gas in the cell. This value is advected in the exact same way as the amount of each gas in each cell (which is what is visualized). As far as I can tell through my reading, the three quantities that are relevant to propagate and conserve if I want a decent simulation are mass, momentum, and energy. Out of those I think the most important for me to conserve are mass and energy (I’m not really giving any regard to conservation of momentum at the moment, though I am tracking it for each cell to allow for better gas-gas interactions). One thing to note is that the current simulation doesn’t really have energy conservation, as the acceleration of the gasses provoked by pressure differences sort of comes from no where. This being said, I think I might be able to just call the kinetic energy negligible to the thermal energy? I’m not sure, and will need to do some number crunching I think. I think I’ll want to add in some temperature visualization so I can get some idea of what is going on (and to see if it’s remotely realistic!). Afterwards I think I’ll want to look into adding more types of gases(really this means generalizing each gas and allowing for an infinite quantity of gases).
For every hour I spend on this project I feel like I spend at least half an hour reading (Which hackatime of course does not track). This is also an especially rambly devlog, so if you’re genuinely curious about what the hell is going on and I did a bad job explaining, post a comment and I am very happy to attempt to explain.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.