Direct numerical simulation (DNS) of the incompressible Navier–Stokes equations with a pseudo-spectral method. Fast Fourier transforms and the (optionally MPI-parallel) field storage are provided by µGrid.
A single executable, simulate.py, runs the calculation and writes the
velocity field to a NetCDF file. It runs serially or under MPI:
# Taylor-Green vortex on a 64^3 grid (serial)
python simulate.py --initial-condition taylor-green -n 64 64 64
# forced isotropic turbulence on 4 MPI ranks
mpirun -np 4 python simulate.py --initial-condition turbulence
# see all options
python simulate.py --helpFull documentation is published at
https://muSpectre.github.io/muNavierStokes/ (built with MkDocs from the
docs/ directory): the physics, the
implementation (including the µFFT→µGrid migration
notes), usage, GPU execution, and a
benchmark (single-CPU, multi-CPU MPI, single-GPU).
| path | contents |
|---|---|
simulate.py |
the simulation driver (single executable) |
muNavierStokes/ |
the solver (NavierStokes) and the RK4 integrator |
scripts/ |
post-processing (slicing, plotting, spectra, decay fit) |
tests/ |
pytest correctness and functional tests |
pytest # run the test suite
pytest --cov # with a coverage reportTests run in CI on every push (see .github/workflows/tests.yml).
muGrid (with FFT + NetCDF support), mpi4py, numpy; plus
matplotlib and netCDF4 for the post-processing scripts. Install the test
extras with pip install -e ".[test]".