Navier-Stokes 2D – Kovasznay flow¶
| Example | |
|---|---|
| Source | DeepXDE example |
| Problem | Forward and Inverse (the Inverse mode is PINNStudio's addition) |
| Dimension | 2D (x, y) |
| Regime | Steady |
| Geometry | Rectangle |
| Outputs | u, v, p |
| Settings | Default, Tuned |
Governing equations¶
Mathematical form (from the benchmark records):
As typed in PINNStudio's Equations page (each expression is a residual, set to zero):
u*du_x + v*du_y + dp_x - 1/Re*(du_xx + du_yy)
u*dv_x + v*dv_y + dp_y - 1/Re*(dv_xx + dv_yy)
du_x + dv_y
Constants: Re = 20, nu = 1/Re, l = 1/(2*nu) - sqrt(1/(4*nu**2) + 4*pi**2)
Domain¶
- Rectangle: \(x \in [-0.5, 1]\), \(y \in [-0.5, 1.5]\)
Boundary conditions¶
| Type | Where | Output | Value | Details |
|---|---|---|---|---|
| Dirichlet BC | True (the whole boundary) |
u |
1 - exp(l*x)*cos(2*pi*y) |
— |
| Dirichlet BC | True (the whole boundary) |
v |
l/(2*pi)*exp(l*x)*sin(2*pi*y) |
— |
| Dirichlet BC | right |
p |
0.5*(1 - exp(2*l*x)) |
— |
Unknowns and measured data (Inverse)¶
| Trainable parameter | Initial value | True value |
|---|---|---|
Re |
10 | 20 |
Measured data (Inverse page, measured-data files):
reference_data/deepxde/kovasznay_inverse/u_obs.txt→ outputu, weight 100reference_data/deepxde/kovasznay_inverse/v_obs.txt→ outputv, weight 100
Settings¶
Forward mode¶
Settings: Default — DeepXDE's own settings
- Network: FNN, hidden layers 4 × 50, inputs (x, y), 3 outputs; activation tanh, initializer Glorot normal
- Points: 2,601 domain, 400 boundary, 100,000 test
- Loss weights:
1,1,1,1,1,1(equations, then boundary-condition rows)
| Phase | Optimizer | Iterations | Learning rate | Decay |
|---|---|---|---|---|
| 1 | Adam | 30,000 | 0.001 | none |
| 2 | L-BFGS | 15,000 | — | none |
No separate Tuned preset: the Tuned item is greyed out for this example (its Default settings are PINNStudio's best).
Inverse mode¶
Settings: Default — DeepXDE's settings with PINNStudio's Inverse-mode changes (see Notes)
- Network: FNN, hidden layers 4 × 50, inputs (x, y), 3 outputs; activation tanh, initializer Glorot normal
- Points: 2,601 domain, 400 boundary, 100,000 test
- Loss weights:
1,1,1,1,1,1(equations, then boundary-condition rows)
| Phase | Optimizer | Iterations | Learning rate | Decay |
|---|---|---|---|---|
| 1 | Adam | 30,000 | 0.001 | none |
| 2 | L-BFGS | 15,000 | — | none |
Settings: Tuned
The Training Log reports: Tuned settings: 3× iterations, a larger network, 3× points and an L-BFGS phase together. The change is applied to the example's own settings.
- Network: FNN, hidden layers 5 × 100, inputs (x, y), 3 outputs; activation tanh, initializer Glorot normal
- Points: 7,803 domain, 1,200 boundary, 100,000 test
- Loss weights:
1,1,1,1,1,1(equations, then boundary-condition rows)
| Phase | Optimizer | Iterations | Learning rate | Decay |
|---|---|---|---|---|
| 1 | Adam | 90,000 | 0.001 | none |
| 2 | L-BFGS | 45,000 | — | none |
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: Default — the example's own settings (not in the tuning sweep); the example has no separate Tuned preset for this mode. Values: median over seeds 2026, 1, 2.
| Output | Relative L₂ |
|---|---|
| u | 2.0 × 10⁻⁴ |
| v | 9.0 × 10⁻⁴ |
| p | 4.1 × 10⁻⁴ |
Other outputs (2 figures)
Inverse problem¶
Settings: Tuned — all of the changes together. Values: median over seeds 2026, 1, 2.
| Parameter | True value | Recovered | Relative error |
|---|---|---|---|
| Re | 20 | 19.9995 | 0.0045 % |
Worst parameter error: 0.0045 % (the median over the seeds of each seed's largest error).
Other outputs (2 figures)
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, Navier-Stokes 2D – Kovasznay flow › Default, then Solve.
- Inverse: toolbar Examples: › Inverse › under the ── 2D ── heading, Navier-Stokes 2D – Kovasznay flow › Default or Tuned, 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¶
- Exact solution, Error Analysis › reference from formula:
u = 1 - exp(l*x)*cos(2*pi*y),v = l/(2*pi)*exp(l*x)*sin(2*pi*y),p = 0.5*(1 - exp(2*l*x))
Notes¶
- Constants Re, nu and l are defined as in DeepXDE's script.
- Inverse mode (PINNStudio's addition): the Reynolds number Re (initial guess 10, true 20) is learned from u and v measured at 500 points (reference_data/deepxde/kovasznay_inverse); the boundary values keep the true Re.
Definition and records¶
- Definition:
EXAMPLESentry "Kovasznay flow" inpinnstudio/core/deepxde_examples.py- Inverse mode (PINNStudio's addition):
ADDED_INVERSE["Kovasznay flow"], same file - Settings: Tuned: entry "Kovasznay flow" in
pinnstudio/resources/tuned_settings.json
- Inverse mode (PINNStudio's addition):
- Equations: Governing equations on this page
- Reference data: the exact-solution formula under Reference solution (no data files)
- Measured data (Inverse):
reference_data/deepxde/kovasznay_inverse/, written bytools/make_deepxde_reference_data.py - Benchmark records:
benchmarks/problems/navier-stokes-2d-kovasznay-flow.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):
Navier-Stokes 2D – Kovasznay flow (tuned).pinn.json,Navier-Stokes 2D – Kovasznay flow, inverse mode (tuned).pinn.json - DeepXDE example: Kovasznay_flow.py (documentation)
- Cite: Lu et al. 2021 (DeepXDE); the problem follows Jin et al. 2021
How the benchmark values were measured and checked: Reproducibility.