Allen-Cahn 1D – Wight & Zhao¶
| Example | |
|---|---|
| Source | PINNStudio template |
| Problem | Forward and Inverse |
| Dimension | 1D (x, t) |
| Regime | Time-dependent |
| Geometry | Interval |
| Outputs | u |
| Settings | Default, Tuned |
Governing equations¶
Mathematical form (from the benchmark records):
Where \(\gamma_1 = 0.0001\) and \(\gamma_2 = 5\).
As typed in PINNStudio's Equations page (each expression is a residual, set to zero):
As typed in PINNStudio's Equations page (Inverse mode) (each expression is a residual, set to zero):
Domain¶
- Interval: \(x \in [-1, 1]\)
- Time interval: \(t \in [0, 1]\)
Initial conditions¶
| Output | Initial value | How it is imposed (Settings: Default) |
|---|---|---|
u |
x**2*cos(pi*x) |
loss term |
Boundary conditions¶
| Type | Where | Output | Value | Details |
|---|---|---|---|---|
| Periodic BC | left |
u |
— | axis x, derivative order 0 |
Unknowns and measured data (Inverse)¶
| Trainable parameter | Initial value | True value |
|---|---|---|
gamma_1 |
1 | 0.0001 |
gamma_2 |
1 | 5 |
Measured data (Inverse page, measured-data files):
reference_data/1D/allen_cahn/t_1.0.txt→ outputu, weight 100
From the benchmark records: same template, switched to Inverse, jointly recovering both \(\gamma_1\) (diffusion) and \(\gamma_2\) (reaction) as unknown parameters.
Settings¶
Forward mode¶
Settings: Default — the paper's method (Wight & Zhao 2021)
- Network: FNN, hidden layers 4 × 128, inputs (x, t), 1 output; activation tanh, initializer Glorot uniform
- Points: 2,000 domain, 200 boundary, 200 initial, 1,000 test
- Loss weights:
1.0,1.0,100.0(equations, then boundary-condition rows, then initial conditions) - Methods: residual-based adaptive refinement (RAR, 6 rounds of 200 points)
| Phase | Optimizer | Iterations | Learning rate | Decay |
|---|---|---|---|---|
| 1 | Adam | 20,000 | 0.001 | none |
| 2 | L-BFGS | 10,000 | — | none |
Settings: Tuned
The Training Log reports: Tuned settings: a larger network (hidden layers twice as wide, one more layer). The change is applied to the template's own settings (not the paper's method that Default loads).
- Network: multi-scale Fourier-feature network (MsFFN), hidden layers 5 × 256, inputs (x, t), 1 output; activation tanh, initializer Glorot uniform; Fourier-feature scales 1, 5
- Points: 10,000 domain, 200 boundary, 512 initial, 1,000 test
- Loss weights:
1.0,1.0(equations, then boundary-condition rows, then initial conditions) - Methods: causal training; multi-scale Fourier features; exact initial condition; exact periodicity (periodic input features)
| Phase | Optimizer | Iterations | Learning rate | Decay |
|---|---|---|---|---|
| 1 | Adam | 20,000 | 0.001 | none |
| 2 | L-BFGS | 10,000 | — | none |
Inverse mode¶
Settings: Default — the template's own settings
- Network: multi-scale Fourier-feature network (MsFFN), hidden layers 4 × 128, inputs (x, t), 1 output; activation tanh, initializer Glorot uniform; Fourier-feature scales 1, 5
- Points: 10,000 domain, 200 boundary, 512 initial, 1,000 test
- Loss weights:
1.0,1.0,100.0(equations, then boundary-condition rows, then initial conditions, then measured data) - Methods: causal training; multi-scale Fourier features; exact initial condition; exact periodicity (periodic input features)
| Phase | Optimizer | Iterations | Learning rate | Decay |
|---|---|---|---|---|
| 1 | Adam | 20,000 | 0.001 | none |
| 2 | L-BFGS | 10,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 — Larger network (2× width, one more layer). Values: median over seeds 2026, 1, 2.
| Output | Relative L₂ |
|---|---|
| u | 7.0 × 10⁻⁴ |
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 |
|---|---|---|---|
| gamma_1 | 0.0001 | 9.9233e-05 | 0.77 % |
| gamma_2 | 5 | 4.99768 | 0.046 % |
Worst parameter error: 0.77 % (the median over the seeds of each seed's largest 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 ── 1D ── heading, Allen-Cahn 1D – Wight & Zhao › Default or Tuned, then Solve.
- Inverse: toolbar Examples: › Inverse › under the ── 1D ── heading, Allen-Cahn 1D – 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¶
- Reference data files:
reference_data/1D/allen_cahn/
Notes¶
- The time-adaptive version of this template is not listed in the Examples list; it still loads by its name from saved problems (HIDDEN_TEMPLATES in example_catalog.py).
Definition and records¶
- Definition: template "1D Allen-Cahn (whole interval)" in
MainWindow._on_template_selected,pinnstudio/ui/main_window.py- Inverse mode:
MainWindow.INVERSE_AUTO_VARS["1D Allen-Cahn (whole interval)"](unknowns) andINVERSE_AUTO_OBS["1D Allen-Cahn (whole interval)"](measured data), same file - Settings: Default (the paper's method):
_ac1d_wzinpinnstudio/core/paper_settings.py - Settings: Tuned: entry "1D Allen-Cahn (whole interval)" in
pinnstudio/resources/tuned_settings.json
- Inverse mode:
- Equations: Governing equations on this page
- Reference data:
reference_data/1D/allen_cahn/, written bytools/make_exact_reference_data.py - Measured data (Inverse):
reference_data/1D/allen_cahn/, written bytools/make_exact_reference_data.py - Benchmark records:
benchmarks/problems/allen-cahn-1d-wight-zhao.md, its entry in the examples overview, the benchmark collection - Tuning-study configurations (records of the tuning study; open one with Problem › Open Saved Problem...; not presets of the Examples list):
Allen-Cahn 1D – Wight & Zhao (PINNStudio template) (tuned).pinn.json,Allen-Cahn 1D – Wight & Zhao (PINNStudio template), inverse mode (tuned).pinn.json - Methods (Default and Tuned settings): RAR, Causal training, Networks and Fourier features, Exact constraints
- Cite: Wight & Zhao 2021
How the benchmark values were measured and checked: Reproducibility.