This model calculates the ground temperature response to obtain the temperature at the wall of each borehole segment in a geothermal system where heat is being injected into or extracted from the ground.
A load-aggregation scheme based on that developed by Claesson
and Javed (2012) is used to calculate the borehole wall temperature
response with the temporal and spatial superpositions of ground
thermal loads. In its base form, the load-aggregation scheme uses
fixed-length aggregation cells to agglomerate thermal load history
together, with more distant cells (denoted with a higher cell and
vector index) representing more distant thermal history. The more
distant the thermal load, the less impactful it is on the borehole
wall temperature change at the current time step. Each cell has an
aggregation time associated to it denoted by
nu, which corresponds to the simulation time (since
the beginning of heat injection or extraction) at which the cell
will begin shifting its thermal load to more distant cells. To
determine nu, cells have a temporal size
rcel (rcel in this model) which
follows the exponential growth :

where nCel is the number of consecutive cells
which can have the same size. Decreasing rcel
will generally decrease calculation times, at the cost of precision
in the temporal superposition. rcel is expressed in
multiples of the aggregation time resolution (via the parameter
tLoaAgg). Then, nu may be expressed as
the sum of all rcel values (multiplied by the
aggregation time resolution) up to and including that cell in
question.
The weighting factors giving the impact of the thermal load in a cell m) for a segment v of borehole J onto the temperature at the wall of segment u of a borehole I at the current time is obtained from analytical thermal response factors:

where hIJ,uv is the thermal response factor of
segment v of borehole J onto segment u of a
borehole I, ks is the thermal conductivity
of the soil and ν refers to the vector nu in
this model.
At every aggregation time step, a time event is generated to perform the load aggregation steps. First, the thermal loads are shifted. When shifting between cells of different size, total energy is conserved. This operation is illustred in the figure below by Cimmino (2014).

After the cell-shifting operation is performed, the first
aggregation cell has its value set to the average thermal load
since the last aggregation step. Temporal superposition is then
applied by means of a scalar product between the aggregated thermal
loads QAgg_flow and the weighting factors κ.
The spatial superposition is applied by summing the contributions
of all segments on the total temperature variation.
Due to Modelica's variable time steps, the load aggregation scheme is modified by separating the thermal response between the current aggregation time step and everything preceding it. This is done according to :

where Tb,I,u is the borehole wall temperature
at segment u of borehole I, Q'b,J,v
is the ground thermal load per borehole length at segment v
of borehole J. tk is the last discrete
aggregation time step, meaning that the current time t
satisfies tk≤t≤tk+1.
Δtagg(=tk+1-tk) is the
parameter tLoaAgg in the present model.
Thermal interactions between segments affect the borehole wall temperature much slower than the effect of heat extraction at a segment on the temperature variation at the same segment. Thus, spatial superposition in the second sum can be neglected :

where ΔTb,I,u*(t) is the borehole wall temperature change at segment u of borehole I due to the thermal history prior to the current aggregation step. At every aggregation time step, spatial and temporal superpositions are used to calculate its discrete value. Assuming no heat injection or extraction until tk+1, this term is assumed to have a linear time derivative, which is given by the difference between ΔTb,I,u*(tk+1) (the temperature change from load history at the next discrete aggregation time step, which is constant over the duration of the ongoing aggregation time step) and the total temperature change at the last aggregation time step, ΔTb,I,u(tk).

The second term ΔTb,q,I,u(t) concerns the
ongoing aggregation time step. To obtain the time derivative of
this term, the thermal response factor hII,uu is
assumed to vary linearly over the course of an aggregation time
step. Therefore, because the ongoing aggregation time step always
concerns the first aggregation cell, its derivative can be
calculated as kappa[i,i,1], the first value in the
kappa array, divided by the aggregation time step
Δt. The derivative of the temperature change at the borehole
wall is then expressed by its multiplication with the heat flow
QI,u at the borehole wall.


With the two terms in the expression of
ΔTb,I,u(t) expressed as time derivatives,
ΔTb,I,u(t) can itself also be expressed as its
time derivative and implemented as such directly in the Modelica
equations block with the der() operator.

Cimmino, M. 2014. Développement et validation expérimentale de facteurs de réponse thermique pour champs de puits géothermiques, Ph.D. Thesis, École Polytechnique de Montréal.
Claesson, J. and Javed, S. 2012. A load-aggregation method to calculate extraction temperatures of borehole heat exchangers. ASHRAE Transactions 118(1): 530-539.