solve_burgers_1d
Solve the 1D Burgers equation with explicit finite differences, using an initial expression and Dirichlet boundary values; returns downsampled results and saves the full grid.
Instructions
Solve u_t + uu_x = nuu_xx with explicit finite differences.
``u_x`` uses a centred difference and ``u_xx`` a second-order centred
difference. ``initial`` is an expression in x; the ends use the constant
Dirichlet values ``left`` and ``right``. The explicit scheme requires
dt <= dx^2/(2*nu) (diffusion) and dt <= dx/max|u| (CFL); a violation is
reported as an error with a hint to increase nt. The full (t, x) grid is
saved to .npz and returned downsampled to at most 20 space and 20 time
points.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nt | No | ||
| nu | Yes | ||
| nx | No | ||
| left | No | ||
| right | No | ||
| t_end | No | ||
| length | No | ||
| initial | No | sin(pi*x) |