Skip to content

Commit

Permalink
Merge pull request #292 from MassimoCimmino/issue291_simplifySteadySt…
Browse files Browse the repository at this point in the history
…ateFLS

Issue291 simplify steady state fls
  • Loading branch information
MassimoCimmino authored Jun 28, 2024
2 parents 2fd9530 + bf991e7 commit 3c82fb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* [Issue 276](https://github.com/MassimoCimmino/pygfunction/issues/276) - Added functions to the `boreholes` module for the generation of rectangular fields in a staggered configuration.

### Enhancements

* [Issue 291](https://github.com/MassimoCimmino/pygfunction/issues/291) - Simplified the expressions in heat_transfer._finite_line_source_steady_state`. The function is now approximately 25% faster.

### Bug fixes

* [Issue 255](https://github.com/MassimoCimmino/pygfunction/issues/255) - Default to an `orientation` of `0.` when `tilt` is `0.` in `boreholes.Borehole` class.
Expand Down
9 changes: 6 additions & 3 deletions pygfunction/heat_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,8 @@ def _finite_line_source_steady_state(dis, H1, D1, H2, D2, reaSource, imgSource):
D2 + D1 + H2 + H1],
axis=-1)
dis = np.expand_dims(dis, axis=-1)
h = 0.5 / H2 * np.inner(p, q * np.log((q + np.sqrt(q**2 + dis**2)) / dis) - np.sqrt(q**2 + dis**2))
qpd = np.sqrt(q**2 + dis**2)
h = 0.5 / H2 * np.inner(p, q * np.log(q + qpd) - qpd)
elif reaSource:
# Real FLS solution
p = np.array([1, -1, 1, -1])
Expand All @@ -1385,7 +1386,8 @@ def _finite_line_source_steady_state(dis, H1, D1, H2, D2, reaSource, imgSource):
D2 - D1 + H2 - H1,],
axis=-1)
dis = np.expand_dims(dis, axis=-1)
h = 0.5 / H2 * np.inner(p, q * np.log((q + np.sqrt(q**2 + dis**2)) / dis) - np.sqrt(q**2 + dis**2))
qpd = np.sqrt(q**2 + dis**2)
h = 0.5 / H2 * np.inner(p, q * np.log(q + qpd) - qpd)
elif imgSource:
# Image FLS solution
p = np.array([1, -1, 1, -1])
Expand All @@ -1395,7 +1397,8 @@ def _finite_line_source_steady_state(dis, H1, D1, H2, D2, reaSource, imgSource):
D2 + D1 + H2 + H1],
axis=-1)
dis = np.expand_dims(dis, axis=-1)
h = 0.5 / H2 * np.inner(p, q * np.log((q + np.sqrt(q**2 + dis**2)) / dis) - np.sqrt(q**2 + dis**2))
qpd = np.sqrt(q**2 + dis**2)
h = 0.5 / H2 * np.inner(p, q * np.log(q + qpd) - qpd)
else:
# No heat source
h = np.zeros(np.broadcast_shapes(
Expand Down

0 comments on commit 3c82fb7

Please sign in to comment.