idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.78k stars 1.05k forks source link

Support for CALPHAD free energies with sublattice compositions #5862

Closed dschwen closed 2 years ago

dschwen commented 9 years ago

In #5787 a small code based on pycalphad was added to MOOSE. This code allows exporting free energy expressions from TDB files for use in MOOSE. CALPHAD uses the concept of sublattice compositions, whereas the phase field equations operate on the total composition fields. Two problems need to be solved:

richardotis commented 9 years ago

pycalphad already has both of those features but, as was discussed in the previous issue, you probably don't want to force the Python stack into high-performance compiled loops. I'd be happy to provide you detailed information on the numerical methods (there are some gotchas not yet published in the literature), but for deep integration I think you may be best going with OpenCalphad, a separate GPL Fortran project being developed by my colleague and friendly competitor @sundmanbo. It's similar in look-and-feel to classic Thermo-Calc, the implementation is high-quality and Prof. Sundman is very well-respected in the CALPHAD community. However I do notice there may be licensing issues with mixing GPL and LGPL code.

(I do recommend sticking with pycalphad for #5787 though because pycalphad's TDB parser is a bit more robust in my experience.)

dschwen commented 9 years ago

I thought as a first step I export the mole fraction constraint equation from pycalphad and use a Lagrange Multiplier kernel (similar to the multiphase stuff) to minimize sublattice concentrations. I guess I still have to figure out the part where I compute the chemical potentials.

The nexts steps will probably involve coupling to an external code to deal with global vs. local minimization issues.

richardotis commented 9 years ago

The chemical potentials are the Lagrange multipliers of the overall mass balance constraints.

dschwen commented 9 years ago

Ahh, I see. That leaves the challenge of obtaining their derivatives and second derivatives. For the Jacobians.

On Fri, Oct 23, 2015, 11:49 AM Richard Otis notifications@github.com wrote:

The chemical potentials are the Lagrange multipliers of the overall mass balance constraints.

— Reply to this email directly or view it on GitHub https://github.com/idaholab/moose/issues/5862#issuecomment-150645127.

dschwen commented 9 years ago

This might work for the derivatives: http://mooseframework.org/wiki/PhysicsModules/PhaseField/CALPHAD/CalphadDerivations/

sundmanbo commented 9 years ago

Richard included me in this discussion recently and I do not know if he has suggested you look at my paper published in Comp.Mat.Sci, Vol 101 (2015), p 127-137. That describes a complete minimizer used in the Open Calphad software. You can download the latest version from the opencalphad repository at github. It has an isoC interface and use OpenMp for parallelization.

Best wishes

Bosse

2015-10-26 21:08 GMT+01:00 Daniel Schwen notifications@github.com:

This might work for the derivatives:

http://mooseframework.org/wiki/PhysicsModules/PhaseField/CALPHAD/CalphadDerivations/

— Reply to this email directly or view it on GitHub https://github.com/idaholab/moose/issues/5862#issuecomment-151268141.

richardotis commented 3 years ago

I saw your recent excellent paper @dschwen https://doi.org/10.1016/j.commatsci.2021.110466 Are the improvements needed to make sublattices work with MOOSE available open source? I'd be interested in seeing or helping put together something, at the level of tutorial or blog post, for how to compute something like Figure 3 in MOOSE, starting from a TDB with a multi-sublattice phase. It wouldn't need to be the same system as in the paper, if that makes it easier.

dschwen commented 3 years ago

Thanks @richardotis. Yeah, I'm going to move that code into MOOSE proper. What's keeping me right now is that I need a small test system with multiple sublattices (one that has non-trivial behavior - and ideally can be solved analytically - and is freely distributable). I have a few things due this week, but I'll work on that very soon. If you have a suggestion for a test system that could be used in our CI I'd be glad to hear it.

richardotis commented 3 years ago

We have a few TDBs we use for examples in the pycalphad repo: https://github.com/pycalphad/pycalphad/tree/develop/examples The most interesting is probably Dupin et al's 2001 Al-Ni, which has a two-sublattice bcc and fcc phase using the order-disorder model: https://github.com/pycalphad/pycalphad/blob/develop/examples/NI_AL_DUPIN_2001.TDB If that system is too big I'd consider the Al-Fe, Al-Mg, or Nb-Re assessments, also in that folder.