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

a switch in chemical potential calculation #21

Closed
broshe opened this issue Sep 9, 2015 · 11 comments
Closed

a switch in chemical potential calculation #21

broshe opened this issue Sep 9, 2015 · 11 comments
Assignees
Labels

Comments

@broshe
Copy link

broshe commented Sep 9, 2015

I calculated the chemical potential in of Fe in Al-Fe liquid.
Here is the code:
db = Database('alfe_sei.TDB')
data = equilibrium(db, ['FE', 'AL'], 'LIQUID', {v.X('FE'): .2, v.T: Trange, v.P: 1e5},verbose=False)
muFe=data['MU'].sel( component='FE').data[0][0][0]
print('Mu(Fe)=',muFe)

The output is
MuFe=-133484.35563831546

Now, this is not what I got from thermo-calc with the same calculation.
Interestingly, the value of -133484.356 is the chemical potential of Al for the same conditions.
So, perhaps pycalphad somehow switched between the two potentials.

Best regards,
Eli

@richardotis
Copy link
Collaborator

Hi Eli, what is the value of Trange?

@broshe
Copy link
Author

broshe commented Sep 9, 2015

Sorry,
Trange=2000 (K)

On Wed, Sep 9, 2015 at 11:01 PM, Richard Otis notifications@github.com
wrote:

Hi Eli, what is the value of Trange?


Reply to this email directly or view it on GitHub
https://github.com/richardotis/pycalphad/issues/21#issuecomment-139029940
.

@richardotis
Copy link
Collaborator

Okay, I can reproduce your value. Can you tell me what Thermo-Calc's value for MU(Fe) is?

@broshe
Copy link
Author

broshe commented Sep 9, 2015

POLY_3:s-c t=2000 x(fe)=.2 p=1e5 n=1
POLY_3:ch_st ph *=sus
POLY_3:ch_st ph liquid=ent 0
POLY_3:l-c
T=2000, X(FE)=0.2, P=1E5, N=1
DEGREES OF FREEDOM 0
POLY_3:c-e
Using global minimization procedure
Calculated 137 grid points in 0 s
Found the set of lowest grid points in 0 s
Calculated POLY solution 0 s, total time 0 s
POLY_3:show mu(fe)

  • MU(FE)=-184306.01*
    POLY_3:show mu(al)
    MU(AL)=-133815.12

On Wed, Sep 9, 2015 at 11:03 PM, Richard Otis notifications@github.com
wrote:

Okay, I can reproduce your value. Can you tell me what Thermo-Calc's value
for MU(Fe) is?


Reply to this email directly or view it on GitHub
https://github.com/richardotis/pycalphad/issues/21#issuecomment-139030555
.

@richardotis
Copy link
Collaborator

You appear to be correct. I've also checked the energy surface and the error becomes self-evident. I'll investigate this further.
image

@richardotis
Copy link
Collaborator

The overall molar Gibbs energy I compute at 2000 K and X(Fe) = 0.2 is -144066.749. Does Thermo-Calc get close to that value? I'm trying to figure out if this issue is just a display error or if there's a more serious bug in the equilibrium engine.

@broshe
Copy link
Author

broshe commented Sep 9, 2015

Thermo-calc gives:
GM=-143913.3

On Wed, Sep 9, 2015 at 11:23 PM, Richard Otis notifications@github.com
wrote:

The overall molar energy I compute at 2000 K and X(Fe) = 0.2 is
-144066.749. Does Thermo-Calc get close to that value? I'm trying to
figure out if this issue is just a display error or if there's a more
serious bug in the equilibrium engine.


Reply to this email directly or view it on GitHub
https://github.com/richardotis/pycalphad/issues/21#issuecomment-139035636
.

@richardotis
Copy link
Collaborator

As you suggested this looks like an error with sorting component names. If you change your condition to X(AL)=0.8, which should be equivalent, the chemical potentials are now the same as Thermo-Calc and the reported energy is -143913.2912436. What appears to be happening is pycalphad is flipping the component names around, so the equilibrium it's reporting is for X(FE)=0.8. The result is correct, just for the wrong conditions. I will write a fix and test and ping you when the bugfix release is pushed out.

@richardotis richardotis self-assigned this Sep 9, 2015
@broshe
Copy link
Author

broshe commented Sep 9, 2015

Thanks Richard,
I tried the calculation with x(Al)=0.8 instead of x(Fe)=.2. This gives the
correct results.
Eli

On Wed, Sep 9, 2015 at 11:42 PM, Richard Otis notifications@github.com
wrote:

As you suggested this looks like an error with sorting component names. If
you change your condition to X(AL)=0.8, which should be equivalent, the
chemical potentials are now the same as Thermo-Calc and the reported energy
is -143913.2912436. What appears to be happening is pycalphad is flipping
the component names around, so the equilibrium it's reporting is for
X(FE)=0.8. The result is correct, just for the wrong conditions. I will
write a fix and test and ping you when the bugfix release is pushed out.


Reply to this email directly or view it on GitHub
https://github.com/richardotis/pycalphad/issues/21#issuecomment-139039722
.

@richardotis
Copy link
Collaborator

@broshe pycalphad 0.2.1 has been released, which includes a fix for this issue. pip install -U pycalphad to update. Please let me know if this resolves your issue. (Make sure the value of pycalphad.__version__ when you print it is 0.2.1, after the update.)

By the way, these are exactly the kinds of bugs I'm looking to find, so please keep on reporting and I'll fix them as quickly as I can.

@broshe
Copy link
Author

broshe commented Sep 11, 2015

Hi Richard,
I tried to install the new pycalphad
by using
pip install -U pycalphad
or
pip3 install -U pycalphad

In both cases the installation failed.
The log file is attached.
What can be done?

Thanks,
Eli

On Thu, Sep 10, 2015 at 9:55 PM, Richard Otis notifications@github.com
wrote:

@broshe https://github.com/broshe pycalphad 0.2.1 has been released,
which includes a fix for this issue. pip install -U pycalphad to update.
Please let me know if this resolves your issue. (Make sure the value of
pycalphad.version when you print it is 0.2.1, after the update.)

By the way, these are exactly the kinds of bugs I'm looking to find, so
please keep on reporting and I'll fix them as quickly as I can.


Reply to this email directly or view it on GitHub
https://github.com/richardotis/pycalphad/issues/21#issuecomment-139344180
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants