From e4f10f0410615c0a0aa3d62b295037df6bf1e060 Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Tue, 5 Mar 2024 10:21:17 +0000 Subject: [PATCH 1/2] removed ticks --- burnman/tools/plot.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/burnman/tools/plot.py b/burnman/tools/plot.py index 7b875d59a..7171e4ebe 100644 --- a/burnman/tools/plot.py +++ b/burnman/tools/plot.py @@ -102,12 +102,12 @@ def plot_projected_elastic_properties( ticks = [] lines = [] for i, prp in enumerate(prps): - title, item = prp + title, values = prp axes[i].set_title(title) - vmin = np.min(item) - vmax = np.max(item) + vmin = np.min(values) + vmax = np.max(values) spacing = np.power(10.0, np.floor(np.log10(vmax - vmin))) nt = int((vmax - vmin - vmax % spacing + vmin % spacing) / spacing) if nt == 1: @@ -124,14 +124,14 @@ def plot_projected_elastic_properties( ticks.append(np.linspace(tmin, tmax, nt)) contour_sets.append( axes[i].contourf( - theta, r, item, n_divs, cmap=plt.cm.jet_r, vmin=vmin, vmax=vmax + theta, r, values, n_divs, cmap="rainbow", vmin=vmin, vmax=vmax ) ) lines.append( axes[i].contour( - theta, r, item, ticks[-1], colors=("black",), linewidths=(1,) + theta, r, values, ticks[-1], colors=("black",), linewidths=(1,) ) ) - axes[i].set_yticks([100]) + axes[i].set_yticks([]) return contour_sets, ticks, lines From ddf58d6a0d5571f904e1a19d2ae637013019b737 Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Tue, 5 Mar 2024 10:21:29 +0000 Subject: [PATCH 2/2] assert Phi=0 at standard state --- burnman/classes/anisotropicmineral.py | 8 ++++++++ burnman/tools/plot.py | 2 +- contrib/anisotropic_eos/cubic_fitting_second_form.py | 8 ++++---- .../anisotropic_eos/cubic_fitting_second_form_atherm.py | 4 ++-- .../cubic_fitting_second_form_only_therm.py | 4 ++-- .../anisotropic_eos/orthorhombic_fitting_second_form.py | 8 ++++---- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/burnman/classes/anisotropicmineral.py b/burnman/classes/anisotropicmineral.py index 6c1d1c9a0..00ea07aa1 100644 --- a/burnman/classes/anisotropicmineral.py +++ b/burnman/classes/anisotropicmineral.py @@ -204,6 +204,14 @@ def __init__( self.anisotropic_params = anisotropic_parameters self.psi_function = psi_function + Psi_Voigt0 = self.psi_function(0.0, 0.0, self.anisotropic_params)[0] + if not np.all(Psi_Voigt0 == 0.0): + raise ValueError( + "All elements of Psi should evaluate to zero at " + "standard state. The current array evaluates to: " + f"{Psi_Voigt0}" + ) + # cell_vectors is the transpose of the cell tensor M self.cell_vectors_0 = cell_parameters_to_vectors(cell_parameters) diff --git a/burnman/tools/plot.py b/burnman/tools/plot.py index 7171e4ebe..0735fab27 100644 --- a/burnman/tools/plot.py +++ b/burnman/tools/plot.py @@ -124,7 +124,7 @@ def plot_projected_elastic_properties( ticks.append(np.linspace(tmin, tmax, nt)) contour_sets.append( axes[i].contourf( - theta, r, values, n_divs, cmap="rainbow", vmin=vmin, vmax=vmax + theta, r, values, n_divs, cmap=plt.cm.jet_r, vmin=vmin, vmax=vmax ) ) lines.append( diff --git a/contrib/anisotropic_eos/cubic_fitting_second_form.py b/contrib/anisotropic_eos/cubic_fitting_second_form.py index d55a0dfbd..6a96110f3 100644 --- a/contrib/anisotropic_eos/cubic_fitting_second_form.py +++ b/contrib/anisotropic_eos/cubic_fitting_second_form.py @@ -61,8 +61,8 @@ def psi_func(f, Pth, params): Psi = ( 0.0 + params["a"] * f - + params["b_1"] * np.exp(params["c_1"] * f) - + params["b_2"] * np.exp(params["c_2"] * f) + + params["b_1"] * (np.exp(params["c_1"] * f) - 1.0) + + params["b_2"] * (np.exp(params["c_2"] * f) - 1.0) ) Psi = Psi + Pth / 1.0e9 * ( params["b_3"] * np.exp(params["c_3"] * f) @@ -379,8 +379,8 @@ def cubic_misfit(x, imin): f'the isotropic model: $V_0$: {m.params["V_0"]*1.e6:.5f} cm$^3$/mol, ' f'$K_0$: {m.params["K_0"]/1.e9:.5f} GPa, ' f'$K\'_0$: {m.params["Kprime_0"]:.5f}, ' - f'$\Theta_0$: {m.params["Debye_0"]:.5f} K, ' - f'$\gamma_0$: {m.params["grueneisen_0"]:.5f}, ' + f'$\\Theta_0$: {m.params["Debye_0"]:.5f} K, ' + f'$\\gamma_0$: {m.params["grueneisen_0"]:.5f}, ' f'and $q_0$: {m.params["q_0"]:.5f}.' ) diff --git a/contrib/anisotropic_eos/cubic_fitting_second_form_atherm.py b/contrib/anisotropic_eos/cubic_fitting_second_form_atherm.py index 6a48fb046..f45b8e956 100644 --- a/contrib/anisotropic_eos/cubic_fitting_second_form_atherm.py +++ b/contrib/anisotropic_eos/cubic_fitting_second_form_atherm.py @@ -53,8 +53,8 @@ def psi_func(f, Pth, params): Psi = ( 0.0 + params["a"] * f - + params["b_1"] * np.exp(params["c_1"] * f) - + params["b_2"] * np.exp(params["c_2"] * f) + + params["b_1"] * (np.exp(params["c_1"] * f) - 1.0) + + params["b_2"] * (np.exp(params["c_2"] * f) - 1.0) ) dPsidPth = 0.0 * params["b_1"] return (Psi, dPsidf, dPsidPth) diff --git a/contrib/anisotropic_eos/cubic_fitting_second_form_only_therm.py b/contrib/anisotropic_eos/cubic_fitting_second_form_only_therm.py index 2e8bc606a..d58a91843 100644 --- a/contrib/anisotropic_eos/cubic_fitting_second_form_only_therm.py +++ b/contrib/anisotropic_eos/cubic_fitting_second_form_only_therm.py @@ -114,8 +114,8 @@ def psi_func(f, Pth, params): Psi = ( 0.0 + params["a"] * f - + params["b_1"] * np.exp(params["c_1"] * f) - + params["b_2"] * np.exp(params["c_2"] * f) + + params["b_1"] * (np.exp(params["c_1"] * f) - 1.0) + + params["b_2"] * (np.exp(params["c_2"] * f) - 1.0) ) Psi = Psi + Pth / 1.0e9 * ( params["b_3"] * np.exp(params["c_3"] * f) diff --git a/contrib/anisotropic_eos/orthorhombic_fitting_second_form.py b/contrib/anisotropic_eos/orthorhombic_fitting_second_form.py index 5615ffcf5..43dfe4529 100644 --- a/contrib/anisotropic_eos/orthorhombic_fitting_second_form.py +++ b/contrib/anisotropic_eos/orthorhombic_fitting_second_form.py @@ -100,8 +100,8 @@ def psi_func(f, Pth, params): Psi = ( 0.0 + params["a"] * f - + params["b_1"] * np.exp(params["c_1"] * f) - + params["b_2"] * np.exp(params["c_2"] * f) + + params["b_1"] * (np.exp(params["c_1"] * f) - 1.0) + + params["b_2"] * (np.exp(params["c_2"] * f) - 1.0) + params["d"] * Pth / 1.0e9 ) dPsidPth = params["d"] / 1.0e9 @@ -393,8 +393,8 @@ def orthorhombic_misfit(x, imin): f'the isotropic model: $V_0$: {m.params["V_0"]*1.e6:.5f} cm$^3$/mol, ' f'$K_0$: {m.params["K_0"]/1.e9:.5f} GPa, ' f'$K\'_0$: {m.params["Kprime_0"]:.5f}, ' - f'$\Theta_0$: {m.params["Debye_0"]:.5f} K, ' - f'$\gamma_0$: {m.params["grueneisen_0"]:.5f}, ' + f'$\\Theta_0$: {m.params["Debye_0"]:.5f} K, ' + f'$\\gamma_0$: {m.params["grueneisen_0"]:.5f}, ' f'and $q_0$: {m.params["q_0"]:.5f}.' )