Skip to content

Commit

Permalink
adding check to prevent negative numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Jan 26, 2024
1 parent 93b5bb5 commit 51c3715
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openpnm/models/geometry/pore_surface_area/_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def sphere(
Tca = network[throat_cross_sectional_area]
_np.subtract.at(value, network.conns[:, 0], Tca)
_np.subtract.at(value, network.conns[:, 1], Tca)
value = _np.clip(value, 1e-12, _np.inf)
return value


Expand Down Expand Up @@ -72,6 +73,7 @@ def circle(
Tca = network[throat_cross_sectional_area]
_np.subtract.at(value, network.conns[:, 0], Tca)
_np.subtract.at(value, network.conns[:, 1], Tca)
value = _np.clip(value, 1e-12, _np.inf)
return value


Expand Down Expand Up @@ -99,6 +101,7 @@ def cube(
Tca = network[throat_cross_sectional_area]
_np.subtract.at(value, network.conns[:, 0], Tca)
_np.subtract.at(value, network.conns[:, 1], Tca)
value = _np.clip(value, 1e-12, _np.inf)
return value


Expand Down Expand Up @@ -126,4 +129,5 @@ def square(
Tca = network[throat_cross_sectional_area]
_np.subtract.at(value, network.conns[:, 0], Tca)
_np.subtract.at(value, network.conns[:, 1], Tca)
value = _np.clip(value, 1e-12, _np.inf)
return value

0 comments on commit 51c3715

Please sign in to comment.