solve_pde_1d
Solve 1D time-dependent PDEs of the form u_t = F(x, t, u, u_x, u_xx) using explicit Euler, centered differences, and Dirichlet boundaries.
Instructions
Solve u_t = F(x, t, u, u_x, u_xx) with an explicit Euler scheme.
``equation`` is a sympy expression for ``F`` in the symbols ``x``, ``t``,
``u``, ``u_x`` and ``u_xx``. Spatial derivatives are second-order centred
differences evaluated on the interior nodes at every step; the ends keep
the constant Dirichlet values ``left``/``right``.
This is only a *semi-general* solver: no stability condition can be
derived for arbitrary ``F``. The result therefore always contains a
``stability_note`` recommending smaller steps or a specialized solver.
If a step produces a non-finite value the solver stops and returns
``err(...)`` with the offending step number.
The full (t, x) grid is saved to .npz; returned arrays are downsampled to
at most 100 space and 50 time points.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nt | No | ||
| nx | No | ||
| left | No | ||
| right | No | ||
| t_end | No | ||
| length | No | ||
| initial | No | sin(pi*x) | |
| equation | Yes |