Skip to content

Commit

Permalink
assert Phi=0 at standard state
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmyhill committed Mar 5, 2024
1 parent e4f10f0 commit ddf58d6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
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
2 changes: 1 addition & 1 deletion burnman/tools/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
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

0 comments on commit ddf58d6

Please sign in to comment.