Skip to content

inequality equation is checked without any margin #3777

@jjwalkowiak

Description

@jjwalkowiak

Describe the issue

I don't know if this is a bug or a feature, but the current setup of the solver stops around 20% of my cases from converging and adds unnecessary iterations to most of them. I think since: #3238 the constrains have no error-margin when they are evaluated, so if I push to many limits at once, I can't get convergence just because of the numerical accuracy.

The solver is very unreliable because of that and small changes to the input can decide between converged/non-converged solution. See #3330 for example

In my fork I just changed one line https://github.com/ukaea/PROCESS/blob/165fcc553ec0c50a0d7070494e17c6ab9a4d21c1/process/solver.py#L209C13-L209C50

from:
return bool(np.all(result.ie >= 0.0))
into:
return bool(np.all(result.ie >= -1e-8))

And it saves me a lot of trouble with non-converged cases. I don't see a reason to push it to the exact 0.0, but maybe I miss something. Also, I assumed that it checks the normalized residue, so 1e-8 seems a reasonable margin. But if this is non-normalized value or something completely different, then maybe this limit should be different.

Metadata

Metadata

Assignees

Labels

ConvergenceSolver or convergence-related problems

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions