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

Issue36 coaxial pipes #79

Merged
merged 47 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f83ed71
Initial implementation of coaxial pipes
MassimoCimmino Nov 1, 2018
ab572c5
Merge remote-tracking branch 'upstream/issue36_coaxialPipes' into iss…
Mar 16, 2021
9022abc
Move Gneilinski Nusselt number to a function, remove sharp jumps in c…
Mar 20, 2021
a0a049b
convective function should only return h_fluid
Mar 20, 2021
0e1dcd9
Catch the Re=4000 case
Mar 20, 2021
843dd7e
update to documentation, linear interpolation now comes from Gnielins…
Mar 20, 2021
9dc7e2d
gnielinski (1975) was not applicable 2300 < Re < 3000, correct docume…
Mar 21, 2021
4dec949
convection coefficient for annulus region of concentric pipes
Apr 6, 2021
974489d
Reformat changes to follow PEP8
Apr 7, 2021
f3b576c
Merge branch 'master' into issue36_CoaxialPipes
Apr 10, 2021
e7e3a0e
Add second borehole thermal resistance function
Apr 11, 2021
e7b8f4f
Merge branch 'master' into issue36_CoaxialPipes
Apr 11, 2021
85b8330
Add function to quickly compute coaxial resistance
Apr 11, 2021
0760b91
Fix coaxial effective borehole resistance
Apr 16, 2021
7a2e440
Merge remote-tracking branch 'upstream/master' into issue36_CoaxialPipes
Apr 16, 2021
6b6119c
Modify custom borehole example to use media.Fluid
May 28, 2021
1344189
Add double u-tubes to custom borehole example
May 27, 2021
ba0b7db
Fix double u-tube parallel bh resistance m_dot
May 28, 2021
222ff28
Merge branch 'master' into issue36_CoaxialPipes
Aug 23, 2021
de49359
Add concentric convective heat transfer coefficient
Aug 23, 2021
fe7a9a9
Adding coaxial to custom borehole...
Aug 23, 2021
645c743
Merge branch 'master' into issue36_CoaxialPipes
Aug 23, 2021
07bb0d6
Make Coaxial run
Aug 23, 2021
70b6501
Add coaxial function call
Aug 23, 2021
8224783
Fix inner and outer radii array definitions
Aug 23, 2021
f9b7b32
Initialization of Coaxial pipe class
MassimoCimmino Aug 23, 2021
5a3adaa
Fix _check_geometry() to be Coaxial compatible
Aug 24, 2021
a6a9675
Refactor custom borehole example (some)
Aug 24, 2021
556dd0d
Add Coaxial debugging code
Aug 24, 2021
b4957b3
Push up solving
Aug 24, 2021
9f28310
Fix check_geometry method for coaxial
Aug 24, 2021
30b102a
Modify coaxial coordinate input
Aug 24, 2021
e76061a
Make visualize_boreholes compatible with coaxial
Aug 24, 2021
80d9bf0
Plot and save coaxial borehole in custom_borehole
Aug 24, 2021
b22c35e
Add double u-tube to custom borehole example
Aug 24, 2021
ce11d8b
Document #36 in changelog
Aug 24, 2021
3efbc1d
Complete docstring for `Coaxial`
MassimoCimmino Aug 25, 2021
4321b0f
Reorder delta-circuit thermal resistances
MassimoCimmino Aug 25, 2021
c1f06cc
Move coaxial-specific visualization to `Coaxial`
MassimoCimmino Aug 25, 2021
f4cc171
Move coaxial-specific checks to `Coaxial`
MassimoCimmino Aug 25, 2021
8a1ffff
Reword CHANGELOG.md
MassimoCimmino Aug 25, 2021
d638256
Remove temporary example
MassimoCimmino Aug 25, 2021
d93ca95
Reformat `convective_heat_transfer_coefficient_concentric_annulus`
MassimoCimmino Aug 25, 2021
3a70afd
Refactor custom_borehole.py
MassimoCimmino Aug 25, 2021
7f2b0c7
Update documentation
MassimoCimmino Aug 25, 2021
54ce372
Fix references in documentation
MassimoCimmino Aug 25, 2021
a7357dd
Fix typos
MassimoCimmino Aug 27, 2021
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 @@ -2,6 +2,10 @@

## Current version

### New features

* [Issue 36](https://github.com/MassimoCimmino/pygfunction/issues/36) - Added a `Coaxial` class to the `pipes` module to model boreholes with coaxial pipes.

### Enhancements

* [Issue 118](https://github.com/MassimoCimmino/pygfunction/issues/118) - Refactored checks for stored `_BasePipe` and `Network` coefficicients to use `numpy.all()`. This decreases calculation time.
Expand Down
6 changes: 3 additions & 3 deletions doc/source/examples/custom_borehole.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Definition and visualization of a borehole
******************************************

This example demonstrates the use of the :doc:`borehole <../modules/boreholes>` module
to define the positions of U-tube pipes inside a borehole and visualize the
to define the positions of pipes inside a borehole and visualize the
top view of a borehole.

The following script generates a borehole with a single U-tube. The
borehole cross-section is then plotted on a figure.
The following script generates boreholes with a single U-tube, a double U-tube (in series and
parallel configurations), and a coaxial borehole. The borehole cross-sections are then plotted.

The script is located in:
`pygfunction/examples/custom_borehole.py`
Expand Down
201 changes: 167 additions & 34 deletions pygfunction/examples/custom_borehole.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,204 @@
created and the borehole resistance is computed.

"""
import numpy as np
from scipy.constants import pi

import pygfunction as gt
from numpy import pi


def main():
# -------------------------------------------------------------------------
# Simulation parameters
# -------------------------------------------------------------------------

# Borehole dimensions
H = 400. # Borehole length (m)
D = 5. # Borehole buried depth (m)
H = 400. # Borehole length (m)
r_b = 0.0875 # Borehole radius (m)

# Pipe dimensions
r_out = 0.0133 # Pipe outer radius (m)
r_in = 0.0108 # Pipe inner radius (m)
D_s = 0.029445 # Shank spacing (m)
# Pipe dimensions (all configurations)
epsilon = 1.0e-6 # Pipe roughness (m)

# Pipe positions
# Single U-tube [(x_in, y_in), (x_out, y_out)]
pos = [(-D_s, 0.), (D_s, 0.)]
# Pipe dimensions (single U-tube and double U-tube)
r_out = 0.0211 # Pipe outer radius (m)
r_in = 0.0147 # Pipe inner radius (m)
D_s = 0.052 # Shank spacing (m)

# Define a borehole
borehole = gt.boreholes.Borehole(H, D, r_b, x=0., y=0.)
# Pipe dimensions (coaxial)
r_in_in = 0.0221 # Inside pipe inner radius (m)
r_in_out = 0.025 # Inside pipe outer radius (m)
r_out_in = 0.0487 # Outer pipe inside radius (m)
r_out_out = 0.055 # Outer pipe outside radius (m)
# Vectors of inner and outer pipe radii
# Note : The dimensions of the inlet pipe are the first elements of
# the vectors. In this example, the inlet pipe is the inside pipe.
r_inner = np.array([r_in_in, r_out_in]) # Inner pipe radii (m)
r_outer = np.array([r_in_out, r_out_out]) # Outer pip radii (m)

# Ground properties
k_s = 2.0 # Ground thermal conductivity (W/m.K)

# Grout properties
k_g = 1.0 # Grout thermal conductivity (W/m.K)

k_p = 0.4 # Pipe thermal conductivity (W/m.K)
k_s = 2.0 # Ground thermal conductivity (W/m.K)
k_g = 1.0 # Grout thermal conductivity (W/m.K)
# Pipe properties
k_p = 0.4 # Pipe thermal conductivity (W/m.K)

# Fluid properties
m_flow_borehole = 0.25 # Total fluid mass flow rate per borehole (kg/s)
cp_f = 3977. # Fluid specific isobaric heat capacity (J/kg.K)
rho_f = 1015. # Fluid density (kg/m3)
mu_f = 0.00203 # Fluid dynamic viscosity (kg/m.s)
k_f = 0.492 # Fluid thermal conductivity (W/m.K)
# Total fluid mass flow rate per borehole (kg/s)
m_flow_borehole = 1.0
# The fluid is propylene-glycol (20 %) at 20 degC
fluid = gt.media.Fluid('MPG', 20.)
cp_f = fluid.cp # Fluid specific isobaric heat capacity (J/kg.K)
rho_f = fluid.rho # Fluid density (kg/m3)
mu_f = fluid.mu # Fluid dynamic viscosity (kg/m.s)
k_f = fluid.k # Fluid thermal conductivity (W/m.K)

# -------------------------------------------------------------------------
# Initialize borehole model
# -------------------------------------------------------------------------

borehole = gt.boreholes.Borehole(H, D, r_b, x=0., y=0.)

# -------------------------------------------------------------------------
# Define a single U-tube borehole
# -------------------------------------------------------------------------

# Pipe positions
# Single U-tube [(x_in, y_in), (x_out, y_out)]
pos_single = [(-D_s, 0.), (D_s, 0.)]

# Pipe thermal resistance
R_p = gt.pipes.conduction_thermal_resistance_circular_pipe(
r_in, r_out, k_p)
# Fluid to inner pipe wall thermal resistance (Single U-tube)

# Fluid to inner pipe wall thermal resistance
m_flow_pipe = m_flow_borehole
h_f = gt.pipes.convective_heat_transfer_coefficient_circular_pipe(
m_flow_pipe, r_in, mu_f, rho_f, k_f, cp_f, epsilon)
R_f = 1.0 / (h_f * 2 * pi * r_in)

# Single U-tube GHE in borehole
SingleUTube = gt.pipes.SingleUTube(
pos, r_in, r_out, borehole, k_s, k_g, R_f + R_p)

R_b = gt.pipes.borehole_thermal_resistance(
SingleUTube, m_flow_borehole, cp_f)

print('Borehole thermal resistance: {0:.4f} m.K/W'.format(R_b))
pos_single, r_in, r_out, borehole, k_s, k_g, R_f + R_p)

# Check the geometry to make sure it is physically possible
#

# This class method is automatically called at the instanciation of the
# pipe object and raises an error if the pipe geometry is invalid. It is
# manually called here for demosntration.
check = SingleUTube._check_geometry()
# manually called here for demonstration.
check_single = SingleUTube._check_geometry()
print('The geometry of the borehole is valid (realistic/possible): '
+ str(check))
+ str(check_single))

# Evaluate and print the effective borehole thermal resistance
R_b = gt.pipes.borehole_thermal_resistance(
SingleUTube, m_flow_borehole, fluid.cp)
print('Single U-tube Borehole thermal resistance: '
'{0:.4f} m.K/W'.format(R_b))

# Visualize the borehole geometry and save the figure
fig_single = SingleUTube.visualize_pipes()
fig_single.savefig('single-u-tube-borehole.png')

# -------------------------------------------------------------------------
# Define a double U-tube borehole
# -------------------------------------------------------------------------

# Pipe positions
# Double U-tube [(x_in1, y_in1), (x_in2, y_in2),
# (x_out1, y_out1), (x_out2, y_out2)]
# Note: in series configuration, fluid enters pipe (in,1), exits (out,1),
# then enters (in,2) and finally exits (out,2)
# (if you view visualize_pipe, series is 1->3->2->4)
pos_double = [(-D_s, 0.), (0., -D_s), (D_s, 0.), (0., D_s)]

# Pipe thermal resistance
R_p = gt.pipes.conduction_thermal_resistance_circular_pipe(
r_in, r_out, k_p)

# Fluid to inner pipe wall thermal resistance
# Double U-tube in series
m_flow_pipe_series = m_flow_borehole
h_f_series = gt.pipes.convective_heat_transfer_coefficient_circular_pipe(
m_flow_pipe_series, r_in, mu_f, rho_f, k_f, cp_f, epsilon)
R_f_series = 1.0 / (h_f_series * 2 * pi * r_in)
# Double U-tube in parallel
m_flow_pipe_parallel = m_flow_borehole / 2
h_f_parallel = gt.pipes.convective_heat_transfer_coefficient_circular_pipe(
m_flow_pipe_parallel, r_in, mu_f, rho_f, k_f, cp_f, epsilon)
R_f_parallel = 1.0 / (h_f_parallel * 2 * pi * r_in)

# Double U-tube GHE in borehole
# Double U-tube in series
DoubleUTube_series = gt.pipes.MultipleUTube(
pos_double, r_in, r_out, borehole, k_s, k_g, R_p + R_f_series, 2,
config='series')
# Double U-tube in parallel
DoubleUTube_parallel = gt.pipes.MultipleUTube(
pos_double, r_in, r_out, borehole, k_s, k_g, R_p + R_f_parallel, 2,
config='parallel')

# Evaluate and print the effective borehole thermal resistance
R_b_series = gt.pipes.borehole_thermal_resistance(
DoubleUTube_series, m_flow_borehole, cp_f)
print('Double U-tube (series) Borehole thermal resistance: {0:.4f} m.K/W'.
format(R_b_series))
R_b_parallel = gt.pipes.borehole_thermal_resistance(
DoubleUTube_parallel, m_flow_borehole, cp_f)
print('Double U-tube (parallel) Borehole thermal resistance: {0:.4f} m.K/W'.
format(R_b_parallel))

# Visualize the borehole geometry and save the figure
fig_double = DoubleUTube_series.visualize_pipes()
fig_double.savefig('double-u-tube-borehole.png')

# -------------------------------------------------------------------------
# Define a coaxial borehole
# -------------------------------------------------------------------------

# Create a borehole top view
fig = SingleUTube.visualize_pipes()
# Pipe positions
# Coaxial pipe (x, y)
pos = (0., 0.)

# Pipe thermal resistance
# (the two pipes have the same thermal conductivity, k_p)
# Inner pipe
R_p_in = gt.pipes.conduction_thermal_resistance_circular_pipe(
r_in_in, r_in_out, k_p)
# Outer pipe
R_p_out = gt.pipes.conduction_thermal_resistance_circular_pipe(
r_out_in, r_out_out, k_p)

# Fluid-to-fluid thermal resistance
# Inner pipe
h_f_in = gt.pipes.convective_heat_transfer_coefficient_circular_pipe(
m_flow_borehole, r_in_in, mu_f, rho_f, k_f, cp_f, epsilon)
R_f_in = 1.0 / (h_f_in * 2 * pi * r_in_in)
# Outer pipe
h_f_a_in, h_f_a_out = \
gt.pipes.convective_heat_transfer_coefficient_concentric_annulus(
m_flow_borehole, r_in_out, r_out_in, mu_f, rho_f, k_f, cp_f,
epsilon)
R_f_out_in = 1.0 / (h_f_a_in * 2 * pi * r_in_out)
R_ff = R_f_in + R_p_in + R_f_out_in

# Coaxial GHE in borehole
R_f_out_out = 1.0 / (h_f_a_out * 2 * pi * r_out_in)
R_fp = R_p_out + R_f_out_out
Coaxial = gt.pipes.Coaxial(
pos, r_inner, r_outer, borehole, k_s, k_g, R_ff, R_fp, J=2)

# Evaluate and print the effective borehole thermal resistance
R_b = gt.pipes.borehole_thermal_resistance(
Coaxial, m_flow_borehole, cp_f)
print('Coaxial tube Borehole thermal resistance: {0:.4f} m.K/W'.
format(R_b))

# Save the figure as a pdf
fig.savefig('borehole-top-view.pdf')
# Visualize the borehole geometry and save the figure
fig_coaxial = Coaxial.visualize_pipes()
fig_coaxial.savefig('coaxial-borehole.png')


if __name__ == '__main__':
Expand Down
Loading