Jump to content

Simulate gases?


Matrixmage

Recommended Posts

Hi, I'm just wondering if it's at all possible to simulate gases? If there isn't a specific gas simulation, I could easily turn a liquid simulation into one, that's assuming there's a liquid one. I'm not really looking for anything fancy, I've been thinking of ways I could do this with raycasts, so I'm only really looking for an easy way to simulate their behaviour.

Thanks,

Matrixmage

Link to comment
Share on other sites

Why do you need it?

Also, note that fluid simulations are one of the most computationally intensive and complex simulations known to mankind. It does not have neat solutions and the outcome depends on minute details like surface roughness etc.

You can approximate aerodynamics with some clever assumptions like Ferram does in FAR. But if you want to cram a true fluid simulator into KSP that'll be an herculean task.

Link to comment
Share on other sites

I assume you aren't taking about exhaust gases because that is already present to some degree. Unless your idea of simulating gas is just making a tank pressure system (since all you need is volume/surface area and fluid pressure/temp), then it should be fine.

Generally speaking though, fluid simulation is horribly expensive. We can almost do liquid okay, but even then, the best example for real time liquid simulation is dwarf fortress. There are very few examples of liquids that are actually modeling pressure reasonably, much less without being tech demos.

Link to comment
Share on other sites

Well, Portal 2 does gels, sort of. But generally, liquid simulation, especially in full 3D (Dwarf Fortress can, due to it's "tile-based" nature, quantify and simplify the system) is something that dedicated, high performance computers are usually used. Even approximations are very expensive, due to the complexity involved. I've heard of a flightsim that could simulate airflow over the wings/fuselage (X-Plane, I think?), but even then, it's a somewhat simpler problem.

Link to comment
Share on other sites

Thanks for the responses everyone! The reason I'm looking into this is because I'm looking into creating a semi-realistic explosions mod. Every other mod that adds some sort of explosion mechanic simplify it to a very large extent. The majority of them just apply a impact or some heat to each part in a certain radius, some of them even try to be more realistic and make the damage decay out from the origin point. These, while still good, don't really do justice to the potential that could be done, so I've taken it upon myself to make a plugin to do just that.

If you don't already understand, I wanted the gas simulation so that I could simulate the explosions movement. As I also said, I have an idea for doing it using raycasts, by sending out a spherical group of them and make sure they have correct behaviour to correctly simulate the movement.

I knew it was a long shot, but if it already existed in unity/KSP with reasonable resource efficiency, I could just use that.

As a bit of a side question, if anyone knows how to make a sphere cast where I can access the data from the specific sections of the sphere, that would be great. But if not, I will just send out a splay of rays, as I mentioned before.

Link to comment
Share on other sites

What sort of effect are you trying to achieve? Heating isn't really implemented into KSP in a proper manner yet (atleast officially), but I imagine you could implement a travelling shock wave. I think shocks arising from chemical explosions tend to travel at extremely large velocities close to the source (can a chemist confirm?), so assuming so, noticing any difference in timing in the arrival of the shock would require either a large difference in the distance of two objects relative to the shock origin or for one objects to be moving at a not-insignificant velocity relative to the stationary object.

I have seen modders talking about creating raycasts so I don't think it would be outside the realms of possibility to make something that applies a force (or forces) to 'object A' and then a force on 'object B' at a later time to simulate the travelling shock. That could be a cool thing with how many of my big rockets go boom. (That is not a euphemism. Lately anything larger than a firecracker has been unsuccessful)

If you're talking about implementing some sort of diffraction effect for shock waves and blast 'shadows' then I'd probably re-iterate what others have said: Fluid dynamic simulations are troublesome. There are probably (possibly..?) some analytic solutions or approximations for shock waves incident on primitive objects. Anything computational and I wouldn't know where to start. I use finite element analysis which can be used for those kinds of fluid dynamic studies and that takes some serious computing power.

All that being said, modders constantly amaze me with what they can create and the problems they overcome... so have at it?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...