1.5 Return codes

Return codes are printed in the CSV file and also printed when BlasterSim terminates with an error. Values 1 and above indicate an error occurred.

Error return codes are listed below:

return code 1:

Whether the simulation ran for 0.1 seconds without the projectile leaving the barrel, indicating that the projectile likely won’t ever leave the barrel.

return code 2:

Whether a control volume has negative mass.

return code 3:

Whether a control volume has negative temperature.

return code 4:

Whether the total system mass deviates from the starting mass by more than 0.001%.

return code 5:

Whether the total system energy deviates from the starting energy by more than 0.01%.

return code 6:

If automatic differentiation is used, whether any component of the gradient of the total system mass deviates by more than 10.0109 (regardless of the units).

return code 7:

If automatic differentiation is used, whether any component of the gradient of the total system energy deviates by more than 10.0106 (regardless of the units).

return code 8:

Whether the ideal gas equation of state has become inaccurate due to the pressure increasing above the critical pressure.

return code 9:

Whether the coordinates of any plunger become desynchronized between control volumes on either side of the mentioned plunger by more than 0.1109 m.

return code 10:

Whether the coordinate of a projectile/plunger goes negative, indicating that the control volume has negative volume and that the projectile/plunger has not only impacted the end but gone through the end.

return code 11:

Whether the maximum number of time loop iterations (100000000) was reached when time stepping. This indicates that BlasterSim was getting stuck at some point. Looking at the CSV output should indicate where BlasterSim was getting stuck for debugging.

return code 12:

Whether the maximum number of iterations (50) was reached when interpolating to a particular projectile/plunger location. This indicates that BlasterSim was unable to properly handle an event like projectile exit or a plunger impacting the end of the plunger tube.

return code 13:

Whether any species in a control volume had negative mass in a Runge-Kutta stage. This tends to occur when the equivalent diameter of the flow restriction is too large. Alternatively, the time step may be too large, however, the equivalent diameter should be checked first as the default time step should be acceptable in the vast majority of situations.

return code 14:

Whether any control volume had negative energy in a Runge-Kutta stage. This is similar to return code 13 and can be fixed in the same ways.

return code 15:

Whether the muzzle velocity exceeds what is believed to be physically possible. See [3, p. 364, eq. 74] and [12, p. 19, eq. 11-8]. This check is performed only at the end of the simulation, not after each time step.

The thresholds used for some of these checks are somewhat arbitrary and are based on what conservatively seems to never cause problems in practice.

The non-error return codes are listed below. A value of -2 and below indicates that an event that requires special treatment was detected (for example, the projectile leaving the barrel or the plunger impacting the end of the plunger tube), and BlasterSim may or may not terminate the simulation depending on the event.

return code -1:

No errors or events were detected. BlasterSim will continue to the next time step.

return code -2:

A control volume’s projectile/plunger has reached its termination position. For example, this could be triggered if a projectile leaves the barrel. BlasterSim will terminate.

return code -3:

A plunger has impacted the end of the plunger tube with non-zero plunger velocity after impact. BlasterSim will continue to the next time step. The time step is multiplied by 0.9. See § 2.2.1.

return code -4:

The time step was multiplied by 0.5 due to a mass or energy conservation tolerance being violated. See § 2.2.1. BlasterSim will continue to the next time step.

return code -5:

The time step was multiplied by 2.0 as it has been 1000 time steps since the time step was last changed and perhaps a larger time step is now acceptable. See § 2.2.1. BlasterSim will continue to the next time step. If another event or error occurred during this time step, that return code will override this return code.

return code -6:

A plunger has impacted the end of the plunger tube with zero plunger velocity after impact. BlasterSim will continue to the next time step.