Skip to content

Commit 4365657

Browse files
committed
Fix for LHS mismatch
1 parent 5ebb225 commit 4365657

14 files changed

+7613
-7315
lines changed

maintainer/walberla_kernels/generate_lb_kernels.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ def generate_stream_collide_kernels(ctx, method, data_type):
221221
},
222222
optimization=optimization
223223
)
224-
225224
for params, target_suffix in paramlist(parameters, ("GPU", "CPU", "AVX")):
226225
stem = f"StreamCollideSweepThermalized{precision_prefix}{target_suffix}" # nopep8
227226
pystencils_espresso.generate_stream_collision_sweep(

maintainer/walberla_kernels/lees_edwards.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def velocity_offset_eqs(config, method, pdfs,
8888
print(f"{delta_pdf_eqs=}")
8989
# Replace the assignments of (rho,u) by (rho, u+v) - (rho,u)
9090
ma = []
91+
9192
for a, c in zip(delta_pdf_eqs.main_assignments, method.stencil):
9293
print(f"Direction {c}: {a}")
9394
# Determine direction of the stencil component in the
@@ -135,12 +136,26 @@ def add_lees_edwards_to_collision(
135136
stencil,
136137
combined_kernel)
137138

138-
print("Lees edwards collisoi nassigments")
139-
ma = []
140-
for i, a in enumerate(collision.main_assignments):
141-
# Add Lees-Edwards-shift to collision main assignments
142-
new_a = Assignment(a.lhs, a.rhs + offset[i].rhs)
143-
if a != new_a: print(f"Initial: {a}\nLE: {new_a}")
144-
ma.append(new_a)
145-
collision.main_assignments = ma
139+
print("Lees edwards collision assigments")
140+
141+
keys = [sp.Symbol(f"d_{i}") for i in range(19)]
142+
143+
for i, key in enumerate(keys):
144+
match_found = False
145+
for j, a in enumerate(collision.main_assignments):
146+
if a.lhs == key:
147+
collision.main_assignments[j] = Assignment(
148+
a.lhs, a.rhs + offset[i].rhs)
149+
match_found = True
150+
print(f"m:{a.lhs}, o:{offset[i].lhs}")
151+
break
152+
if match_found:
153+
continue
154+
for j, a in enumerate(collision.subexpressions):
155+
if hasattr(a, 'lhs'):
156+
if a.lhs == key:
157+
collision.subexpressions[j] = Assignment(
158+
a.lhs, a.rhs + offset[i].rhs)
159+
print(f"s:{a.lhs}, o:{offset[i].lhs}")
160+
break
146161
return collision

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepLeesEdwardsDoublePrecision.cpp

Lines changed: 530 additions & 506 deletions
Large diffs are not rendered by default.

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepLeesEdwardsDoublePrecisionAVX.cpp

Lines changed: 882 additions & 857 deletions
Large diffs are not rendered by default.

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepLeesEdwardsDoublePrecisionCUDA.cu

Lines changed: 521 additions & 499 deletions
Large diffs are not rendered by default.

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepLeesEdwardsSinglePrecision.cpp

Lines changed: 515 additions & 491 deletions
Large diffs are not rendered by default.

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepLeesEdwardsSinglePrecisionAVX.cpp

Lines changed: 850 additions & 825 deletions
Large diffs are not rendered by default.

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepLeesEdwardsSinglePrecisionCUDA.cu

Lines changed: 509 additions & 487 deletions
Large diffs are not rendered by default.

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepThermalizedDoublePrecision.cpp

Lines changed: 526 additions & 502 deletions
Large diffs are not rendered by default.

src/walberla_bridge/src/lattice_boltzmann/generated_kernels/StreamCollideSweepThermalizedDoublePrecisionAVX.cpp

Lines changed: 878 additions & 853 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)