Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing a bug in array shape's compatibility in ZouHe BC #34

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/CFD/cylinder2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ def set_boundary_conditions(self):

# Outflow BC
outlet = self.boundingBoxIndices['right']
rho_outlet = np.ones(outlet.shape[0], dtype=self.precisionPolicy.compute_dtype)
rho_outlet = np.ones((outlet.shape[0], 1), dtype=self.precisionPolicy.compute_dtype)
self.BCs.append(ExtrapolationOutflow(tuple(outlet.T), self.gridInfo, self.precisionPolicy))
# self.BCs.append(ZouHe(tuple(outlet.T), self.gridInfo, self.precisionPolicy, 'pressure', rho_outlet))

# Inlet BC
inlet = self.boundingBoxIndices['left']
Expand Down
6 changes: 3 additions & 3 deletions src/boundary_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,11 @@ def calculate_vel(self, fpop, rho):
"""
Calculate velocity based on the prescribed pressure/density (Zou/He BC)
"""
unormal = -1. + 1. / rho * (jnp.sum(fpop[self.indices] * self.imiddleMask, axis=1) +
2. * jnp.sum(fpop[self.indices] * self.iknownMask, axis=1))
unormal = -1. + 1. / rho * (jnp.sum(fpop[self.indices] * self.imiddleMask, axis=1, keepdims=True) +
2. * jnp.sum(fpop[self.indices] * self.iknownMask, axis=1, keepdims=True))

# Return the above unormal as a normal vector which sets the tangential velocities to zero
vel = unormal[:, None] * self.normals
vel = unormal * self.normals
return vel

@partial(jit, static_argnums=(0,), inline=True)
Expand Down
Loading