Open MassimoCimmino opened 3 years ago
It seems the optimal discretization is dependent on the boundary condition and on the borehole spacing. Here is some initial results for large rectangular fields using the 'equivalent'
solver and nSegments=8
. The reference g-function is calculated using a uniform discretization of nSegments=64
.
@MassimoCimmino, continuing with your analysis, the optimal discretization is dependent on the number of segments, as well as the borehole’s configuration, including the borehole’s length, spacing, and the number of boreholes within the field. An initial evaluation of the error on the g-function, with a discretization using the current 2% end-length ratio is shown in the following figure, where the maximum relative error is presented on the vertical axis and the field characteristics, which in this case is the non-dimensional coefficient B/H, are on the horizontal axis, whereas the number of boreholes in the field is color-mapped. Based on these initial results, an “optimal” end-length ratio (ELR) depending on the number of segments that allows the minimization of the maximum relative error found on 11,440 different rectangular field configurations is proposed, considering a BC-UBWT (boundary condition of equal wall temperature throughout the length and for each borehole) using the “equivalent” solver, varying the borefield’s characteristics as follows.
Other constant parameters are the buried depth = 4 m., the borehole radius = 0.075 m., and the ground’s thermal diffusivity = 1e-6 m2/s. Two optimization problems have been solved by using the scipy.optimize package, one to find an “optimal” end-length ratio that is able to minimize the maximum value of the whole set of relative errors of the 11,440 configurations (“Proposed ELR”) and another one to find an optimal end-length ratio for every specific borefield configuration (“Optimized ELR”) only to compare how far from the “best case scenario” the results are, when using a single end-length ratio for all borefield configurations. The objective function related to the "proposed ELR" could be represented as: Where gi (t) is the calculated g-function for the i-th configuration at the time t. g(ref,i) (t) is the reference g-function for the i-th configuration at the time t. C is the total number of borehole’s configurations being analyzed. The following figures show the results of the second optimization problem, finding an Optimal end-length ratio for each configuration. At the left hand side there is a similar graph as the first one in this comment, comparing the maximum relative error found per each borefield configuration, and to the right hand side, the figure shows the different end-length ratio of each configuration. The following figure shows, in the vertical axis, the maximum relative error found on g-functions for borefields with an 8 segment discretization against the non-dimensional B/H coefficient in the horizontal axis, using three different end-length ratios.
The points on the figure represent the maximum relative error found for all the configurations for each B/H value (spacing between boreholes divided by length of the boreholes), which is one of the non-dimensional coefficients used to calculate the g-functions, whereas the curves are the trend-lines that better represents the behavior of these points. Something that is important to notice, even though it is not depicted in the previous figure, is that the maximum relative error was found at the maximum time value used to evaluate the g-functions (t_max = 1,000 years) for every configuration, and usually for fields containing the greatest number of boreholes. It can be noticed that there are some regions where the “non-optimized ELR” performs better than the “proposed ELR”, using the latter allows the user to make sure that the relative error will not be greater than 1.6%, at least for the range of borefield configurations being studied, instead of the 4% related to small B/H values, which translates to small bore to bore spacing and long boreholes. The reference g-function has been calculated for 43,471 borefield configurations, but with a non-uniform discretization of 8 segments using segment_ratios from the pygfunction utilities module, and then dividing 6 times each segment, resulting in 48 segments. The following figure shows the RMSE (root-mean-square error) of the g-functions evaluated over the 25-time steps, using the proposed end-length ratio of 0.93%, for a reduced amount of borefield configurations, that represent the initial set of 11,440 borefields. The varying characteristics of the borefields used to calculate the RMSE are:
All the possible combinations of the previous characteristics result in a total of 54 borehole configurations depicting the overall behavior of the 11,440 initial configurations. It can be seen from the results, that the maximum RMSE is below 2 units (same units as the g-functions) for the configurations with many boreholes and small B/H values. The RMSE was calculated as follows. Where T is the number of time steps. t0 is the initial time step (100 h) to evaluate the g-functions. t{max} is the maximum time (1,000 years) to evaluate the g-functions. The normalized RMSE has also been calculated, as shown in the following figure. Like previous results, the NRMSE is around 1.5% with a maximum of 1.9% as per the configuration of 400 boreholes, H = 300 m., and B = 10 m. Finally, the same process has been performed for borehole’s discretization ranging from 3 to 20 segments. The results are presented in the following figure. The results show that if the number of segments increases, the proposed end-length ratio decreases as well as the maximum relative error found. Besides, in the case of 3 segments, the maximum relative error is 12.8% which represents the maximum punctual error (worst case scenario). However, the NRMSE is 1.9%, which means that the overall calculated g-functions’ deviation from the reference is less than 2%. After the discretization of 5 segments, the maximum relative error drops to 4.4%, which is already low, even though the NRMSE is still 1.9%. After 10 segments, the maximum relative error is already under 1%, so even if the discretization is more refined, this will not translate into better g-function approximations. For the last 4 discretization cases, the proposed end-length ratio is around 0.1%, which is the proposed value for a borefield discretization with more than 20 segments. The proposed end-length ratios that have been calculated performing the optimization of the objective function for different number of segments, are summarized in the following table. <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
Number of segments | Single value end-length ratio [%] | g-function maximum relative error [%] -- | -- | -- 3 | 4.9815088 | 12.76180118 4 | 3.6552159 | 9.198007236 5 | 2.1154286 | 4.425303902 6 | 1.7554335 | 3.387627878 7 | 1.07976099 | 1.918855204 8 | 0.933328725 | 1.573007695 9 | 0.56647504 | 1.126958382 10 | 0.543812273 | 0.926026377 11 | 0.420806777 | 0.698536353 12 | 0.38677094 | 0.589718204 13 | 0.321749616 | 0.461556782 14 | 0.273372555 | 0.390246517 15 | 0.26220223 | 0.310080598 16 | 0.2073062 | 0.261352627 17 | 0.12950481 | 0.202410441 18 | 0.102573158 | 0.159855556 19 | 0.094044551 | 0.112241572 20 | 0.113892859 | 0.087696581
136 showed that the optimal
segment_ratios
that minimizes the error on the g-function is dependent on the number of segments (and potentially on the bore field configuration).This issue is to find optimal parameters (
end_length_ratio
) for the borehole discretization. A solution would be to generate a table that gives the optimal parameter for each value ofnSegments
up to reasonable max value (e.g.nSegments=128
). This could be accessed by settingend_length_ratio='optimal'
as an input toutilities.segment_ratios()
.