Skip to content

Cahn-Hilliard 2D – Wight & Zhao

Example
Source PINNStudio template
Problem Forward and Inverse
Dimension 2D (x, y, t)
Regime Time-dependent
Geometry Rectangle
Outputs phi, mu
Settings Default, Tuned

Governing equations

Mathematical form (from the benchmark records):

\[\frac{\partial \phi}{\partial t} = \lambda\left(\frac{\partial^2 \mu}{\partial x^2} + \frac{\partial^2 \mu}{\partial y^2}\right), \qquad \mu = \phi^3 - \phi - \varepsilon^2\left(\frac{\partial^2 \phi}{\partial x^2} + \frac{\partial^2 \phi}{\partial y^2}\right), \qquad (x, y) \in [-1, 1]^2,\ t \in [0, 1]\]

Where \(\lambda = 1\) and \(\varepsilon = 0.05\). As in the 1D example, the chemical potential \(\mu\) is a second output (the paper's network is also \((\phi, \mu)\)), so no residual needs a fourth derivative.

As typed in PINNStudio's Equations page (each expression is a residual, set to zero):

dphi_t - (dmu_xx + dmu_yy)
mu - (phi**3 - phi) + 0.0025*(dphi_xx + dphi_yy)

As typed in PINNStudio's Equations page (Inverse mode) (each expression is a residual, set to zero):

dphi_t - (dmu_xx + dmu_yy)
mu - (phi**3 - phi) + eps_sq*(dphi_xx + dphi_yy)

Domain

  • Rectangle: \(x \in [-1, 1]\), \(y \in [-1, 1]\)
  • Time interval: \(t \in [0, 1]\)

Initial conditions

Output Initial value How it is imposed (Settings: Default)
phi tanh((0.4 - (sqrt((x - 0.28)**2 + y**2 + 1e-12) + sqrt((x + 0.28)**2 + y**2 + 1e-12) - sqrt((sqrt((x - 0.28)**2 + y**2 + 1e-12) - sqrt((x + 0.28)**2 + y**2 + 1e-12))**2 + 0.0004))/2)/0.1) loss term
mu 0 not used as a loss term

Boundary conditions

Type Where Output Value Details
Periodic BC left phi — axis x, derivative order 0
Periodic BC bottom phi — axis y, derivative order 0
Periodic BC left mu — axis x, derivative order 0
Periodic BC bottom mu — axis y, derivative order 0

Unknowns and measured data (Inverse)

Trainable parameter Initial value True value
eps_sq 1 0.0025

Measured data (Inverse page, measured-data files):

From the benchmark records: same template, switched to Inverse, recovering \(\varepsilon^2\) (initial guess 1, true value 0.0025) from \(\phi\) measured at \(t = 1\).

Settings

Forward mode

Settings: Default — the paper's method (Wight & Zhao 2021)

  • Network: FNN, hidden layers 6 × 128, inputs (x, y, t), 2 outputs; activation tanh, initializer Glorot uniform
  • Points: 20,000 domain, 800 boundary, 1,024 initial, 1,000 test
  • Loss weights: 1.0,1.0,1.0,1.0,1.0,1.0,1000.0 (equations, then boundary-condition rows, then initial conditions)
  • Methods: time windows (5 windows)
Phase Optimizer Iterations Learning rate Decay
1 Adam 10,000 0.001 none
2 L-BFGS 10,000 — none
Settings: Tuned

The Training Log reports: Tuned settings: the template's own settings (PINNStudio's best for it).

  • Network: FNN, hidden layers 4 × 128, inputs (x, y, t), 2 outputs; activation tanh, initializer Glorot uniform
  • Points: 20,000 domain, 800 boundary, 1,024 initial, 1,000 test
  • Loss weights: 1.0,1.0,1.0,1.0,1.0,1.0,100.0 (equations, then boundary-condition rows, then initial conditions)
  • Methods: exact periodicity (periodic input features)
Phase Optimizer Iterations Learning rate Decay
1 Adam 20,000 0.001 none
2 L-BFGS 20,000 — none

Inverse mode

Settings: Default — the template's own settings

  • Network: FNN, hidden layers 4 × 128, inputs (x, y, t), 2 outputs; activation tanh, initializer Glorot uniform
  • Points: 20,000 domain, 800 boundary, 1,024 initial, 1,000 test
  • Loss weights: 1.0,1.0,1.0,1.0,1.0,1.0,100.0,100.0 (equations, then boundary-condition rows, then initial conditions, then measured data)
  • Methods: exact periodicity (periodic input features)
Phase Optimizer Iterations Learning rate Decay
1 Adam 20,000 0.001 none
2 L-BFGS 20,000 — none

No separate Tuned preset: the Tuned item is greyed out for this example (its Default settings are PINNStudio's best).

Results

The configuration selected in PINNStudio's benchmark study, run on one RTX 4090. Forward: relative L₂ error of each output at the last reference time. Inverse: each parameter's relative error and, per seed, the largest of them (worst parameter error).

Forward problem

Settings: Tuned — the template's own settings. Values: median over seeds 2026, 1, 2.

Output Relative L₂
μ 2.2 × 10⁻²
φ 1.1 × 10⁻²
abs_mu 8.0 × 10⁻⁴
Forward result: PINN, reference and error, μ
Forward, Tuned settings: PINN, reference and error, μ.
Other outputs (1 figure)

Forward result: PINN, reference and error, u
Forward, Tuned settings: PINN, reference and error, u.

Inverse problem

Settings: Default — the example's own settings (no change did better); the example has no separate Tuned preset for this mode. Values: median over seeds 2026, 1, 2.

Parameter True value Recovered Relative error
ε² 0.0025 0.00251029 0.41 %

Worst parameter error: 0.41 % (the median over the seeds of each seed's largest error).

Inverse result: PINN, reference and error, u
Inverse, Default settings: PINN, reference and error, u.
Inverse result: parameter convergence
Inverse, Default settings: parameter convergence.
Other outputs (1 figure)

Inverse result: PINN, reference and error, μ
Inverse, Default settings: PINN, reference and error, μ.

Full benchmark record: every setting tried, the per-seed values and all figures are in the benchmark records on GitHub.

Loading it in PINNStudio

  • Forward: toolbar Examples: › Forward › under the ── 2D ── heading, Cahn-Hilliard 2D – Wight & Zhao › Default or Tuned, then Solve.
  • Inverse: toolbar Examples: › Inverse › under the ── 2D ── heading, Cahn-Hilliard 2D – Wight & Zhao › Default, then Solve.

Loading an example fills in every setting; anything you change before Solve is listed in the Training Log. Your save folder, GPU, random-seed and plot-style settings are kept.

Reference solution

Definition and records

How the benchmark values were measured and checked: Reproducibility.

← Back to the example gallery