Skip to content

Runtime warnings with some divide errors #46

@alasdairross

Description

@alasdairross

I'm encountering some runtime warnings coming from division issues. The warning is raised but the code will not break and exit, but rather just keeps running indefinitely. Example of the output is below.

freegsnke/freegsnke/nk_solver_H.py:129: RuntimeWarning: invalid value encountered in divide
  self.Gn[:, self.n_it] = useful_residual / self.n_G[self.n_it]

freegsnke/freegsnke/nk_solver_H.py:151: RuntimeWarning: invalid value encountered in divide
  next_candidate /= self.Hm[self.n_it + 1, self.n_it]

The script I'm running is looping through a set of equilibria specified by the lao profile parameters and active currents, resolving for each row in the table, and the rows are uncorrelated so two consecutive equilibrium could be quite different (and hence cause solving issues).

Update : Here are some example parameters that caused issues

[2025-10-30 13:19:41.235759] Iter 32484: invalid value encountered in divide
coil currents :
[-29731.01201212   3114.26389825   -846.01985597   -627.20680506
  -3875.4337149   -1286.03889702  -2722.14205039   2259.13975181
    826.54147667  -1987.97853614  -5176.37687919    509.348719  ])
proile params:
Ip : 677461.9934160174, fvac : -0.44836548772630824, alpha : [ 194516.66864986  -22062.66079821 -172454.00785165], beta : [ 1.755299   -2.94866525  1.19336625]

[2025-10-30 13:25:06.634374] Iter 26644: divide by zero encountered in divide
coil currents : 
[-8377.14162021  3024.3665201   1455.75518114  4178.57317005
  4063.38945388 -2926.68866955   140.1431723    332.94907985
 -2233.22796071  -912.54119553 -6724.28221982   364.77928198])
proile params: 
 Ip : 847529.4941647184, fvac : -0.41079957493444, alpha : [ 42275.19857377  10465.69811517 -52740.89668894], beta : [ 1.61396258 -2.03764747  0.42368489]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions