Commit dec028ae authored by Martin Bauer's avatar Martin Bauer
Browse files

Bugfix in lbmpy waLBerla interface

- added rudimentary test to prevent these kind of problems
parent ff9e8f48
import unittest
import sympy as sp
from lbmpy.boundaries import NoSlip, UBB
from lbmpy_walberla import Field, RefinementScaling, generateLatticeModel
from lbmpy.creationfunctions import createLatticeBoltzmannMethod
from lbmpy_walberla.boundary import createBoundaryClass
class TestWalberlaCodeGen(unittest.TestCase):
def test_latticeModel(self):
forceField = Field.createGeneric('force', spatialDimensions=3, indexDimensions=1, layout='fzyx')
force = [forceField(0), forceField(1), forceField(2)]
omega = sp.Symbol("omega")
scaling = RefinementScaling()
scaling.addStandardRelaxationRateScaling(omega)
scaling.addForceScaling(forceField)
header, sources, _ = generateLatticeModel(latticeModelName="TestModel", method='srt', stencil='D3Q19',
forceModel='guo',
force=force, relaxationRates=[omega], refinementScaling=scaling)
def test_ubb(self):
boundary = UBB([0.05, 0, 0], dim=3, name="MyUBB")
method = createLatticeBoltzmannMethod(stencil='D3Q19', method='srt')
createBoundaryClass(boundary, method)
def test_noSlip(self):
boundary = NoSlip(name='MyNoSlip')
method = createLatticeBoltzmannMethod(stencil='D3Q19', method='srt')
createBoundaryClass(boundary, method)
import numpy as np
from jinja2 import Environment, PackageLoader
from pystencils import Field
from pystencils import Field, FieldType
from pystencils.data_types import createType, TypedSymbol
from pystencils_walberla.jinja_filters import addPystencilsFiltersToJinjaEnv
......@@ -44,7 +44,7 @@ def createBoundaryClass(boundaryObject, lbMethod, doublePrecision=True, target='
pdfField = Field.createGeneric('pdfs', lbMethod.dim, np.float64 if doublePrecision else np.float32,
indexDimensions=1, layout='fzyx', indexShape=[len(lbMethod.stencil)])
indexField = Field('indexVector', indexStructDtype, layout=[0],
indexField = Field('indexVector', FieldType.INDEXED, indexStructDtype, layout=[0],
shape=(TypedSymbol("indexVectorSize", createType(np.int64)), 1), strides=(1, 1))
kernel = generateIndexBoundaryKernelGeneric(pdfField, indexField, indexStructDtype, lbMethod, boundaryObject,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment