Curious: (I don't know anything about gun designs either)
- the inside of a gun barrel is in direct contact with the projectile, yes? So wouldn't a longer barrel reduce the speed of the projectile because of drag?
I assumed the necessity of a longer barrel, was about stabilizing the projectiles trajectory before it leaves the muzzle and thereby aiming for higher precision, not as much a higher projectile velocity...
Due to the expansion of the gases, the bullet generally
accelerates along the full length of the barrel. So, for a given
bullet mass, and given
propellent type/charge, the "muzzle velocity" of the bullet (initial velocity as it exits the muzzle) is largely a function of the barrel length. Now, this is a bit of a generalization. There are trade-offs to having too short a barrel, and too long a barrel...both in terms of ballistics, as well as to operational function, so the firearms designer tries to optimize the barrel length depending on the intended purpose of the firearm.
And yes, for a given projectile and cartridge, there is a limit point whereby the barrel would become too long, which would have a detrimental effect on the muzzle velocity. This would occur when the friction between the bullet and the barrel, as well as air resistance, equals the continuously diminishing gas pressure behind the bullet...at which point the bullet would begin to deccelerate, before exiting the muzzle.