ukaea / PROCESS

PROCESS is a systems code at UKAEA that calculates in a self-consistent manner the parameters of a fusion power plant with a specified performance, ensuring that its operating limits are not violated, and with the option to optimise to a given function of these parameters.
https://ukaea.github.io/PROCESS/
MIT License
26 stars 11 forks source link

[BUG] Divide by 0 HELIAS-5B #3184

Open timothy-nunn opened 1 month ago

timothy-nunn commented 1 month ago

Describe the bug

Running the HELIAS-5B input file results in a divide by 0 error after a feasible solution is found.

Steps to reproduce

FELIX.IN.DAT.txt

Expected behaviour

MFile is written once feasible solution is found.

Evidence

**************************************************************************************************************
process.plasma_profiles - WARNING - Parabolic plasma profiles is used for an L-Mode plasma, but the physics variables do not describe an L-Mode plasma. 'rhopedt', 'rhopedn', 'teped', 'tesep', 'neped', 'nesep', and 'tbeta' have all been reset to L-Mode appropriate values
/Users/timothynunn/process/process/impurity_radiation.py:398: RuntimeWarning: divide by zero encountered in log
  zav_of_te = yi + c * (numpy.log(tprofile) - xi)
/Users/timothynunn/process/process/impurity_radiation.py:456: RuntimeWarning: divide by zero encountered in log
  pimpden = numpy.exp(yi + c * (numpy.log(tprofile) - xi))
6 | Convergence Parameter: 1.037E-07

 ************************************* PROCESS found a feasible solution **************************************

/Users/timothynunn/process/process/physics.py:2258: RuntimeWarning: divide by zero encountered in scalar divide
  1
/Users/timothynunn/process/process/physics.py:1743: RuntimeWarning: invalid value encountered in divide
  ] = (
/Users/timothynunn/process/process/physics.py:1753: RuntimeWarning: invalid value encountered in divide
  physics_variables.fhe3 * physics_variables.deni / physics_variables.dene
/Users/timothynunn/process/process/physics.py:1807: RuntimeWarning: divide by zero encountered in log
  - (np.log(physics_variables.dene) / 2.0)
/Users/timothynunn/process/process/physics.py:1808: RuntimeWarning: divide by zero encountered in log
  + np.log(physics_variables.te * 1000.0)
/Users/timothynunn/process/process/physics.py:1806: RuntimeWarning: invalid value encountered in scalar add
  31.0
/Users/timothynunn/process/process/physics.py:1812: RuntimeWarning: divide by zero encountered in log
  - (np.log(physics_variables.dene) / 2.0)
/Users/timothynunn/process/process/physics.py:1813: RuntimeWarning: divide by zero encountered in log
  + np.log(physics_variables.te * 1000.0)
/Users/timothynunn/process/process/physics.py:1811: RuntimeWarning: invalid value encountered in scalar add
  31.3
/Users/timothynunn/process/process/physics.py:1863: RuntimeWarning: invalid value encountered in divide
  physics_variables.aion = physics_variables.aion / physics_variables.dnitot
/Users/timothynunn/process/process/physics.py:1866: RuntimeWarning: invalid value encountered in divide
  physics_variables.zeffai = (
/Users/timothynunn/process/process/profiles.py:310: RuntimeWarning: invalid value encountered in divide
  physics_variables.ti / physics_variables.te * physics_variables.te0
/Users/timothynunn/process/process/profiles.py:178: RuntimeWarning: invalid value encountered in divide
  physics_variables.dnitot / physics_variables.dene * physics_variables.ne0
/Users/timothynunn/process/process/plasma_profiles.py:281: RuntimeWarning: invalid value encountered in scalar divide
  -dtdrho_max * physics_variables.rminor * rho_te_max / te_max
/Users/timothynunn/process/process/plasma_profiles.py:285: RuntimeWarning: invalid value encountered in scalar divide
  -dndrho_max * physics_variables.rminor * rho_ne_max / ne_max
Traceback (most recent call last):
  File "/Users/timothynunn/process/.venv/bin/process", line 33, in <module>
    sys.exit(load_entry_point('process', 'console_scripts', 'process')())
  File "/Users/timothynunn/process/process/main.py", line 657, in main
    Process(args)
  File "/Users/timothynunn/process/process/main.py", line 127, in __init__
    self.run_mode()
  File "/Users/timothynunn/process/process/main.py", line 204, in run_mode
    self.run.run()
  File "/Users/timothynunn/process/process/main.py", line 362, in run
    self.run_scan(self.solver)
  File "/Users/timothynunn/process/process/main.py", line 465, in run_scan
    self.scan = Scan(self.models, solver)
  File "/Users/timothynunn/process/process/scan.py", line 22, in __init__
    self.run_scan()
  File "/Users/timothynunn/process/process/scan.py", line 37, in run_scan
    final.finalise(self.models, ifail)
  File "/Users/timothynunn/process/process/final.py", line 23, in finalise
    op.write(models, ft.constants.nout)
  File "/Users/timothynunn/process/process/output.py", line 22, in write
    models.stellarator.run(output=True)
  File "/Users/timothynunn/process/process/stellarator.py", line 121, in run
    self.stopt(True)
  File "/Users/timothynunn/process/process/stellarator.py", line 354, in stopt
    self.stopt_output(
  File "/Users/timothynunn/process/process/stellarator.py", line 3235, in stopt_output
    powerht_local, pscalingmw_local = self.power_at_ignition_point(
  File "/Users/timothynunn/process/process/stellarator.py", line 3285, in power_at_ignition_point
    self.stphys(False)
  File "/Users/timothynunn/process/process/stellarator.py", line 4065, in stphys
    physics_variables.piepv = rether(
ZeroDivisionError: division by zero

Environment