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

Merge branch 'fix_Boundary_2D_creation' into 'master'

Hotfix! for creation of wrong index when using generate_boundary in 2D

See merge request !3
parents 9d786d66 1118257a
1 merge request!3Hotfix! for creation of wrong index when using generate_boundary in 2D
Pipeline #20269 failed with stage
in 6 minutes and 1 second
......@@ -32,7 +32,16 @@ def generate_boundary(generation_context, class_name, boundary_object, lb_method
openmp=generation_context.openmp)
kernel.function_name = "boundary_" + boundary_object.name
stencil_info = [(i, ", ".join([str(e) for e in d])) for i, d in enumerate(lb_method.stencil)]
# waLBerla is a 3D framework. Therefore, a zero for the z index has to be added if we work in 2D
if lb_method.dim == 2:
stencil = ()
for d in lb_method.stencil:
d = d + (0,)
stencil = stencil + (d,)
else:
stencil = lb_method.stencil
stencil_info = [(i, ", ".join([str(e) for e in d])) for i, d in enumerate(stencil)]
context = {
'class_name': boundary_object.name,
......
......@@ -91,7 +91,13 @@ class WalberlaLbmpyCodegenTest(unittest.TestCase):
generate_lattice_model(ctx, 'FluctuatingMRT', collision_rule)
@staticmethod
def test_boundary():
def test_boundary_3D():
with ManualCodeGenerationContext(openmp=True, double_accuracy=True) as ctx:
lb_method = create_lb_method(stencil='D3Q19', method='srt')
generate_boundary(ctx, 'Boundary', NoSlip(), lb_method, target='gpu')
\ No newline at end of file
generate_boundary(ctx, 'Boundary', NoSlip(), lb_method, target='gpu')
@staticmethod
def test_boundary_2D():
with ManualCodeGenerationContext(openmp=True, double_accuracy=True) as ctx:
lb_method = create_lb_method(stencil='D2Q9', method='srt')
generate_boundary(ctx, 'Boundary', NoSlip(), lb_method, target='gpu')
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