# Basic explosion physics - determining force

I'm using a game engine that has a ton of physics stuff built in. What I am currently trying to do is to simulation an explosion with F force in an x,y coordinate system and figure out how other items in the world are affected by it (they each have x,y as well).

The ultimate function I call is applyForce and it takes an x,y vector in Newtons for the force and a point to act on (the other objects in this case).

Currently I am doing the following:

1. Determining the distance of the explosion point for each of the objects' x,y coordinates
2. If the distance is less than the force F (my total explosion force) then I proceed
3. I subtract the distance from F and assign that back to F - so this effectively becomes the total force that can act on the object based on distance
4. I find the angle of the explosion point from the object by atan2(x1-x2,y1-y2)*180/PI
5. Find the resulting X force by F * cos(angle)
6. Find the resulting Y force by F * sin(angle)
7. Use these to assign the Force vector and apply it to the object

In general I think this okay but I feel like I am missing something as right now the forces are still a bit sporadic. I think I am making the assumption that the signs of the force (- or +) will be handled by the Trig functions above but I have a feeling that is not the case. From my logs sometimes the angle is -167 and I'm wondering if that shouldn't just be based on a 360 degree system instead? I'm assuming if that's the case then I have to do some logic to assign the correct - or + signs to the forces so it moves in a direction away from the explosion point. Can anyone point me in the right direction? I am a developer so this could be completely off :)

-
For anyone doing this type of math in a programming language, make sure you are using the expected units. In this case I was converting to degrees but the cos/sin was expecting radians by default so that is why the forces were sporadic. Also I multiplied both forces by -1 to move it away from the explosion point. Cheers! –  methodin Apr 17 '11 at 16:44
As you are explicitly doing game physics, the game programming site might be a reasonable alternative place for this question. If you are serious about treating the physics, you're going to have to be more careful and precise with your terminology and more explicit about the physics you want to model. The "physics" you present above is goofy in a couple of ways and I suspect the difficulty arises first in the matter of terminology. To misquote a movie: "You keep using the word "force". I do not think it means what you think it means.". –  dmckee Apr 17 '11 at 18:06
Game developers would give me their already abstracted answer which may or may not contain some of the little things I might need to make a difference in my application. I'm more interested in a rudimentary understanding of the logic about the model (which you provided below) so I can understand what parts might be exactly relevant for my purposes and what parts can be abstracted for this particular implementation. I understand the sentiment behind your comment however if I simply regurgitate other developer's code I won't really be increasing my knowledge and will have to keep asking. –  methodin Apr 17 '11 at 19:11
Just a quick note re angles - there's nothing wrong with the angle being negative. sin & cos are defined for any angle from $-\inf$ to $+\inf$, with a period of 360 degrees (or 2pi radians). –  Sam Davies Apr 18 '11 at 13:20

In the simplest approximation, an explosion is a shockwave moving out from some locus. The shockwave may be a compression front in a ambient medium, or may be a wave of gas propagating from the explosive into a vacuum.

So that's the first thing you need to tell us: in air, water, vacuum, or what?

When the shockwave arrives at some material thing, it is the pressure exerted by the shockwave that transfers momentum (i.e. applies a force) to the target. The target object then accelrates as per Newton's law:

$$\vec{F} = m\vec{a} .$$

The vector part of the above is the trigonometry that you show. I'm simply going to assume that you have your coordinate system squared away. However, we still haven't said how much force. To a first approximation it goes by the shock pressure $P$ times the area $A$ the object presents to the shock wave. So that gets us to

$$\vec{a} = \frac{P A}{m} \hat{n}$$

where the unit vector $\hat{n}$ is normal to the surface of the shockwave.

We're still not done because we don't know $P$. Again, we'll take the simplest approximation. Assume you know the shock pressure $P_0$ at the surface of the explosive (this is presumably something you can look up for chemical explosives). When the shockwave has total area $\mathcal{A}$, it's pressure is

$$P = P_0 \frac{\mathcal{A}_0}{\mathcal{A}}$$

where $\mathcal{A_0}$ is the area over which $P_0$ applied. For small sources (like a bomb or stick of dynamite) this will give you a $1/r^2$ type dependence for the pressure. For long linear sources you get a $1/\rho$ dependence; and for large surface charges a pressure that is independent of distance.

That isn't a good approximation, because you can expect the shockwave to spread out of it's own accord over time, and I have not yet modeled that. The really, really simple thing to do here is to choose a maximum range $l = \tau v_s$ equal to some time interval times the speed of shock propagation, and apply a hard cutoff at that point.

Now we know how much force as a function of distance from the explosive and geometry of the explosive, but to get to change in velocity we need to know for how long the force is applied. Obviously that will be related to the depth of the shockwave and to it's speed of propagation: $\Delta t \approx v_s * d$. Unfortunately I'm hazy on how to estimate $d$. For a simple explosive I might go with half the "size" of the charge (radius, thickness, whatever). The speed of propagation depends on the medium. Again, for game purposes you could simple chose some number. Once we have $\Delta t$ we get

$$\Delta v = \Delta t * a .$$

Since you say that your engine works on a applied impulse, you get

$$I = \Delta t * P * A = \Delta t * \frac{P_0 \mathcal{A}_0}{\mathcal{A}} * A,$$

which is actually pretty simple.

And that should get you on your way.

-
I know I'm exceedingly late to the party, but I thought it worth pointing out that trig isn't necessary for calculating F = ma; it's a simple vector multiplication. The answer kind of alludes to this fact, but doesn't make it clear. Otherwise +1 good answer. –  Marcelo Cantos May 18 at 23:06