Step 1: Spinodal decomposition
The Spinodal example evolves the dimensionless composition \(c\) by the Cahn–Hilliard equation. Its bulk free energy is \(f=A c^2(1-c)^2\), where \(A\) sets the energy scale. The initial composition is close to 0.5, with small random fluctuations. Composition is conserved: redistribution changes the local value but not the total amount in the periodic domain.
The saved input specifies a 512 × 512 grid, grid spacing 1, time step 1 and 10,000 steps. These are the original workshop settings, not a new convergence study. For a browser demonstration and explained downloadable scripts, use the chemical spinodal example.
Step 2: Precipitate growth
The PptCodes1D and PptCodes2D examples evolve composition \(c\) and a dimensionless structural order parameter \(\eta\). The matrix has \(\eta=0\); the precipitate has \(\eta=1\). Composition is conserved. The structural field is not conserved, so the precipitate boundary can move as the precipitate grows or dissolves.
Here \(f\) is the local bulk free-energy density. The coefficients \(A\) and \(B\) set the matrix and precipitate free-energy scales; \(P\) sets the barrier between the two structures. All quantities in these codes are nondimensional. No physical conversion to metres, seconds or joules is supplied.
The total free energy also includes \(\kappa_c|\nabla c|^2\) and \(\kappa_\eta|\nabla\eta|^2\), where \(\kappa_c\) and \(\kappa_\eta\) are the gradient-energy coefficients. Consequently, the composition chemical potential is \(\mu=\partial f/\partial c-2\kappa_c\nabla^2c\). Composition evolves as \(\partial c/\partial t=M\nabla^2\mu\), where \(M\) is mobility. The structural field evolves as \(\partial\eta/\partial t=-L[\partial f/\partial\eta-2\kappa_\eta\nabla^2\eta]\), where \(L\) is the relaxation coefficient. The factor 2 follows from the gradient-energy convention used in these sources.
The two-dimensional input starts with a central precipitate, composition 1 inside it and composition 0.3 in the matrix. It specifies a 256 × 256 grid, spacing 0.4 and time step 0.2. The radius in the initializer is calculated in grid indices; it should not be treated as a physical length without checking that convention.
Step 3: Elastic stress effects on phase separation
My existing interactive binary spinodal example shows how elastic strain energy affects phase separation. It uses homogeneous elasticity: the elastic constants are the same throughout the material, but they can be anisotropic. A composition-dependent misfit produces elastic strain energy, and anisotropic elastic constants make that energy depend on direction.
Change the misfit and elastic parameters in that example and observe the evolving composition. Set the misfit to zero to recover the chemical calculation with the same initial field.
Open elastic stress effects on phase separation →
Step 4: Phase separation inside an embedded particle
For a particle surrounded by another material, I use a field to identify the particle and its exterior. That field weights the appropriate free energies and can also control transport or boundary conditions. Whether it remains fixed or evolves depends on the physical problem. An evolving precipitate field permits growth and dissolution; a fixed particle field describes phase separation within a prescribed particle.
Read the embedded phase-field explanation, equations and research references →
Using the workshop sources
The download contains my original source and input files for these three examples, with a Makefile in each folder and a README. It omits old executables and output fields. The codes use C and FFTW 3. The C sources are unchanged from 2014; in 2026 I updated the Makefiles so the codes build with current compilers, and added one for Spinodal. All three build without warnings with GCC 13 and FFTW 3.3 and run correctly: in Spinodal, the mean composition stays at 0.5 while the field separates towards 0 and 1.
sudo apt install build-essential libfftw3-dev # Ubuntu or Debian
cd PFWorkshop2014/Spinodal # or PptCodes1D, PptCodes2D
make
./spinodal.out # ./pptg.out in PptCodes1D and PptCodes2D
Each program reads bin1ary, which names its input and output parameter files, so keep it in the folder. Edit InputParams to change the grid, time step and number of steps. The README explains the binary output format and how to build on macOS.
I assess a new calculation using conservation, energy, time-step sensitivity and grid refinement at a fixed domain size. The original evolution loops include the final step in an inclusive loop; check the saved time and the number of updates when making comparisons.