Skip to content

Note: Output is not generated for this example (to save resources on GitHub).

Decaying Homogeneous Isotropic Turbulence - 3D

In this example we consider decaying homogeneous isotropic turbulence, similar to the cases considered in [1] and [2]. The initial velocity field is created randomly, but with a specific energy spectrum. Due to viscous dissipation, the turbulent features eventually group to form larger visible eddies.

julia
using CairoMakie
using IncompressibleNavierStokes

Problem setup

julia
ArrayType = Array
# using CUDA; ArrayType = CuArray
T = Float32
n = 128
ax = range(T(0), T(1), n + 1)
setup = Setup(; x = (ax, ax, ax), Re = T(4e3), ArrayType);
psolver = psolver_spectral_lowmemory(setup);
ustart = random_field(setup; psolver);
nothing #hide

Solve problem

julia
state, outputs = solve_unsteady(;
    setup,
    ustart,
    tlims = (T(0), T(2)),
    psolver,
    processors = (
        # rtp = realtimeplotter(; setup, plot = fieldplot, nupdate = 10),
        # ehist = realtimeplotter(; setup, plot = energy_history_plot, nupdate = 10),
        espec = realtimeplotter(; setup, plot = energy_spectrum_plot, nupdate = 10),
        # anim = animator(; setup, path = "$outdir/solution.mkv", nupdate = 20),
        # vtk = vtk_writer(; setup, nupdate = 10, dir = outdir, filename = "solution"),
        log = timelogger(; nupdate = 10),
    ),
);
nothing #hide

Post-process

Field plot

julia
# outputs.rtp
# fieldplot(state; setup, levels = 0:5)

Energy history

julia
# outputs.ehist

Energy spectrum

julia
outputs.espec

This page was generated using Literate.jl.