Public API
General
BoreholeNetworksSimulator.initialize
— Functioninitialize(options::SimulationOptions)
Precompute the objects of each TimeSuperpositionMethod
that can be computed ahead of time and return the SimulationContainers
of the required size.
BoreholeNetworksSimulator.simulate!
— Functionsimulate!(;options::SimulationOptions, operator, containers::SimulationContainers)
Run the simulation defined by options
. At the end of simulation, containers.X
will contain the results. containers
should be the output of initialize
.
operator
should be a function that returns a BoreholeOperation
and with signature operator(i, Tin, Tout, Tb, q, configurations)
:
i::Int
is the time stepTin
is a vector containing the inlet temperature of each boreholeTout
is a vector containing the outlet temperature of each boreholeTb
is a vector containing the borehole wall temperature of each boreholeq
is a vector containing the heat exchanged by each boreholeconfigurations
: is the list of possible hydraulic configurations of the borefield.
BoreholeNetworksSimulator.BoreholeNetwork
— TypeBoreholeNetwork(branches::Vector)
Representation of the hydraulic connections of the boreholes in the network. Each element in branches
should be a vector representing a branch of boreholes connected in series, specified by their identifiers. The first borehole of each branch is assumed to be connected in parallel.
BoreholeNetworksSimulator.BoreholeOperation
— TypeBoreholeOperation{T <: Number}(network::BoreholeNetwork, mass_flows:: Vector{T})
Represents a operation state of the network, with network
representing the hydraulic configuration and mass_flows
a Vector
containing the mass flow rate of each branch.
Simulation Options
BoreholeNetworksSimulator.SimulationOptions
— Typestruct SimulationOptions{
+ TSM <: TimeSuperpositionMethod,
+ C <: Constraint,
+ B <: Borefield,
+ M <: Medium,
+ BC <: BoundaryCondition
+ }(
+ method::TSM
+ constraint::C
+ borefield::B
+ medium::M
+ boundary_condition::BoundaryCondition = DirichletBoundaryCondition()
+ fluid::Fluid = Fluid(cpf=4182., name="INCOMP::MEA-20%")
+ configurations::Vector{BoreholeNetwork}
+ Δt
+ Nt::Int
+)
Specifies all the options for the simulation.
method
: time superposition method used to compute the response. Available options:ConvolutionMethod
,NonHistoryMethod
.constraint
: constraint that the system must satisfy. Can be variable with time. Available options:HeatLoadConstraint
,InletTempConstraint
.borefield
: describes the geometrical properties and the boreholes of the borefield on which the simulation will be performed. Available options:EqualBoreholesBorefield
.medium
: properties of the ground where theborefield
is places. Available options:GroundMedium
,FlowInPorousMedium
.boundary_condition
: boundary condition of the domain where the simulation is performed. Available options:NoBoundary
,DirichletBoundaryCondition
.fluid
: properties of the fluid flowing through the hydraulic system.configurations
: possible hydraulic topologies possible in the system, including reverse flow.Δt
: time step used in the simulation.Nt
: total amount of time steps of the simulation.
Medium
BoreholeNetworksSimulator.Medium
— Typeabstract type Medium
Interface for mediums.
Required functions:
get_λ(::Medium)
: Return the thermal conductivity of the medium.get_α(::Medium)
: Return the thermal diffusivity of the medium.get_T0(::Medium)
: Return the initial temperature of the medium.compute_response!(g, ::Medium, borefield::Borefield, boundary_condition::BoundaryCondition, t)
: Compute inplace ing
the thermal responses between boreholes inborefield
, imposing the boundary conditionboundary_condition
, for all times int
.
Options
BoreholeNetworksSimulator.GroundMedium
— TypeGroundMedium{T <: Real} <: Medium @deftype T
Model pure conduction in the ground.
Arguments
λ = 3.
: ground conductivityα = 1e-6
: ground thermal diffusivityC = λ/α
: ground medium capacityT0 = 0.
: initial ground temperature
BoreholeNetworksSimulator.FlowInPorousMedium
— TypeFlowInPorousMedium{T <: Real} <: Medium @deftype T
Model a porous ground with a water flow.
Arguments
λw = 0.6
: water thermal conductivityλs = 2.
: ground thermal conductivityCw = 4.18*1e6
:water thermal capacityCs = 1.7*1e6
: ground thermal capacityθ = 0.
: angle of Darcy velocityΦ = 0.2
: porosityλ = λs * (1-Φ) + λw*Φ
: porous medium conductivityC = Cs * (1-Φ) + Cw*Φ
: porous medium capacityα = λ/C
: porous medium thermal diffusivityux_in_meterperday = 1e-2
: groundwater speed along the flow coordinateux = ux_in_meterperday/(3600*24)
: groundwater speed in m/svt = ux * Cw/C
: porous medium darcy velocityT0 = 0.
: initial ground temperature
Borefield
BoreholeNetworksSimulator.Borefield
— Typeabstract type Borefield
Interface for borefields.
Required functions
n_boreholes(::Borefield)
: Return the amount of boreholes present in the borefield.get_H(::Borefield, i)
: Return the length of boreholei
.get_rb(::Borefield, i)
: Return the radius of boreholei
.segment_coordinates(::Borefield)
: Return a vector with the coordinates of each segment.internal_model_coeffs!(M, ::Borefield, medium, operation, fluid)
: Compute inplace inM
the coefficients corresponding to the internal model equations, given themedium
,fluid
andoperation
in use in the system. Note thatM
is only a slice ofNb
(number of boreholes) rows, provided as aview
.internal_model_b!(b, ::Borefield)
: Compute inplace inb
the independent terms corresponding to the internal model equations. Note thatb
is only a vector of lengthNb
(number of boreholes) rows, provided as aview
.
Options
BoreholeNetworksSimulator.EqualBoreholesBorefield
— TypeEqualBoreholesBorefield{T <: Borehole, R <: Medium, S <: Real} <: Borefield
+EqualBoreholesBorefield(borehole_prototype::T, positions::Vector{Point2{S}}), medium::R)
Model a borefield with boreholes all identical to the prototype borehole_prototype
, placed at positions
. Note that the length of positions
determines the amount of boreholes in the field. medium
contains the properties of the ground.
Borehole
BoreholeNetworksSimulator.Borehole
— Typeabstract type Borehole
Interface for boreholes.
Required functions:
get_H(::Borehole)
: Return the length of the borehole.get_D(::Borehole)
: Return the burial depth of the borehole.get_rb(::Borehole)
: Return the radius of the borehole.uniform_Tb_coeffs(::Borehole, λ, mass_flow, Tref, fluid)
: Return the internal model coefficients for the resistance network between the pipes and the wall.
Options
BoreholeNetworksSimulator.SingleUPipeBorehole
— TypeSingleUPipeBorehole{T <: Real} <: Borehole @deftype T
+SingleUPipeBorehole(H, D)
Model a borehole with a single U-pipe with burial depth D
and length H
.
Arguments
λg = 2.5
: grout conductivityCg = 2000. * 1550.
: grout capacityαg = λg/Cg
: grout thermal diffusivityrp = 0.02
: pipe radiusλp = 0.42
: pipe material conductivitydpw = 0.0023
: pipe thicknessrpo = rp + dpw
: equivalent pipe radiushp = 725.
: heat transfer coefficient fluid to pipepipe_position::NTuple{2, Tuple{T, T}} = [(0.03, 0.0), (-0.03, 0.0)]
: positions of the downward and upward branches of the pipe. (0, 0) represents the center of the borehole.rb = 0.115/2
: borehole radius
Constraint
BoreholeNetworksSimulator.Constraint
— Typeabstract type Constraint
Interface for constraints.
Required functions:
constraints_coeffs!(M, ::Constraint, operation::BoreholeOperation)
: Compute inplace inM
the coefficients corresponding to the constraints equations, given the currentoperation.network
. Note thatM
is only a slice ofNbr
(number of branches) rows, provided as aview
.constraints_b!(b, ::Constraint, ::BoreholeOperation, step)
: Compute inplace inb
the independent term corresponding to the constraints equations, given the currentoperation.network
, at the time stepstep
. Note thatb
is only a vector of lengthNbr
(number of branches), provided as aview
.
Options
BoreholeNetworksSimulator.HeatLoadConstraint
— TypeHeatLoadConstraint(Q_tot::Matrix{T}){T <: Number} <: Constraint
Constrain the heat extracted per branch.
The heat constraint Q_tot
must be a Matrix
, whose column i
are the loads per branch at the time step i
. The amount of rows of Q_tot
must equal to the amount of branches specified in BoreholeNetwork
.
BoreholeNetworksSimulator.InletTempConstraint
— TypeInletTempConstraint(T_in::Matrix{T}){T <: Number} <: Constraint
Constrain the inlet temperature of the first borehole in each branch.
The inlet temperature T_in
must be a Matrix
, whose column i
are the inlet temperatures per branch at the time step i
. The amount of rows of T_in
must equal to the amount of branches specified in BoreholeNetwork
.
Time Superposition Method
BoreholeNetworksSimulator.TimeSuperpositionMethod
— Typeabstract type TimeSuperpositionMethod
Interface for time superposition methods.
Required functions:
method_coeffs!(M, ::TimeSuperpositionMethod, borefield, medium, boundary_condition)
: Compute inplace inM
the coefficients corresponding to the heat transfer equations, given themedium
, andboundary_condition
in use in the system. Note thatM
is only a slice ofNbr
(number of branches) rows, provided as aview
.method_b!(b, ::TimeSuperpositionMethod, borefield, medium, step)
: Compute inplace inb
the independent terms corresponding to the heat transfer equations, given themedium
, at the given time stepstep
. Note thatb
is only a vector of lengthNbr
(number of branches) rows, provided as aview
.precompute_auxiliaries!(method::TimeSuperpositionMethod; options)
: Compute inplace inmethod
the auxiliary quantities used in the simulation that can be performed ahead of time.update_auxiliaries!(::TimeSuperpositionMethod, X, borefield, step)
: Update inplace inmethod
the auxiliaries after each time stepstep
.
Options
BoreholeNetworksSimulator.ConvolutionMethod
— TypeConvolutionMethod{T} <: TimeSuperpositionMethod
+ConvolutionMethod()
Use the naïve convolution to compute the thermal response between boreholes. It should be initialized without arguments, but it contains the variables:
g
stores the unit response between each pair of boreholes evaluated at each time of the simulation.
It should be precomputed with initialize
.
q
stores the heat extraction in each borehole at each time step. It is filled as the simulation runs.
BoreholeNetworksSimulator.NonHistoryMethod
— TypeNonHistoryMethod{T} <: TimeSuperpositionMethod
+NonHistoryMethod()
Use the non-history method to compute the thermal response between boreholes. See A non-history dependent temporal superposition algorithm for the finite line source solution. It should be initialized without arguments, but it contains the variables:
F::Matrix{T}
: each column contains theF
function (encoding the load history) for each borehole. It is initially 0.ζ::Vector{T}
: discretization nodes of the integration interval. Shared for all boreholes. Precomputed ininitialize
.w::Matrix{T}
: weights of the ζ integration for each pair of boreholes. Precomputed ininitialize
.expΔt::Vector{T}
: exp(-ζ^2*Δt). Precomputed ininitialize
.
Boundary Condition
BoreholeNetworksSimulator.BoundaryCondition
— Typeabstract type BoundaryCondition
Interface for boundary conditions.
Options
BoreholeNetworksSimulator.NoBoundary
— TypeNoBoundary <: BoundaryCondition
Option to solve the problem in an infinite domain
BoreholeNetworksSimulator.DirichletBoundaryCondition
— TypeDirichletBoundaryCondition <: BoundaryCondition
Option to enforce that the surface plane z=0
remains at temperature T=0