Non-history method

The non-history method is a time superposition method introduced in [1] whose computational complexity in the number of time steps $N_t$ is $\mathcal{O}\left( N_t \right)$. Recall that the standard way to do time superposition is via the convolution of the load with the response, which implemented via the Fast Fourier Transform, yields a computational complexity of $\mathcal{O}\left( N_t \log{N_t} \right)$. This means that using the non-history method in simulations allows for finer time steps.

To show this, let us run a simulation with hourly time steps, with a duration of 1 year (so $8760$ time steps), with both the convolution and the non-history time superposition methods. Let us define an example, very similar to Basic tutorial

using BoreholeNetworksSimulator
Δt = 3600.
Nt = 8760

medium = GroundMedium(α=1e-6, λ=3., T0=10.)
borehole = SingleUPipeBorehole(H=10., D=10.)
positions = [(0., 0.), (0., 5.)]
borefield = EqualBoreholesBorefield(borehole_prototype=borehole, positions=positions)
constraint = constant_HeatLoadConstraint(5 .* ones(BoreholeNetworksSimulator.n_boreholes(borefield)), Nt)

configurations = [BoreholeNetwork([[1], [2]])]
operator = SimpleOperator(mass_flow = 2., branches = 2)
SimpleOperator{Float64}([2.0, 2.0])

Now, we define two different options using different method parameters, one with ConvolutionMethod corresponding to the convolution, and the other with NonHistoryMethod, corresponding with the non-history method.

options_convolution = SimulationOptions(
    method = ConvolutionMethod(),
    constraint = constraint,
    borefield = borefield,
    medium = medium,
    fluid = Water(),
    Δt = Δt,
    Nt = Nt,
    configurations = configurations
)

options_nonhistory = SimulationOptions(
    method = NonHistoryMethod(),
    constraint = constraint,
    borefield = borefield,
    medium = medium,
    fluid = Water(),
    Δt = Δt,
    Nt = Nt,
    configurations = configurations
)
SimulationOptions{NonHistoryMethod{Float64}, HeatLoadConstraint{Float64}, EqualBoreholesBorefield{SingleUPipeBorehole{Float64}, Float64}, GroundMedium{Float64}, DirichletBoundaryCondition, Water}
  method: NonHistoryMethod{Float64}
  constraint: HeatLoadConstraint{Float64}
  borefield: EqualBoreholesBorefield{SingleUPipeBorehole{Float64}, Float64}
  medium: GroundMedium{Float64}
  fluid: Water
  boundary_condition: DirichletBoundaryCondition DirichletBoundaryCondition()
  Δt: Float64 3600.0
  Nt: Int64 8760
  Nb: Int64 2
  Ns: Int64 2
  Ts: Int64 1
  Tmax: Float64 3.1536e7
  t: StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}
  configurations: Array{BoreholeNetwork}((1,))

Let us run the convolution

containers_convolution = @time initialize(options_convolution)
@time simulate!(operator=operator, options=options_convolution, containers=containers_convolution)
 13.597594 seconds (12.03 M allocations: 1.767 GiB, 1.00% gc time, 8.62% compilation time)
  5.104401 seconds (7.08 M allocations: 434.546 MiB, 2.48% gc time, 79.93% compilation time)

And now let us run the non-history

containers_nonhistory = @time initialize(options_nonhistory)
@time simulate!(operator=operator, options=options_nonhistory, containers=containers_nonhistory)


abs.(containers_convolution.X - containers_nonhistory.X)
8×8760 Matrix{Float64}:
 8.7332e-7  8.74527e-7  8.75103e-7  …  8.78044e-7  8.78044e-7  8.78044e-7
 8.7332e-7  8.74527e-7  8.75103e-7     8.78044e-7  8.78044e-7  8.78044e-7
 8.7332e-7  8.74527e-7  8.75103e-7     8.78044e-7  8.78044e-7  8.78044e-7
 8.7332e-7  8.74527e-7  8.75103e-7     8.78044e-7  8.78044e-7  8.78044e-7
 8.7332e-7  8.74527e-7  8.75103e-7     8.78044e-7  8.78044e-7  8.78044e-7
 8.7332e-7  8.74527e-7  8.75103e-7  …  8.78044e-7  8.78044e-7  8.78044e-7
 0.0        0.0         0.0            0.0         0.0         0.0
 0.0        0.0         0.0            0.0         0.0         0.0

References

[1] Lazzarotto, Alberto; Basquens, Marc; Cimmino, Massimo; Non-history dependent temporal superposition algorithm for the point source solution, Research Conference Proceedings of the IGSHPA (2024).


This page was generated using Literate.jl.