## Billiard simulation–part 5: friction

May 26, 2013 at 9:03 AM

The velocity of the balls progressively decreases due to three different effects: loss of energy during collisions, friction with the table (rolling friction or rolling resistance) and friction with the air (drag).

The loss of energy during collisions is already accounted for by the coefficient of restitution used in the collisions formulas.

The general formula for the rolling friction is:

$$F_{rr} = c_{rr}N$$

where $$F_{rr}$$ is the resulting rolling friction force, $$c_{rr}$$ is the coefficient of rolling friction – that depends on the materials of the ball and the table – and $$N$$ is the downward force exerted by the ball on the table. $$N$$ is equal to the mass $$m$$ of the ball times the gravitational acceleration $$g$$: $$N = mg$$. The deceleration $$a_{rr}$$ of the ball due to the rolling friction is the friction force divided by the mass of the ball: $$a_{rr}=F_{rr}/m$$. Combining these two equation the rolling friction deceleration is:

$$a_{rr} = c_{rr}g$$

The formula for the air drag is:

$$F_d = \frac{1}{2}\rho_a v^2 c_d A$$

where $$F_d$$ is the resulting drag force, $$\rho_a$$ is the air density, $$v$$ is the ball speed, $$c_d$$ is the drag coefficient and $$A$$ is the cross-sectional area of the ball. The deceleration $$a_{d}$$ of the ball due to the air drag is the air drag force divided by the mass of the ball:

$$a_d = \frac{F_d}{m} = \frac{F_d}{\frac{4}{3}\pi\rho_b r^3}$$

where $$\rho_b$$ is the density of the ball and $$r$$ is its radius. The cross-sectional area of the ball is $$A=\pi r^2$$ – putting all this together the air drag deceleration is:

$$a_d = f_d \frac{v^2}{r}$$

where the air drag factor $$f_d$$ is defined as

$$f_d = \frac{3\rho_a c_d}{8\rho_b}$$

The drag coefficient $$c_d$$ for a sphere varies quite a bit with the velocity of the object – see here for example, but overall the air drag is quite small, so even using a constant would not change the result much; hence given the air density and the ball density $$f_d$$ can be considered a constant as well.

Assuming that the time interval used to update the simulation is small compared with the rate of change of the ball velocities, the speed after the interval is simply the original speed decremented by the deceleration times the interval:

$$v_t = v_0 – (a_{rr}+a_d)t$$

The resulting code is:

  /**
* Updates the ball velocity, applying rolling resistance and air drag for a specified time interval
* @param t the time interval to use. Only first-order effects are considered, so the time interval
* must be small compared to the rate of change of the velocity
* @param airDragFactor total air drag factor computed from the ball and air densities and the
* air drag coefficient (assumed to be constant)
* @param rollingResistanceDeceleration total rolling resistance deceleration computed from the
* rolling resistance coefficient and the gravitational acceleration
*/
updateVelocity(t: number, airDragFactor: number, rollingResistanceDeceleration: number) {
var speed2 = this.v * this.v + this.w * this.w;
if (speed2 > 0) {
var airResistanceDeceleration = airDragFactor * speed2 / this.radius;
var totalDeceleration = airResistanceDeceleration + rollingResistanceDeceleration;
var speed = Math.sqrt(speed2);
var newSpeed = speed - totalDeceleration * t;
if (newSpeed <= 0) {
// The ball stopped
this.v = 0;
this.w = 0;
} else {
// Update the speed, keeping the velocity direction the same (the air drag and rolling resistance
// forces are in the exact opposite direction of the velocity)
this.v = this.v * newSpeed / speed;
this.w = this.w * newSpeed / speed;
}
}
} // updateVelocity

Posted in: Physics | Programming