Skip to content

Decaying Homogeneous Isotropic Turbulence - 2D

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.

Packages

We just need IncompressibleNavierStokes and a Makie plotting backend.

julia
using CairoMakie
using IncompressibleNavierStokes

Setup

julia
n = 256
ax = LinRange(0.0, 1.0, n + 1)
setup = Setup(; x = (ax, ax), Re = 4e3);
ustart = random_field(setup, 0.0);

Solve unsteady problem

julia
state, outputs = solve_unsteady(;
    setup,
    ustart,
    tlims = (0.0, 1.0),
    processors = (
        rtp = realtimeplotter(; setup, nupdate = 10),
        ehist = realtimeplotter(;
            setup,
            plot = energy_history_plot,
            nupdate = 10,
            displayfig = false,
        ),
        espec = realtimeplotter(;
            setup,
            plot = energy_spectrum_plot,
            nupdate = 10,
            displayfig = false,
        ),
        log = timelogger(; nupdate = 100),
    ),
);
[ Info: Iteration 100	t = 0.0964896	Δt = 0.000983729	umax = 3.53899
[ Info: Iteration 200	t = 0.20155	Δt = 0.000996286	umax = 3.52646
[ Info: Iteration 300	t = 0.309626	Δt = 0.0011381	umax = 3.0853
[ Info: Iteration 400	t = 0.421681	Δt = 0.00121462	umax = 2.88734
[ Info: Iteration 500	t = 0.558478	Δt = 0.00133737	umax = 2.64088
[ Info: Iteration 600	t = 0.677049	Δt = 0.00119959	umax = 2.92191
[ Info: Iteration 700	t = 0.812756	Δt = 0.00148143	umax = 2.37713
[ Info: Iteration 800	t = 0.948302	Δt = 0.00143439	umax = 2.43438

Post-process

We may visualize or export the computed fields

Energy history

julia
outputs.ehist

Energy spectrum

julia
outputs.espec

Plot field

julia
fieldplot(state; setup)


This page was generated using Literate.jl.