8000 GitHub - b-fg/HIT.jl: Decaying homogeneous isotropic turbulence simulated with WaterLily
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ HIT.jl Public

Decaying homogeneous isotropic turbulence simulated with WaterLily

Notifications You must be signed in to change notification settings

b-fg/HIT.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HIT.jl: Homogeneous Isotropic Turbulence with WaterLily.jl

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 $N$ cells per direction, resulting in $N^3$ total cells. Experimental results can be nicely matched with resolutions of $N={32,64,128,256}$, and a turbulence model constant of $C_s=0.17$.

Installation and run

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.

Playing with the run_hit.jl 5334 script

  • Simulations can be run in either a CPU (default) or GPU. To run on GPU, in the script we add using CUDA and change T=Array to T=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 of Cs 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.

About

Decaying homogeneous isotropic turbulence simulated with WaterLily

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0