Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbasquensmunoz committed Aug 23, 2024
1 parent 513455b commit 19372a7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pages = [
]

dir = @__DIR__
Literate.markdown("$dir/src/tutorial.jl", "$dir/src")
Literate.markdown("$dir/src/nonhistory.jl", "$dir/src")
#Literate.markdown("$dir/src/tutorial.jl", "$dir/src")
#Literate.markdown("$dir/src/nonhistory.jl", "$dir/src")
makedocs(
pages = pages,
sitename = "BoreholeNetworksSimulator.jl"
Expand Down
15 changes: 5 additions & 10 deletions docs/src/nonhistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ To show this, let us run a simulation with hourly time steps, with a duration of
with both the convolution and the non-history time superposition methods.
Let us define an example, very similar to [Basic tutorial](@ref)

````@example nonhistory
````
using BoreholeNetworksSimulator
````

````@example nonhistory
````
Δt = 3600.#8760*3600/12.
Nt = 8760
Expand All @@ -40,7 +40,7 @@ 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.

````@example nonhistory
````
options_convolution = SimulationOptions(
method = ConvolutionMethod(),
constraint = constraint,
Expand All @@ -64,14 +64,14 @@ options_nonhistory = SimulationOptions(

Let us run the convolution

````@example nonhistory
````
containers_convolution = @time initialize(options_convolution)
@time simulate!(operator=operator, options=options_convolution, containers=containers_convolution)
````

And now let us run the non-history

````@example nonhistory
````
containers_nonhistory = @time initialize(options_nonhistory)
@time simulate!(operator=operator, options=options_nonhistory, containers=containers_nonhistory)
Expand All @@ -83,8 +83,3 @@ abs.(containers_convolution.X - containers_nonhistory.X)
[1] [Lazzarotto, Alberto; Basquens, Marc; Cimmino, Massimo;
_Non-history dependent temporal superposition algorithm for the pint source solution_,
Research Conference Proceedings of the IGSHPA (2024).](https://doi.org/10.22488/okstate.24.000021)

---

*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*

1 change: 0 additions & 1 deletion docs/src/tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Nt = 10*12
# We model the ground with a subtype of [`Medium`](@ref), in
# our case, as per our assumptions, we are particularly interested in [`GroundMedium`](@ref):

@show GroundMedium()
α = 1e-6
λ = 3.
T0 = 10.
Expand Down
32 changes: 13 additions & 19 deletions docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Let us see the components one by one with an example.
We start by specifying the simulation time step and the simulation duration. For our example,
we will take monthly time steps during 10 years:

````@example tutorial
````
using BoreholeNetworksSimulator
````

````@example tutorial
````
Δt = 8760*3600/12.
Nt = 10*12
````
Expand All @@ -30,8 +30,7 @@ The undisturbed temperature of the ground is ``T_0=10 \ ^{\circ}C``.
We model the ground with a subtype of [`Medium`](@ref), in
our case, as per our assumptions, we are particularly interested in [`GroundMedium`](@ref):

````@example tutorial
@show GroundMedium()
````
α = 1e-6
λ = 3.
T0 = 10.
Expand All @@ -52,7 +51,7 @@ we can use [`EqualBoreholesBorefield`](@ref), which instantiates several identic
from a prototype. The prototype is specified by a subtype of [`Borehole`](@ref).
In our case, we can use [`SingleUPipeBorehole`](@ref) to model a borehole with a single U-pipe.

````@example tutorial
````
D = 10.
H = 100.
Expand All @@ -64,7 +63,7 @@ pipe resistance, etc., but for the moment we will use their default values.

Next, we need to specify where the borehole are located.

````@example tutorial
````
σ = 5.
positions = [(0., 0.), (0., σ)]
borefield = EqualBoreholesBorefield(borehole_prototype=borehole, positions=positions)
Expand All @@ -87,7 +86,7 @@ of the boreholes present in that branch. Each identifier `i::Int` refers to the
In our example, we want to simulate two independent boreholes, so each of them must be in a separate branch.
Also, for the moment, we are only interested in this configuration, so we define:

````@example tutorial
````
configurations = [BoreholeNetwork([[1], [2]])]
````

Expand All @@ -98,15 +97,15 @@ impose that their inlet temperatures be equal. In our example, since we want out
we will impose the total amount of heat that we want to extract from each borehole. We will impose a constant
load, equal for both boreholes. This is specified by

````@example tutorial
````
q1 = 5.
q2 = 5.
constraint = constant_HeatLoadConstraint([q1, q2], Nt)
````

We can finally create the object with all the options:

````@example tutorial
````
options = SimulationOptions(
method = ConvolutionMethod(),
constraint = constraint,
Expand All @@ -125,7 +124,7 @@ configuration will be used for the next time step. In our case, we only want a s
The second specifies the mass flow rate through each branch of the selected configuration, provided as
a vector. In our example, we will keep this constant through the simulation:

````@example tutorial
````
function operator(i, Tin, Tout, Tb, q, configurations)
network = configurations[1]
BoreholeOperation(network, 2 .* ones(n_branches(network)))
Expand All @@ -135,13 +134,13 @@ end
Before simulating, we first need to call [`initialize`](@ref) to run some precomputations
that will be used throught the simulation and to instantiate containers where the result will be written.

````@example tutorial
````
containers = initialize(options)
````

And finally, we can start the simulation.

````@example tutorial
````
@time simulate!(operator=operator, options=options, containers=containers)
````

Expand All @@ -151,11 +150,6 @@ strategies.

The result is saved in

````@example tutorial
containers.X
````

---

*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*

containers.X
````

0 comments on commit 19372a7

Please sign in to comment.