Skip to content

Add a tutorial on learning the Brusselator reaction with a neural network - #681

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:brusselator-ude-tutorial
Sep 5, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:brusselator-ude-tutorial

Conversation

@utkuyilmaz1903

Copy link
Copy Markdown
Member

Second UDE tutorial, following #680: the network takes both Brusselator fields as input and returns both reaction terms, NN([u, v], θ) in place of u^2 v and -u^2 v. 1D, periodic, α = 0.1, 21 points.

What the page shows:

  • the discretized system has 8 equations at 21 and at 81 grid points;
  • fitting the trajectory from a near-zero network does not work here (plain Adam at two learning rates, a longer horizon, a wider network, and Adam with tight solver tolerances all stall), so the network is first fit to the missing term estimated from the data (central differences in time, three-point Laplacian in space), then refined through the solver with 20 BFGS iterations on the trajectory loss;
  • the UDE reproduces the data to about 0.01 (values up to 5) and the learned reaction is within about 1% (relative L2) of u^2 v on the points the data visits, shown as a parity plot.

One finding worth noting: at the default solver tolerances the ForwardDiff gradient of the trajectory loss is about 25% off from finite differences and BFGS line searches stall (382 evaluations, and once over an hour); with abstol = reltol = 1e-8 the gradient matches finite differences and 20 iterations take 76 evaluations, about 80 s. The page uses the tight tolerances and says why.

The page takes a few minutes to build. OptimizationOptimJL is added to the docs env for BFGS. Cross-linked from the first neural network tutorial.

@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as ready for review September 5, 2026 21:53
@ChrisRackauckas
ChrisRackauckas merged commit 45793a4 into SciML:master Sep 5, 2026
5 checks passed
@utkuyilmaz1903
utkuyilmaz1903 deleted the brusselator-ude-tutorial branch September 6, 2026 17:07
ChrisRackauckas added a commit that referenced this pull request Sep 7, 2026
- Trim the array-form capability list from MOLFiniteDifference. (#673)
- Stop infinite expansion when a PDE unknown is missing from the system. (#674)
- Support vector-valued functions in ArrayDiscretization (#675)
- Test ModelingToolkitNeuralNets terms and fix the compiled ODE path (#678)
- Add a tutorial on training a neural network term in a PDE (#679)
- Stack vector field inputs and batch network calls in ArrayDiscretization (#680)
- Add a tutorial on learning the Brusselator reaction with a neural network (#681)
- Stack scalar inputs with field slices in ArrayDiscretization (#682)
- Test callable diffusion coefficients (#683)
- Reconstruct array observables once per PDE field (#676)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants