From aefe9bc1b6eebc232ccb188c33ff5c6214ddf1db Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Mon, 25 Nov 2024 10:45:36 +0000 Subject: [PATCH] fix BM4, MT pressure calcs --- burnman/eos/birch_murnaghan_4th.py | 11 +++++++---- burnman/eos/modified_tait.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/burnman/eos/birch_murnaghan_4th.py b/burnman/eos/birch_murnaghan_4th.py index 93ee5b4a..52815b28 100644 --- a/burnman/eos/birch_murnaghan_4th.py +++ b/burnman/eos/birch_murnaghan_4th.py @@ -45,14 +45,17 @@ def bulk_modulus_fourth(volume, params): def volume_fourth_order(pressure, params): - func = lambda x: birch_murnaghan_fourth(params["V_0"] / x, params) - pressure + + def delta_pressure(x): + return birch_murnaghan_fourth(params["V_0"] / x, params) - pressure + try: - sol = bracket(func, params["V_0"], 1.0e-2 * params["V_0"]) + sol = bracket(delta_pressure, params["V_0"], 1.0e-2 * params["V_0"]) except: raise ValueError( "Cannot find a volume, perhaps you are outside of the range of validity for the equation of state?" ) - return opt.brentq(func, sol[0], sol[1]) + return opt.brentq(delta_pressure, sol[0], sol[1]) def birch_murnaghan_fourth(x, params): @@ -93,7 +96,7 @@ def volume(self, pressure, temperature, params): return volume_fourth_order(pressure, params) def pressure(self, temperature, volume, params): - return birch_murnaghan_fourth(volume / params["V_0"], params) + return birch_murnaghan_fourth(params["V_0"] / volume, params) def isothermal_bulk_modulus_reuss(self, pressure, temperature, volume, params): """ diff --git a/burnman/eos/modified_tait.py b/burnman/eos/modified_tait.py index 90d176b2..f59d7399 100644 --- a/burnman/eos/modified_tait.py +++ b/burnman/eos/modified_tait.py @@ -113,7 +113,7 @@ def pressure(self, temperature, volume, params): """ Returns pressure [Pa] as a function of temperature [K] and volume[m^3] """ - return modified_tait(params["V_0"] / volume, params) + return modified_tait(volume / params["V_0"], params) def isothermal_bulk_modulus_reuss(self, pressure, temperature, volume, params): """