Skip to content

Commit

Permalink
fixed a bug in bc and kbc (Warp) that emerged after merging 2d and 3d…
Browse files Browse the repository at this point in the history
… kernels
  • Loading branch information
hsalehipour committed Oct 25, 2024
1 parent 104f482 commit e8025e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions xlb/operator/boundary_condition/bc_regularized.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,14 @@ def _get_fsum(
def get_normal_vectors(
missing_mask: Any,
):
for l in range(_q):
if missing_mask[l] == wp.uint8(1) and wp.abs(_c[0, l]) + wp.abs(_c[1, l]) + wp.abs(_c[2, l]) == 1:
return -_u_vec(_c_float[0, l], _c_float[1, l], _c_float[2, l])
if wp.static(_d == 3):
for l in range(_q):
if missing_mask[l] == wp.uint8(1) and wp.abs(_c[0, l]) + wp.abs(_c[1, l]) + wp.abs(_c[2, l]) == 1:
return -_u_vec(_c_float[0, l], _c_float[1, l], _c_float[2, l])
else:
for l in range(_q):
if missing_mask[l] == wp.uint8(1) and wp.abs(_c[0, l]) + wp.abs(_c[1, l]) == 1:
return -_u_vec(_c_float[0, l], _c_float[1, l])

@wp.func
def bounceback_nonequilibrium(
Expand Down
5 changes: 4 additions & 1 deletion xlb/operator/collision/kbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ def functional(
):
# Compute shear and delta_s
fneq = f - feq
shear = decompose_shear_d3q27(fneq)
if wp.static(self.velocity_set.d == 3):
shear = decompose_shear_d3q27(fneq)
else:
shear = decompose_shear_d2q9(fneq)
delta_s = shear * rho # TODO: Check this

# Perform collision
Expand Down

0 comments on commit e8025e2

Please sign in to comment.