Python program for 2D implementation of Lax-Friedrichs scheme for simulation of inviscid flow of a perfect gas.
main/
main.py
: Main module for performing the simulation.utils.py
: Utility functions for postprocessing simulation output and generating initial conditions.plot_utils.py
: Utility functions for plotting and creating animations.
example/
gresho_vortex_example.py
: Example simulation of the Gresho Vortex.waves_example.py
: Example simulation of propagating waves.analysis_vortex.ipynb
: Notebook that outputs figures related to the Gresho vortex.analysis_wave.ipynb
: Notebook that outputs figures related to the propagating waves.
example_videos/
: Two example videos for the Gresho vortex and propagating wave simulations
The core functionality relies in the Fluid2D()
class inside main/main.py
, which implements the Lax-Friedrichs scheme in 2D for the fluid flow equations. The simulation output is saved in a .hdf5
file format. There is also the possibility to add lagrangian tracers to the simulation. Check example/gresho_vortex_example.py
for example usage.
- numpy: For math operations.
- matplotlib: For plotting.
- h5py: For saving simulation output data.
- PIL: For saving frames.
- ffmpeg: For rendering animations.
This project is licensed under the MIT License.