Skip to content
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
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
=======
History
=======
2026.3.26 -- Bugfix: Corrected handling of viscosity <= 0.0
* Ignore the hydrostatic correction if the given viscosity is less than or equal
to 0. This allows a flowchart to work more simply whether the viscosity os know or
not.

2026.3.15 -- Fixed an error with MLFFs and protected the viscosity correction.
* Fixed and error with the name of the MLFF, which caused the code to crash after
printing the results but before ending.
Expand Down
13 changes: 10 additions & 3 deletions diffusivity_step/diffusivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ def analyze(

# If requested, calculate the Yeh-Hummer correction for cell size
correction = None
if P["hydrodynamic correction"]:
if P["hydrodynamic correction"] and P["viscosity"] > 0:
if "T" in self._state_vars:
T = self._state["T"][-1]
if "a" in self._state_vars:
Expand Down Expand Up @@ -1164,12 +1164,19 @@ def description_text(self, P=None, short=False):
)

correction = P["hydrodynamic correction"]
viscosity = P["viscosity"]
if not self.is_expr(viscosity):
try:
if viscosity.magnitude <= 0:
correction = "no"
except Exception:
pass

if isinstance(correction, str) and self.is_expr(correction):
text += (
f" The expression '{correction}' will determine whether to use the "
"Yeh-Hummer hydrodynamic correction for the finite cell size using "
f"a viscosity of {P['viscosity']}."
f"a viscosity of {viscosity}."
)
else:
if isinstance(correction, str):
Expand All @@ -1178,7 +1185,7 @@ def description_text(self, P=None, short=False):
text += (
" The calculated diffusivity will be corrected for the finite cell "
"size using the Yeh-Hummer hydrodynamic correction using "
f"a viscosity of {P['viscosity']}."
f"a viscosity of {viscosity}."
)

text += "\n\n"
Expand Down
Loading