IncompressibleNavierStokes.jl
Incompressible Navier-Stokes solver
Install / Use
/learn @agdestein/IncompressibleNavierStokes.jlREADME

IncompressibleNavierStokes
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.
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 this repository 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 = (
u = (
(DirichletBC(), DirichletBC()),
(DirichletBC(), DirichletBC()),
),
temp = (
(SymmetricBC(), SymmetricBC()),
(DirichletBC(1.0), DirichletBC(0.0)),
),
),
)
# Physical parameters
params = (
viscosity = 3e-4,
conductivity = 2e-4,
gravity = 1.0,
gdir = 2, # Gravity in the y-direction
dodissipation = true,
)
# Solve equation
solve_unsteady(;
force! = boussinesq!,
setup,
start = (
u = velocityfield(setup, (dim, x, y) -> zero(x)),
temp = temperaturefield(setup, (x, y) -> 1 / 2 + sinpi(30 * x) / 100),
),
tlims = (0.0, 30.0),
params,
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
- WaterLily.jl Incompressible solver with immersed boundaries
- Oceananigans.jl: Ocean simulations
- ClimaCore.jl: Atmospheric simulations
- Trixi.jl: High order solvers for various hyperbolic equations
- Ferrite.jl: Finite element discretizations
- Gridap.jl: Finite element discretizations
- FourierFlows.jl: Pseudo-spectral discretizations
Related Skills
node-connect
336.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.8kCommit, push, and open a PR
