Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
405ca22
Move Solver classes to new solvers module
MassimoCimmino Apr 25, 2025
70a07cf
Update CHANGELOG.md
MassimoCimmino Apr 25, 2025
c884df9
Add solvers to documentation
MassimoCimmino Apr 25, 2025
c628db0
Update master version to v2.4.0.dev0
MassimoCimmino Apr 29, 2025
106fa7a
Merge pull request #321 from MassimoCimmino/issue313_startVersion-2-4…
MassimoCimmino Apr 29, 2025
60a7aa4
Merge remote-tracking branch 'origin/master' into issue319_solversModule
MassimoCimmino Apr 29, 2025
e3d966a
Fix doc files and docstrings
MassimoCimmino Apr 29, 2025
5e53299
Update setup to find modules in subfolders
MassimoCimmino May 9, 2025
147938f
Merge pull request #320 from MassimoCimmino/issue319_solversModule
MassimoCimmino May 9, 2025
2373595
Add __add__ function to borefield class
wouterpeere Jun 29, 2025
2ef74cb
Small fix
wouterpeere Jun 29, 2025
0fab12d
draft updated stubs for gFunction api
mitchute Jul 1, 2025
cec642d
moving over to class method for creating gFunction. wip - UBWT and UH…
mitchute Jul 2, 2025
1ec7e80
running verison of API
mitchute Jul 6, 2025
0d44726
fix duplicated test name causing test scenario to not execute
mitchute Jul 7, 2025
d5e2057
address review comments
mitchute Jul 9, 2025
f2112b4
__add__ function for Borehole class
wouterpeere Jul 9, 2025
32c5a59
Fix test
wouterpeere Jul 9, 2025
50c62b9
add docstrings, a few additional cleanups to adhere to passing only s…
mitchute Jul 9, 2025
45e5d45
Review pull request
MassimoCimmino Jul 10, 2025
f563585
Update CHANGELOG.md
MassimoCimmino Jul 10, 2025
dbaeb3f
__radd__ in Borehole
MassimoCimmino Jul 10, 2025
7e6065a
Fix tests
MassimoCimmino Jul 10, 2025
0fd3efa
Fix tests
MassimoCimmino Jul 10, 2025
9cdf77d
Fix typo
wouterpeere Jul 10, 2025
22c1aa0
Update tests
wouterpeere Jul 10, 2025
1cbf556
add __rand__ back
wouterpeere Jul 10, 2025
18d2dd5
add fluid_temperature argument
mitchute Jul 14, 2025
75f52ea
Formatting changes
MassimoCimmino Jul 15, 2025
0f890d4
Re-order conductivity indices in coaxial R_ff and R_fp
MassimoCimmino Jul 15, 2025
5b914f5
Update CHANGELOG.md
MassimoCimmino Jul 15, 2025
8151179
Merge pull request #325 from wouterpeere/master
MassimoCimmino Jul 15, 2025
8225765
Merge remote-tracking branch 'origin/master' into pr326_gfuncApi
MassimoCimmino Jul 15, 2025
2e96dc2
Misplaced change in CHANGELOG.md
MassimoCimmino Jul 15, 2025
2631443
Final review of PR326
MassimoCimmino Jul 31, 2025
0ca4ef8
Merge pull request #326 from mitchute/gfunc_api
MassimoCimmino Jul 31, 2025
1cf60dc
Merge branch 'master' into maintenance/issue327_version-2-3-1
MassimoCimmino Jul 31, 2025
453a3b2
Increment pygfunction version
MassimoCimmino Jul 31, 2025
1dad3e1
Add maintenance/2.3.x to tests
MassimoCimmino Jul 31, 2025
ed50f0a
Fix warnings in doc
MassimoCimmino Jul 31, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- master
- maintenance/2.2.x
- maintenance/2.3.x
pull_request:
branches:
- master
- maintenance/2.2.x
- maintenance/2.3.x
types: [opened, synchronize, reopened]

jobs:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# History of changes

## Version 2.3.1 (2025-08-04)

### New features

* [Pull Request 325](https://github.com/MassimoCimmino/pygfunction/pull/325) - Borefields and boreholes can now be concatenated using the `+` operator, e.g. using `new_field = field_1 + field_2`.
* [Pull Request 326](https://github.com/MassimoCimmino/pygfunction/pull/326) - Introduced `gFunction.from_static_params` and `Network.from_static_params` methods. These methods facilitate the creation of `Network` objects and the evaluation of g-functions by automatically evaluating the required thermal resistances for the creation of `Pipe` objects.

### Other changes

* [Issue 319](https://github.com/MassimoCimmino/pygfunction/issues/319) - Created `solvers` module. `Solver` classes are moved out of the `gfunction` module and into the new module.

## Version 2.3 (2025-04-29)

### New features
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# The short X.Y version.
version = u'2.3'
# The full version, including alpha/beta/rc tags.
release = u'2.3.1.dev0'
release = u'2.3.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
1 change: 1 addition & 0 deletions doc/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Modules
modules/media
modules/networks
modules/pipes
modules/solvers
modules/utilities
9 changes: 9 additions & 0 deletions doc/source/modules/solvers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. solvers:

**************
Solvers Module
**************

.. automodule:: pygfunction.solvers
:members:
:show-inheritance:
1 change: 1 addition & 0 deletions pygfunction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
media,
networks,
pipes,
solvers,
utilities,
)
36 changes: 36 additions & 0 deletions pygfunction/borefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,42 @@ def __ne__(
check = not self == other_field
return check

def __add__(self,
other_field: Union[Borehole, List[Borehole], Self]) -> Self:
"""Add two borefields together"""
if not isinstance(other_field, (Borehole, list, self.__class__)):
raise TypeError(
f'Expected Borefield, list or Borehole input;'
f' got {other_field}'
)
# List of boreholes
field = self.to_boreholes()
# Convert other_field to a list if it is a Borehole
if isinstance(other_field, Borehole):
other_field = [other_field]
# Convert borefield to a list if it is a Borefield
if isinstance(other_field, self.__class__):
other_field = other_field.to_boreholes()
return Borefield.from_boreholes(field + other_field)

def __radd__(self,
other_field: Union[Borehole, List[Borehole], Self]) -> Self:
"""Add two borefields together"""
if not isinstance(other_field, (Borehole, list, self.__class__)):
raise TypeError(
f'Expected Borefield, list or Borehole input;'
f' got {other_field}'
)
# List of boreholes
field = self.to_boreholes()
# Convert other_field to a list if it is a Borehole
if isinstance(other_field, Borehole):
other_field = [other_field]
# Convert borefield to a list if it is a Borefield
if isinstance(other_field, self.__class__):
other_field = other_field.to_boreholes()
return Borefield.from_boreholes(other_field + field)

def evaluate_g_function(
self,
alpha: float,
Expand Down
52 changes: 52 additions & 0 deletions pygfunction/boreholes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
from typing import Union
import warnings

import numpy as np
from scipy.spatial.distance import pdist
from typing_extensions import Self # for compatibility with Python <= 3.10

from .utilities import _initialize_figure, _format_axes, _format_axes_3d

Expand Down Expand Up @@ -54,6 +56,56 @@ def __repr__(self):
f' orientation={self.orientation})')
return s

def __add__(self, other: Union[Self, list]):
"""
Adds two boreholes together to form a borefield
"""
if not isinstance(other, (self.__class__, list)):
# Check if other is a borefield and try the operation using
# other.__radd__
try:
field = other.__radd__(self)
except:
# Invalid input
raise TypeError(
f'Expected Borefield, list or Borehole input;'
f' got {other}'
)
elif isinstance(other, list):
# Create a borefield from the borehole and a list
from .borefield import Borefield
field = Borefield.from_boreholes([self] + other)
else:
# Create a borefield from the two boreholes
from .borefield import Borefield
field = Borefield.from_boreholes([self, other])
return field

def __radd__(self, other: Union[Self, list]):
"""
Adds two boreholes together to form a borefield
"""
if not isinstance(other, (self.__class__, list)):
# Check if other is a borefield and try the operation using
# other.__radd__
try:
field = other.__add__(self)
except:
# Invalid input
raise TypeError(
f'Expected Borefield, list or Borehole input;'
f' got {other}'
)
elif isinstance(other, list):
# Create a borefield from the borehole and a list
from .borefield import Borefield
field = Borefield.from_boreholes(other + [self])
else:
# Create a borefield from the two boreholes
from .borefield import Borefield
field = Borefield.from_boreholes([other, self])
return field

def distance(self, target):
"""
Evaluate the distance between the current borehole and a target
Expand Down
21 changes: 21 additions & 0 deletions pygfunction/enums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from enum import Enum, auto
from typing import Annotated


class PipeType(Enum):
"""Enumerator for pipe configuration type."""
COAXIAL_ANNULAR_IN: Annotated[
int, "Coaxial pipe (annular inlet)"
] = auto()
COAXIAL_ANNULAR_OUT: Annotated[
int, "Coaxial pipe (annular outlet)"
] = auto()
DOUBLE_UTUBE_PARALLEL: Annotated[
int, "Double U-tube (parallel)"
] = auto()
DOUBLE_UTUBE_SERIES: Annotated[
int, "Double U-tube (series)"
] = auto()
SINGLE_UTUBE: Annotated[
int, "Single U-tube"
] = auto()
Loading