This is a Swift implementation of a D2Q9 Lattice-Boltzmann fluid flow simulation.

Overview

DMCLatticeBoltzmann

This is a Swift implementation of a D2Q9 Lattice-Boltzmann fluid flow simulation.

This package defines three products.

The DMCLatticeBoltzmann library models the flow of large collections of particles in a 2-dimensional space.

The DMCLatticeBoltzmannRender library creates QuickTime movies showing how the simulation evolves over time.

The DMCLatticeBoltzmannSim command line executable shows how these libraries can be used to run and record a simulation.

Movie Still

DMC is meant to reduce the likelihood of name collisions with other Swift packages. It's short for "Desert Moon Consulting," my software consulting LLC.

Motivation

After modeling fluid flow in terms of simple particle interactions I wondered whether I could learn enough about Boltzmann's kinetic theory of gases to model fluid flow in terms of the statistical behavior of large numbers of particles.

Who am I kidding? Of course I couldn't. But I did almost immediately trip across Lattice Boltzmann modeling techniques.

The only time I'd tried to learn about computational fluid dynamics, in the early 1990s, I'd been overwhelmed by Navier Stokes equations, methods for building complex 3D meshes, and so on. In addition to being hard for me to understand, it all seemed too far abstracted from gas particles to provide any satisfactory understanding.

Given that, it was a thrill to discover that people had been building computational models of fluid flow in terms of Boltzmann's kinetic theory for decades. The Lattice Boltzmann approach uses a version of Boltzmann's equation to model the properties of gas flowing through a lattice of discrete points in space, across discrete steps in time. I don't really understand Boltzmann's equation, but the rest of the approach makes good sense.

Sources

This code draws heavily on the following sources.

https://softologyblog.wordpress.com/2017/03/28/more-fun-with-lattice-boltzman-method-lbm-fluid-simulations/

https://physics.weber.edu/schroeder/fluids/ and its links, including:

https://homepages.abdn.ac.uk/jderksen/pages/lbm/ln02_lb.pdf

You might also like...
Syntactic sugar in Swift for asynchronous dispatches in Grand Central Dispatch

Async Now more than syntactic sugar for asynchronous dispatches in Grand Central Dispatch (GCD) in Swift Async sugar looks like this: Async.userInitia

AwaitKit is a powerful Swift library which provides a powerful way to write asynchronous code in a sequential manner.
AwaitKit is a powerful Swift library which provides a powerful way to write asynchronous code in a sequential manner.

AwaitKit is a powerful Swift library inspired by the Async/Await specification in ES8 (ECMAScript 2017) which provides a powerful way to write asynchronous code in a sequential manner.

Elegant ⏱ interface for Swift apps

Each Elegant ⏱ interface for Swift apps Each is a NSTimer bridge library written in Swift. Features Requirements Installation Usage Leaks License Feat

 GCDTimer - Well tested Grand Central Dispatch (GCD) Timer in Swift
GCDTimer - Well tested Grand Central Dispatch (GCD) Timer in Swift

GCDTimer Well tested Grand Central Dispatch (GCD) Timer in Swift. Checkout the test file. Usage Long running timer import GCDTimer

Schedule timing task in Swift using a fluent API. (A friendly alternative to Timer)
Schedule timing task in Swift using a fluent API. (A friendly alternative to Timer)

Schedule(简体中文) Schedule is a timing tasks scheduler written in Swift. It allows you run timing tasks with elegant and intuitive syntax. Features Elega

Grand Central Dispatch simplified with swift.

GCDKit GCDKit is Grand Central Dispatch simplified with Swift. for Swift 1.2: Use version 1.0.1 for Swift 2.1 / 2.2: Use the master branch Introductio

Queues, timers, and task groups in Swift
Queues, timers, and task groups in Swift

Dispatcher eases the pain of using Grand Central Dispatch by introducing 4 new Swift classes. Dispatcher Queue Group Timer Requirements Swift 2.0+ Ins

A wrapper of Grand Central Dispatch written in Swift

GCD A wrapper of Grand Central Dispatch written in Swift. Examples gcd // submit your code for asynchronous execution on a global queue with high prio

A Swift microframework for very easy atomic values.

Atomic Atomic is a fast, safe class for making values thread-safe in Swift. It is backed by pthread_mutex_lock which is the fastest, most-efficient lo

Owner
Mitch Chapman
Mitch Chapman
Egg-Timer - Intermediate Swift Programming - Control Flow and Optionals

Egg-Timer Intermediate Swift Programming - Control Flow and Optionals What I lea

null 0 Jan 10, 2022
AsyncDispatcher is a lightweight Dispatcher implementation of Flux pattern.

Simplified Dispatcher implementation of Flux pattern written in Swift using new async/await concurrency model

Natan Zalkin 5 Dec 25, 2022
Remote shell using libssh2 with Objective-C, thread safe implementation.

NSRemoteShell Remote shell using libssh2 with Objective-C. Thread safe implementation. Available as Swift Package. git libssh2 prebuilt binaries are r

Lakr Aream 14 Sep 13, 2022
A complete set of primitives for concurrency and reactive programming on Swift

A complete set of primitives for concurrency and reactive programming on Swift 1.4.0 is the latest and greatest, but only for Swift 4.2 and 5.0 use 1.

AsyncNinja 156 Aug 31, 2022
Futures is a cross-platform framework for simplifying asynchronous programming, written in Swift.

Futures Futures is a cross-platform framework for simplifying asynchronous programming, written in Swift. It's lightweight, fast, and easy to understa

David Ask 60 Aug 11, 2022
GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This help

Quan Vo 42 Oct 5, 2022
Hydra ⚡️ Lightweight full-featured Promises, Async & Await Library in Swift

Lightweight full-featured Promises, Async & Await Library in Swift What's this? Hydra is full-featured lightweight library which allows you to write b

Daniele Margutti 2k Dec 24, 2022
Kommander is a Swift library to manage the task execution in different threads.

A lightweight, pure-Swift library for manage the task execution in different threads. Through the definition a simple but powerful concept, Kommand.

Intelygenz 173 Apr 11, 2022
SwiftCoroutine - Swift coroutines for iOS, macOS and Linux.

Many languages, such as Kotlin, Go, JavaScript, Python, Rust, C#, C++ and others, already have coroutines support that makes the async/await pattern i

Alex Belozierov 808 Dec 1, 2022
Venice - Coroutines, structured concurrency and CSP for Swift on macOS and Linux.

Venice provides structured concurrency and CSP for Swift. Features Coroutines Coroutine cancelation Coroutine groups Channels Receive-only chan

Zewo 1.5k Dec 22, 2022