A grid solver for fluid dyanmic equations - includes the fifth order WENO-JS and modified Roe solver.
A test project to learn and document hydrodynamics code.
- WENO-JS fifth order
- Roe solver with WENO-Z fifth order
- Written in JAX
Dependencies:
jax
python
numpy
matplotlib
It uses the "cpu" version of jax by default. To change that, edit the following code:
$ swirl-solver.py
jax.config.update('jax_platform_name', "cpu")
#can change it to "gpu"
To run tests, run the following command
python swirl-solver.py
At the top of swirl-solver.py
# For a Density wave solution:
# Set up the test
BC, u0, rd, xlims, Tfinal = setup_test(1)
# For a Riemann solution (Sod Shock Tube):
# Set up the test
BC, u0, rd, xlims, Tfinal = setup_test(2)
To change flux method, solver type or time integration method, edit the following code:
flux_type, slvr, integ = laxf, weno5, RK4
# flux_type: laxf || slvr: solverf, weno5, roe || integ: RK1, RK3, RK4
To activate plotting, in swirl-solver.py:
plots = True
In swirl-solver.py:
Z = # No. of grid points
Co = # CFL number