Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Sparse
  • WallLaw
  • improved_comm
  • master
  • mr_refactor_wfb
  • suffa/cumulantfourth_order_correction_with_psm
  • release/0.2.1
  • release/0.2.10
  • release/0.2.11
  • release/0.2.12
  • release/0.2.13
  • release/0.2.14
  • release/0.2.15
  • release/0.2.2
  • release/0.2.3
  • release/0.2.4
  • release/0.2.5
  • release/0.2.6
  • release/0.2.7
  • release/0.2.8
  • release/0.2.9
  • release/0.3.0
  • release/0.3.1
  • release/0.3.2
  • release/0.3.3
  • release/0.3.4
  • release/0.4.0
  • release/0.4.1
  • release/0.4.2
  • release/0.4.3
  • release/0.4.4
  • release/1.0
  • release/1.0.1
  • release/1.1
  • release/1.1.1
  • release/1.2
  • release/1.3
  • release/1.3.1
  • release/1.3.2
  • release/1.3.3
  • release/1.3.4
  • release/1.3.5
  • release/1.3.6
  • release/1.3.7
44 results

Target

Select target project
No results found
Select Git revision
  • accessor_choice
  • csebug
  • fluct_zero_centered
  • fluctuating
  • fluctuating_lb_test
  • fluctuation_test
  • improved_comm
  • master
  • poiseuille
  • test_martin
  • release/0.2.1
  • release/0.2.2
  • release/0.2.3
  • release/0.2.4
  • release/0.2.5
  • release/0.2.6
16 results
Show changes
361 files
+ 53236
14020
Compare changes
  • Side-by-side
  • Inline

Files

+3 −3
Original line number Original line Diff line number Diff line
[flake8]
[flake8]
max-line-length=120
max-line-length=120
exclude=lbmpy/plot.py
exclude=src/lbmpy/plot.py
        lbmpy/session.py
        src/lbmpy/session.py
ignore = W293 W503 W291
ignore = W293 W503 W291 C901 E741

.gitattributes

0 → 100644
+1 −0
Original line number Original line Diff line number Diff line
src/lbmpy/_version.py export-subst
+23 −4
Original line number Original line Diff line number Diff line
__pycache__
__pycache__
.ipynb_checkpoints
.ipynb_checkpoints
.coverage
.coverage*
*.pyc
*.pyc
*.vti
*.vti
/build
/build
/html_doc
/dist
/dist
/*.egg-info
*.egg-info
.cache
.cache
_build
_build
/.idea
/.idea
.cache
_local_tmp
_local_tmp
**/.vscode
**/pylintrc
*.bak
*.tmp
/tests/db
doc/bibtex.json
/db
/src/lbmpy/phasefield/simplex_projection.*.so
/src/lbmpy/phasefield/simplex_projection.c

test-report
report.xml

# macOS
**/.DS_Store
*.uuid

# benchmark database
/tests/benchmark/db
 No newline at end of file
+160 −68
Original line number Original line Diff line number Diff line
stages:
stages:
  - test
  - "Code Quality"
  - "Tests"
  - "Prerelease-Tests"
  - integration
  - nightly
  - docs
  - deploy
  - deploy


# --------------------------  Code Quality --------------------------------------------------------------------------------


# --------------------------  Tests ------------------------------------------------------------------------------------

# Linter for code formatting
flake8-lint:
  stage: "Code Quality"
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine
  script:
    - nox -s lint
  tags:
    - docker


# --------------------------  Tests --------------------------------------------------------------------------------


# Normal test - runs on every commit all but "long run" tests
# Normal test - runs on every commit all but "long run" tests
tests-and-coverage:
testsuite-cuda-py3.10:
  stage: test
  stage: "Tests"
  except:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:ubuntu24.04-cuda12.6
    variables:
  needs: []
      - $ENABLE_NIGHTLY_BUILDS
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  script:
  script:
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - mkdir public
    - nox -s "testsuite_gpu-3.10(cupy12)"
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. -m "not longrun"
  tags:
  tags:
    - docker
    - docker
    - cuda
    - cuda
    - cudaComputeCapability6.1
    - AVX
    - AVX
  coverage: /Total coverage:\s\d+.\d+\%/
  artifacts:
  artifacts:
    when: always
    when: always
    paths:
    paths:
      - coverage_report
      - coverage_report
      - test-report
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml
      junit: report.xml


# Nightly test  - runs "long run" jobs only

test-longrun:
testsuite-cpu-py3.13:
  stage: test
  stage: "Tests"
  only:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine
    variables:
  needs: []
      - $ENABLE_NIGHTLY_BUILDS
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  script:
  script:
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - nox -s "testsuite_cpu-3.13"
    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=.
  tags:
  tags:
    - docker
    - docker
    - cuda
    - AVX
    - AVX
  artifacts:
  artifacts:
    when: always
    paths:
    paths:
      - coverage_report
      - test-report
    reports:
      junit: report.xml


# Minimal tests in windows environment

minimal-windows:
# Normal test with longruns
  stage: test
tests-and-coverage-with-longrun:
  except:
  stage: "Tests"
    variables:
  when: manual
      - $ENABLE_NIGHTLY_BUILDS
  allow_failure: true
  tags:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
    - win
  script:
  script:
    - source /cygdrive/c/Users/build/Miniconda3/Scripts/activate
    # - pip install sympy --upgrade
    - source activate pystencils_dev
    - export NUM_CORES=$(nproc --all)
    - env
    - mkdir -p ~/.config/matplotlib
    - conda env list
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - mkdir public
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - python -c "import numpy"
    - env
    - python setup.py quicktest
    - pip list

    - py.test -v -n $NUM_CORES
minimal-ubuntu:
  tags:
  stage: test
    - docker
  except:
    - cuda
    variables:
    - cudaComputeCapability6.1
      - $ENABLE_NIGHTLY_BUILDS
    - AVX
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_ubuntu

# --------------------------  Nightly and Pre-Release Tests --------------------------------------------------------------------------------

# Test against latest pystencils 2.0 development version
pystencils-2.0dev:
  stage: "Prerelease-Tests"
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:ubuntu24.04-cuda12.6
  allow_failure: true
  needs: []
  script:
  script:
    - pip3 install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - mkdir -p ~/.config/matplotlib
    - python3 setup.py quicktest
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - nox -s "testsuite_pystencils2(cupy12)"
  tags:
  tags:
    - docker
    - docker
    - AVX
    - cuda
    - cudaComputeCapability6.1
  artifacts:
    when: always
    paths:
      - test-report
    reports:
      junit: report.xml


minimal-conda:
minimal-sympy-master:
  stage: test
  stage: "Prerelease-Tests"
  except:
  needs: []
    variables:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine
      - $ENABLE_NIGHTLY_BUILDS
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
  script:
  script:
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - nox -s quicktest -P 3.13 -- --sympy-master
    - python setup.py quicktest
  allow_failure: true
  tags:
  tags:
    - docker
    - docker


# pycodegen-integration:
#   image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
#   stage: integration
#   when: manual
#   allow_failure: true
#   script:
#     - env
#     - pip list
#     - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pycodegen.git
#     - cd pycodegen
#     - git submodule sync --recursive
#     - git submodule update --init --recursive
#     - git submodule foreach git fetch origin   # compare the latest master version!
#     - git submodule foreach git reset --hard origin/master
#     - cd lbmpy
#     - git remote add test $CI_REPOSITORY_URL
#     - git fetch test
#     - git reset --hard $CI_COMMIT_SHA
#     - cd ..
#     - pip install -e pystencils/
#     - pip install -e lbmpy/
#     - ./install_walberla.sh
#     # build all integration tests
#     - cd walberla/build/
#     - make -j $NUM_CORES MicroBenchmarkGpuLbm LbCodeGenerationExample
#     - cd apps/benchmarks/UniformGridGPU
#     - make -j $NUM_CORES
#     - cd ../UniformGridCPU
#     - make -j $NUM_CORES


# -------------------- Linter & Documentation --------------------------------------------------------------------------
#   tags:
#     - docker
#     - cuda
#     - cudaComputeCapability6.1
#     - AVX




flake8-lint:
# -------------------- Scheduled Tasks --------------------------------------------------------------------------
  stage: test

  except:

    variables:
nightly-sympy:
      - $ENABLE_NIGHTLY_BUILDS
  stage: nightly
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python
  before_script:
    - pip install -e .
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - pip install --upgrade --pre sympy
  script:
  script:
    - flake8 lbmpy
    - env
    - pip list
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - mkdir public
    - pytest -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
  tags:
  tags:
    - docker
    - docker
    - AVX
    - cuda
    - cuda
    - cudaComputeCapability6.1
  artifacts:
    when: always
    reports:
      junit: report.xml



# -------------------- Documentation and deploy ------------------------------------------------------------------------


build-documentation:
build-documentation:
  stage: test
  stage: docs
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  needs: []
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/documentation
  before_script:
    - pip install -e .
  script:
  script:
    - export PYTHONPATH=`pwd`
    - export PYTHONPATH=`pwd`
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
    - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils
@@ -118,6 +208,7 @@ build-documentation:
  tags:
  tags:
    - docker
    - docker
    - cuda
    - cuda
    - cudaComputeCapability6.1
  artifacts:
  artifacts:
    paths:
    paths:
      - html_doc
      - html_doc
@@ -125,7 +216,10 @@ build-documentation:


pages:
pages:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  rules:
    - if: '$CI_PIPELINE_SOURCE != "schedule" && $CI_PROJECT_PATH == "pycodegen/lbmpy" && $CI_COMMIT_BRANCH == "master"'
  stage: deploy
  stage: deploy
  needs: ["testsuite-cuda-py3.10", "build-documentation"]
  script:
  script:
    - ls -l
    - ls -l
    - mv coverage_report html_doc
    - mv coverage_report html_doc
@@ -135,5 +229,3 @@ pages:
      - public
      - public
  tags:
  tags:
    - docker
    - docker
  only:
    - master@pycodegen/lbmpy

AUTHORS.txt

0 → 100644
+14 −0
Original line number Original line Diff line number Diff line

Contributors:
-------------

  - Martin Bauer <martin.bauer@fau.de>
  - Markus Holzer <markus.holzer@fau.de>
  - Michael Kuron <mkuron@icp.uni-stuttgart.de>
  - Stephan Seitz <stephan.seitz@fau.de>
  - Frederik Hennig <frederik.hennig@fau.de>
  - Helen Schottenhamml <helen.schottenhamml@fau.de>
  - Rudolf Weeber <weeber@icp.uni-stuttgart.de>
  - Christian Godenschwager <christian.godenschwager@fau.de>
  - Jan Hönig <jan.hoenig@fau.de>
  - Philipp Suffa <philipp.suffa@fau.de>

CHANGELOG.md

0 → 100644
+6 −0
Original line number Original line Diff line number Diff line
# Change Log

## Unreleased

### Removed
* Removing OpenCL support because it is not supported by pystencils anymore

CONTRIBUTING.md

0 → 100644
+3 −0
Original line number Original line Diff line number Diff line
# Contributing

lbmpy is built on the open-source python framework [pystencils](https://pypi.org/project/pystencils/). Please consider the [contribution guideline](https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/CONTRIBUTING.md) of pystencils for contributing to lbmpy.
 No newline at end of file
+3 −2
Original line number Original line Diff line number Diff line
include README.md
include AUTHORS.txt
include COPYING.txt
include CONTRIBUTING.md
include CHANGELOG.md
+51 −8
Original line number Original line Diff line number Diff line
lbmpy
lbmpy
=====
=====


[![Docs](https://img.shields.io/badge/read-the_docs-brightgreen.svg)](http://pycodegen.pages.walberla.net/lbmpy)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/mabau/lbmpy/master?filepath=doc%2Fnotebooks)
[![Docs](https://img.shields.io/badge/read-the_docs-brightgreen.svg)](http://pycodegen.pages.i10git.cs.fau.de/lbmpy)
[![pipeline status](https://i10git.cs.fau.de/pycodegen/lbmpy/badges/master/pipeline.svg)](https://i10git.cs.fau.de/pycodegen/lbmpy/commits/master)
[![pipeline status](https://i10git.cs.fau.de/pycodegen/lbmpy/badges/master/pipeline.svg)](https://i10git.cs.fau.de/pycodegen/lbmpy/commits/master)
[![coverage report](https://i10git.cs.fau.de/pycodegen/lbmpy/badges/master/coverage.svg)](http://pycodegen.pages.walberla.net/lbmpy/coverage_report)
[![coverage report](https://i10git.cs.fau.de/pycodegen/lbmpy/badges/master/coverage.svg)](http://pycodegen.pages.i10git.cs.fau.de/lbmpy/coverage_report)




Run fast fluid simulations based on the lattice Boltzmann method in Python.
Run fast fluid simulations based on the lattice Boltzmann method in Python on CPUs and GPUs.
lbmpy creates highly optimized LB compute kernels in C or CUDA, for a wide variety of different collision operators, including MRT,
entropic, and cumulant schemes.


![alt text](doc/img/logo.png)
All collision operators can be easily adapted, for example, to integrate turbulence models, custom force terms, or multi-phase models. 
It even comes with an integrated Chapman Enskog analysis based on sympy!

Common test scenarios can be set up quickly:
```python
from pystencils import Target
from lbmpy.session import *

ch = create_channel(domain_size=(300, 100, 100), force=1e-7, method=Method.TRT,
                    equilibrium_order=2, compressible=True,
                    relaxation_rates=[1.97, 1.6], optimization={'target': Target.GPU})
```

To find out more, check out the interactive [tutorial notebooks online with binder](https://mybinder.org/v2/gh/mabau/lbmpy/master?filepath=doc%2Fnotebooks).




Installation
Installation
------------
------------


For local installation use pip:

```bash
```bash
export PIP_EXTRA_INDEX_URL=https://www.walberla.net/pip
pip install lbmpy[interactive]
pip install lbmpy[interactive]
```
```


@@ -23,7 +40,8 @@ pip install lbmpy[interactive]
Without `[interactive]` you get a minimal version with very little dependencies.
Without `[interactive]` you get a minimal version with very little dependencies.


All options:
All options:
-  `gpu`: use this if nVidia GPU is available and CUDA is installed
- `gpu`: use this if a NVIDIA GPU is available and CUDA is installed
- `opencl`: use this to enable the target `opencl` (execution using OpenCL)
- `alltrafos`: pulls in additional dependencies for loop simplification e.g. libisl
- `alltrafos`: pulls in additional dependencies for loop simplification e.g. libisl
- `interactive`: installs dependencies to work in Jupyter including image I/O, plotting etc.
- `interactive`: installs dependencies to work in Jupyter including image I/O, plotting etc.


@@ -36,5 +54,30 @@ pip install lbmpy[interactive,gpu,doc]
Documentation
Documentation
-------------
-------------


Read the docs [here](http://pycodegen.pages.walberla.net/lbmpy) and
Read the docs [here](http://pycodegen.pages.i10git.cs.fau.de/lbmpy) and
check out the Jupyter notebooks in `doc/notebooks`. 
check out the Jupyter notebooks in `doc/notebooks`. 

Contributing
-------
To see how to open issues, submit bug reports, create feature requests or submit your additions to lbmpy please refer to
[contribution documentation](https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/CONTRIBUTING.md) of pystencils since lbmpy is heavily build on pystencils.


Many thanks go to the [contributors](https://i10git.cs.fau.de/pycodegen/lbmpy/-/blob/master/AUTHORS.txt) of lbmpy.


### Please cite us

If you use lbmpy in a publication, please cite the following articles:

Overview:
  - F. Hennig et al, Advanced Automatic Code Generation for Multiple Relaxation-Time Lattice Boltzmann Methods. SIAM Journal on Scientific Computing, 2023. https://doi.org/10.1137/22M1531348 ([Preprint](https://arxiv.org/abs/2211.02435))
  - M. Bauer et al, lbmpy: Automatic code generation for efficient parallel lattice Boltzmann methods. Journal of Computational Science, 2021. https://doi.org/10.1016/j.jocs.2020.101269 ([Preprint](https://arxiv.org/abs/2001.11806))

Multiphase:
   - M. Holzer et al, Highly efficient lattice Boltzmann multiphase simulations of immiscible fluids at high-density ratios on CPUs and GPUs through code generation. The International Journal of High Performance Computing Applications, 2021. https://doi.org/10.1177/10943420211016525


### Further Reading

- F. Hennig et al, Automatic Code Generation for the Cumulant Lattice Boltzmann Method. ICMMES, 2021. [Poster Link](https://www.researchgate.net/publication/353224406_Automatic_Code_Generation_for_the_Cumulant_Lattice_Boltzmann_Method)

binder/apt.txt

0 → 100644
+3 −0
Original line number Original line Diff line number Diff line
build-essential
graphviz
ffmpeg

binder/environment.yml

0 → 100644
+36 −0
Original line number Original line Diff line number Diff line

# ----------------------------------------------------------------------------------------------------------------------
# Environment with all dependencies to use pystencils
#
#
# Download conda at https://conda.io/miniconda.html and create this environment by running:
#     conda env create -f conda_environment_user.yml
#     . activate pystencils
#
# If you have CUDA or ROCm installed and want to use your GPU, uncomment the last line to install cupy
#
# ----------------------------------------------------------------------------------------------------------------------

name: pystencils
dependencies:
  # Basic dependencies:
  - python >= 3.6
  - numpy
  - sympy >= 1.1
  - appdirs # to find default cache directory on each platform
  - joblib # caching on hard-disk, this is optional, but if not installed lbmpy is really slow
  - cython # speed up boundary list computation (optional)
  - matplotlib
  - imageio
  - pandas
  - scipy
  - pip
  - pip:
      - islpy # used to optimize staggered kernels
      - py-cpuinfo # get cpu info like cache sizes, supported vector instruction sets, ...
      - graphviz  # can show abstract syntax trees as formatted graphs
      - ipy_table  # HTML tables for jupyter notebooks
      - pyevtk # VTK output for serial simulations
      - blitzdb # file-based No-SQL database to store simulation results
      - pystencils
      #- cupy # add this if you have CUDA or ROCm installed

binder/start

0 → 100755
+6 −0
Original line number Original line Diff line number Diff line
#!/bin/bash

python3 setup.py develop

export MPMATH_NOGMPY=1
exec "$@"
 No newline at end of file
+81 −22
Original line number Original line Diff line number Diff line
@@ -3,23 +3,40 @@ import pytest
import tempfile
import tempfile
import runpy
import runpy
import sys
import sys
import warnings
import platform
import pathlib

import nbformat
import nbconvert
import sympy

from lbmpy._compat import IS_PYSTENCILS_2

# Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
# Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
# at the same time
# at the same time
if not IS_PYSTENCILS_2:
    from pystencils.cpu import cpujit
    from pystencils.cpu import cpujit


# trigger cython imports - there seems to be a problem when multiple processes try to compile the same cython file
# trigger cython imports - there seems to be a problem when multiple processes try to compile the same cython file
# at the same time
# at the same time
try:
try:
    import pyximport
    import pyximport

    pyximport.install(language_level=3)
    pyximport.install(language_level=3)
    from lbmpy.phasefield.simplex_projection import simplex_projection_2d  # NOQA
except ImportError:
except ImportError:
    pass
    pass
from lbmpy.phasefield.simplex_projection import simplex_projection_2d  # NOQA



SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__))
SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.abspath('lbmpy'))
sys.path.insert(0, os.path.abspath('lbmpy'))


# the Ubuntu pipeline uses an older version of pytest which uses deprecated functionality.
# This leads to many warinings in the test and coverage pipeline.
pytest_numeric_version = [int(x, 10) for x in pytest.__version__.split('.')]
pytest_numeric_version.reverse()
pytest_version = sum(x * (100 ** i) for i, x in enumerate(pytest_numeric_version))



def add_path_to_ignore(path):
def add_path_to_ignore(path):
    if not os.path.exists(path):
    if not os.path.exists(path):
@@ -30,21 +47,42 @@ def add_path_to_ignore(path):


collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"),
collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"),
                  os.path.join(SCRIPT_FOLDER, "doc", "img", "mb_discretization", "maxwell_boltzmann_stencil_plot.py")]
                  os.path.join(SCRIPT_FOLDER, "doc", "img", "mb_discretization", "maxwell_boltzmann_stencil_plot.py")]
add_path_to_ignore('pystencils_tests/benchmark')
add_path_to_ignore('_local_tmp')
add_path_to_ignore('_local_tmp')


if IS_PYSTENCILS_2:
    #   TODO: Fix these step-by-step
    collect_ignore += [
        os.path.join(SCRIPT_FOLDER, "doc", "notebooks", "10_tutorial_conservative_allen_cahn_two_phase.ipynb"),
        os.path.join(SCRIPT_FOLDER, "tests", "test_compiled_in_boundaries.ipynb")
    ]


try:
try:
    import pycuda
    import cupy
except ImportError:
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "lbmpy_tests/test_cpu_gpu_equivalence.py")]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_cpu_gpu_equivalence.py")]


try:
try:
    import waLBerla
    import waLBerla
except ImportError:
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "lbmpy_tests/test_serial_scenarios.py")]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_datahandling_parallel.py")]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "lbmpy_tests/test_datahandling_parallel.py")]


try:
    import blitzdb
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/benchmark"),
                       os.path.join(SCRIPT_FOLDER,
                                    "tests/full_scenarios/kida_vortex_flow/scenario_kida_vortex_flow.py"),
                       os.path.join(SCRIPT_FOLDER, "tests/full_scenarios/shear_wave/scenario_shear_wave.py"),
                       os.path.join(SCRIPT_FOLDER, "tests/test_json_serializer.py"),
                       os.path.join(SCRIPT_FOLDER, "src/lbmpy/db.py")]

if platform.system().lower() == 'windows':
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_quicktests.py")]

sver = sympy.__version__.split(".")
if int(sver[0]) == 1 and int(sver[1]) < 2:
    add_path_to_ignore('tests/phasefield')
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_n_phase_boyer_noncoupled.ipynb")]


collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')]
collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')]


@@ -54,10 +92,6 @@ for root, sub_dirs, files in os.walk('.'):
            collect_ignore.append(f)
            collect_ignore.append(f)




import nbformat
from nbconvert import PythonExporter


class IPythonMockup:
class IPythonMockup:
    def run_line_magic(self, *args, **kwargs):
    def run_line_magic(self, *args, **kwargs):
        pass
        pass
@@ -84,35 +118,60 @@ class IPyNbTest(pytest.Item):


        # disable matplotlib output
        # disable matplotlib output
        exec("import matplotlib.pyplot as p; "
        exec("import matplotlib.pyplot as p; "
             "p.close('all'); "
             "p.switch_backend('Template')", global_dict)
             "p.switch_backend('Template')", global_dict)


        # in notebooks there is an implicit plt.show() - if this is not called a warning is shown when the next
        # in notebooks there is an implicit plt.show() - if this is not called a warning is shown when the next
        # plot is created. This warning is suppressed here
        # plot is created. This warning is suppressed here
        # Also animations cannot be shown, which also leads to a warning.
        exec("import warnings;"
        exec("import warnings;"
             "warnings.filterwarnings('ignore', 'Adding an axes using the same arguments as a previous.*')",
             "warnings.filterwarnings('ignore', 'Adding an axes using the same arguments as a previous.*');"
             "warnings.filterwarnings('ignore', 'Animation was deleted without rendering anything.*');",
             global_dict)
             global_dict)
        with tempfile.NamedTemporaryFile() as f:
        with tempfile.NamedTemporaryFile() as f:
            f.write(self.code.encode())
            f.write(self.code.encode())
            f.flush()
            f.flush()
            runpy.run_path(f.name, init_globals=global_dict, run_name=self.name)
            runpy.run_path(f.name, init_globals=global_dict, run_name=self.name)


        #   Close any open figures
        exec("import matplotlib.pyplot as p; "
             "p.close('all')", global_dict)



class IPyNbFile(pytest.File):
class IPyNbFile(pytest.File):
    def collect(self):
    def collect(self):
        exporter = PythonExporter()
        exporter = nbconvert.PythonExporter()
        exporter.exclude_markdown = True
        exporter.exclude_markdown = True
        exporter.exclude_input_prompt = True
        exporter.exclude_input_prompt = True


        notebook_contents = self.fspath.open()
        notebook_contents = self.fspath.open(encoding='utf-8')

        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", "IPython.core.inputsplitter is deprecated")
            notebook = nbformat.read(notebook_contents, 4)
            notebook = nbformat.read(notebook_contents, 4)
            code, _ = exporter.from_notebook_node(notebook)
            code, _ = exporter.from_notebook_node(notebook)
            if pytest_version >= 50403:
                yield IPyNbTest.from_parent(name=self.name, parent=self, code=code)
            else:
                yield IPyNbTest(self.name, self, code)
                yield IPyNbTest(self.name, self, code)


    def teardown(self):
    def teardown(self):
        pass
        pass




if pytest_version >= 70000:
    #   Since pytest 7.0, usage of `py.path.local` is deprecated and `pathlib.Path` should be used instead
    import pathlib

    def pytest_collect_file(file_path: pathlib.Path, parent):
        glob_exprs = ["*demo*.ipynb", "*tutorial*.ipynb", "test_*.ipynb"]
        if any(file_path.match(g) for g in glob_exprs):
            return IPyNbFile.from_parent(path=file_path, parent=parent)
else:
    def pytest_collect_file(path, parent):
    def pytest_collect_file(path, parent):
        glob_exprs = ["*demo*.ipynb", "*tutorial*.ipynb", "test_*.ipynb"]
        glob_exprs = ["*demo*.ipynb", "*tutorial*.ipynb", "test_*.ipynb"]
        if any(path.fnmatch(g) for g in glob_exprs):
        if any(path.fnmatch(g) for g in glob_exprs):
            if pytest_version >= 50403:
                return IPyNbFile.from_parent(fspath=path, parent=parent)
            else:
                return IPyNbFile(path, parent)
                return IPyNbFile(path, parent)
+12 −7
Original line number Original line Diff line number Diff line
@@ -5,9 +5,10 @@ import datetime
import sphinx_rtd_theme
import sphinx_rtd_theme
import os
import os
import sys
import sys
import re
import lbmpy


sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('.'))
from version_from_git import version_number_from_git


extensions = [
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autodoc',
@@ -25,11 +26,14 @@ templates_path = ['_templates']
source_suffix = '.rst'
source_suffix = '.rst'
master_doc = 'index'
master_doc = 'index'


copyright = '{}, Martin Bauer'.format(datetime.datetime.now().year)
copyright = f'{datetime.datetime.now().year}, Martin Bauer, Markus Holzer, Frederik Hennig'
author = 'Martin Bauer'
author = 'Martin Bauer, Markus Holzer, Frederik Hennig'
version = version_number_from_git()
# The short X.Y version (including .devXXXX, rcX, b1 suffixes if present)
release = version_number_from_git()
version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', lbmpy.__version__)
language = None
version = re.sub(r'(\.dev\d+).*?$', r'\1', version)
# The full version, including alpha/beta/rc tags.
release = lbmpy.__version__
language = 'en'
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']
default_role = 'any'
default_role = 'any'
pygments_style = 'sphinx'
pygments_style = 'sphinx'
@@ -54,6 +58,7 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3.6', None),
                       }
                       }


autodoc_member_order = 'bysource'
autodoc_member_order = 'bysource'
bibtex_bibfiles = ['sphinx/lbmpy.bib']


project = 'lbmpy'
project = 'lbmpy'
html_logo = "img/logo.png"
html_logo = 'img/logo.png'

doc/img/Boundary.svg

0 → 100644
+149 −0

File added.

Preview size limit exceeded, changes collapsed.

doc/img/lbmpy-logo.svg

0 → 100644
+794 −0

File added.

Preview size limit exceeded, changes collapsed.

+27 −31
Original line number Original line Diff line number Diff line
@@ -2,23 +2,23 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<!-- Created with Inkscape (http://www.inkscape.org/) -->


<svg
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="53.913788mm"
   width="53.913788mm"
   height="53.913788mm"
   height="53.913788mm"
   viewBox="0 0 53.913788 53.913788"
   viewBox="0 0 53.913788 53.913788"
   version="1.1"
   version="1.1"
   id="svg834"
   id="svg834"
   inkscape:version="0.92.3 (2405546, 2018-03-11)"
   inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
   sodipodi:docname="logo.svg"
   sodipodi:docname="logo.svg"
   inkscape:export-filename="/local/bauer/code/lbmpy/lbmpy/doc/img/logo.png"
   inkscape:export-filename="/local/bauer/code/lbmpy/lbmpy/doc/img/logo.png"
   inkscape:export-xdpi="70.669998"
   inkscape:export-xdpi="70.669998"
   inkscape:export-ydpi="70.669998">
   inkscape:export-ydpi="70.669998"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/">
  <defs
  <defs
     id="defs828">
     id="defs828">
    <marker
    <marker
@@ -641,25 +641,31 @@
     inkscape:pageopacity="0.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:pageshadow="2"
     inkscape:zoom="1.4"
     inkscape:zoom="1.4"
     inkscape:cx="158.26067"
     inkscape:cx="158.21429"
     inkscape:cy="-4.9825309"
     inkscape:cy="251.78571"
     inkscape:document-units="mm"
     inkscape:document-units="mm"
     inkscape:current-layer="layer1"
     inkscape:current-layer="layer1"
     showgrid="false"
     showgrid="false"
     inkscape:window-width="1214"
     inkscape:window-width="1557"
     inkscape:window-height="1052"
     inkscape:window-height="1122"
     inkscape:window-x="1482"
     inkscape:window-x="0"
     inkscape:window-y="524"
     inkscape:window-y="0"
     inkscape:window-maximized="0"
     inkscape:window-maximized="0"
     fit-margin-top="0"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-right="0"
     fit-margin-bottom="0">
     fit-margin-bottom="0"
     inkscape:showpageshadow="0"
     inkscape:pagecheckerboard="1"
     inkscape:deskcolor="#d1d1d1">
    <inkscape:grid
    <inkscape:grid
       type="xygrid"
       type="xygrid"
       id="grid1886"
       id="grid1886"
       originx="-9.8407853"
       originx="-9.8407853"
       originy="-227.28709" />
       originy="-227.28709"
       spacingy="1"
       spacingx="1"
       units="mm" />
  </sodipodi:namedview>
  </sodipodi:namedview>
  <metadata
  <metadata
     id="metadata831">
     id="metadata831">
@@ -688,21 +694,11 @@
       ry="3.0735996"
       ry="3.0735996"
       inkscape:export-xdpi="188.45"
       inkscape:export-xdpi="188.45"
       inkscape:export-ydpi="188.45" />
       inkscape:export-ydpi="188.45" />
    <text
    <path
       xml:space="preserve"
       style="font-weight:bold;font-size:16.9333px;line-height:125%;font-family:'Latin Modern Mono Light';-inkscape-font-specification:'Latin Modern Mono Light, Bold';letter-spacing:0px;word-spacing:0px;fill:#ffffff;stroke-width:0.264583px"
       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11666656px;line-height:125%;font-family:'Latin Modern Mono Light';-inkscape-font-specification:'Latin Modern Mono Light, ';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       d="m 21.505785,62.578241 c 0,-0.626532 -0.474132,-0.643466 -0.795865,-0.643466 h -2.015062 v -8.26345 c 0,-0.609599 -0.118533,-0.812798 -0.795865,-0.812798 h -2.607729 c -0.321732,0 -0.812798,0.01693 -0.812798,0.643465 0,0.609599 0.507999,0.626532 0.795865,0.626532 h 2.015063 v 7.806251 h -1.99813 c -0.321732,0 -0.812798,0.01693 -0.812798,0.643466 0,0.609599 0.507999,0.626532 0.795865,0.626532 h 5.435589 c 0.3048,0 0.795865,-0.01693 0.795865,-0.626532 z m 9.228643,-3.064927 c 0,-2.116663 -1.54093,-3.776126 -3.352793,-3.776126 -0.728132,0 -1.405464,0.237066 -1.964263,0.643465 v -2.709328 c 0,-0.609599 -0.118533,-0.812798 -0.795865,-0.812798 h -1.202265 c -0.321732,0 -0.812798,0.01693 -0.812798,0.643465 0,0.609599 0.507999,0.626532 0.795865,0.626532 h 0.609599 v 8.263451 c 0,0.406399 0.01693,0.812798 0.711198,0.812798 0.524933,0 0.660399,-0.237066 0.677332,-0.575732 0.643466,0.541865 1.303865,0.677332 1.79493,0.677332 1.862663,0 3.53906,-1.625597 3.53906,-3.793059 z m -1.388531,0 c 0,1.49013 -1.083731,2.523061 -2.184395,2.523061 -1.202265,0 -1.727197,-1.371597 -1.727197,-2.116662 v -1.202265 c 0,-0.914398 0.897465,-1.710263 1.862663,-1.710263 1.151464,0 2.048929,1.151465 2.048929,2.506129 z m 10.820373,3.064927 c 0,-0.558799 -0.321733,-0.643466 -0.931331,-0.643466 v -3.860792 c 0,-0.355599 -0.03387,-2.336795 -1.608664,-2.336795 -0.474132,0 -1.117598,0.186266 -1.608663,0.745065 -0.287867,-0.491066 -0.745066,-0.745065 -1.269998,-0.745065 -0.491066,0 -0.948265,0.169333 -1.337731,0.474132 -0.118533,-0.372533 -0.440265,-0.389466 -0.745065,-0.389466 h -0.524932 c -0.3048,0 -0.812799,0.03387 -0.812799,0.626532 0,0.558799 0.321733,0.643466 0.931332,0.643466 v 4.842923 c -0.609599,0 -0.931332,0.08467 -0.931332,0.643466 0,0.609599 0.524933,0.626532 0.812799,0.626532 h 1.43933 c 0.3048,0 0.761999,-0.01693 0.761999,-0.626532 0,-0.558799 -0.270933,-0.643466 -0.880532,-0.643466 v -2.827861 c 0,-1.354664 0.575732,-2.099729 1.219198,-2.099729 0.321733,0 0.474132,0.270933 0.474132,1.219198 v 3.708392 c -0.355599,0.01693 -0.677332,0.1016 -0.677332,0.643466 0,0.609599 0.474133,0.626532 0.761999,0.626532 h 1.236131 c 0.304799,0 0.761998,-0.01693 0.761998,-0.626532 0,-0.558799 -0.287866,-0.643466 -0.897465,-0.643466 v -2.827861 c 0,-1.354664 0.592666,-2.099729 1.219198,-2.099729 0.338666,0 0.474132,0.270933 0.474132,1.219198 v 3.708392 c -0.338666,0.01693 -0.660398,0.1016 -0.660398,0.643466 0,0.609599 0.474132,0.626532 0.745065,0.626532 h 1.236131 c 0.304799,0 0.812798,-0.01693 0.812798,-0.626532 z m 9.829776,-3.064927 c 0,-2.116663 -1.540931,-3.776126 -3.352794,-3.776126 -0.728132,0 -1.422397,0.237066 -1.981196,0.660398 -0.01693,-0.389466 -0.169333,-0.575732 -0.778932,-0.575732 H 42.68086 c -0.321733,0 -0.812798,0.03387 -0.812798,0.643466 0,0.609598 0.507999,0.626532 0.795865,0.626532 h 0.609598 v 8.500516 H 42.68086 c -0.321733,0 -0.812798,0.01693 -0.812798,0.643466 0,0.609598 0.507999,0.626532 0.795865,0.626532 h 2.624661 c 0.287866,0 0.795865,-0.01693 0.795865,-0.626532 0,-0.626532 -0.491065,-0.643466 -0.812798,-0.643466 h -0.592666 v -2.963327 c 0.643466,0.558799 1.286931,0.677332 1.777997,0.677332 1.862663,0 3.53906,-1.625597 3.53906,-3.793059 z m -1.388531,0 c 0,1.49013 -1.083731,2.523061 -2.184396,2.523061 -1.202264,0 -1.727196,-1.371597 -1.727196,-2.116662 v -1.202265 c 0,-0.914398 0.897465,-1.710263 1.862663,-1.710263 1.151464,0 2.048929,1.151465 2.048929,2.506129 z M 59.08922,56.46532 c 0,-0.626533 -0.474133,-0.643466 -0.795865,-0.643466 h -1.930397 c -0.304799,0 -0.795865,0.03387 -0.795865,0.626532 0,0.626532 0.474133,0.643466 0.795865,0.643466 h 0.270933 l -1.456264,4.419591 -1.676396,-4.419591 h 0.220133 c 0.304799,0 0.795865,-0.01693 0.795865,-0.626532 0,-0.626533 -0.474133,-0.643466 -0.795865,-0.643466 h -1.930397 c -0.321732,0 -0.795865,0.01693 -0.795865,0.643466 0,0.609598 0.491066,0.626532 0.795865,0.626532 H 52.2143 l 2.370662,5.977455 c -0.06773,0.186266 -0.423333,1.371597 -0.609599,1.744129 -0.338666,0.643466 -0.863598,1.032932 -1.185331,1.032932 0.01693,-0.06773 0.186266,-0.118533 0.186266,-0.372533 0,-0.491066 -0.355599,-0.846665 -0.846665,-0.846665 -0.524932,0 -0.846665,0.355599 -0.846665,0.846665 0,0.761999 0.609599,1.490131 1.490131,1.490131 1.69333,0 2.523062,-2.252129 2.590795,-2.438396 l 2.523061,-7.433718 h 0.4064 c 0.304799,0 0.795865,-0.01693 0.795865,-0.626532 z"
       x="13.547134"
       y="63.204773"
       id="text1392"
       id="text1392"
       inkscape:export-xdpi="188.45"
       aria-label="lbm py" />
       inkscape:export-ydpi="188.45"><tspan
         sodipodi:role="line"
         id="tspan1390"
         x="13.547134"
         y="63.204773"
         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:16.93333244px;font-family:'Latin Modern Mono Light';-inkscape-font-specification:'Latin Modern Mono Light, Bold';fill:#ffffff;stroke-width:0.26458332px">lbm<tspan
   style="font-size:2.82222223px"
   id="tspan1398"> </tspan>py</tspan></text>
    <path
    <path
       style="fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:0.84519458;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Send-8-6-9)"
       style="fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:0.84519458;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Send-8-6-9)"
       d="M 36.797679,33.475 H 23.568513"
       d="M 36.797679,33.475 H 23.568513"
+3 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,9 @@ lbmpy
    :maxdepth: 2
    :maxdepth: 2


    sphinx/tutorials.rst
    sphinx/tutorials.rst
    sphinx/methods.rst
    sphinx/boundary_conditions.rst
    sphinx/forcemodels.rst
    sphinx/api.rst
    sphinx/api.rst




Original line number Original line Diff line number Diff line
@@ -5,13 +5,13 @@ API Reference
   :maxdepth: 1
   :maxdepth: 1


   scenarios.rst
   scenarios.rst
   kernelcreation.rst
   enums.rst
   methodcreation.rst
   stencils.rst
   stencils.rst
   methods.rst
   kernelcreation.rst
   equilibrium.rst
   moment_transforms.rst
   maxwellian_equilibrium.rst
   maxwellian_equilibrium.rst
   continuous_distribution_measures.rst
   continuous_distribution_measures.rst
   moments.rst
   moments.rst
   cumulants.rst
   cumulants.rst
   forcemodels.rst
   zbibliography.rst
   zbibliography.rst
+6 −0
Original line number Original line Diff line number Diff line
*******************
Boundary Conditions
*******************

.. automodule:: lbmpy.boundaries.boundaryconditions
   :members:

doc/sphinx/enums.rst

0 → 100644
+6 −0
Original line number Original line Diff line number Diff line
************
Enumerations
************

.. automodule:: lbmpy.enums
   :members:
+33 −0
Original line number Original line Diff line number Diff line
*********************************************
Equilibrium Distributions (lbmpy.equilibrium)
*********************************************

.. automodule:: lbmpy.equilibrium


Abstract Base Class
===================

.. autoclass:: lbmpy.equilibrium.AbstractEquilibrium
    :members:
    :private-members: _monomial_raw_moment, _monomial_central_moment, _monomial_cumulant

Generic Discrete Equilibria
===========================

Use the following class for custom discrete equilibria.

.. autoclass:: lbmpy.equilibrium.GenericDiscreteEquilibrium
    :members:

Maxwellian Equilibria for Hydrodynamics
=======================================

The following classes represent the continuous and the discrete variant of the Maxwellian equilibrium for
hydrodynamics.

.. autoclass:: lbmpy.equilibrium.ContinuousHydrodynamicMaxwellian
    :members:

.. autoclass:: lbmpy.equilibrium.DiscreteHydrodynamicMaxwellian
    :members:
Original line number Original line Diff line number Diff line
@@ -6,7 +6,8 @@
  number={4},
  number={4},
  pages={043309},
  pages={043309},
  year={2015},
  year={2015},
  publisher={APS}
  publisher={APS},
  doi={10.1103/PhysRevE.92.043309},
}
}


@PHDTHESIS{luo1993lattice,
@PHDTHESIS{luo1993lattice,
@@ -16,7 +17,7 @@
   school = {GEORGIA INSTITUTE OF TECHNOLOGY.},
   school = {GEORGIA INSTITUTE OF TECHNOLOGY.},
     year = 1993,
     year = 1993,
   adsurl = {http://adsabs.harvard.edu/abs/1993PhDT.......233L},
   adsurl = {http://adsabs.harvard.edu/abs/1993PhDT.......233L},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
  adsnote = {Provided by the SAO/NASA Astrophysics Data System},
}
}


@Article{guo2002discrete,
@Article{guo2002discrete,
@@ -28,8 +29,24 @@
  number    = {4},
  number    = {4},
  pages     = {046308},
  pages     = {046308},
  publisher = {APS},
  publisher = {APS},
  doi = {10.1103/PhysRevE.65.046308},
}
}


@article{HeForce,
  title = {Discrete Boltzmann equation model for nonideal gases},
  author = {He, Xiaoyi and Shan, Xiaowen and Doolen, Gary D.},
  journal = {Physical Review E},
  volume = {57},
  issue = {1},
  pages = {R13--R16},
  numpages = {0},
  year = {1998},
  month = {1},
  publisher = {APS},
  doi = {10.1103/PhysRevE.57.R13}
}


@article{buick2000gravity,
@article{buick2000gravity,
  title={Gravity in a lattice Boltzmann model},
  title={Gravity in a lattice Boltzmann model},
  author={Buick, JM and Greated, CA},
  author={Buick, JM and Greated, CA},
@@ -38,7 +55,15 @@
  number={5},
  number={5},
  pages={5307},
  pages={5307},
  year={2000},
  year={2000},
  publisher={APS}
  publisher={APS},
  doi = {10.1103/PhysRevE.61.5307},
}

@phdthesis{schiller2008thermal,
  title={Thermal fluctuations and boundary conditions in the lattice Boltzmann method},
  author={Schiller, Ulf Daniel},
  year={2008},
  school={Johannes Gutenberg Universit{\"a}t Mainz}
}
}




@@ -60,12 +85,233 @@ year = {2018}




@article{Semprebon2016,
@article{Semprebon2016,
author = {Semprebon, Ciro and Kusumaatmaja, Halim},
  title = {Ternary free-energy lattice Boltzmann model with tunable surface tensions and contact angles},
  author = {Semprebon, Ciro and Kr\"uger, Timm and Kusumaatmaja, Halim},
  journal = {Phys. Rev. E},
  volume = {93},
  issue = {3},
  pages = {033305},
  numpages = {11},
  year = {2016},
  month = {Mar},
  publisher = {American Physical Society},
  doi = {10.1103/PhysRevE.93.033305},
  doi = {10.1103/PhysRevE.93.033305},
keywords = {lbm,multiphase,phasefield},
mendeley-tags = {lbm,multiphase,phasefield},
pages = {1--11},
title = {{Ternary free-energy lattice Boltzmann model with tunable surface tensions and contact angles}},
volume = {033305},
year = {2016}
}
}

@article{geier2015,
author = {Geier, Martin and Sch{\"{o}}nherr, Martin and Pasquali, Andrea and Krafczyk, Manfred},
title = {{The cumulant lattice Boltzmann equation in three dimensions: Theory and validation}},
journal = {Computers \& Mathematics with Applications},
volume = {70},
number = {4},
pages = {507-547},
year = {2015},
issn = {0898-1221},
doi = {10.1016/j.camwa.2015.05.001},
}

@article{geier2017,
author = {Geier, Martin and Pasquali, Andrea and Sch{\"{o}}nherr, Martin},
title = {Parametrization of the Cumulant Lattice Boltzmann Method for Fourth Order Accurate Diffusion Part I},
year = {2017},
issue_date = {November 2017},
publisher = {Academic Press Professional, Inc.},
address = {USA},
volume = {348},
number = {C},
issn = {0021-9991},
url = {https://doi.org/10.1016/j.jcp.2017.05.040},
doi = {10.1016/j.jcp.2017.05.040},
journal = {J. Comput. Phys.},
month = {nov},
pages = {862–888},
numpages = {27}
}

@Article{Coreixas2019,
  title = {Comprehensive comparison of collision models in the lattice Boltzmann framework: Theoretical investigations},
  author = {Coreixas, Christophe and Chopard, Bastien and Latt, Jonas},
  journal = {Phys. Rev. E},
  volume = {100},
  issue = {3},
  pages = {033305},
  numpages = {46},
  year = {2019},
  month = {Sep},
  publisher = {American Physical Society},
  doi = {10.1103/PhysRevE.100.033305},
  url = {https://link.aps.org/doi/10.1103/PhysRevE.100.033305}
}

@PhdThesis{Geier2006,
  author = {Martin Geier},
  school = {Department of Microsystems Technology IMTEK, University of Freiburg},
  title  = {Ab inito derivation of the cascaded lattice Boltzmann automaton},
  year   = {2006},
}

@article{Fakhari2018,
title = {A phase-field lattice {Boltzmann} model for simulating multiphase flows in porous media: Application and comparison to experiments of {CO2} sequestration at pore scale},
journal = {Advances in Water Resources},
volume = {114},
pages = {119-134},
year = {2018},
issn = {0309-1708},
doi = {10.1016/j.advwatres.2018.02.005},
author = {Fakhari, A. and Li, Y. and Bolster, D. and Christensen, K. T.},
}

@article{silva2010,
title = {A study on the inclusion of body forces in the lattice Boltzmann BGK equation to recover steady-state hydrodynamics},
journal = {Physica A: Statistical Mechanics and its Applications},
volume = {390},
number = {6},
pages = {1085-1095},
year = {2011},
doi = {10.1016/j.physa.2010.11.037},
author = {Silva, G. and Semiao, V.},
keywords = {{Lattice Boltzmann} method, {BGK} collision operator, Steady-state flows, Body force driven flows}
}

@article{silva2020,
  title = {Force methods for the two-relaxation-times lattice {Boltzmann}},
  author = {Postma, B. and Silva, G.},
  journal = {Phys. Rev. E},
  volume = {102},
  issue = {6},
  year = {2020},
  month = {12},
  publisher = {American Physical Society},
  doi = {10.1103/PhysRevE.102.063307},
}

@book{lbm_book,
  doi = {10.1007/978-3-319-44649-3},
  year = {2017},
  publisher = {Springer International Publishing},
  author = {Kr\"{u}ger, T. and Kusumaatmaja, H. and Kuzmin, A. and Shardt, O. and Silva, G. and Viggen, E. M.},
  title = {The Lattice {Boltzmann} Method}
}

@article{Ansumali2003,
	doi = {10.1209/epl/i2003-00496-6},
	year = 2003,
	month = {sep},
	journal = {{IOP} Publishing},
	volume = {63},
	number = {6},
	pages = {798--804},
	author = {S Ansumali and I. V Karlin and H. C Öttinger},
	title = {Minimal entropic kinetic models for hydrodynamics},
	abstract = {We derive minimal discrete models of the Boltzmann equation consistent with equilibrium thermodynamics, and which recover correct hydrodynamics in arbitrary dimensions. A new discrete velocity model is proposed for the simulation of the Navier-Stokes-Fourier equation and is tested in the setup of Taylor vortex flow. A simple analytical procedure for constructing the equilibrium for thermal hydrodynamics is established. For the lattice Boltzmann method of isothermal hydrodynamics, the explicit analytical form of the equilibrium distribution is presented. This results in an entropic version of the isothermal lattice Boltzmann method with the simplicity and computational efficiency of the standard lattice Boltzmann model.}
}

@Article{raw_moments,
  author  = {D. D'Humières},
  journal = {Rarefied gas dynamics},
  title   = {Generalized lattice-{Boltzmann} equations},
  year    = {1992},
}

@article{FAKHARI201722,
    author = "Abbas Fakhari and Diogo Bolster and Li-Shi Luo",
    title = "A weighted multiple-relaxation-time lattice {Boltzmann} method for multiphase flows and its application to partial coalescence cascades",
    journal = "Journal of Computational Physics",
    year = "2017",
    doi = "10.1016/j.jcp.2017.03.062"
}

@article{TRT,
author = {Ginzburg Irina and Frederik Verhaeghe and D. D'Humières},
year = {2008},
month = {01},
pages = {427-478},
title = {Two-relaxation-time Lattice Boltzmann scheme: about parametrization, velocity, pressure and mixed boundary conditions},
volume = {3},
journal = {Communications in Computational Physics}
}

@Article{HeIncompressible,
  author    = {Xiaoyi He and Li-Shi Luo},
  journal   = {Journal of Statistical Physics},
  title     = {Lattice Boltzmann Model for the Incompressible Navier{\textendash}Stokes Equation},
  year      = {1997},
  month     = {aug},
  number    = {3/4},
  pages     = {927--944},
  volume    = {88},
  doi       = {10.1023/b:joss.0000015179.12689.e4},
  publisher = {Springer Science and Business Media {LLC}},
}

@Article{GruszczynskiCascadedPhaseFieldModel,
  author    = {G. Gruszczy{\'{n}}ski and T. Mitchell and C. Leonardi and {\L}. {\L}aniewski-Wo{\l}{\l}k and T. Barber},
  journal   = {Computers {\&} Mathematics with Applications},
  title     = {A cascaded phase-field lattice Boltzmann model for the simulation of incompressible, immiscible fluids with high density contrast},
  year      = {2020},
  month     = {feb},
  number    = {4},
  pages     = {1049--1071},
  volume    = {79},
  doi       = {10.1016/j.camwa.2019.08.018},
  publisher = {Elsevier {BV}},
}

@Article{Casson,
  author    = {R. Ouared and B. Chopard},
  journal   = {Journal of Statistical Physics},
  title     = {Lattice {Boltzmann} Simulations of Blood Flow: {Non-Newtonian} Rheology and Clotting Processes},
  year      = {2005},
  doi       = {10.1007/s10955-005-8415-x},
  publisher = {Springer Link},
}

@article{BouzidiBC,
    author = {Bouzidi, M’hamed and Firdaouss, Mouaouia and Lallemand, Pierre},
    title = "{Momentum transfer of a Boltzmann-lattice fluid with boundaries}",
    journal = {Physics of Fluids},
    year = {2001},
    month = {11},
    doi = {10.1063/1.1399290},
    url = {https://doi.org/10.1063/1.1399290},
}

@Article{rozema15,
  doi       = {10.1063/1.4928700},
  year      = {2015},
  month     = {aug},
  publisher = {AIP Publishing},
  volume    = {27},
  number    = {8},
  author    = {Wybe Rozema and Hyun J. Bae and Parviz Moin and Roel Verstappen},
  title     = {Minimum-dissipation models for large-eddy simulation},
  journal   = {Physics of Fluids}
}

@article{Han2021,
   doi = {10.1088/1873-7005/ac1782},
   url = {https://dx.doi.org/10.1088/1873-7005/ac1782}                    ,
   year = {2021},
   month = {aug},
   publisher = {IOP Publishing},
   volume = {53},
   number = {4},
   pages = {045506},
   author = {Mengtao Han and Ryozo Ooka and Hideki Kikumoto},
   title = {A wall function approach in lattice Boltzmann method: algorithm and validation using turbulent channel flow},
   journal = {Fluid Dynamics Research}
}

@article{Maronga2020,
 author = {Maronga, Bj{\"o}rn and Knigge, Christoph and Raasch, Siegfried},
 year = {2020},
 title = {{An Improved Surface Boundary Condition for Large-Eddy Simulations Based on Monin--Obukhov Similarity Theory: Evaluation and Consequences for Grid Convergence in Neutral and Stable Conditions}},
 pages = {297--325},
 volume = {174},
 number = {2},
 issn = {0006-8314},
 journal = {{Boundary-layer meteorology}},
 doi = {10.1007/s10546-019-00485-w}
}

@Comment{jabref-meta: databaseType:bibtex;}
Original line number Original line Diff line number Diff line
**********************
*******************************
Maxwellian Equilibrium
Maxwellian Equilibrium (Legacy)
**********************
*******************************


.. automodule:: lbmpy.maxwellian_equilibrium
.. automodule:: lbmpy.maxwellian_equilibrium
    :members:
    :members:
@@ -11,7 +11,7 @@ Maxwellian Equilibrium


    .. autofunction:: lbmpy.maxwellian_equilibrium.continuous_maxwellian_equilibrium
    .. autofunction:: lbmpy.maxwellian_equilibrium.continuous_maxwellian_equilibrium


    .. autofunction:: lbmpy.maxwellian_equilibrium.get_moments_of_continuous_maxwellian_equilibrium
    .. autofunction:: lbmpy.maxwellian_equilibrium.get_equilibrium_values_of_maxwell_boltzmann_function


    .. autofunction:: lbmpy.maxwellian_equilibrium.get_moments_of_discrete_maxwellian_equilibrium
    .. autofunction:: lbmpy.maxwellian_equilibrium.get_moments_of_discrete_maxwellian_equilibrium

doc/sphinx/methodcreation.rst

deleted100644 → 0
+0 −8
Original line number Original line Diff line number Diff line
Creating LBM methods
====================

This module is a lower level API to construct methods.
When possible use the high level API.

.. automodule:: lbmpy.methods.creationfunctions
    :members:
Original line number Original line Diff line number Diff line
***********************
********************************
Methods (lbmpy.methods)
Collision models (lbmpy.methods)
***********************
********************************


This module defines the classes defining all types of lattice Boltzmann methods available in *lbmpy*,
together with a set of factory functions used to create their instances. The factory functions are
organized in three levels of abstraction. Objects of the method classes should be created only through
these factory functions, never manually.


LBM Method Interfaces
Methods in *lbmpy* can be distinguished into three categories:
=====================
 - :ref:`methods_rawmomentbased`, including the classical single relaxation-time (SRT, BGK), two relaxation-time (TRT) 
   and multiple relaxation-time (MRT) methods, as well as entropic variants of the TRT method.
 - :ref:`methods_centralmomentbased`, which are multiple relaxation-time methods using relaxation in central moment space.
 - :ref:`methods_cumulantbased`, multiple relaxation-time methods using relaxation in cumulant space.


.. autoclass:: lbmpy.methods.AbstractLbMethod
Abstract LB Method Base Class
=============================

.. autoclass:: lbmpy.methods.LbmCollisionRule
    :members:
    :members:


.. autoclass:: lbmpy.methods.AbstractConservedQuantityComputation
.. autoclass:: lbmpy.methods.AbstractLbMethod
    :members:
    :members:


.. _methods_rawmomentbased:


Raw Moment-based methods
========================


These methods are represented by instances of :class:`lbmpy.methods.momentbased.MomentBasedLbMethod` and will derive
collision equations either in population space (SRT, TRT, entropic TRT), or in raw moment space (MRT variants).


LBM with conserved zeroth and first order
Creation Functions
=========================================
------------------


.. autoclass:: lbmpy.methods.DensityVelocityComputation
The following factory functions create raw moment-based methods using variants of the regular hydrodynamic maxwellian
equilibrium.

.. autofunction:: lbmpy.methods.create_srt

.. autofunction:: lbmpy.methods.create_trt

.. autofunction:: lbmpy.methods.create_trt_with_magic_number

.. autofunction:: lbmpy.methods.create_mrt_orthogonal

.. autofunction:: lbmpy.methods.create_trt_kbc


Class
-----

.. autoclass:: lbmpy.methods.momentbased.MomentBasedLbMethod
    :members:
    :members:




.. _methods_centralmomentbased:


Central Moment-based methods
============================


Moment-based methods
These methods are represented by instances of :class:`lbmpy.methods.momentbased.CentralMomentBasedLbMethod` and will derive
====================
collision equations in central moment space.


Creation Functions
Creation Functions
------------------
------------------


.. autofunction:: lbmpy.methods.create_srt
The following factory functions create central moment-based methods using variants of the regular hydrodynamic maxwellian
equilibrium.


.. autofunction:: lbmpy.methods.create_trt
.. autofunction:: lbmpy.methods.create_central_moment


.. autofunction:: lbmpy.methods.create_trt_with_magic_number
Class
-----

.. autoclass:: lbmpy.methods.momentbased.CentralMomentBasedLbMethod
    :members:


.. autofunction:: lbmpy.methods.create_mrt_orthogonal


.. autofunction:: lbmpy.methods.create_with_continuous_maxwellian_eq_moments
.. _methods_cumulantbased:


.. autofunction:: lbmpy.methods.create_with_discrete_maxwellian_eq_moments
Cumulant-based methods
======================

These methods are represented by instances of :class:`lbmpy.methods.cumulantbased.CumulantBasedLbMethod` and will derive
collision equations in cumulant space.

Creation Functions
------------------

The following factory functions create cumulant-based methods using the regular continuous hydrodynamic maxwellian equilibrium.

.. autofunction:: lbmpy.methods.create_cumulant

.. autofunction:: lbmpy.methods.create_with_monomial_cumulants

.. autofunction:: lbmpy.methods.create_with_default_polynomial_cumulants




Class
Class
-----
-----


.. autoclass:: lbmpy.methods.MomentBasedLbMethod
.. autoclass:: lbmpy.methods.cumulantbased.CumulantBasedLbMethod
    :members:



Default Moment sets
===================

The following functions provide default sets of polynomial raw moments, central moments and cumulants
to be used in MRT-type methods.

.. autofunction:: lbmpy.methods.default_moment_sets.cascaded_moment_sets_literature

.. autofunction:: lbmpy.methods.default_moment_sets.mrt_orthogonal_modes_literature



Low-Level Method Creation Interface
===================================

The following classes and factory functions constitute the lower levels of abstraction in method creation.
They are called from the higher-level functions described above, or, in special cases, by the user directly.

Custom method variants in population space, raw and central moment space based on the hydrodynamic Maxwellian
equilibrium may be created using either 
:func:`lbmpy.methods.creationfunctions.create_with_discrete_maxwellian_equilibrium` or 
:func:`create_with_continuous_maxwellian_equilibrium`.

Methods may also be created using custom equilibrium distributions using
:func:`lbmpy.methods.creationfunctions.create_from_equilibrium`.

The desired collision space, and the transform classes defining the manner of transforming populations to that
space and back, are defined using :class:`lbmpy.enums.CollisionSpace` and :class:`lbmpy.methods.CollisionSpaceInfo`.

Collision Space Info
--------------------

.. autoclass lbmpy.methods.CollisionSpaceInfo
    :members:

Low-Level Creation Functions
----------------------------

.. autofunction:: lbmpy.methods.creationfunctions.create_with_discrete_maxwellian_equilibrium

.. autofunction:: lbmpy.methods.creationfunctions.create_with_continuous_maxwellian_equilibrium

.. autofunction:: lbmpy.methods.creationfunctions.create_from_equilibrium


Conserved Quantity Computation
==============================

The classes of the conserved quantity computation (CQC) submodule define an LB Method's conserved quantities and
the equations to compute them. For hydrodynamic methods, :class:`lbmpy.methods.DensityVelocityComputation` is
the typical choice. For custom methods, however, a custom CQC class might have to be created.

.. autoclass:: lbmpy.methods.AbstractConservedQuantityComputation
    :members:
    :members:


.. autoclass:: lbmpy.methods.DensityVelocityComputation
    :members:
 No newline at end of file
+258 −0
Original line number Original line Diff line number Diff line
*******************************************
Moment Transforms (lbmpy.moment_transforms)
*******************************************

The ``moment_transforms`` module provides an ecosystem for transformation of quantities between
lattice Boltzmann population space and other spaces of observable quantities. Currently, transforms
to raw and central moment space are available.

The common base class `lbmpy.moment_transforms.AbstractMomentTransform` defines the interface all transform classes share.
This interface, together with the fundamental principles all transforms adhere to, is explained 
in the following.

Principles of Collision Space Transforms
========================================

Each class of this module implements a bijective map :math:`\mathcal{M}` from population space 
to raw moment or central moment space, capable of transforming the particle distribution 
function :math:`\mathbf{f}` to (almost) arbitrary user-defined moment sets.

Monomial and Polynomial Moments
-------------------------------

We discriminate *monomial* and *polynomial* moments. The monomial moments are the canonical basis of their
corresponding space. Polynomial moments are defined as linear combinations of this basis. Monomial moments are
typically expressed by exponent tuples :math:`(\alpha, \beta, \gamma)`. The monomial raw moments are defined as

.. math::
    
    m_{\alpha \beta \gamma} 
        = \sum_{i = 0}^{q - 1} f_i c_{i,x}^{\alpha} c_{i,y}^{\beta} c_{i,z}^{\gamma}

and the monomial central moments are given by

.. math::
    
    \kappa_{\alpha \beta \gamma} 
        = \sum_{i = 0}^{q - 1} 
            f_i 
            (c_{i,x} - u_x)^{\alpha} 
            (c_{i,y} - u_y)^{\beta} 
            (c_{i,z} - u_z)^{\gamma}.

Polynomial moments are, in turn, expressed by
polynomial expressions :math:`p` in the coordinate symbols :math:`x`, :math:`y` and :math:`z`.
An exponent tuple :math:`(\alpha, \beta, \gamma)` corresponds directly 
to the mixed monomial expression :math:`x^{\alpha} y^{\beta} z^{\gamma}`. Polynomial moments are then
constructed as linear combinations of these monomials. For example, the polynomial

.. math::

    p(x,y,z) = x^2 + y^2 + z^2 + 1.

defines both the polynomial raw moment

.. math::

    M = m_{200} + m_{020} + m_{002}

and central moment

.. math::

    K = \kappa_{200} + \kappa_{020} + \kappa_{002}.


Transformation Matrices
-----------------------

The collision space basis for an MRT LB method on a :math:`DdQq` lattice is spanned by a set of :math:`q`
polynomial quantities, given by polynomials :math:`\left( p_i \right)_{i=0, \dots, q-1}`.
Through the polynomials, a polynomialization matrix :math:`P` is defined such that

.. math::

    \mathbf{M} &= P \mathbf{m} \\
    \mathbf{K} &= P \mathbf{\kappa}

Both rules can also be written using matrix multiplication, such that

.. math::
    \mathbf{m} = M \mathbf{f} 
    \qquad 
    \mathbf{\kappa} = K \mathbf{f}.

Further, there exists a mapping from raw to central moment space using (monomial or polynomial)
shift matrices (see `set_up_shift_matrix`) such that

.. math::
    \mathbf{\kappa} = N \mathbf{m}
    \qquad
    \mathbf{K} = N^P \mathbf{M}.

Working with the transformation matrices, those mappings can easily be inverted.
This module provides classes that derive efficient implementations of these transformations.

Moment Aliasing
---------------

For a collision space transform to be invertible, exactly :math:`q` independent polynomial quantities of
the collision space must be chosen. In that case, since all transforms discussed here are linear, the space of
populations is isomorphic to the chosen moment space. The important word here is 'independent'. Even if :math:`q`
distinct moment polynomials are chosen, due to discrete lattice artifacts, they might not span the entire collision
space if chosen wrongly. The discrete lattice structure gives rise to *moment aliasing* effects. The most simple such
effect occurs in the monomial raw moments, where are all nonzero even and all odd exponents are essentially the same.
For example, we have :math:`m_{400} = m_{200}` or :math:`m_{305} = m_{101}`. This rule holds on every direct-neighborhood
stencil. Sparse stencils, like :math:`D3Q15`, may introduce additional aliases. On the :math:`D3Q15` stencil, due to its
structure, we have also :math:`m_{112} = m_{110}` and even :math:`m_{202} = m_{220} = m_{022} = m_{222}`.

Including aliases in a set of monomial moments will lead to a non-invertible transform and is hence not possible.
In polynomials, however, aliases may occur without breaking the transform. Several established sets of polynomial
moments, like in orthogonal raw moment space MRT methods, will comprise :math:`q` polynomials :math:`\mathbf{M}` that in turn are built
out of :math:`r > q` monomial moments :math:`\mathbf{m}`. In that set of monomials, non-independent moments have to be included by definition.
Since the full transformation matrix :math:`M^P = PM` is still invertible, this is not a problem in general. If, however, the
two steps of the transform are computed separately, it becomes problematic, as the matrices :math:`M \in \mathbb{R}^{r \times q}`
and :math:`P \in \mathbb{R}^{q \times r}` are not invertible on their own. 

But there is a remedy. By eliminating aliases from the moment polynomials, they can be reduced to a new set of polynomials based
on a non-aliased reduced vector of monomial moments :math:`\tilde{\mathbf{m}} \in \mathbb{R}^{q}`, expressed through the reduced
matrix :math:`\tilde{P}`.


Interfaces and Usage
====================

Construction
------------

All moment transform classes expect either a sequence of exponent tuples or a sequence of polynomials that define
the set of quantities spanning the destination space. If polynomials are given, the exponent tuples of the underlying
set of monomials are extracted automatically. Depending on the implementation, moment aliases may be eliminated in the
process, altering both the polynomials and the set of monomials.


Forward and Backward Transform
------------------------------

The core functionality of the transform classes is given by the methods ``forward_transform`` and ``backward_transform``.
They return assignment collections containing the equations to compute moments from populations, and vice versa.

Symbols Used
^^^^^^^^^^^^

Unless otherwise specified by the user, monomial and polynomial quantities occur in the transformation equations according
to the naming conventions listed in the following table:

+--------------------------------+---------------------------------------------+----------------------+
|                                |              Monomial                       |    Polynomial        |
+--------------------------------+---------------------------------------------+----------------------+
| Pre-Collision Raw Moment       | :math:`m_{\alpha \beta \gamma}`             | :math:`M_{i}`        |
+--------------------------------+---------------------------------------------+----------------------+
| Post-Collision Raw Moment      | :math:`m_{post, \alpha \beta \gamma}`       | :math:`M_{post, i}`  |
+--------------------------------+---------------------------------------------+----------------------+
| Pre-Collision Central Moment   | :math:`\kappa_{\alpha \beta \gamma}`        | :math:`K_{i}`        |
+--------------------------------+---------------------------------------------+----------------------+
| Post-Collision Central Moment  | :math:`\kappa_{post, \alpha \beta \gamma}`  | :math:`K_{post, i}`  |
+--------------------------------+---------------------------------------------+----------------------+

These symbols are also exposed by the member properties `pre_collision_symbols`, `post_collision_symbols`, 
`pre_collision_monomial_symbols` and `post_collision_monomial_symbols`.

Forward Transform
^^^^^^^^^^^^^^^^^

Implementations of the `lbmpy.moment_transforms.AbstractMomentTransform.forward_transform` method 
derive equations for the transform from population to moment space, to compute pre-collision moments
from pre-collision populations. The returned ``AssignmentCollection`` has the `pre_collision_symbols` 
as left-hand sides of its main assignments, computed from the given ``pdf_symbols`` and, potentially,
the macroscopic density and velocity. Depending on the implementation, the `pre_collision_monomial_symbols`
may be part of the assignment collection in the form of subexpressions. 

Backward Transform
^^^^^^^^^^^^^^^^^^

Implementations of `lbmpy.moment_transforms.AbstractMomentTransform.backward_transform` contain the post-collision
polynomial quantities as free symbols of their equation right-hand sides, and compute the post-collision populations
from those. The PDF symbols are the left-hand sides of the main assignments.


Absorption of Conserved Quantity Equations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Transformations from the population space to any space of observable quantities may *absorb* the equations 
defining the macroscopic quantities entering the equilibrium (typically the density :math:`\rho` and the
velocity :math:`\mathbf{u}`). This means that the ``forward_transform`` will possibly rewrite the
assignments given in the constructor argument ``conserved_quantity_equations`` to reduce
the total operation count. For example, in the transformation step from populations to
raw moments (see `lbmpy.moment_transforms.PdfsToMomentsByChimeraTransform`), :math:`\rho` can be aliased as the zeroth-order moment
:math:`m_{000}`. Assignments to the conserved quantities will then be part of the AssignmentCollection
returned by ``forward_transform`` and need not be added to the collision rule separately. 

Simplification
^^^^^^^^^^^^^^

Both ``forward_transform`` and ``backward_transform`` expect a keyword argument ``simplification``
which can be used to direct simplification steps applied during the derivation of the transformation
equations. Possible values are:

- `False` or ``'none'``: No simplification is to be applied
- `True` or ``'default'``: A default simplification strategy specific to the implementation is applied.
    The actual simplification steps depend strongly on the nature of the equations. They are defined by
    the implementation. It is the responsibility of the implementation to select the most effective
    simplification strategy.
- ``'default_with_cse'``: Same as ``'default'``, but with an additional pass of common subexpression elimination.


Working With Monomials
^^^^^^^^^^^^^^^^^^^^^^

In certain situations, we want the ``forward_transform`` to yield equations for the monomial symbols :math:`m_{\alpha \beta \gamma}`
and :math:`\kappa_{\alpha \beta \gamma}` only, and the ``backward_transform`` to return equations that also expect these symbols as input. 
In this case, it is not sufficient to pass a set of monomials or exponent tuples to the constructor, as those are still treated as 
polynomials internally. Instead, both transform methods expose keyword arguments ``return_monomials`` and ``start_from_monomials``, respectively.
If set to true, equations in the monomial moments are returned. They are best used *only* together with the ``exponent_tuples`` constructor argument
to have full control over the monomials. If polynomials are passed to the constructor, the behaviour of these flags is generally not well-defined,
especially in the presence of aliases.


The Transform Classes
=====================

Abstract Base Class
-------------------

.. autoclass:: lbmpy.moment_transforms.AbstractMomentTransform
    :members:


Moment Space Transforms
-----------------------

.. autoclass:: lbmpy.moment_transforms.PdfsToMomentsByMatrixTransform
    :members:

.. autoclass:: lbmpy.moment_transforms.PdfsToMomentsByChimeraTransform
    :members:


Central Moment Space Transforms
-------------------------------

.. autoclass:: lbmpy.moment_transforms.PdfsToCentralMomentsByMatrix
    :members:

.. autoclass:: lbmpy.moment_transforms.BinomialChimeraTransform
    :members:

.. autoclass:: lbmpy.moment_transforms.FastCentralMomentTransform
    :members:

.. autoclass:: lbmpy.moment_transforms.PdfsToCentralMomentsByShiftMatrix
    :members:

Cumulant Space Transforms
-------------------------

.. autoclass:: lbmpy.moment_transforms.CentralMomentsToCumulantsByGeneratingFunc
    :members:
Original line number Original line Diff line number Diff line
@@ -4,6 +4,10 @@ Tutorials
All tutorials are automatically created by Jupyter Notebooks.
All tutorials are automatically created by Jupyter Notebooks.
You can open the notebooks directly to play around with the code examples.
You can open the notebooks directly to play around with the code examples.


=================
Basics
=================

.. toctree::
.. toctree::
    :maxdepth: 1
    :maxdepth: 1


@@ -11,14 +15,70 @@ You can open the notebooks directly to play around with the code examples.
    /notebooks/01_tutorial_predefinedScenarios.ipynb
    /notebooks/01_tutorial_predefinedScenarios.ipynb
    /notebooks/02_tutorial_boundary_setup.ipynb
    /notebooks/02_tutorial_boundary_setup.ipynb
    /notebooks/03_tutorial_lbm_formulation.ipynb
    /notebooks/03_tutorial_lbm_formulation.ipynb
    /notebooks/04_tutorial_nondimensionalization_and_scaling.ipynb
    /notebooks/04_tutorial_cumulant_LBM.ipynb
    /notebooks/05_tutorial_modifying_method_smagorinsky.ipynb
    /notebooks/05_tutorial_nondimensionalization_and_scaling.ipynb
    /notebooks/06_tutorial_thermal_lbm.ipynb

    /notebooks/07_tutorial_shanchen_twophase.ipynb
===================
    /notebooks/08_tutorial_shanchen_twocomponent.ipynb
Turbulence modeling
===================

.. toctree::
    :maxdepth: 1

    /notebooks/06_tutorial_modifying_method_smagorinsky.ipynb

=================
Thermal flows
=================

.. toctree::
    :maxdepth: 1

    /notebooks/07_tutorial_thermal_lbm.ipynb
    /notebooks/demo_thermalized_lbm.ipynb

=================
Multiphase flows
=================

.. toctree::
    :maxdepth: 1

    /notebooks/08_tutorial_shanchen_twophase.ipynb
    /notebooks/09_tutorial_shanchen_twocomponent.ipynb
    /notebooks/10_tutorial_conservative_allen_cahn_two_phase.ipynb

========================
Thermocapillary flows
========================

.. toctree::
    :maxdepth: 1

    /notebooks/12_Thermocapillary_flows_heated_channel.ipynb
    /notebooks/13_Thermocapillary_flows_droplet_motion.ipynb

===================
Non Newtonian flow
===================

.. toctree::
    :maxdepth: 1

    /notebooks/11_tutorial_Non_Newtonian_Flow.ipynb

=================
Diverse
=================

.. toctree::
    :maxdepth: 1

    /notebooks/demo_stencils.ipynb
    /notebooks/demo_stencils.ipynb
    /notebooks/demo_streaming_patterns.ipynb
    /notebooks/demo_create_method_from_scratch.ipynb
    /notebooks/demo_create_method_from_scratch.ipynb
    /notebooks/demo_moments_cumulants_and_maxwellian_equilibrium.ipynb
    /notebooks/demo_moments_cumulants_and_maxwellian_equilibrium.ipynb
    /notebooks/demo_automatic_chapman_enskog_analysis.ipynb
    /notebooks/demo_automatic_chapman_enskog_analysis.ipynb
    /notebooks/demo_thermalized_lbm.ipynb
    /notebooks/demo_interpolation_boundary_conditions.ipynb
    /notebooks/demo_shallow_water_lbm.ipynb
    /notebooks/demo_theoretical_background_generic_equilibrium_construction.ipynb
    /notebooks/demo_theoretical_background_generic_equilibrium_construction.ipynb
Original line number Original line Diff line number Diff line
@@ -2,4 +2,4 @@ Bibliography
------------
------------


.. bibliography:: lbmpy.bib
.. bibliography:: lbmpy.bib
   :cited:
   :all:
 No newline at end of file
 No newline at end of file

doc/version_from_git.py

deleted100644 → 0
+0 −31
Original line number Original line Diff line number Diff line
import subprocess


def version_number_from_git(tag_prefix='release/', sha_length=10, version_format="{version}.dev{commits}+{sha}"):
    def get_released_versions():
        tags = sorted(subprocess.getoutput('git tag').split('\n'))
        versions = [t[len(tag_prefix):] for t in tags if t.startswith(tag_prefix)]
        return versions

    def tag_from_version(v):
        return tag_prefix + v

    def increment_version(v):
        parsed_version = [int(i) for i in v.split('.')]
        parsed_version[-1] += 1
        return '.'.join(str(i) for i in parsed_version)

    latest_release = get_released_versions()[-1]
    commits_since_tag = subprocess.getoutput('git rev-list {}..HEAD --count'.format(tag_from_version(latest_release)))
    sha = subprocess.getoutput('git rev-parse HEAD')[:sha_length]
    is_dirty = len(subprocess.getoutput("git status --untracked-files=no -s")) > 0

    if int(commits_since_tag) == 0:
        version_string = latest_release
    else:
        next_version = increment_version(latest_release)
        version_string = version_format.format(version=next_version, commits=commits_since_tag, sha=sha)

    if is_dirty:
        version_string += ".dirty"
    return version_string

lbmpy/boundaries/__init__.py

deleted100644 → 0
+0 −5
Original line number Original line Diff line number Diff line
from lbmpy.boundaries.boundaryconditions import (
    UBB, FixedDensity, NeumannByCopy, NoSlip, StreamInConstant)
from lbmpy.boundaries.boundaryhandling import LatticeBoltzmannBoundaryHandling

__all__ = ['NoSlip', 'UBB', 'FixedDensity', 'NeumannByCopy', 'LatticeBoltzmannBoundaryHandling', 'StreamInConstant']