Skip to content

Commit

Permalink
- Change parameters in pressure drop calculation
Browse files Browse the repository at this point in the history
- Add U-bend for accuracy
  • Loading branch information
wouterpeere committed Feb 26, 2025
1 parent dc2fc2a commit e89f22d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added support for DHW profiles in optimisation (issue #272).
- Added Prandtl number to FluidData class (issue #326).

## Changed

- Added U-bend to the pressure drop calculation of the pipe (issue #332).

## [2.3.1] - 2025-01-23

### Added
Expand Down
11 changes: 7 additions & 4 deletions GHEtool/VariableClasses/PipeData/CoaxialPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def Re(self, fluid_data: FluidData) -> float:
# Reynolds number
return fluid_data.rho * V * D_h / fluid_data.mu

def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
def pressure_drop(self, fluid_data: FluidData, borehole_length: float) -> float:
"""
Calculates the pressure drop across the entire borehole.
It assumed that the U-tubes are all connected in parallel.
Expand All @@ -149,8 +149,8 @@ def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
----------
fluid_data: FluidData
Fluid data
borehole_depth : float
Borehole depth [m]
borehole_length : float
Borehole length [m]
Returns
-------
Expand All @@ -167,7 +167,10 @@ def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
# Darcy-Wiesbach friction factor
fd = gt.pipes.fluid_friction_factor_circular_pipe(
fluid_data.mfr, r_h, fluid_data.mu, fluid_data.rho, self.epsilon)
return (fd * (borehole_depth * 2) / (2 * r_h) * fluid_data.rho * V ** 2 / 2) / 1000

# add 0.2 for the local losses
# (source: https://www.engineeringtoolbox.com/minor-loss-coefficients-pipes-d_626.html)
return ((fd * (borehole_length * 2) / (2 * r_h) + 0.2) * fluid_data.rho * V ** 2 / 2) / 1000

def draw_borehole_internal(self, r_b: float) -> None:
"""
Expand Down
10 changes: 6 additions & 4 deletions GHEtool/VariableClasses/PipeData/MultipleUTube.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def Re(self, fluid_data: FluidData) -> float:
(pi * self.r_in ** 2)
return fluid_data.rho * u * self.r_in * 2 / fluid_data.mu

def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
def pressure_drop(self, fluid_data: FluidData, borehole_length: float) -> float:
"""
Calculates the pressure drop across the entire borehole.
It assumed that the U-tubes are all connected in parallel.
Expand All @@ -142,8 +142,8 @@ def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
----------
fluid_data: FluidData
Fluid data
borehole_depth : float
Borehole depth [m]
borehole_length : float
Borehole length [m]
Returns
-------
Expand All @@ -161,7 +161,9 @@ def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
A = pi * self.r_in ** 2
V = (fluid_data.vfr / 1000) / A / self.number_of_pipes

return (fd * (borehole_depth * 2) / (2 * self.r_in) * fluid_data.rho * V ** 2 / 2) / 1000
# add 0.2 for the local losses
# (source: https://www.engineeringtoolbox.com/minor-loss-coefficients-pipes-d_626.html)
return ((fd * (borehole_length * 2) / (2 * self.r_in) + 0.2) * fluid_data.rho * V ** 2 / 2) / 1000

def draw_borehole_internal(self, r_b: float) -> None:
"""
Expand Down
6 changes: 3 additions & 3 deletions GHEtool/VariableClasses/PipeData/_PipeData.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def Re(self, fluid_data: FluidData) -> float:
"""

@abc.abstractmethod
def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
def pressure_drop(self, fluid_data: FluidData, borehole_length: float) -> float:
"""
Calculates the pressure drop across the entire borehole.
It assumed that the U-tubes are all connected in parallel.
Expand All @@ -90,8 +90,8 @@ def pressure_drop(self, fluid_data: FluidData, borehole_depth: float) -> float:
----------
fluid_data: FluidData
Fluid data
borehole_depth : float
Borehole depth [m]
borehole_length : float
Borehole length [m]
Returns
-------
Expand Down
6 changes: 3 additions & 3 deletions GHEtool/test/unit-tests/test_pipedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ def test_pressure_drop():
fluid_data = FluidData(0.3, 0.568, 998, 4180, 1e-3)
single = MultipleUTube(1, 0.02, 0.02, 0.4, 0.05, 1)
double = MultipleUTube(1, 0.013, 0.016, 0.4, 0.05, 2)
assert np.isclose(single.pressure_drop(fluid_data, 100), 4.4688388696204555)
assert np.isclose(double.pressure_drop(fluid_data, 100), 10.339838859988387)
assert np.isclose(single.pressure_drop(fluid_data, 100), 4.474549607676448)
assert np.isclose(double.pressure_drop(fluid_data, 100), 10.347836812519452)
coaxial = CoaxialPipe(r_in_in, r_in_out, r_out_in, r_out_out, k_p, k_g, is_inner_inlet=True)
assert np.isclose(coaxial.pressure_drop(fluid_data, 100), 0.16366613552554135)
assert np.isclose(coaxial.pressure_drop(fluid_data, 100), 0.1639237572210245)


def test_repr_():
Expand Down

0 comments on commit e89f22d

Please sign in to comment.