Skip to content

Commit 56fb9e8

Browse files
Merge pull request MassimoCimmino#302 from MassimoCimmino/issue215_variableMassFlowGFunctions
Variable fluid mass flow rate g-functions
2 parents 8af0a87 + 4329587 commit 56fb9e8

12 files changed

+1268
-397
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### New features
66

7+
* [Issue 215](https://github.com/MassimoCimmino/pygfunction/issues/215) - Implemented variable fluid mass flow rate g-functions. Bore fields with series-connected boreholes and reversible flow direction can now be simulated.
78
* [Issue 282](https://github.com/MassimoCimmino/pygfunction/issues/282) - Enabled the use of negative mass flow rates in `Pipe` and `Network` classes to model reversed flow direction.
89

910
## Version 2.2.3 (2024-07-01)

doc/source/example_index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Examples
2121
examples/fluid_temperature
2222
examples/equal_inlet_temperature
2323
examples/fluid_temperature_multiple_boreholes
24+
examples/fluid_temperature_reversible_flow_direction
2425
examples/multiple_independent_Utubes
2526
examples/multipole_temperature
2627
examples/bore_field_thermal_resistance
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.. examples:
2+
3+
*******************************************************************************************************
4+
Simulation of fluid temperatures in a field of series-connected boreholes and reversible flow direction
5+
*******************************************************************************************************
6+
7+
This example demonstrates the use of the
8+
:doc:`networks <../modules/networks>` module to predict the fluid temperature variations
9+
in a bore field with series-connected boreholes and reversible flow direction.
10+
11+
The variable fluid mass flow rates g-functions of a bore field are first calculated
12+
using the mixed inlet fluid temperature boundary condition [1]_. Then, the effective borehole
13+
wall temperature variations are calculated using the load aggregation scheme of Claesson and
14+
Javed [2]_. g-Functions used in the temporal superposition are interpolated with regards to
15+
the fluid mass flow rate at the moment of heat extraction.
16+
17+
The script is located in:
18+
`pygfunction/examples/fluid_temperature_reversible_flow_direction.py`
19+
20+
.. literalinclude:: ../../../examples/fluid_temperature_reversible_flow_direction.py
21+
:language: python
22+
:linenos:
23+
24+
.. rubric:: References
25+
.. [1] Cimmino, M. (2024). g-Functions for fields of
26+
series- and parallel-connected boreholes with variable fluid mass flow
27+
rate and reversible flow direction. Renewable Energy 228: 120661.
28+
.. [2] Claesson, J., & Javed, S. (2011). A load-aggregation method to calculate
29+
extraction temperatures of borehole heat exchangers. ASHRAE Transactions,
30+
118 (1): 530–539.

examples/discretize_boreholes.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ def main():
114114
m_flow_network = m_flow_borehole*nBoreholes
115115

116116
# Network of boreholes connected in parallel
117-
network = gt.networks.Network(
118-
boreField, UTubes, m_flow_network=m_flow_network, cp_f=cp_f)
117+
network = gt.networks.Network(boreField, UTubes)
119118

120119
# -------------------------------------------------------------------------
121120
# Evaluate the g-functions for the borefield
@@ -124,8 +123,8 @@ def main():
124123
# Compute g-function for the converged MIFT case with equal number of
125124
# segments per borehole, and equal segment lengths along the boreholes
126125
gfunc_MIFT_uniform = gt.gfunction.gFunction(
127-
network, alpha, time=time, boundary_condition='MIFT',
128-
options=options_uniform)
126+
network, alpha, time=time, m_flow_network=m_flow_network, cp_f=cp_f,
127+
boundary_condition='MIFT', options=options_uniform)
129128

130129
# Calculate the g-function for uniform borehole wall temperature
131130
gfunc_UBWT_uniform = gt.gfunction.gFunction(
@@ -135,8 +134,8 @@ def main():
135134
# Compute g-function for the MIFT case with equal number of segments per
136135
# borehole, and non-uniform segment lengths along the boreholes
137136
gfunc_MIFT_unequal = gt.gfunction.gFunction(
138-
network, alpha, time=time, boundary_condition='MIFT',
139-
options=options_unequal)
137+
network, alpha, time=time, m_flow_network=m_flow_network, cp_f=cp_f,
138+
boundary_condition='MIFT', options=options_unequal)
140139

141140
# Calculate the g-function for uniform borehole wall temperature
142141
gfunc_UBWT_unequal = gt.gfunction.gFunction(

examples/equal_inlet_temperature.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,37 +93,38 @@ def main():
9393
# Single U-tube, same for all boreholes in the bore field
9494
UTubes = []
9595
for borehole in boreField:
96-
SingleUTube = gt.pipes.SingleUTube(pos_pipes, r_in, r_out,
97-
borehole, k_s, k_g, R_f + R_p)
96+
SingleUTube = gt.pipes.SingleUTube(
97+
pos_pipes, r_in, r_out, borehole, k_s, k_g, R_f + R_p)
9898
UTubes.append(SingleUTube)
99-
m_flow_network = m_flow_borehole*nBoreholes
100-
network = gt.networks.Network(
101-
boreField, UTubes, m_flow_network=m_flow_network, cp_f=cp_f,
102-
nSegments=nSegments)
99+
m_flow_network = m_flow_borehole * nBoreholes
100+
network = gt.networks.Network(boreField, UTubes)
103101

104102
# -------------------------------------------------------------------------
105103
# Evaluate the g-functions for the borefield
106104
# -------------------------------------------------------------------------
107105

108106
# Calculate the g-function for uniform heat extraction rate
109107
gfunc_uniform_Q = gt.gfunction.gFunction(
110-
boreField, alpha, time=time, boundary_condition='UHTR', options=options)
108+
boreField, alpha, time=time, boundary_condition='UHTR',
109+
options=options)
111110

112111
# Calculate the g-function for uniform borehole wall temperature
113112
gfunc_uniform_T = gt.gfunction.gFunction(
114-
boreField, alpha, time=time, boundary_condition='UBWT', options=options)
113+
boreField, alpha, time=time, boundary_condition='UBWT',
114+
options=options)
115115

116116
# Calculate the g-function for equal inlet fluid temperature
117117
gfunc_equal_Tf_in = gt.gfunction.gFunction(
118-
network, alpha, time=time, boundary_condition='MIFT', options=options)
118+
network, alpha, time=time, m_flow_network=m_flow_network, cp_f=cp_f,
119+
boundary_condition='MIFT', options=options)
119120

120121
# -------------------------------------------------------------------------
121122
# Plot g-functions
122123
# -------------------------------------------------------------------------
123124

124125
ax = gfunc_uniform_Q.visualize_g_function().axes[0]
125-
ax.plot(np.log(time/ts), gfunc_uniform_T.gFunc, 'k--')
126-
ax.plot(np.log(time/ts), gfunc_equal_Tf_in.gFunc, 'r-.')
126+
ax.plot(np.log(time / ts), gfunc_uniform_T.gFunc, 'k--')
127+
ax.plot(np.log(time / ts), gfunc_equal_Tf_in.gFunc, 'r-.')
127128
ax.legend(['Uniform heat extraction rate',
128129
'Uniform borehole wall temperature',
129130
'Equal inlet temperature'])

examples/fluid_temperature_multiple_boreholes.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def main():
5555

5656
# Fluid properties
5757
m_flow_borehole = 0.25 # Total fluid mass flow rate per borehole (kg/s)
58-
m_flow_network = m_flow_borehole*N_1*N_2 # Total fluid mass flow rate (kg/s)
58+
# Total fluid mass flow rate (kg/s)
59+
m_flow_network = m_flow_borehole * N_1 * N_2
5960
# The fluid is propylene-glycol (20 %) at 20 degC
6061
fluid = gt.media.Fluid('MPG', 20.)
6162
cp_f = fluid.cp # Fluid specific isobaric heat capacity (J/kg.K)
@@ -102,8 +103,7 @@ def main():
102103
nPipes=2, config='parallel')
103104
UTubes.append(UTube)
104105
# Build a network object from the list of UTubes
105-
network = gt.networks.Network(
106-
boreField, UTubes, m_flow_network=m_flow_network, cp_f=cp_f)
106+
network = gt.networks.Network(boreField, UTubes)
107107

108108
# -------------------------------------------------------------------------
109109
# Calculate g-function
@@ -113,17 +113,17 @@ def main():
113113
time_req = LoadAgg.get_times_for_simulation()
114114
# Calculate g-function
115115
gFunc = gt.gfunction.gFunction(
116-
network, alpha, time=time_req, boundary_condition='MIFT',
117-
options=options)
116+
network, alpha, time=time_req, m_flow_network=m_flow_network,
117+
cp_f=cp_f, boundary_condition='MIFT', options=options)
118118
# Initialize load aggregation scheme
119-
LoadAgg.initialize(gFunc.gFunc/(2*pi*k_s))
119+
LoadAgg.initialize(gFunc.gFunc / (2 * pi * k_s))
120120

121121
# -------------------------------------------------------------------------
122122
# Simulation
123123
# -------------------------------------------------------------------------
124124

125125
# Evaluate heat extraction rate
126-
Q_tot = nBoreholes*synthetic_load(time/3600.)
126+
Q_tot = nBoreholes*synthetic_load(time / 3600.)
127127

128128
T_b = np.zeros(Nt)
129129
T_f_in = np.zeros(Nt)
@@ -192,7 +192,6 @@ def main():
192192
T_f = UTubes[0].get_temperature(
193193
z, T_f_in[it], T_b[it], m_flow_borehole, cp_f)
194194

195-
196195
# Configure figure and axes
197196
fig = gt.utilities._initialize_figure()
198197

0 commit comments

Comments
 (0)