geodynamics / burnman

BurnMan is a library for modeling mantle thermodynamics and thermoelasticity constrained by mineral physics experiments.
https://geodynamics.github.io/burnman/
GNU General Public License v2.0
54 stars 41 forks source link

Improve set_state_with_volume #520

Closed bobmyhill closed 2 years ago

bobmyhill commented 2 years ago

This PR adds a try/except to Material.set_state_with_volume that ensures that the root finding procedure doesn't fail just because brentq tries a pressure that is outside the range of validity of the EoS.

The tweak causes one of the existing tests to fail (because it was designed to test the failure case!). That test has now been replaced with one that would have previously failed.