Files
CoolProp/include/Solvers.h
msaitta-mpr 15720ab6cc Prevent crashes near critical density due to saturation calc (#2173)
* Add extrapolating secant solver

Sometimes, the backwards ancillary solver fails near the critical
point. This can happen if the ancillary function at its limit
(i.e., critical temperature) does not reach the desired seek value
(e.g., density). Because we are only usually using these to get a
guess value, we can extrapolate them without issue to avoid a crash
near the critical point.

This helps to resolve #2154.

* Stabilize saturation curve solution

Solving for the saturation curve near the critical point can be
unstable. This commit fixes that in a few ways.

1) Prevent the solver from overshooting and prevent a negative
temperature or density.

2) If it does fail, try again with a smaller omega value.

If the solver fails after all of this, we will still throw to allow
something downstream to handle it.

This helps to address issue #2154.

* Move saturation_D_pure max iterations to options
2022-10-28 18:08:13 -04:00

4.1 KiB