A Python implementation of the turbulence synthesis algorithm from Jos Stam's "Turbulent Wind Fields for Gaseous Phenomena". Generates temporally correlated 2D or 3D homogenous turbulent velocity fields that are periodic in space and time. This implementation also features additions from "A General Animation Framework for Gaseous Phenomena" including optional Gaussian spatial or fractal temporal correlation.
Use example scripts to generate gifs below. Tunable parameters include:
Nx
,Ny
,Nz
- Velocity field sizeNt
- Number of fields to generatespatial_correlation
-fractal
orgaussian
temporal_correlation
-fractal
orgaussian
sigma_spatial
- Parameter for spatial correlationsigma_temporal
- Parameter for temporal correlationk_inertial
- Minimum percentage of maximum wavenumber to begin turbulence generation.
fractal
spatial correlation and gaussian
temporal correlation are the standard settings from the original paper. Increasing k_inertial
has the effect of restricting the average eddy size and is a sensitive parameter beyond near zero values.
Velocity fields with parameters Nx
, Ny
, Nz
, Nt
are generated with array dimensions [Ny
, Nx
, Nz
,Nt
]. Thus, 0th and 1st dimensions correspond to rows (Ny
) and columns (Nx
) and the last dimension always corresponds to the temporal dimension (Nt
). Velocity component directions correspond to the indexing convention respectively.
The examples below show the 3D case of velocity magnitude and vorticity field evolution for the two spatial correlation options. For the 4D case, a slice through the animated volume can be visualised in the code or the velocity fields can be exported to ParaView or Blender for volume visualisation.
This project is licensed under the MIT License.