2. 1D Burgers equation¶
This tutorial solves the viscous Burgers equation, the standard first test for PINNs, starting from the shipped example. You will look at how a time-dependent PDE is laid out across the model tree, train it, and read the comparison with the reference solution that comes with the example.
What you will learn
- load a shipped example from the Examples list and choose Default or Tuned settings;
- read a time-dependent problem in the model tree: domain, initial condition, boundary-condition rows;
- train with a single L-BFGS phase;
- read the line and surface comparisons that Error Analysis writes.
The problem. On \( x \in [-1, 1] \), \( t \in [0, 1] \):
A steep front forms near \( x = 0 \). The example uses the settings of Raissi et al. (2019) (see references).
Prerequisites¶
- Tutorial 1 (or familiarity with the model tree and Solve).
- No files are needed: the reference data ship with PINNStudio.
Steps¶
Load the example¶
- In the toolbar, leave the first Examples: box at Forward, choose Burgers 1D – Raissi et al. in the second box, and leave the third box at Default. (The same example is listed under 1D on the Start tab.)
-
The Training Log confirms what was loaded:
Walk through the model tree¶
- Problem: 1D (x), Time Dependent, Forward.
- Equations: one output
uand the residualdu_t + 1.0*u*du_x - (0.01/pi)*du_xx. -
Geometry: x: from
-1to1; t: from0to1. -
Collocation points: Domain points: 10000, Boundary points: 50, Initial points: 50.
- Initial conditions:
-sin(pi*x). -
Boundary conditions: two rows, BC 1 · Dirichlet, u and BC 2 · Dirichlet, u. Click BC 1 in the tree to see its Type: (Dirichlet BC), Output: (1), Where: (Left side (x = x_min)) and Value: (0.0). BC 2 is the same on the right side.
-
Neural network: 8 hidden layers of 20 neurons,
tanh. -
Training: a single phase, L-BFGS with 50000 iterations, and Use recommended L-BFGS settings ticked (DeepXDE's default L-BFGS options).
-
Results › Error Analysis: the dialog already lists five reference files (\( t = 0, 0.25, 0.5, 0.75, 1 \)) under Reference files. Click Cancel to keep them as they are.
Solve¶
- Click Solve. L-BFGS prints the loss every 1000 steps; the four columns are the PDE residual, the two boundary conditions and the initial condition. L-BFGS may stop before 50000 iterations when the loss no longer changes.
Expected results¶
The solution plot shows the sine profile steepening into a sharp front at \( x = 0 \). The error is largest around the front.
In our test run on a CPU, shortened to 3000 L-BFGS iterations (about 5 minutes), the final loss was 2.1 × 10⁻⁵ and the relative L2 error was between 1.1 × 10⁻³ and 2.2 × 10⁻³ at the five reference times (1.6 × 10⁻³ over all five together). The full 50000 iterations take longer; L-BFGS usually stops earlier.
error_analysis/error_metrics.txt in the run folder lists the error at every reference time.
Variations to try¶
- Switch the third Examples box to Tuned. For this example the log says
Tuned settings: Raissi et al.'s settings: the paper's settings are already PINNStudio's best here, so nothing changes. Other examples do change; see Tutorial 13. - On Results, set Plot type: to Line (time steps) to get \( u(x) \) curves at several times instead of a surface.
- Add an Adam phase before L-BFGS (Add Phase, then set the first phase's Optimizer: to Adam). This is needed for per-point weights (Tutorial 11).
Troubleshooting¶
| Symptom | What to check |
|---|---|
| The run takes very long | 10000 domain points with L-BFGS is heavy on a CPU. Lower Iterations: for a first try, or reduce Domain points:. |
Error Analysis: no valid reference files loaded. |
The reference-file paths no longer exist (for example after moving the installation). Reload the example. |
| The front is smeared | Typical of too few iterations or points near the front; see RAR (Tutorial 10) and point weights (Tutorial 11). |
Next steps¶
- Tutorial 3: a 2D problem with mixed boundary conditions.
- Boundary conditions and Results and plots in the user guide; Optimizers and training phases in the reference.






