A simple 4th order Runge-Kutta scheme [7, p. 1081] is used for time integration. In the interior ballistics calculations, the time step (/dt) is typically constant (the default is s), except in certain circumstances:
When an event like a plunger impact or projectile leaving the barrel is detected. In these cases, the next time step is adjusted to closely determine the time of the event using a secant method variation of Hénon’s trick [5]. Subsequent time steps are unchanged.
When between two time steps, the total system mass deviates by more than or the total system energy deviates by more than , the time step is multiplied by to try to maintain strong conservation (exponential backoff). This adaptivity is not enough in some instances, so it may sometimes be necessary for the user to reduce the time step.
When plunger impact occurs, the time step is multiplied by as the plunger dynamics after impact may be faster. This is particularly true after multiple plunger impacts, which can happen in some cases.
If the time step is unchanged due to conservation or plunger impact for time iterations, then the time step is multiplied by . Every subsequent time iterations without increases to the time step have the same increase. The time step will not increase above the time step set for the simulation.
Forward-mode automatic differentiation is available internally in BlasterSim using a library I developed previously [16]. However, features dependent on automatic differentiation such as uncertainty quantification are not yet implemented.
Certain modeling decisions were made due to the use of automatic differentiation. Automatic differentiation would require detecting every discontinuity that occurs (as is done with the plunger impact; see § 2.1.9), so to reduce the amount of event detection needed, it is useful to use smooth submodels when possible.
The smooth friction model described in § 2.1.8 was motivated in part by a desire to remove discontinuities.