Simple Julia Lattice Boltzmann Solver for Thin Liquid Films and Droplets, approximating the thin film equation.
Author Zitzeronion
7 Stars
Updated Last
10 Months Ago
Started In
November 2020


Dev CI codecov status DOI Swalbe.jl Downloads


Thin film simulations using lattice Boltzmann 🌈 🌊

Why is a thin film solver called Swalbe.jl you may ask?

The idea is to use the lattice Boltzmann method (LBM) and all its benefits (easy to code, vast amount of literature and scalability) to simulate thin liquid film flows. Instead of reinventing the wheel we make use of a class of lattice Boltzmann models that were build to simulate shallow water problems, see Salmon (not the fish 🐟), Dellar and van Thang et al. (all free to read). Thus the name of the package Shallow WAter Lattice Boltzmann slovEr or Swalbe.

Of course using a plain shallow water model will not work to simulate thin film dynamics, that is the reason we build our own model :neckbeard:. Now the main difference is that we throw away most of the shallow water parts by assuming they are small as compared to thin film relevant things, e.g. the substrate fluid interaction. The full explanation of the model with some benchmarks can be found in our paper Zitz et al. (the C/C++ OpenACC codebase has not been further developed since the project moved to Julia)

How to get


First of all you need a Julia (>= 1.6) installation. Julia is a high level open source programming language and it is as easy to use as python 🐍 (my opinion).

Julia can be downloaded at the projects homepage julialang.org.

Install using the Julia package manager

Swalbe.jl is a registered package of the Julia package manager. The only thing you have to do is to add the package to your Julia environment with:

julia> ] add Swalbe

Install from source

Of course you can also clone or fork the repo and activate the package inside the julia REPL (Read Evaluate Print Loop). First you need to go the Swalbe directory and open a REPL

git clone <swalbe git url>
cd swalbe.jl

now you can activate the package with

julia> ] activate .

To check if the package works you can run the test suite with

julia> ] test Swalbe

All tests can be found in test folder, but do not expect too many comments. Still especially the simulate.jl file is worth a look.

How to use

The idea of Swalbe.jl is to script your thin film simulation, based on a lattice Boltzmann iteration.
That is why most core functions can be easily extended, or used out of the box. Find some examples in the scripts folder.

Some initial conditions are handily pre-programmed. E.g. simulating the Rayleigh-Taylor instability:

using Swalbe

# set the constants of the system
sys = Swalbe.SysConst(Lx=100, Ly=100, g=-0.001, γ=0.0005, Tmax=1000)

# run with given parameters for Tmax timesteps ...
# return Lx×Ly array with the final configuration
h = Swalbe.run_rayleightaylor(sys, "CPU"; h₀=1.0, ϵ=0.01, verbos=true)

Further examples can be found in the tutorials section of the documentation: Tutorials

Some development for this solver was performed under the priority program SPP2171-Dynamic Wetting of Flexible, Adaptive, and Switchable Surfaces. On the homepage of the SPP in the resources' section we supply a simple tutorial for the coalescence of droplets using a Pluto notebook.

How to support and contribute

Leave a star if you like the idea of the project and/or the content of the package. You can support the project by actively using it and raising issues. Help is always very welcome, if you want to contribute open a PR or raise an issue with a feature request (and if possible with a way how to include it). Feel free to DM me on Twitter if you have questions, I will try to answer them all timely.

Status of the Package


The package has reached a stable release with version 0.1. All tools needed for running a numerical experiment are tested and usable. I am currently writing a paper for which all experiments were done with this package 😊.


Used By Packages

No packages found.