Skip to content

ENH: Molar volume #466

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

Merged
merged 7 commits into from
Apr 9, 2023
Merged

ENH: Molar volume #466

merged 7 commits into from
Apr 9, 2023

Conversation

mfrichtl
Copy link
Contributor

@mfrichtl mfrichtl commented Apr 7, 2023

This PR is a partial implementation of the molar volume model from Lu, Selleby, and Sundman (2005). It includes the nonmagnetic thermal expansion, magnetic contribution to molar volume, and the contribution to the Gibbs free energy in cases where the molar volume is independent of pressure. Tests for these terms are also included. There are no required changes to the dependencies of pycalphad. This PR is inclusive of PR #423.

The pressure dependence of the molar volume can be implemented in the future via VC and VK parameters and Equations 9, 10, and 12 of the reference paper. It will require the exponential integral to be implemented into symengine.

@codecov
Copy link

codecov bot commented Apr 7, 2023

Codecov Report

Merging #466 (f07ac7a) into develop (8f20e2a) will increase coverage by 0.03%.
The diff coverage is 97.61%.

@@             Coverage Diff             @@
##           develop     #466      +/-   ##
===========================================
+ Coverage    90.25%   90.29%   +0.03%     
===========================================
  Files           50       50              
  Lines         7726     7768      +42     
===========================================
+ Hits          6973     7014      +41     
- Misses         753      754       +1     
Impacted Files Coverage Δ
pycalphad/model.py 91.94% <95.00%> (+0.09%) ⬆️
pycalphad/tests/test_calculate.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@richardotis
Copy link
Collaborator

richardotis commented Apr 8, 2023

Thanks for your work. Where do you need the exponential integral function to complete the implementation? [Ed. Note: In this thread we worked out that I was looking at the wrong paper. The correct paper was added as a link in the PR text.] We may be able to rewrite or approximate the expression in terms of supported functions. Is it just the Debye function?

I'll start taking a look at the code now. When combined with the new dot derivative support in #432, we'll be able to compute coefficients of thermal expansion (CTEs) in the vicinity of the magnetic transition.

@richardotis
Copy link
Collaborator

If it's just the Debye function, I'll note some recent work investigating integral-free forms of the Debye function: https://www.mdpi.com/2227-7390/10/10/1745

In particular, Equation 71 in that paper shows how we could write the Debye function in terms of several polylogarithms, which isn't itself novel; the problem has always been that polylogarithms are difficult to implement numerically over the entire domain of $\Theta/T$ we care about. However, this new work shows a form where we would only need to call polylogarithms in the form $\mathrm{Li}_{s}(e^{-\Theta/T})$, which would restrict the domain to $0 &lt; z &lt; 1$. That would permit the use of relatively well-behaved (and simple) power series approximations of the polylogarithms.

@mfrichtl
Copy link
Contributor Author

mfrichtl commented Apr 9, 2023

@richardotis, the model uses the exponential integral function, actually the paper appears to use the E1. And its inverse. There may be some what to transform it into a Debye function, but there are numerical implementations of the exponential integral as well, such as this one: https://link.springer.com/article/10.1007/s11075-017-0331-z

I've played around a bit with the full implementation in Lu's paper and haven't yet found the magic combinations of the VC and VK parameters that match the experimental results he presents for iron using Scipy's exponential integral functions. It's entirely possible I'm missing something obvious, but my results thus far are incorrect. They're in the right ballpark, but I'm just not able to fit the experimental data with the parameters provided in the paper. I thought at least having the atmospheric molar volume model implemented into pycalphad was a good first step, with a note for future implementation of the pressure dependence.

@richardotis
Copy link
Collaborator

We can proceed without adding more features to this PR. I just wanted the problem documented for future reference. Where in the paper do you see the E1 function? I keep missing it.

@mfrichtl
Copy link
Contributor Author

mfrichtl commented Apr 9, 2023

Equation 6 in the paper defines Ei(z), but the equation itself matches the definition of E1(z). They're pretty similar though, with Ei(-z) = -E1(z). https://dlmf.nist.gov/6.2#E1 has more. I'm not terribly familiar with this function, so I could be misinterpreting.

@richardotis
Copy link
Collaborator

We're talking about this paper, right? https://dx.doi.org/10.1016/j.actamat.2005.01.049
Equation 6 in that paper looks to me like this:
image
I can't find the exponential integral function used anywhere in that paper.

@richardotis
Copy link
Collaborator

Oh I see, you probably mean https://doi.org/10.1016/j.calphad.2005.04.001 - they were very productive that year, good reminder on the importance of DOIs!

@mfrichtl
Copy link
Contributor Author

mfrichtl commented Apr 9, 2023

Ahh I see the confusion. Lu was lead author on 3 different papers on this topic in 2005. I'm actually referring to this paper: https://www.sciencedirect.com/science/article/abs/pii/S0364591605000349.
Equation 6 is:
image

which I think is actually the definition of the E1.
And the full molar volume model is:

image

@richardotis richardotis merged commit e345631 into pycalphad:develop Apr 9, 2023
@richardotis
Copy link
Collaborator

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants