This project implements numerical schemes for solving the one-dimensional transport equation
The code requires the following Python libraries:
numpyfor numerical operationsplotlyfor visualizationcopyfor deep copying arrays
- Defines the problem parameters (time interval, wave speed, and CFL condition).
- Specifies the initial condition
$u(x,0) = \sin(2 \pi x)$ . - Provides an analytical solution for validation.
The function espaceDiscretise(J, lam) computes:
dx: spatial step sizedt: temporal step sizeX: array of discretized spatial pointsM: number of time steps
Several numerical schemes are implemented in a dictionary Schema:
- Centered Difference (C)
- Upwind (DAG/DAD)
- Lax-Friedrichs (LF)
- Lax-Wendroff (LW)
The function schema(dx, dt, X, M, c_1, c0, c1) computes the numerical solution for a given scheme.
numerical_solution(Schema, J): Computes and visualizes numerical solutions against the analytical solution.plot_norm_Qn(Schema, J): Evaluates stability by plotting norms of matrix powers.convergenceDeltaX(Schema, J): Analyzes error convergence with respect to spatial discretization.
Run the script to visualize results for different schemes:
python transport_solver.py- The numerical solutions are plotted and compared against the analytical solution.
- Stability analysis evaluates growth in matrix norms.
- Convergence studies confirm expected error behavior for different schemes.