The one idea: a length with a confidence level
A normal design (Calculation › Size borehole length) takes every input as exact and gives one length H: the borehole length at which the mean fluid temperature Tf (the mean of the inlet and outlet temperature of the borehole fluid) just reaches its limits. But the ground conductivity λ, the undisturbed temperature and the loads are known only within a range. Monte Carlo gives each uncertain input a probability distribution, draws many input combinations, sizes the borehole for each of them, and looks at the spread of the results.
x = F−1(u)uij = (πj(i) + vij) / NH95 = P95(H)ρs of the ranksF is the cumulative distribution function of an input, u is uniform on (0, 1), πj is a random permutation of the N strata of input j and vij a uniform number in [0, 1). ρs is Spearman’s rank correlation between an input and the result over all samples (section 4). The confidence refers only to the inputs given as uncertain, with the distributions given. Everything else is taken as exact.
The workflow
The first choice is the mode. It decides what is calculated for each sample: Size mode sizes the length as Size borehole length does; Simulate mode keeps the length and calculates Tf over the period as Calculation › Calculate does. The limits are the lowest and highest Tf allowed (Tf,min, Tf,max); Hmin–Hmax is the range in which the length is searched. A thermal response test (TRT) measures λ on site.
In the program, Monte Carlo is started from Tools › Monte Carlo… and the results appear under Advanced analysis › Studies & uncertainty › Monte Carlo.
- Dialog: the uncertain inputs (any registered input: ground, layers, borehole, grout, pipes, flow, fluid, load multipliers, SPF, limits), their distribution (normal, log-normal, uniform, triangular) with optional truncation, the number of samples (2 to 100 000), the seed, the sampling method, the mode and optional rank correlations.
- Results page: Summary (statistics table and the Spearman ρ of each input), Histogram, Sensitivity, Convergence (statistics of the first n samples), Scatter (one input against the result) and Runs (every run, CSV export).
How the calculation works
- Check. Unknown or repeated ids, invalid parameters (sd < 0, min > max, mode outside the triangle), truncation bounds that exclude the distribution, and a correlation matrix that is not positive definite stop the run before anything is drawn.
- Draw. One random generator (64-bit Mersenne twister) started with the seed fills the N × k matrix input by input. Each value is x = F−1(u). With truncation to [lo, hi], u is first mapped to F(lo) + u · (F(hi) − F(lo)): the truncated distribution is sampled exactly, with no rejection loop. The same seed and setup give the same matrix on every PC; adding an input does not change the columns before it.
- Correlate. With rank correlations (Iman–Conover 1982) each column is reordered so that the ranks follow the target. The values of each input, and so its distribution, do not change; only their pairing does.
- Run. Each sample is applied to a copy of the project through the input registry (values outside the input’s sanity bounds make that run fail). Size mode sizes the length with the project’s sizing options; Simulate mode simulates at the current lengths and reuses g-functions (the dimensionless temperature response of the field to a constant heat rate) between samples with the same field.
- Sort. A run that throws an error is failed. In Size mode a run that cannot be sized within Hmin–Hmax is not sized: its length would be clipped at Hmax, which is not a required length. Both are counted and left out of the statistics.
- Statistics over the remaining runs (section 5).
Sampling and reading the percentiles
A percentile is read from the sorted results. P95 of H is the length that 95 % of the runs did not need to exceed. With N runs it is an estimate, and the tail is the least certain part: the statistics must settle as N grows.
The sensitivity ranking uses Spearman’s rank correlation between each input and the result, with all inputs varying together. |ρ| near 1 means the input dominates; the sign gives the direction. When the result is close to additive in the inputs, the ρ² add up to about 1 (here: 0.97).
How each result is derived
| Result | How BoreTherm derives it | Example |
|---|---|---|
| H at 95 % confidence (P95 of H) | type-7 percentile of the 100 sized lengths: h = 0.95 · (N − 1) = 94.05 → x(94) + 0.05 · (x(95) − x(94)), 0-based | 166.3 + 0.05 · (167.1 − 166.3) = 166.3 m |
| Median P50 and P5 | the same rule at p = 50 and 5 | 145.1 m and 130.4 m |
| Mean and standard deviation | over the runs summarised; sd with n − 1 | 145.2 m ± 10.9 m |
| Total length | the same statistics of Nb · H (16 boreholes) | P50 2322 m, P95 2661 m |
| Tf,max and Tf,min | extremes of the sizing criterion in every sized run | Tf,max P95 17.3 °C (limit 20 °C); Tf,min −3.00 °C to −2.99 °C |
| Share within the limits | Size mode: runs sized inside Hmin–Hmax; Simulate mode: runs whose limits check passes | 100 % |
| Failed / not sized | a run error, or (Size) not sized within Hmin–Hmax: left out of every statistic | 0 / 0 |
| Spearman ρ (sensitivity) | Pearson correlation of the ranks of an input and of H over the runs summarised | λ −0.77, Ts −0.43 |
| Histogram | Freedman–Diaconis width 2 · IQR · n−1/3 (IQR = P75 − P25), equal bins from min to max | 2 · 12.56 · 100−1/3 = 5.41 m → 11 bins |
In Size mode every sized run ends with its binding limit just met: here Tf,min sits at the −3 °C limit in all 100 runs (within the sizing tolerance). The spread is in the length, not in the temperature, so the Spearman ρ against Tf,min carries no information in this mode.
The example in numbers
| Uncertain input | Unit | Project value | Distribution | Truncation | ρ with H |
|---|---|---|---|---|---|
| Ground conductivity λ | W/(m K) | 2.6 | Normal, mean 2.6, sd 0.3 | 1.5 to 4.0 | −0.77 |
| Ground heat capacity C | MJ/(m³ K) | 2.2 | Uniform 2.0 to 2.6 | none | −0.17 |
| Surface temperature Ts | °C | 9.0 | Normal, mean 9.0, sd 0.5 | none | −0.43 |
| Heating energy multiplier | – | 1.00 | Triangular 0.90 / 1.00 / 1.15 | none | 0.41 |
100 Latin-hypercube samples, seed 1, Size mode, Hmin–Hmax 20–300 m, limits −3 °C / 20 °C. 0 runs failed, 0 were not sized. The ordinary sizing with every input at its project value gives 143.7 m. The median of the samples is 145.1 m, close to it; P95 is 166.3 m, 22.6 m (+16 %) more. That difference is the price of the stated uncertainty at 95 % confidence: 362 m of drilling for the 16 boreholes.
Limits to keep in mind
- The result is only as good as the distributions. Base them on data: a TRT with its confidence interval for λ, measured temperatures for Ts, the uncertainty of the load forecast.
- Each sample uses one value per input for the whole field (homogeneous ground). Spatial scatter between boreholes is not sampled.
- Inputs are independent unless you give rank correlations. Correlated inputs share their ρ: read them together.
- Runs that fail or are not sized are left out. If “not sized within Hmax” appears, the percentiles describe only the sized runs and understate the length: widen Hmin–Hmax and run again.
- The tails need samples: 100 for a first look, about 1000 for P90/P95 that are used as a design length. The Convergence tab shows when the curves are flat.
- Monte Carlo always uses the analytic (g-function) model of the design, also when the project has a 3D / FEM analysis.
Numbers calculated with BoreTherm. Theory: BoreTherm theory manual.