Skip to main content

Real-time interactive Lattice Boltzmann CFD with full GPU acceleration and graphics

Project description

FluidX3D Python Module

Real-time interactive GPU-accelerated Computational Fluid Dynamics (CFD) with Python!

This is a Python wrapper for FluidX3D v2.16, the fastest and most memory efficient Lattice Boltzmann CFD software, capable of running simulations with up to 10 billion cells in VRAM.

FluidX3D Demo

Features

  • 🚀 Full GPU Acceleration - Utilizes OpenCL for massive parallel computation
  • 🎮 Interactive Graphics - Real-time 3D visualization with interactive controls
  • 🔧 Runtime Configuration - All simulation parameters configurable via Python API
  • 📊 High Performance - Processes millions of lattice cells per second
  • 🎯 Easy to Use - Simple Python interface to powerful CFD engine
  • 🪟 Windows Graphics - Native window support with keyboard/mouse controls

Requirements

  • Windows (required for interactive graphics)
  • Python 3.11+
  • OpenCL-capable GPU (NVIDIA, AMD, or Intel)
  • Visual C++ Redistributables (usually already installed)

Installation

pip install fluidx3d

Quick Start

import fluidx3d

# Configure simulation
config = fluidx3d.Config()
config.parse_args([
    '--D3Q27',              # Use D3Q27 velocity set
    '--FP16S',              # Use FP16 precision
    '--SUBGRID',            # Enable subgrid model
    '--SRT',                # Use SRT collision operator
    '--GRAPHICS',           # Enable graphics
    '--window',             # Use windowed mode (not fullscreen)
    '-f', 'your_model.stl', # Input STL file
    '-r', '15400',          # Resolution (VRAM in MB)
    '-u', '7.0',            # Velocity (m/s)
    '--re', '535000000',    # Reynolds number
    '--secs', '10.0',       # Simulation time (seconds)
])

# Run simulation (opens interactive window!)
config.run_simulation()

Interactive Controls

When the graphics window opens:

  • P - Pause/resume simulation
  • O - Save frames to disk
  • H - Show/hide help overlay
  • 1-7 - Toggle visualization modes
  • Mouse - Rotate camera
  • W/A/S/D - Move camera (in free camera mode)
  • F - Toggle free camera mode
  • Esc - Quit

Example: Airship Simulation

import fluidx3d

config = fluidx3d.Config()
config.parse_args([
    '--D3Q27', '--FP16S', '--SUBGRID',
    '--SRT', '--UPDATE_FIELDS', '--GRAPHICS',
    '--EQUILIBRIUM_BOUNDARIES', '--window',
    '-f', 'LZ_129_Hindenburg.stl',
    '-r', '15400',  # ~15GB VRAM
    '-u', '7',      # 7 m/s velocity
    '--re', '535000000',  # Reynolds number
    '--rho', '1024',      # Density
    '--secs', '30.0',     # 30 seconds simulation
    '--fps', '60',
    '--slomo', '10',
])

# Access parameters
print(f"Velocity: {config.get_float('u')} m/s")
print(f"Reynolds: {config.get_float('re')}")

# Get all parameters as dict
params = config.to_dict()

# Run simulation
config.run_simulation()

Available Arguments

Velocity Sets

  • --D2Q9 - 2D 9-velocity
  • --D3Q15 - 3D 15-velocity
  • --D3Q19 - 3D 19-velocity
  • --D3Q27 - 3D 27-velocity (recommended)

Precision & Performance

  • --FP16S - Half precision (recommended, 2x faster)
  • --FP16C - Half precision compression
  • --SUBGRID - Subgrid turbulence model

Collision Operators

  • --SRT - Single Relaxation Time
  • --TRT - Two Relaxation Time

Features

  • --GRAPHICS - Enable interactive graphics
  • --window - Windowed mode (not fullscreen)
  • --UPDATE_FIELDS - Update velocity/density fields
  • --EQUILIBRIUM_BOUNDARIES - Equilibrium boundaries
  • --MOVING_BOUNDARIES - Moving solid boundaries
  • --SURFACE - Free surface flow
  • --TEMPERATURE - Temperature simulation
  • --PARTICLES - Particle tracking

Simulation Parameters

  • -f FILE - Input STL file
  • -r RES - Resolution (VRAM usage in MB)
  • -u VEL - Velocity (m/s)
  • -c CHORD - Characteristic length (m)
  • --re RE - Reynolds number
  • --rho RHO - Density (kg/m³)
  • --secs TIME - Simulation duration (seconds)
  • --fps FPS - Video framerate
  • --slomo FACTOR - Slow motion factor
  • --export PATH - Export directory

Geometry Transform

  • --rotx DEG - Rotate around X axis
  • --roty DEG - Rotate around Y axis
  • --rotz DEG - Rotate around Z axis
  • --scale FACTOR - Scale factor
  • --aoa DEG - Angle of attack

Performance Tips

  1. Use --FP16S - Doubles performance on most GPUs
  2. Use --D3Q27 - Best accuracy for complex flows
  3. Adjust resolution - Use -r to balance quality vs speed
  4. Monitor VRAM - Shown in console output at startup

Hardware Requirements

Minimum

  • NVIDIA GTX 1060 / AMD RX 580 / Intel Arc A380 (4GB VRAM)
  • 8GB system RAM
  • Windows 10/11

Recommended

  • NVIDIA RTX 3060 or better (12GB+ VRAM)
  • 16GB+ system RAM
  • Windows 11

Credits

License

GNU General Public License v3.0 - See LICENSE.md

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fluidx3d-2.16.3-cp314-cp314-win_amd64.whl (580.6 kB view details)

Uploaded CPython 3.14Windows x86-64

fluidx3d-2.16.3-cp313-cp313-win_amd64.whl (566.8 kB view details)

Uploaded CPython 3.13Windows x86-64

fluidx3d-2.16.3-cp312-cp312-win_amd64.whl (566.7 kB view details)

Uploaded CPython 3.12Windows x86-64

fluidx3d-2.16.3-cp311-cp311-win_amd64.whl (566.2 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file fluidx3d-2.16.3-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fluidx3d-2.16.3-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 580.6 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for fluidx3d-2.16.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 724e11a5a3b69c222c91c72bc3843ef08ca0bbf1827cdaec6e70a84fd8012893
MD5 500920410605bba2b5b6969d5fda6319
BLAKE2b-256 a8ecbd82bc6bd060143da0b4e5a95e6274908ad786ae7c67f7beb964636c6e5c

See more details on using hashes here.

File details

Details for the file fluidx3d-2.16.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fluidx3d-2.16.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 566.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for fluidx3d-2.16.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dc1b423546a7706fc98779def1db9c0a3f77ddde39426682796102b15614c567
MD5 827682a64ca49a4b65b12536c4abee7b
BLAKE2b-256 32c6a96aedd9d3b9fa49e30e925d2d50d2e2f54dce59eb9109749c1246b15682

See more details on using hashes here.

File details

Details for the file fluidx3d-2.16.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fluidx3d-2.16.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 566.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for fluidx3d-2.16.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 96dafe649bdc5afeafdb5ee7f2e8d2fcce64f4a3d742f1bdd63fed777011e670
MD5 44e36e09c05a6b04b60328d35ac591d9
BLAKE2b-256 145387ef101d218a71a23a3e179ec49af404ba34fa0ea10b5ab17fba5c4c911a

See more details on using hashes here.

File details

Details for the file fluidx3d-2.16.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: fluidx3d-2.16.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 566.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for fluidx3d-2.16.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9c731e296ff3ad03bf63475635b57f2fc453ac9e7f243b698d1917de6131266d
MD5 1fc897ce6e56142a35837135560c7483
BLAKE2b-256 dab42ba8122d0145a565453d08883f1d57abc76bcc63fcdce3cb42450c225958

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page