Simulating decaying homogeneous isotropic turbulence (HIT), made easy!
This repo uses WaterLily.jl as a CFD solver to simulate HIT. We use experimental data from the paper of Comte-Bellot and Corrsin to validate the results, and the HIT generator method from Saad et al. to create a random incompressible turbulent flow field as initial condition.
An explicit turbulence model, the Smagorinsky-Lilly model, is used to account for the sub-grid scales. In WaterLily, we select a central difference scheme for the convective term to mitigate numerical dissipation. The numerical domain is defined as a triple-periodic box with
First, you need to have a working Julia installation in your system, ideally with Julia version >=1.10. I recommend using juliaup to install and manage different Julia versions.
Once Julia is installed, download this repository and use the Julia package manager to install the dependencies. The instructions below use git
to download the repo, but you can just download the source files as well.
git clone https://github.com/b-fg/HIT.jl && cd HIT.jl
julia --project -e 'using Pkg; Pkg.add(name="WaterLily", rev="turbulence_modelling"); Pkg.instantiate()'
The instantiate
command will download and compile all the dependencies. Alternatively, you can use the package manager within the Julia REPL julia --project
by pressing ]
, and then run the (e.g.) instantiate
command. Note that we use the branch turbulence_modelling
of WaterLily.
Next, we do the same from the example/
directory. Here, we will indicate that the HIT.jl
package is installed locally as well.
cd example
julia --project -e 'using Pkg; Pkg.develop(path=".."); Pkg.add(name="WaterLily", rev="turbulence_modelling"); Pkg.instantiate()'
Now the run_hit.jl
script can be simply run within the example
directory with
julia --project run_hit.jl
and this should produce the above plot of the energy cascade compared to the experimental data using N=32
cells per direction.
- Simulations can be run in either a CPU (default) or GPU. To run on GPU, in the script we add
using CUDA
and changeT=Array
toT=CuArray
. - Run with the desired resolution by changing
N
. - Choose the number of spectral modes considered in the intitial velocity vector field by modifying
modes
. - Choose to run without/with the Smagorinsky-Lilly model by setting its constant
Cs = 0
(no explicit turbulence model), or a positive value ofCs
for the model to be activated (and use that constant value). - Choose the discretization scheme of the convective term to use a central difference scheme
λ = cds
or the QUICK schemeλ = quick
. - Visualize the flow using the
ω_viz
routine, which generates a 3D plot of constant vorticity magnitude structures. For example
f, ax = ω_viz(sim; t_end=sim_time(sim)+200, isovalue=0.04)
generates the 3D plot and runs the simulation for 200 convective time units. You can change the isosurface value of the vorticity magnitude with the isovalue
parameter.