reilleya / openMotor

An open-source internal ballistics simulator for rocket motor experimenters
GNU General Public License v3.0
368 stars 73 forks source link

Divide by zero with a null propellant #172

Closed reilleya closed 3 years ago

reilleya commented 3 years ago

Running a simulation against a propellant with these properties fails: image

The error is as follows:

Traceback (most recent call last):
  File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Programming Projects\openMotor\uilib\simulationManager.py", line 44, in _simThread
    simRes = self.motor.runSimulation(self.updateProgressBar)
  File "D:\Programming Projects\openMotor\motorlib\motor.py", line 178, in runSimulation
    simRes.channels['pressure'].addData(self.calcIdealPressure(perGrainReg, 0, None))
  File "D:\Programming Projects\openMotor\motorlib\motor.py", line 92, in calcIdealPressure
    denom = ((gamma / ((gasConstant / molarMass) * temp)) * ((2 / (gamma + 1)) ** ((gamma + 1) / (gamma - 1)))) ** 0.5
ZeroDivisionError: float division by zero
reilleya commented 3 years ago

Fixed