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

Issue291 simplify steady state fls #292

Merged
merged 2 commits into from
Jun 28, 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
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
Loading