Skip to content

Commit

Permalink
Fixed pressure computation
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkelshaw committed Oct 24, 2023
1 parent ad3c724 commit 4ef889a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kolsol/numpy/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def pressure(self, u_hat: np.ndarray) -> np.ndarray:
f_hat = oe.contract('...t, ut... -> ...u', -self.nabla, aapt)

with np.errstate(divide='ignore', invalid='ignore'):
p_hat = oe.contract('...u, ...u -> ...', -self.nabla, f_hat) / self.kk
p_hat = oe.contract('...u, ...u -> ...', -self.nabla, f_hat + self.f) / self.kk
p_hat[tuple([...]) + tuple(self.nk for _ in range(self.ndim))] = 0.0

return p_hat
Expand Down
2 changes: 1 addition & 1 deletion kolsol/torch/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def pressure(self, u_hat: torch.Tensor) -> torch.Tensor:
aapt = torch.stack(uij_aapt, dim=0)
f_hat = oe.contract('...t, ut... -> ...u', -self.nabla, aapt)

p_hat = oe.contract('...u, ...u -> ...', -self.nabla, f_hat) / self.kk_div
p_hat = oe.contract('...u, ...u -> ...', -self.nabla, f_hat + self.f) / self.kk_div
p_hat[tuple([...]) + tuple(self.nk for _ in range(self.ndim))] = 0.0

return p_hat
Expand Down

0 comments on commit 4ef889a

Please sign in to comment.