IncompressibleNavierStokes
Documentation | Workflows | Code coverage | Quality assurance |
---|
| | | |
This package implements energy-conserving solvers for the incompressible Navier-Stokes
equations on a staggered Cartesian grid. It is based on the Matlab package
INS2D/INS3D. The simulations can be run on the single/multithreaded CPUs or Nvidia GPUs.
This package also provides experimental support for neural closure models for
large eddy simulation.
Installation
To install IncompressibleNavierStokes, open up a Julia-REPL, type ]
to get
into Pkg-mode, and type:
(v1.10) pkg> add IncompressibleNavierStokes
which will install the package and all dependencies to your local environment.
Note that IncompressibleNavierStokes requires Julia version 1.9
or above.
See the
Documentation
for examples of some typical workflows. More examples can be found in the
examples
directory.
Source code for paper
See here for the source code used in the paper
Discretize first, filter next: learning divergence-consistent closure models for large-eddy simulation.
Gallery
The velocity and pressure fields may be visualized in a live session using
Makie. Alternatively,
ParaView may be used, after exporting individual
snapshot files using the save_vtk
function, or the full time series using the
VTKWriter
processor.
Demo
Make sure to have the GLMakie
and IncompressibleNavierStokes
installed:
using Pkg
Pkg.add(["GLMakie", "IncompressibleNavierStokes"])
Then run run the following code to make a short animation:
using GLMakie
using IncompressibleNavierStokes
# Setup
setup = Setup(
x = (tanh_grid(0.0, 2.0, 200, 1.2), tanh_grid(0.0, 1.0, 100, 1.2)),
boundary_conditions = ((DirichletBC(), DirichletBC()), (DirichletBC(), DirichletBC())),
temperature = temperature_equation(;
Pr = 0.71,
Ra = 1e7,
Ge = 1.0,
boundary_conditions = (
(SymmetricBC(), SymmetricBC()),
(DirichletBC(1.0), DirichletBC(0.0)),
),
),
)
# Solve equation
solve_unsteady(;
setup,
ustart = velocityfield(setup, (dim, x, y) -> zero(x)),
tempstart = temperaturefield(setup, (x, y) -> 1 / 2 + sinpi(30 * x) / 100),
tlims = (0.0, 30.0),
Δt = 0.02,
processors = (;
anim = animator(;
setup,
path = "temperature.mp4",
fieldname = :temperature,
colorrange = (0.0, 1.0),
size = (900, 500),
colormap = :seaborn_icefire_gradient,
nupdate = 5,
),
),
)
Similar projects