Closed felipeeler closed 9 months ago
The LET relperm can have infinite saturation derivatives at endpoints (Sw = Swc or Sw = 1 - Sorw) when one of its Corey exponents (L or T) is smaller than 1. Infinite valued derivatives cause the Newton solver to fail. We discussed the issue with the LET model authors. They acknowledged the problem and suggested methods to regularise the derivative. We are currently developing a more robust implementation of the LET relperm and expect to provide an update soon.
Thank you very much for the reply!
We have updated the implementation of the LET relperm such that the function and its derivative are always finite. For the implementation we followed the suggestion of the LET authors.
In case you are interested in implementation details, the key update is the introduction of the 'power_eps' function in the relperm library. When the exponent (L or T in the LET relperm model) is less than 1, power_eps returns a regularized version of the power function by using a small parameter 'eps',
power_eps(s, N) = ((s + eps)**N - eps**N)/((1+eps)**N - eps**N) for N < 1.
When the exponent (L or T) is greater or equal 1, power_eps is equivalent to the standard power function,
power_eps(s, N) = s**N for N >= 1.
The eps parameter can be specified as the last input parameter for the Rlp2PLET and Rlp2PCorey models; eps = 0.0001 by default.
In addition, to further increase robustness, we introduced checks on input parameters for Corey and LET relperm models. Parameters will be accepted only, if they are within a physically acceptable range (0 <= Sr1 < 1, 0 < N1, Sr1 + Sr2 < 1, etc.).
With the updated implementation, your example problem now runs without any problem. Thanks for sharing the issue!
I really appreciate it! Thank you!
The solver crashes for some values of the parameters reported as feasible by the authors of the paper "SCA2005-32". The crash is at the .solve() call. It points to line 545 (_solver_result = solve_1D2Pversion)
The authors of LET mode say:
Using values like the ones listed below will cause this crash:
I'm pasting some sample code:
The main difference is that I'm using another Pc function, but I think it does not influence the behavior I'm reporting. This code works fine with L, E, T values ≥ 1.