From edb34577916bee8471a61ea988bf396b78c6ffed Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Wed, 8 Mar 2017 17:45:28 +0100 Subject: [PATCH] lbmpy: small bugfixes & performance improvements --- boundaries/boundaryhandling.py | 2 +- plot2d.py | 6 ------ updatekernels.py | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/boundaries/boundaryhandling.py b/boundaries/boundaryhandling.py index 4f7edcaa..3f68a725 100644 --- a/boundaries/boundaryhandling.py +++ b/boundaries/boundaryhandling.py @@ -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) diff --git a/plot2d.py b/plot2d.py index b1bb3647..0023377f 100644 --- a/plot2d.py +++ b/plot2d.py @@ -1,12 +1,7 @@ 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) diff --git a/updatekernels.py b/updatekernels.py index d27ed4f6..08a28247 100644 --- a/updatekernels.py +++ b/updatekernels.py @@ -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 -- GitLab