Skip to content

Commit

Permalink
Merge pull request #302 from MassimoCimmino/issue215_variableMassFlow…
Browse files Browse the repository at this point in the history
…GFunctions

Variable fluid mass flow rate g-functions
  • Loading branch information
MassimoCimmino authored Sep 10, 2024
2 parents 8af0a87 + 4329587 commit 56fb9e8
Show file tree
Hide file tree
Showing 12 changed files with 1,268 additions and 397 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New features

* [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.
* [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.

## Version 2.2.3 (2024-07-01)
Expand Down
1 change: 1 addition & 0 deletions doc/source/example_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Examples
examples/fluid_temperature
examples/equal_inlet_temperature
examples/fluid_temperature_multiple_boreholes
examples/fluid_temperature_reversible_flow_direction
examples/multiple_independent_Utubes
examples/multipole_temperature
examples/bore_field_thermal_resistance
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. examples:
*******************************************************************************************************
Simulation of fluid temperatures in a field of series-connected boreholes and reversible flow direction
*******************************************************************************************************

This example demonstrates the use of the
:doc:`networks <../modules/networks>` module to predict the fluid temperature variations
in a bore field with series-connected boreholes and reversible flow direction.

The variable fluid mass flow rates g-functions of a bore field are first calculated
using the mixed inlet fluid temperature boundary condition [1]_. Then, the effective borehole
wall temperature variations are calculated using the load aggregation scheme of Claesson and
Javed [2]_. g-Functions used in the temporal superposition are interpolated with regards to
the fluid mass flow rate at the moment of heat extraction.

The script is located in:
`pygfunction/examples/fluid_temperature_reversible_flow_direction.py`

.. literalinclude:: ../../../examples/fluid_temperature_reversible_flow_direction.py
:language: python
:linenos:

.. rubric:: References
.. [1] Cimmino, M. (2024). g-Functions for fields of
series- and parallel-connected boreholes with variable fluid mass flow
rate and reversible flow direction. Renewable Energy 228: 120661.
.. [2] Claesson, J., & Javed, S. (2011). A load-aggregation method to calculate
extraction temperatures of borehole heat exchangers. ASHRAE Transactions,
118 (1): 530–539.
11 changes: 5 additions & 6 deletions examples/discretize_boreholes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ def main():
m_flow_network = m_flow_borehole*nBoreholes

# Network of boreholes connected in parallel
network = gt.networks.Network(
boreField, UTubes, m_flow_network=m_flow_network, cp_f=cp_f)
network = gt.networks.Network(boreField, UTubes)

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

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

# Calculate the g-function for uniform borehole wall temperature
gfunc_UBWT_unequal = gt.gfunction.gFunction(
Expand Down
23 changes: 12 additions & 11 deletions examples/equal_inlet_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,37 +93,38 @@ def main():
# Single U-tube, same for all boreholes in the bore field
UTubes = []
for borehole in boreField:
SingleUTube = gt.pipes.SingleUTube(pos_pipes, r_in, r_out,
borehole, k_s, k_g, R_f + R_p)
SingleUTube = gt.pipes.SingleUTube(
pos_pipes, r_in, r_out, borehole, k_s, k_g, R_f + R_p)
UTubes.append(SingleUTube)
m_flow_network = m_flow_borehole*nBoreholes
network = gt.networks.Network(
boreField, UTubes, m_flow_network=m_flow_network, cp_f=cp_f,
nSegments=nSegments)
m_flow_network = m_flow_borehole * nBoreholes
network = gt.networks.Network(boreField, UTubes)

# -------------------------------------------------------------------------
# Evaluate the g-functions for the borefield
# -------------------------------------------------------------------------

# Calculate the g-function for uniform heat extraction rate
gfunc_uniform_Q = gt.gfunction.gFunction(
boreField, alpha, time=time, boundary_condition='UHTR', options=options)
boreField, alpha, time=time, boundary_condition='UHTR',
options=options)

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

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

# -------------------------------------------------------------------------
# Plot g-functions
# -------------------------------------------------------------------------

ax = gfunc_uniform_Q.visualize_g_function().axes[0]
ax.plot(np.log(time/ts), gfunc_uniform_T.gFunc, 'k--')
ax.plot(np.log(time/ts), gfunc_equal_Tf_in.gFunc, 'r-.')
ax.plot(np.log(time / ts), gfunc_uniform_T.gFunc, 'k--')
ax.plot(np.log(time / ts), gfunc_equal_Tf_in.gFunc, 'r-.')
ax.legend(['Uniform heat extraction rate',
'Uniform borehole wall temperature',
'Equal inlet temperature'])
Expand Down
15 changes: 7 additions & 8 deletions examples/fluid_temperature_multiple_boreholes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def main():

# Fluid properties
m_flow_borehole = 0.25 # Total fluid mass flow rate per borehole (kg/s)
m_flow_network = m_flow_borehole*N_1*N_2 # Total fluid mass flow rate (kg/s)
# Total fluid mass flow rate (kg/s)
m_flow_network = m_flow_borehole * N_1 * N_2
# 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)
Expand Down Expand Up @@ -102,8 +103,7 @@ def main():
nPipes=2, config='parallel')
UTubes.append(UTube)
# Build a network object from the list of UTubes
network = gt.networks.Network(
boreField, UTubes, m_flow_network=m_flow_network, cp_f=cp_f)
network = gt.networks.Network(boreField, UTubes)

# -------------------------------------------------------------------------
# Calculate g-function
Expand All @@ -113,17 +113,17 @@ def main():
time_req = LoadAgg.get_times_for_simulation()
# Calculate g-function
gFunc = gt.gfunction.gFunction(
network, alpha, time=time_req, boundary_condition='MIFT',
options=options)
network, alpha, time=time_req, m_flow_network=m_flow_network,
cp_f=cp_f, boundary_condition='MIFT', options=options)
# Initialize load aggregation scheme
LoadAgg.initialize(gFunc.gFunc/(2*pi*k_s))
LoadAgg.initialize(gFunc.gFunc / (2 * pi * k_s))

# -------------------------------------------------------------------------
# Simulation
# -------------------------------------------------------------------------

# Evaluate heat extraction rate
Q_tot = nBoreholes*synthetic_load(time/3600.)
Q_tot = nBoreholes*synthetic_load(time / 3600.)

T_b = np.zeros(Nt)
T_f_in = np.zeros(Nt)
Expand Down Expand Up @@ -192,7 +192,6 @@ def main():
T_f = UTubes[0].get_temperature(
z, T_f_in[it], T_b[it], m_flow_borehole, cp_f)


# Configure figure and axes
fig = gt.utilities._initialize_figure()

Expand Down
Loading

0 comments on commit 56fb9e8

Please sign in to comment.