{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "nbsphinx": "hidden" }, "outputs": [], "source": [ "from lbmpy.session import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Demo: Stencils\n", "\n", "A stencil is a class which holds internally a tuple of directions, where each direction is again a tuple with as many entries as there are dimensions. The stencil class behaves like a nested tuple.\n", "Internally it already has a predefined set of commonly used stencils.\n", "A common notation for stencils in the lattice Boltzmann literature is the *DxQy* notation, where *x* is the dimension of the space, and *y* the number of directions. For example *D2Q9* is a two-dimensional stencil with 9 directions. The available DxQy stencils can be obtained via the Stencil enum which is in the enum submodule of lbmpy:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
Nr. | \n", "Direction Name | \n", "Direction | \n", "
---|---|---|
$0$ | \n", "$\\mathtt{\\text{C}}$ | \n", "$\\left( 0, \\ 0\\right)$ | \n", "
$1$ | \n", "$\\mathtt{\\text{N}}$ | \n", "$\\left( 0, \\ 1\\right)$ | \n", "
$2$ | \n", "$\\mathtt{\\text{S}}$ | \n", "$\\left( 0, \\ -1\\right)$ | \n", "
$3$ | \n", "$\\mathtt{\\text{W}}$ | \n", "$\\left( -1, \\ 0\\right)$ | \n", "
$4$ | \n", "$\\mathtt{\\text{E}}$ | \n", "$\\left( 1, \\ 0\\right)$ | \n", "
$5$ | \n", "$\\mathtt{\\text{NW}}$ | \n", "$\\left( -1, \\ 1\\right)$ | \n", "
$6$ | \n", "$\\mathtt{\\text{NE}}$ | \n", "$\\left( 1, \\ 1\\right)$ | \n", "
$7$ | \n", "$\\mathtt{\\text{SW}}$ | \n", "$\\left( -1, \\ -1\\right)$ | \n", "
$8$ | \n", "$\\mathtt{\\text{SE}}$ | \n", "$\\left( 1, \\ -1\\right)$ | \n", "