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

Calculate gives the wrong result if pressure and temperature are not both specified. #116

bocklund opened this issue Aug 3, 2017 · 3 comments


Copy link

bocklund commented Aug 3, 2017

In the binary example, we see the following code produce this plot

from pycalphad import calculate
from pycalphad.plot.utils import phase_legend
import numpy as np

legend_handles, colorlist = phase_legend(my_phases_nbre)

fig = plt.figure(figsize=(9,6))
ax = fig.gca()
for name in my_phases_nbre:
    result = calculate(db_nbre, ['NB', 'RE'], name, T=2800, output='GM')
    ax.scatter(result.X.sel(component='RE'), result.GM,
               marker='.', s=5, color=colorlist[name.upper()])
ax.set_xlim((0, 1))
ax.legend(handles=legend_handles, loc='center left', bbox_to_anchor=(1, 0.6))


But changing the temperature to 300 or 1000000 gives the same plot (and the same values from calculate). If you specify pressure in calculate e.g. result = calculate(db_nbre, ['NB', 'RE'], name, T=2800, P=101325, output='GM') the resulting plot is

Further changes to temperature produce expected results. The energy surface plotted when P is not specified gives a similar result to T>=6000 (piecewise max in TDB). I assume this is a bug and not the intended result?

Copy link

Please make this throw an error if something isn't specified, instead of silently calculating the wrong thing, as suggested by @richardotis.

Copy link

The assigned values to statevar_dict need to be wrapped with a call to unpack_condition()
That should fix it.

Copy link

That does not fix the issue. Still investigating.

richardotis added a commit that referenced this issue Nov 5, 2017
richardotis added a commit that referenced this issue Nov 12, 2017
richardotis added a commit that referenced this issue Nov 12, 2017
richardotis added a commit that referenced this issue Nov 26, 2017
bocklund added a commit to bocklund/pycalphad that referenced this issue Aug 17, 2021
* Add recipes from the Cu-Mg example
* Add some more ESPEI background to the main page
* Make a new How-to section in the docs and reorganize appropriate things to that place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants