Upwind
First order: smooth but strongly diffusive. At t = 15 s the pulse peak has dropped to 0.22.
Two classic finite-difference schemes for the 1-D linear wave equation: the original Fortran studies, a Python port tested against their output, and an error comparison against the exact solution.
The grid is 301 nodes with a spacing of 0.01 and a time step of 0.01, so the Courant number is 0.09.
This repo merges two earlier repos, Upwind-Differencing-Scheme and Explicit-Maccormack-Method.
First order: smooth but strongly diffusive. At t = 15 s the pulse peak has dropped to 0.22.
Second order: keeps the peak (0.73 at t = 15 s) but adds trailing wiggles from dispersion.
Every scheme is scored by RMS error against the exactly translated pulse.
fortran/upwind.f90 and fortran/maccormack.f90 compile with any Fortran 90 compiler and write Gnuplot-ready .plt files.
schemes.py reproduces the Fortran output; the tests check both ports against the committed results within 1e-5.
Snapshots are at t = 1, 3, 6, 10, 15 ... 55 s, not 1 to 10 s, and the old MacCormack results came from a backward-difference predictor.
From the README’s “Run it” section. Full options, requirements and troubleshooting are there too.
Open the README$ pip install numpy matplotlib
$ python schemes.py # error table + comparison.png
$ python tests/test_schemes.py # port vs Fortran output checks
37 files in the repo · last updated 8 Nov 2026.
Browse the codeFortran, Python, CFD.
The commands in the “Run it” box above come straight from the README. Paste them into a terminal; the README covers options and troubleshooting.
The source is public on GitHub under the MIT licence.
Juwen Lie, an R&D mechanical engineer in Batam, Indonesia, as an independent personal project.
Upwind vs MacCormack, side by side.