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.

2
mentions
5
contributors
Get started
1266 commitsLast commit ≈ 1 week ago52 stars13 forks

Cite this software

What IncompressibleNavierStokes can do for you

Logo Logo

IncompressibleNavierStokes

Stable Dev Build Status Coverage Aqua QA DOI

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

Logo of IncompressibleNavierStokes
Keywords
Programming language
  • Julia 100%
License
</>Source code

Participating organisations

CWI
Netherlands eScience Center
Natural Sciences & Engineering
Natural Sciences & Engineering
Environment & Sustainability
Environment & Sustainability

Reference papers

Mentions

Contributors

Related projects

DEEPDIP

Discovering deep physics models with differentiable programming

Updated 7 months ago
In progress

Related software

CoupledNODE

CO

CoupledNODE.jl is a SciML repository that extends NODEs (Neural Ordinary Differential Equations) to C-NODEs (Coupled Neural ODEs), providing a data-driven approach to modelling solutions for multiscale systems when exact solutions are not feasible.

Updated 4 weeks ago
5