Closed jranalli closed 1 year ago
This is something that we should be able to address in the code where _argparse identifies the solution region. It should be possible to detect the possibility for multiple solutions. I'll throw this on the pile for the next release.
OK, this is actually yet another instance of issue #46. The non-monotonic behavior is due to extreme extrapolation outside of reasonable densities. That also explains why the existing bracketing algorithms weren't preventing the problem. A temporary fix is to just tighten the density limits set at the back-end.
>>> ch4 = pm.get('mp.CH4')
>>> ch4.data['dlim'] = [0, 1000.]
>>> ch4.d(s=-5.529, T=223)
array([460.287385])
This is now resolved with new density limits in version 2.2.2.
I encountered two example test cases where we get iteration/bracketing issues due to the function we're iterating becoming non-monotonic at the conditions of interest. This means there will always be multiple possible solutions, which is a difficult problem to fix period, but right now they're not even reporting a possible answer because they choke on the bracketing.
Here if we call things based on entropy
The underlying codes do an iteration of _s based on density. Plotting _s(d, T) reveals that two possible density values correspond to the target entropy and so the iteration code breaks.
Here's a similar test condition that results from _p(T, d)