2026-08-14 –, Room 3
The phase field method simulates microstructure evolution and phase transitions. PhaseFields.jl is the first pure Julia package providing major phase field models with built-in FDM and FEM (via Gridap.jl) and adaptive time stepping (DifferentialEquations.jl). It couples with OpenCALPHAD.jl for chemical potentials via automatic differentiation from CALPHAD databases. We demonstrate spinodal decomposition, CALPHAD-driven solidification, and Stefan problem validation.
Understanding and predicting the internal structure of materials at the microscale (microstructure) is essential in materials science and engineering. The arrangement of different phases and their interfaces determines key material properties including mechanical strength and thermal conductivity.
The phase field method simulates microstructure evolution during solidification and phase separation.
It represents different phases (e.g., solid and liquid, matrix and precipitates) using a continuous field variable phi that varies smoothly across interfaces, avoiding explicit interface tracking. The value phi = 1 represents the solid phase and phi = 0 represents the liquid phase, with a diffuse interface region in between.
The driving force of the field variable phi is based on the thermodynamic principle of Gibbs free energy minimization. In the Allen-Cahn model (interface motion) it drives the order parameter phi, while in the Cahn-Hilliard model (phase separation) it drives the composition c. We present how automatic differentiation with Julia is effectively utilized in phase field simulations.
The accompanying figure shows 2D spinodal decomposition simulated by the Cahn-Hilliard equation. The color map represents the local composition c (mole fraction of component B in a binary A-B system). Starting from a nearly uniform mixture (left, c = 0.5 with small fluctuations), the system spontaneously separates into two coexisting phases: an A-rich phase (c = 0.3, blue) and a B-rich phase (c = 0.7, red). This phase separation is driven by a double-well free energy whose two minima correspond to the equilibrium compositions of the coexisting phases. The simulation uses OrdinaryDiffEq.jl for time integration via the unified PhaseFields.solve API.
We have developed two pure Julia packages for phase field simulation.
The first package PhaseFields.jl implements a framework for multiple phase field models. Each phase field model defines a set of equations governing the field variable phi and the associated physical fields such as concentration and temperature. These equations are spatially discretized using the built-in FDM or FEM (via Gridap.jl). Then, time evolution is solved using DifferentialEquations.jl, applying an appropriate time stepping method as needed.
The second package, OpenCALPHAD.jl, predicts phase diagrams mapping the thermodynamically stable phases of materials as functions of temperature, pressure, and composition. It also evaluates Gibbs free energy from thermodynamic databases described in TDB format or as pure Julia functions. The driving force of the field variable phi is directly evaluated through automatic differentiation, eliminating the need for symbolic differentiation and hand-coded derivatives.
Two packages integrate seamlessly with the Julia ecosystem, including Plots.jl for visualization of phase diagrams and phase field simulations.
We attach a Google Colab notebook that highlights several features of the two packages including Ag-Cu binary phase diagram (CALPHAD), Allen-Cahn 1D interface migration, 2D spinodal decomposition (Cahn-Hilliard), and the Stefan problem (thermal solidification).
Validation / Features / Future Directions
OpenCALPHAD.jl is a pure Julia port of openCALPHAD, an open-source CALPHAD software package developed by Bo Sundman, a co-developer of Thermo-Calc and one of the pioneers of computational thermodynamics. OpenCALPHAD.jl has been validated for binary phase diagram calculations against the reference Fortran implementation openCALPHAD v6.100, demonstrating numerical agreement within 0.02% for phase boundaries. PhaseFields.jl was validated by its ability to reproduce results from significant papers in this field including the Stefan problem (thermal solidification).
CALPHAD-coupled phase field simulation has been demonstrated in 1D (Allen-Cahn with Ag-Cu driving force from TDB database via automatic differentiation). Extension to 2D CALPHAD-coupled Cahn-Hilliard (spinodal decomposition with real alloy thermodynamics) is in progress. The CahnHilliardProblem interface accepts any custom free energy function via duck typing, making it straightforward to plug in CALPHAD Gibbs energy as the driving force.
We plan to implement the Kim-Kim-Suzuki (KKS) model, which resolves the driving force scaling mismatch between CALPHAD thermodynamics and the phase field double-well barrier by separating the concentration into phase-specific values at the interface.
Since OpenCALPHAD.jl already provides ForwardDiff-compatible Gibbs energy functions,
the chemical potentials required by the KKS equal-potential condition can be obtained directly via automatic differentiation.
Both packages are freely available for academic and commercial use. They are designed with educational use in mind, featuring readable code that closely follows the mathematical formulation of the underlying theory. This makes them suitable for teaching computational thermodynamics and for researchers who wish to understand or extend the underlying algorithms.
We aim to expand the range of material systems and phase field models that can be handled by both packages.
Both packages are open to contributions and designed for extensibility. Contributions are welcome.
Links
- PhaseFields.jl: https://github.com/hsugawa8651/PhaseFields.jl, https://hsugawa8651.github.io/PhaseFields.jl
- OpenCALPHAD.jl: https://github.com/hsugawa8651/OpenCALPHAD.jl, https://hsugawa8651.github.io/OpenCALPHAD.jl
- Colab: https://colab.research.google.com/gist/hsugawa8651/483b77d1526ee9a5fe370db159192275/colab_demo_ocpf.ipynb
Hiroharu Sugawara is an associate professor in the Graduate School of Systems Design at Tokyo Metropolitan University, Tokyo, Japan. He received his Ph.D. in electronic engineering from the University of Tokyo in 1994.
His research focuses on eco-friendly semiconductor functional materials.
He has been a Julia user since Julia 0.5.
He has been teaching a programming exercise course using the Julia language for university freshmen in the Department of Mechanical Systems Engineering every year since the 2018 academic year.
He translated Tanmay Bakshi's "Tanmay Teaches Julia for Beginners" into Japanese (ISBN 978-4807920211) in 2022.