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
still problem with solver #102
Comments
Sorry, Eli, I'm a little confused on what exactly you are saying is incorrect. Are you saying all of those results are incorrect except for the last one? What were you expecting to see? Note that you can format your code nicely by wrapping it in three backticks, e.g. ``` would format to
|
Hi Brandon,
Yes, all the results except for the last one are incorrect.
There should be solubility of iron in aluminium on the order of x(Fe)=1e-4.
Instead, in these calculations (except the last) we get x(Fe)=2e-11.
So this is an error.
Eli
בתאריך 18 ביוני 2017 19:13, "Brandon Bocklund" <notifications@github.com>
כתב:
… Sorry, Eli, I'm a little confused on what exactly you are saying is
incorrect. Are you saying all of those results are incorrect except for the
last one?
What were you expecting to see?
Note that you can format your code nicely by wrapping it in three
backticks, e.g.
```
eq = equilibrium(dbf, comps, phases, conditions)
```
would format to
eq = equilibrium(dbf, comps, phases, conditions)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#102 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM2xTgNhLFUgUVDFuwth5o5nyYbyfhPyks5sFVq7gaJpZM4N9fn->
.
|
Which version of pycalphad are you running? |
0.5 the last release.
בתאריך 18 ביוני 2017 19:51, "Brandon Bocklund" <notifications@github.com>
כתב:
… Which version of pycalphad are you running?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#102 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM2xTuayHWjlTgT0gl_1q4-HodLjh_Jiks5sFWOWgaJpZM4N9fn->
.
|
I am running on the HEAD of the develop branch (not much further than the 0.5.1 release) and on the Al-Fe_sei database straight from NIMS I have the following results that seem to be more in the ballpark (default from pycalphad import Database, equilibrium, variables as v
db_file = '/Users/brandon/Box Sync/databases/nims-databases/Al-Fe_sei.tdb'
dbf = Database(db_file)
comps = ['AL', 'FE', 'VA']
phases = ['FCC_A1', 'LIQUID']
conditions = {v.X('FE'): .0028156, v.T: 931.385693359375, v.P: 1.0e5}
eq = equilibrium(dbf, comps, phases, conditions)
eq.X
Then same conditions with eq = equilibrium(dbf, comps, phases, conditions, calc_opts={'pdens': 2000})
Increasing the point density to 10000 goes back to the answer calculated by eq = equilibrium(dbf, comps, phases, conditions, calc_opts={'pdens': 10000})
So it looks like that particular point density is giving some problems. Some coming changes by @richardotis should improve the solver further. |
Further, it looks like the 2000 point density isn't taking steps (verbose output):
|
I ran all the examples with pdens=500.
It removed most of the errors but not all.
Look at the fourth equilibrium:
{T: 929.518, X_FE: 0.005477, P: 100000.0}
phases in equilibrium
['FCC_A1' 'LIQUID']
compositions of equilibrium phases
[[ 1.00000000e+00 2.65337850e-11]
[ 9.94442085e-01 5.55791522e-03]]
anyway, I thought increasing pdens can only impove the accuracy of the
calculation. Here it seems to do the opposite.
Eli
…On Sun, Jun 18, 2017 at 9:11 PM, Brandon Bocklund ***@***.***> wrote:
Further, it looks like the 2000 point density isn't taking steps (verbose
output):
Calculation Backend: Compiled (autowrap)
Components: AL FE VA
Phases: FCC_A1 LIQUID [done]
('NEW_L_MULTIPLIERS', array([ 472.5425895 , -1829.33937232, 7065.81999672,
-37723.13634075, -147658.20014453]))
('old_driving_force', -38032.669484192571)
(1.0, -38032.669495361733, 2.6818302023556839e-09)
('alpha', 1.0)
('Phases', [CompositionSet(FCC_A1, [ 1.00000000e+00 2.66513395e-11]), CompositionSet(LIQUID, [ 0.99700143 0.00299857])])
('step', array([ -2.56502130e-11, 2.56513395e-11, -1.44832580e-16,
2.92931975e-06, -2.92931976e-06, -9.15504689e-04,
9.15504689e-04]))
('Site fractions', array([ 1.00000000e+00, 2.66513395e-11, 1.00000000e+00,
9.97001429e-01, 2.99857143e-03]))
('Phase fractions', array([ 0.06102043, 0.93897957]))
('Chemical potentials', array([ -37723.13634075, -147658.20014453]))
('Chem pot progress', array([ -3.58490070e-06, -6.61725708e-03]))
('Energy progress', 0.00028365789330564439)
('Driving force', 1.1037191143259406e-05)
No progress
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#102 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM2xTmF5W2hOPKGpdzJpOw5xzYpUZX_nks5sFWhvgaJpZM4N9fn->
.
|
The python is
python 3.5.2 |Anaconda 4.3.1 (64-bit)| (default, Jul 2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
>> pycalphad.__version__
'0.5'
בתאריך 18 ביוני 2017 19:56, "Eli Brosh" <ebrosh1@gmail.com> כתב:
… 0.5 the last release.
בתאריך 18 ביוני 2017 19:51, "Brandon Bocklund" ***@***.***>
כתב:
> Which version of pycalphad are you running?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#102 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AM2xTuayHWjlTgT0gl_1q4-HodLjh_Jiks5sFWOWgaJpZM4N9fn->
> .
>
|
You could try a higher pdens that is not 2000. E.g. 4000 worked for me for the conditions
Indeed, increasing the point density should only be positive and it should never make your answer worse. My understanding is (@richardotis could explain better) that in the last example, with both a point density of 500 and 2000, your initial sampling of the energy surface is 'lucky' (unlucky in this case) in that the points that are sampled are the global minimum under the equilibrium conditions in the solver. In both cases with the conditions I think this has to do with some trickiness of small solubilities, the slope of the free energy surface in that area, and the sampling resolution in that small region. |
Can we set a tighter requirement for conversion?
I mean, a condition for when the program thinks it converged has to be
defined somehow.
Perhaps the difference between two iterations has to be smaller than a
certain number.
Can we pass such parameter to the solver?
Eli
…On Sun, Jun 18, 2017 at 9:43 PM, Brandon Bocklund ***@***.***> wrote:
You could try a higher pdens that is not 2000. E.g. 4000 worked for me for
the conditions
{T: 929.518, X_FE: 0.005477, P: 100000.0}
Indeed, increasing the point density should only be positive and it should
never make your answer worse. My understanding is ***@***.***
<https://github.com/richardotis> could explain better) that in the last
example, with both a point density of 500 and 2000, your initial sampling
of the energy surface is 'lucky' (unlucky in this case) in that the points
that are sampled are the global minimum under the equilibrium conditions in
the solver.
In both cases with the conditions {T: 929.518, X_FE: 0.005477, P:
100000.0} and pdens=500 or pdens=2000 you are getting convergence on the
initial step.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#102 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM2xTmtiS4jojxZH4hXlntbSTDoar401ks5sFW_FgaJpZM4N9fn->
.
|
The conditions are controlled in eqsolver.pyx. The conditions themselves are at the top of the file lines 14-21 and they are checked in lines 485-488. There is currently no way to set these programmatically from equilibrium() or calculate() because they are hardcoded there. You are, of course, free to change them at your own risk. In this case you can see that the driving force criteria is that any driving force below |
I would like to try change the conditions in eqsolver.pyx
I searched for eqsolver in my computer and found two files
/home/ebrosh/anaconda3/lib/python3.5/site-packages/pycalphad/core/
eqsolver.cpython-35m-x86_64-linux-gnu.so
/home/ebrosh/anaconda3/pkgs/pycalphad-0.5-py35_0/lib/python3.5/site-packages/pycalphad/core//
eqsolver.cpython-35m-x86_64-linux-gnu.so
So, where is eqsolver.pyx and how can I change it?
Regards,
Eli
…On Sun, Jun 18, 2017 at 9:56 PM, Brandon Bocklund ***@***.***> wrote:
The conditions are controlled in eqsolver.pyx
<https://github.com/pycalphad/pycalphad/blob/develop/pycalphad/core/eqsolver.pyx>.
The conditions themselves are at the top of the file lines 14-21 and they
are checked in lines 485-488.
There is currently no way to set these programmatically from equilibrium()
or calculate() because they are hardcoded there. You are, of course, free
to change them at your own risk.
In this case you can see that the driving force criteria is that any
driving force below 1e-4 is converged and the points we have on the
initial step from my comment above with pdens=2000 happens to give
driving force of 1.103e-5 so it is 'converged' even though the actual
answer is incorrect.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#102 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM2xTi5dt9Ah_GhtPgpRtIDcjbZOAjrhks5sFXL0gaJpZM4N9fn->
.
|
In order to change the values you'll have to install pycalphad from source see the installation guide for installing development versions. Every time you make a change in |
Thank you very much Brandon.
I will try to recompile.
Also, I ask if possible to include in the next release a feature that can
allow to manipulate these conditions without reinstalling.
Best regards,
Eli
…On Sun, Jun 18, 2017 at 10:28 PM, Brandon Bocklund ***@***.*** > wrote:
.pyx files are compiled by Cython at build time. The files that end in
*.so are the compiled versions of eqsolver.
In order to change the values you'll have to install pycalphad from source
see the installation guide
<https://pycalphad.org/docs/latest/INSTALLING.html#development-versions-advanced-users>
for installing development versions.
Every time you make a change in eqsolver.pyx, you'll have to recompile.
The easiest way is to go to pycalphad's root directory (with the setup.py)
and run python setup.py build_ext
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#102 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM2xTsxWCzRNiD-LKjbzoYDyQANDGCavks5sFXpcgaJpZM4N9fn->
.
|
We will consider that suggestion, thank you! Let us know if you need anything else. Ok to close this? |
Yes.
…On Sun, Jun 18, 2017 at 10:42 PM, Brandon Bocklund ***@***.*** > wrote:
We will consider that suggestion, thank you!
Let us know if you need anything else. Ok to close this?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#102 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM2xTgpgH4wFMcCEJ_sjyVSNStPZy0y_ks5sFX2igaJpZM4N9fn->
.
|
The `add_ideal_exclusions` function was added by pycalphad#102 in June 2019 and was also deprecated at that time for removal in ESPEI 0.8. This function and its usages are now removed in favor of manually adding the exclusions or using tags.
Hello Richard and Brandon,
I still find problems with the equilibrium solver.
See below some apparently simple calculations that give wrong results.
The calculations are done on the Al-Fe system on the Al-rich side.
At several temperatures, the calculation results in a wrong composition for the FCC_A1 phase.
Here is the script (after the script I give the results):
#!/usr/bin/env python3
-- coding: utf-8 --
"""
Created on Sun Jun 18 13:45:49 2017
@author: ebrosh
"""
from pycalphad import Database, equilibrium
import pycalphad.variables as v
db = Database('/home/ebrosh/Documents/ebroshWorks/tcworks/Al-Fe-solidification/alfe_sei.TDB')
print('conditions')
conditions={v.X('FE'): .0028156, v.T: 931.385693359375, v.P: 1.0e5}
print(conditions)
data = equilibrium(db, ['AL', 'FE','VA'],['LIQUID','FCC_A1'], conditions,verbose=False,calc_opts={'pdens': 2000})
print('phases in equilibrium')
print(data['Phase'].values.squeeze())
print('compositions of equilibrium phases')
print(data['X'].values.squeeze())
print('conditions')
conditions={v.X('FE'): .00460485, v.T: 929.933, v.P: 1.0e5}
print(conditions)
data = equilibrium(db, ['AL', 'FE','VA'],['LIQUID','FCC_A1'], conditions,verbose=False,calc_opts={'pdens': 2000})
print('phases in equilibrium')
print(data['Phase'].values.squeeze())
print('compositions of equilibrium phases')
print(data['X'].values.squeeze())
print('conditions')
conditions={v.X('FE'): .0047534, v.T: 929.933, v.P: 1.0e5}
print(conditions)
data = equilibrium(db, ['AL', 'FE','VA'],['LIQUID','FCC_A1'], conditions,verbose=False,calc_opts={'pdens': 2000})
print('phases in equilibrium')
print(data['Phase'].values.squeeze())
print('compositions of equilibrium phases')
print(data['X'].values.squeeze())
print('conditions')
conditions={v.X('FE'): .005477, v.T: 929.518, v.P: 1.0e5}
print(conditions)
data = equilibrium(db, ['AL', 'FE','VA'],['LIQUID','FCC_A1'], conditions,verbose=False,calc_opts={'pdens': 2000})
print('phases in equilibrium')
print(data['Phase'].values.squeeze())
print('compositions of equilibrium phases')
print(data['X'].values.squeeze())
this last equilibrium is correct
print('conditions')
conditions={v.X('FE'): .005477, v.T: 929, v.P: 1.0e5}
print(conditions)
data = equilibrium(db, ['AL', 'FE','VA'],['LIQUID','FCC_A1'], conditions,verbose=False,calc_opts={'pdens': 2000})
print('phases in equilibrium')
print(data['Phase'].values.squeeze())
print('compositions of equilibrium phases')
print(data['X'].values.squeeze())
print('note that the last one is correct')
Results of running the script:
conditions
{P: 100000.0, T: 931.385693359375, X_FE: 0.0028156}
phases in equilibrium
['FCC_A1' 'LIQUID']
compositions of equilibrium phases
[[ 1.00000000e+00 2.66513395e-11]
[ 9.97001429e-01 2.99857143e-03]]
conditions
{P: 100000.0, T: 929.933, X_FE: 0.00460485}
phases in equilibrium
['FCC_A1' 'LIQUID']
compositions of equilibrium phases
[[ 1.00000000e+00 2.75875971e-11]
[ 9.95001245e-01 4.99875457e-03]]
conditions
{P: 100000.0, T: 929.933, X_FE: 0.0047534}
phases in equilibrium
['FCC_A1' 'LIQUID']
compositions of equilibrium phases
[[ 1.00000000e+00 2.74369001e-11]
[ 9.95001245e-01 4.99875456e-03]]
conditions
{P: 100000.0, T: 929.518, X_FE: 0.005477}
phases in equilibrium
['FCC_A1' 'LIQUID']
compositions of equilibrium phases
[[ 1.00000000e+00 2.65337850e-11]
[ 9.94442085e-01 5.55791522e-03]]
conditions
{P: 100000.0, T: 929, X_FE: 0.005477}
phases in equilibrium
['FCC_A1' 'LIQUID']
compositions of equilibrium phases
[[ 9.99845081e-01 1.54919219e-04]
[ 9.93613993e-01 6.38600654e-03]]
note that the last one is correct
Can this be fixed ?
Best regards,
Eli
The text was updated successfully, but these errors were encountered: