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=100., D=10.)
positions = [(0., 0.), (0., 5.)]
borefield = EqualBoreholesBorefield(borehole_prototype=borehole, positions=positions)
constraint = constant_HeatLoadConstraint(5 .* ones(BoreholeNetworksSimulator.n_boreholes(borefield)), Nt)
fluid = Water()

network = all_parallel_network(2)
configurations = [network]
operator = ConstantOperator(network, mass_flows = 2 * ones(2))
ConstantOperator{Float64}
  valves: Dict{Int64, Valve{Float64}}
  mass_flow: Float64 4.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 = fluid,
    Δt = Δt,
    Nt = Nt,
    configurations = configurations
)

options_nonhistory = SimulationOptions(
    method = NonHistoryMethod(),
    constraint = constraint,
    borefield = borefield,
    medium = medium,
    fluid = fluid,
    Δt = Δt,
    Nt = Nt,
    configurations = configurations
)
SimulationOptions{Float64, Float64, NonHistoryMethod{Float64}, HeatLoadConstraint{Float64}, EqualBoreholesBorefield{SingleUPipeBorehole{Float64}, Float64}, GroundMedium{Float64}, DirichletBoundaryCondition, MeanApproximation, Water}
  method: NonHistoryMethod{Float64}
  constraint: HeatLoadConstraint{Float64}
  borefield: EqualBoreholesBorefield{SingleUPipeBorehole{Float64}, Float64}
  medium: GroundMedium{Float64}
  fluid: Water
  boundary_condition: DirichletBoundaryCondition DirichletBoundaryCondition()
  approximation: MeanApproximation MeanApproximation()
  Δt: Float64 3600.0
  Nt: Int64 8760
  Nb: Int64 2
  Ns: Int64 2
  Ts: Int64 1
  Tmax: Float64 3.1536e7
  t: Array{Float64}((8760,)) [3600.0, 7200.0, 10800.0, 14400.0, 18000.0, 21600.0, 25200.0, 28800.0, 32400.0, 36000.0  …  3.15036e7, 3.15072e7, 3.15108e7, 3.15144e7, 3.1518e7, 3.15216e7, 3.15252e7, 3.15288e7, 3.15324e7, 3.1536e7]
  configurations: Array{BoreholeNetwork}((1,))
  atol: Float64 0.0
  rtol: Float64 1.4901161193847656e-8

Let us run the convolution

containers_convolution = @time initialize(options_convolution)
@time simulate!(operator=operator, options=options_convolution, containers=containers_convolution)
  1.508676 seconds (1.19 M allocations: 88.333 MiB, 1.54% gc time, 62.67% compilation time)
  2.055758 seconds (1.61 M allocations: 250.969 MiB, 1.07% gc time, 52.09% 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}:
 4.49312e-11  4.13714e-11  3.96732e-11  …  1.39782e-11  1.39817e-11
 4.49312e-11  4.13714e-11  3.96732e-11     1.39782e-11  1.39817e-11
 4.49312e-11  4.13714e-11  3.96732e-11     1.39782e-11  1.39817e-11
 4.49312e-11  4.13714e-11  3.96732e-11     1.39782e-11  1.39817e-11
 4.49312e-11  4.13696e-11  3.96714e-11     1.39799e-11  1.39799e-11
 4.49312e-11  4.13696e-11  3.96714e-11  …  1.39799e-11  1.39799e-11
 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.