Cahn-Hilliard equation

The Cahn-Hilliard equation describes phase separation, for example of elements in an alloy. Starting from a random distribution of -1 and +1 (representing two species), the concentration evolves in time. Adjust the diffusion constant and the gamma parameter to obtain different solutions of the differential equations, and the timestep parameter to visualize the formation of domains.
  • Contributed by: Oliver K. Ernst


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


The Cahn-Hilliard equation describes phase separation, e.g. of elements in an alloy. It is given by:
where c is the concentration with -1 and +1 representing two different species, D is the diffusion constant, and γ is an additional parameter. The differential equations are discretized using finite differences and solved on a 30x30 grid with periodic boundary conditions starting from a random initial condition of -1 or +1 at each node. The equations are solved from time 0 to time 4, and the distances between compartments in the discretization are defined as 1.
J. W. Cahn and J. E. Hilliard, "Free energy of a nonuniform system. I. Interfacial free energy," J. Chem. Phys. 28 (258) 1958.
Snapshot 1: example of domains formed.
Snapshot 2: example of a random initial condition.
Snapshot 3: at high diffusion constants and gamma parameter value, large and homogenous domains will form.