MassimoCimmino / pygfunction

An open-source toolbox for the evaluation of thermal response factors (g-functions) of geothermal borehole fields.
BSD 3-Clause "New" or "Revised" License
46 stars 21 forks source link

Issue171 enumerate #175

Closed MassimoCimmino closed 2 years ago

MassimoCimmino commented 2 years ago

Closes #171.

Profiling results will be shown below to confirm there was no negative impact on calculation time.

MassimoCimmino commented 2 years ago

Timing results for 'equivalent' solver, using nSegments=8 and default unequal discretization

>>> import pygfunction as gt
>>> alpha = 1.0e-6
>>> time = gt.utilities.time_geometric(100*3600., 3000*8760*3600., 25)
>>> method = 'equivalent'
>>> for (N_1, N_2) in [(1, 1), (5, 2), (5, 5), (10, 10), (20, 20)]:
>>>     boreholes = gt.boreholes.rectangle_field(N_1, N_2, 7.5, 7.5, 150., 4., 0.075)
>>>     %timeit -n10 gt.gfunction.gFunction(boreholes, alpha, time=time, method=method)

Before changes

499 ms ± 691 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
753 ms ± 17.1 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
753 ms ± 861 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
816 ms ± 975 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
1.14 s ± 1.83 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

After changes

493 ms ± 550 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
736 ms ± 755 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
745 ms ± 774 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
807 ms ± 1.58 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
1.12 s ± 3.78 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
MassimoCimmino commented 2 years ago

Timing results for 'equivalent' solver, using nSegments=12 and uniform discretization

>>> import pygfunction as gt
>>> alpha = 1.0e-6
>>> time = gt.utilities.time_geometric(100*3600., 3000*8760*3600., 25)
>>> method = 'equivalent'
>>> options = {'nSegments': 12, 'segment_ratios': None}
>>> for (N_1, N_2) in [(1, 1), (5, 2), (5, 5), (10, 10), (20, 20)]:
>>>     boreholes = gt.boreholes.rectangle_field(N_1, N_2, 7.5, 7.5, 150., 4., 0.075)
>>>     %timeit -n10 gt.gfunction.gFunction(boreholes, alpha, time=time, method=method, options=options)

Before changes

591 ms ± 578 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
863 ms ± 1.74 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
871 ms ± 742 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
928 ms ± 1.1 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
1.21 s ± 523 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

After changes

590 ms ± 612 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
863 ms ± 1.83 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
871 ms ± 4.41 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
933 ms ± 10.3 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
1.21 s ± 1.33 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
MassimoCimmino commented 2 years ago

Timing results for 'similarities' solver, using nSegments=8 and default unequal discretization

>>> import pygfunction as gt
>>> alpha = 1.0e-6
>>> time = gt.utilities.time_geometric(100*3600., 3000*8760*3600., 25)
>>> method = 'similarities'
>>> for (N_1, N_2) in [(1, 1), (5, 2), (5, 5), (10, 10)]:
>>>     boreholes = gt.boreholes.rectangle_field(N_1, N_2, 7.5, 7.5, 150., 4., 0.075)
>>>     %timeit -n10 gt.gfunction.gFunction(boreholes, alpha, time=time, method=method)

Before changes

421 ms ± 809 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
729 ms ± 1.03 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
804 ms ± 3.95 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
1.95 s ± 14.7 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

After changes

428 ms ± 9.75 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
726 ms ± 1.22 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
803 ms ± 3.64 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
1.96 s ± 12.7 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
MassimoCimmino commented 2 years ago

Timing results for 'similarities' solver, using nSegments=12 and uniform discretization

>>> import pygfunction as gt
>>> alpha = 1.0e-6
>>> time = gt.utilities.time_geometric(100*3600., 3000*8760*3600., 25)
>>> method = 'similarities'
>>> options = {'nSegments': 12, 'segment_ratios': None}
>>> for (N_1, N_2) in [(1, 1), (5, 2), (5, 5), (10, 10)]:
>>>     boreholes = gt.boreholes.rectangle_field(N_1, N_2, 7.5, 7.5, 150., 4., 0.075)
>>>     %timeit -n10 gt.gfunction.gFunction(boreholes, alpha, time=time, method=method, options=options)

Before changes

484 ms ± 1.89 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
855 ms ± 906 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
989 ms ± 5.34 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
3.37 s ± 12 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

After changes

485 ms ± 580 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
860 ms ± 975 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
995 ms ± 4.69 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
3.37 s ± 8.38 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)