2.1 Interior ballistics

2.1.1 Control volume notation

m˙ijpsxiAigas
Figure 2.1: Control volume number i as represented in BlasterSim.

Internally, BlasterSim simulate blasters using control volumes with arbitrary flow connections between control volumes. This allows BlasterSim to simulates spring and pneumatic blasters with the same core simulation code. This also allows simulating more atypical blasters without major code changes.

An isolated control volume numbered i is shown in figure 2.1. A single flow connection to the control volume numbered j is shown with mass flow rate m˙ij, a projectile/plunger labeled p with mass mp,i, a spring with stiffness ki, mass ms,i, and spring precompression Δpre,i (see figure 1.2 for a graphical definition), cross-sectional area Ai, projectile/plunger position xi and velocity x˙i, and gas mass mi and energy Ei.

The integers i and j will be used as indices for control volumes.

Gas mass and energy as chosen as these are conserved variables and it is believed that using conserved variables will lead to better conservation properties in the numerical methods.

A control volume represented like this can be used to represent a variety of scenarios relevant to gas gun interior ballistics, including:

  • a barrel, where p represents the projectile, xi represents the projectile location, and ki and ms,i are set to zero;

  • a plunger tube for springers where p represents the plunger head, and xi represents the plunger head location;

  • a constant volume chamber for pneumatics where p represents a solid wall, mp,i is set to infinity, and ki and ms,i are set to zero;

  • a piston tube used in HPA Nerf blasters similar to a plunger tube; and

  • a constant pressure atmosphere where xi is arbitrary, and ki and ms,i are set to zero.

The gas mass could be composed of multiple species in BlasterSim. At the moment, the pneumatic and springer modes of BlasterSim use only dry air, but humidity and alternative gases are intended to be added in the future. For completeness, this guide will be written as if multiple gas species are present. The mass fraction y and gas species index k which identifies the gas are used.

2.1.2 Conservation laws

dm˙k,idt=j(yk,jm˙jiyk,im˙ij) (2.1)
dEidt=piAix˙i+j(m˙jihjm˙ijhi) (2.2)
Ei=miui (2.3)

2.1.3 Equations of state

pi=miRiTiAixi (2.4)

2.1.4 Thermodynamic properties

uk,i(T)=u0,k+cv,k(TiT0,k) (2.5)
hk,i(T)=h0,k+cp,k(TiT0,k) (2.6)

2.1.5 Connection flow model

Beater [1, ch. 5]

2.1.6 Valve opening model

Valves do not open instantaneously, and sometimes slow opening has a significant impact on performance. BlasterSim models how far a valve is open with a prescribed valve opening model. αij is the valve opening fraction, which is how open the valve is. αij=0 is fully closed m˙ij=0 and αij=1 is fully open. The specific equation BlasterSim uses is

αij=α0,ij +α˙0,ij(ttopening,ij)
+(33α0,ij2α˙0,ij)(ttopening,ij)2
(22α0,ijα˙0,ij)(ttopening,ij)3, (2.7)

for t<topening,ij. For ttopening,ij, αij=1. α0,ij is the initial (time zero) valve opening fraction (useful when a valve isn’t used like in a springer). α˙0,ij is the initial valve opening rate. topening,ij is the valve opening time, the time it takes for the valve to fully open (reach αij=1).

This equation may seem overly complicated, but is the simplest polynomial equation that satisfies a few constraints:

αij(0) =α0,ij(set initial valve opening fraction) (2.8)
dαijdt(0) =α˙0,ij(set initial valve opening rate) (2.9)
αij(topening,ij) =1(valve is fully open attopening,ij) (2.10)
dαijdt(topening,ij) =0(needed for automatic differentiation) (2.11)

When the valve is fully open, αij no longer changes with time, so its derivative is zero. Consequently, the last constraint listed is needed to match the derivative at t=topening,ij, which is necessary for automatic differentiation. See § 2.3.2 for more about automatic differentiation in BlasterSim. The last constraint prevents a simple linear model (αij=α0,ij+(1α0,ij)t/topening,ij) from being used.

Note that to ensure monotonicity of αij (in other words, avoid oscillations of the valve opening fraction), α˙0,ij must satisfy the inequality 0α˙0,ij3(1α0,ij).

The pneumatic and springer cases will now be discussed, with the ij subscript dropped for simplicity as there is only one flow restriction in both cases.

For pneumatics, α0=0 and α˙0=1. The second condition approximates a simple linear model. In the future α˙0 may become an input parameter if deemed necessary to improve accuracy. The SpudFiles Wiki [10] gives some estimated opening times:

  • Burst disks: likely under 1 ms

  • Pilot-operated valves (like QEVs, “back-pressure tanks”, “cores”): 3–5 ms

  • Ball valves: about 100 ms if hand activated

These values are recommended as starting points only. For modeling any particular blaster, it is better to try to independently determine the valve opening time through something like high speed video.

For springers, α0=1 and α˙0=0. As there is no valve in a springer, this simply sets the flow restriction to always be open.

This simple valve opening model is most accurate for manually operated valves. More detailed modeling of pilot-operated valves could make determining the valve opening time unnecessary, but this alternative valve opening model has not yet been added to BlasterSim.

2.1.7 Projectile and plunger equations of motion

dxidt =x˙i (2.12)
dx˙idt =Aimeff,i(pipmirror,ipf,i)kimeff,i(xi+Δpre,i) (2.13)

The effective mass of the projectile/plunger factors in the spring mass. The spring is not moving at a uniform velocity as one end is stationary, so it would be incorrect to add all the spring mass to the effective mass. The effective mass equation used is

meff,i=mp,i+Cmsms,i (2.14)

where Cms=13 as suggested by Ruby [8] for a stiff spring.

2.1.8 Projectile and plunger friction model

Consider a projectile/plunger p with both static and dynamic friction. BlasterSim uses an effective friction pressure pf,i defined to oppose the direction of motion. Using a pressure instead of force allows for more familiar units and is conventional in spud guns. The maximum static friction pressure is pfs,i and the magnitude of the dynamic friction pressure is pfd,i. When static friction is active, the actual static friction force is just enough force to equilibrate the forces so that p doesn’t move (where dx˙idt=0; see equation 2.13), until the force exceeds the maximum static friction force. In other words, the actual static friction pressure pf0,i is the minimum of the equilibrium pressure pfe,i or the maximum static friction pressure, and in the direction of the equilibrium pressure. Mathematically, this can be stated as

pf0,i=sgn(pfe,i)min(pfs,i,|pfe,i|). (2.15)

The actual dynamic friction pressure is sgn(x˙i)pfd,i, taking into account both the magnitude of the dynamic friction pressure pfd,i and the direction.

The effective friction pressure pf,i then will switch between static and dynamic friction depending on the velocity:

pf,i={pf0,i,ifx˙i=0(static),sgn(x˙i)pfd,i,ifx˙i0(dynamic). (2.16)

BlasterSim does not use this model because it is not smooth. Smooth functions are useful for automatic differentiation (see § 2.3.2) and beneficial for numerical stability. Also, the use of strict floating point equality in the x˙i=0 branch can lead to numerical reproducibility issues. BlasterSim uses a smoothed version of this model which avoids these problems.

To create a smoothed version of equation 2.16, it’s helpful to first rewrite equation 2.16 in terms of the sgn function:

pf,i=pf0,i+[pfd,isgn(x˙i)pf0,i]sgn(x˙i). (2.17)

The smooth approximation to equation 2.16 will be made by noting that

sgn(x˙i)tanh(x˙ivs), (2.18)

where vs is a small scale over which the tanh function changes from -1 to 1.

Consequently, the function implemented in cva.f90 as p_f is

pf,i=pf0,i+[pfd,itanh(x˙ivs)pf0,i]tanh(x˙ivs). (2.19)

Making a smooth approximation for pf0,i is more difficult. Rather than replacing a single part of equation 2.15, an new function was constructed that does not resemble equation 2.15 algebraically but takes similar values. A piecewise function is implemented in cva.f90 as p_f0 so that the actual static friction pressure pf0,i equals the equilibrium pressure pfe,i for small values of pfe,i:

pf0,i={pfe,i,if|pfe,i|ps,sgn(pfe,i)pf0,i,high,if|pfe,i|>ps, (2.20)

where ps is chosen to be a somewhat arbitrary fraction of pfs,i and

pf0,i,high=pfs,itanh(|pfe,i|pspfs,ips+arctanh(pspfs,i)). (2.21)

Note that despite the appearance of sgn(pfe,i) and |pfe,i|, equation 2.20 is continuous and has continuous derivatives as those terms only become discontinuous at pfe,i=0 and do not appear in the branch where pfe,i=0.

2.1.9 Plunger impact

At the moment, BlasterSim does not handle plunger impact with the end of the plunger tube, and will crash if that occurs. Plunger impact will be handled in a future version of BlasterSim. Plunger impact does not appear to be necessary in the springers simulated so far, but certainly it is a factor in some springers.