Skip to content
Snippets Groups Projects
Commit edb34577 authored by Martin Bauer's avatar Martin Bauer
Browse files

lbmpy: small bugfixes & performance improvements

parent 8a0bb113
No related branches found
No related tags found
No related merge requests found
......@@ -164,7 +164,7 @@ def generateBoundaryHandling(pdfField, indexArr, lbMethod, boundaryFunctor):
cellLoopBody.append(be)
functionBody = Block([cellLoop])
ast = KernelFunction(functionBody, [pdfField, indexField])
ast = KernelFunction(functionBody, [indexField] + list(fieldsAccessed))
if len(additionalNodes) > 0:
loops = ast.atoms(LoopOverCoordinate)
......
from matplotlib.pyplot import *
def removeGhostLayers(field):
return field[1:-1, 1:-1]
def vectorField(field, step=2, **kwargs):
field = removeGhostLayers(field)
veln = field.swapaxes(0, 1)
quiver(veln[::step, ::step, 0], veln[::step, ::step, 1], **kwargs)
......@@ -19,7 +14,6 @@ def vectorFieldMagnitude(field, **kwargs):
def scalarField(field, **kwargs):
import numpy as np
field = removeGhostLayers(field)
field = np.swapaxes(field, 0, 1)
return imshow(field, origin='lower', **kwargs)
......
......@@ -75,7 +75,7 @@ def createStreamPullKernel(collisionRule, numpyField=None, srcFieldName="src", d
def createPdfArray(size, numDirections, ghostLayers=1, layout='fzyx'):
"""
Creates an empy numpy array for a pdf field with the specified memory layout.
Creates an empty numpy array for a pdf field with the specified memory layout.
Examples:
>>> createPdfArray((3, 4, 5), 9, layout='zyxf', ghostLayers=0).shape
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment