All Projects → lettucecfd → lettuce

lettucecfd / lettuce

Licence: MIT License
Computational Fluid Dynamics based on PyTorch and the Lattice Boltzmann Method

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to lettuce

featool-multiphysics
FEATool - "Physics Simulation Made Easy" (Fully Integrated FEA, FEniCS, OpenFOAM, SU2 Solver GUI & Multi-Physics Simulation Platform)
Stars: ✭ 190 (+156.76%)
Mutual labels:  cfd, physics-simulation
GodlyTorch
[NOT MAINTAINED] An app that can control the intensity of the torch of your rooted android device.
Stars: ✭ 16 (-78.38%)
Mutual labels:  torch
hybridCentralSolvers
United collection of hybrid Central solvers - one-phase, two-phase and multicomponent versions
Stars: ✭ 42 (-43.24%)
Mutual labels:  cfd
DeepClassifier
DeepClassifier is aimed at building general text classification model library.It's easy and user-friendly to build any text classification task.
Stars: ✭ 25 (-66.22%)
Mutual labels:  torch
opem
OPEM (Open Source PEM Fuel Cell Simulation Tool)
Stars: ✭ 107 (+44.59%)
Mutual labels:  physics-simulation
CFD-collection
Computational fluid dynamics codes
Stars: ✭ 16 (-78.38%)
Mutual labels:  cfd
euler2d kokkos
Simple 2d finite volume solver for Euler equations using c++ kokkos library
Stars: ✭ 27 (-63.51%)
Mutual labels:  cfd
vqa-soft
Accompanying code for "A Simple Loss Function for Improving the Convergence and Accuracy of Visual Question Answering Models" CVPR 2017 VQA workshop paper.
Stars: ✭ 14 (-81.08%)
Mutual labels:  torch
tensorsem
Structural Equation Modeling using Torch
Stars: ✭ 36 (-51.35%)
Mutual labels:  torch
GAMES103
notes and related materials for GAMES103
Stars: ✭ 21 (-71.62%)
Mutual labels:  physics-simulation
Neural-Zoom
Infinite Zoom For Style Transfer
Stars: ✭ 34 (-54.05%)
Mutual labels:  torch
CFD-Julia-12-steps--o-Navier-Stokes-Equations
This is a replication of "CFD Python: 12 steps to Navier-Stokes" in Julia
Stars: ✭ 33 (-55.41%)
Mutual labels:  cfd
N-body-numerical-simulation
Script written in Python to integrate the equations of motion of N particles interacting with each other gravitationally. The script computes the equations of motion and use scipy.integrate to integrate them. Then it uses matplotlib to visualize the solution.
Stars: ✭ 40 (-45.95%)
Mutual labels:  physics-simulation
mi-gen
Mass-Interaction Sound Synthesis Toolbox for Max/MSP's gen~
Stars: ✭ 50 (-32.43%)
Mutual labels:  physics-simulation
Amber
Amber-ify LED torch.
Stars: ✭ 26 (-64.86%)
Mutual labels:  torch
torch-lrcn
An implementation of the LRCN in Torch
Stars: ✭ 85 (+14.86%)
Mutual labels:  torch
metalens
Design, optimize, & simulate metasurface lenses (aka diffractive lenses), beam deflectors, gratings etc
Stars: ✭ 52 (-29.73%)
Mutual labels:  physics-simulation
HamiltonianSolver
Numerically solves equations of motion for a given Hamiltonian function
Stars: ✭ 51 (-31.08%)
Mutual labels:  physics-simulation
photontorch
Highly parallel simulation and optimization of photonic circuits in time and frequency domain based on the deep-learning framework PyTorch
Stars: ✭ 29 (-60.81%)
Mutual labels:  torch
dafoam
DAFoam: Discrete Adjoint with OpenFOAM for High-fidelity Gradient-based Design Optimization
Stars: ✭ 86 (+16.22%)
Mutual labels:  cfd

https://raw.githubusercontent.com/lettucecfd/lettuce/master/.source/img/logo_lettuce_typo.png

CI Status Documentation Status https://img.shields.io/lgtm/grade/python/g/lettucecfd/lettuce.svg?logo=lgtm&logoWidth=18

GPU-accelerated Lattice Boltzmann Simulations in Python

Lettuce is a Computational Fluid Dynamics framework based on the lattice Boltzmann method (LBM).

It provides

  • GPU-accelerated computation based on PyTorch
  • Rapid Prototyping in 2D and 3D
  • Usage of neural networks and automatic differentiation within LBM

Resources

When using lettuce please cite:

@inproceedings{bedrunka2021lettuce,
  title={Lettuce: PyTorch-Based Lattice Boltzmann Framework},
  author={Bedrunka, Mario Christopher and Wilde, Dominik and Kliemank, Martin and Reith, Dirk and Foysi, Holger and Kr{\"a}mer, Andreas},
  booktitle={High Performance Computing: ISC High Performance Digital 2021 International Workshops, Frankfurt am Main, Germany, June 24--July 2, 2021, Revised Selected Papers},
  pages={40},
  organization={Springer Nature}
}

Getting Started

The following Python code will run a two-dimensional Taylor-Green vortex on a GPU:

import torch
from lettuce import BGKCollision, StandardStreaming, Lattice, D2Q9, TaylorGreenVortex2D, Simulation

device = "cuda:0"   # for running on cpu: device = "cpu"
dtype = torch.float32

lattice = Lattice(D2Q9, device, dtype)
flow = TaylorGreenVortex2D(resolution=256, reynolds_number=10, mach_number=0.05, lattice=lattice)
collision = BGKCollision(lattice, tau=flow.units.relaxation_parameter_lu)
streaming = StandardStreaming(lattice)
simulation = Simulation(flow=flow, lattice=lattice,  collision=collision, streaming=streaming)
mlups = simulation.step(num_steps=1000)

print("Performance in MLUPS:", mlups)

More advanced examples are available as jupyter notebooks:

Installation

  • Install the anaconda package manager from www.anaconda.org

  • Create a new conda environment and install all dependencies:

    conda create -n lettuce -c pytorch -c conda-forge\
         "pytorch>=1.2" matplotlib pytest click cudatoolkit "pyevtk>=1.2"
    
  • Activate the conda environment:

    conda activate lettuce
    
  • Clone this repository from github

  • Change into the cloned directory

  • Run the install script:

    python setup.py install
    
  • Run the test cases:

    python setup.py test
    
  • Check out the convergence order, running on CPU:

    lettuce --no-cuda convergence
    
  • For running a CUDA-driven LBM simulation on one GPU omit the --no-cuda. If CUDA is not found, make sure that cuda drivers are installed and compatible with the installed cudatoolkit (see conda install command above).

  • Check out the performance, running on GPU:

    lettuce benchmark
    

Credits

We use the following third-party packages:

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

License

  • Free software: MIT license, as found in the LICENSE file.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].