Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert Phi=0 at standard state #573

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions burnman/classes/anisotropicmineral.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions burnman/tools/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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=plt.cm.jet_r, 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
8 changes: 4 additions & 4 deletions contrib/anisotropic_eos/cubic_fitting_second_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}.'
)

Expand Down
4 changes: 2 additions & 2 deletions contrib/anisotropic_eos/cubic_fitting_second_form_atherm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions contrib/anisotropic_eos/orthorhombic_fitting_second_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}.'
)

Expand Down
Loading