Cahn-Hilliard Equation for Phase Separation

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

The Cahn–Hilliard equation describes phase separation, for example, of elements in an alloy. Starting from a random distribution of and (representing two species), the concentration evolves in time. To obtain solutions of the differential equations, use the "" slider to adjust the diffusion constant and the "" slider to adjust the gamma parameter. Use the "time step" slider to visualize the formation of domains.

Contributed by: Oliver K. Ernst (September 2019)
Open content licensed under CC BY-NC-SA


The Cahn–Hilliard equation describes phase separation, for example, of elements in an alloy. It is given by:


where is the concentration, with values and representing the two different species; is the diffusion constant; and the parameter relates to the transition region between domains. The differential equations are discretized using finite differences and solved on a 30×30 grid with periodic boundary conditions starting from a random initial condition of or at each node. The equations are solved from time 0 to time 4, with the distances between compartments in the discretization defined as 1.

Snapshot 1: example of domains formed

Snapshot 2: example of a random initial condition

Snapshot 3: example of large and homogeneous domains formed at high diffusion constants and gamma parameter value


[1] J. W. Cahn and J. E. Hilliard, "Free Energy of a Nonuniform System. I. Interfacial Free Energy," The Journal of Chemical Physics, 28(2), 1958 pp. 258–267. doi:10.1063/1.1744102.


Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.