Notice: Wiley Online Library will be unavailable on Saturday 30th July 2016 from 08:00-11:00 BST / 03:00-06:00 EST / 15:00-18:00 SGT for essential maintenance. Apologies for the inconvenience.
 Convection currents in a porous medium form when the medium is subject to sufficient heating from below (or equivalently, cooling from above) or when cooled or heated from the side. In the context of geothermal energy extraction, we are interested in how the convection currents transport heat when a sealed borehole containing cold fluid extracts heat from the porous medium; also known as a borehole heat exchanger. Using pseudospectral methods together with domain decomposition, we consider two scenarios for heat extraction from a borehole; one system where the porous medium is initialized with constant temperature in the vertical direction and one system initialized with a vertical temperature gradient. We find the convection currents to have a positive effect on the heat extraction for the case with a constant initial temperature in the porous medium, and a negative effect for some of the systems with an initial temperature gradient in the porous medium: Convection gives a negative effect when the borehole temperature is close the initial temperature in the porous medium, but gradually provides a positive effect if the borehole temperature is decreased and the Rayleigh number is larger.
If you can't find a tool you're looking for, please click the link at the top of the page to "Go to old article view". Alternatively, view our Knowledge Base articles for additional help. Your feedback is important to us, so please let us know if you have comments or ideas for improvement.
 Borehole heat exchangers (BHEs) are utilized for production of shallow and medium depth geothermal energy. BHE systems are sealed, vertical pipes in the ground containing fluid having a lower temperature than the ground. The fluid is circulated inside the pipes such that colder fluid is brought down and heated; warmer fluid is brought back up giving a net energy profit used for heating or electricity production. Many buildings install shallow boreholes producing local heating and cooling in the combination with heat pumps, while deep, abandoned wells are used also for direct heating [Rybach and Hopkirk, 1995; Kohl et al., 2002].
 In the porous medium surrounding a BHE, several thermal processes can be present. Conduction is the transfer of thermal energy between neighboring molecules in a substance due to molecular vibrations and collisions. The energy is always transferred from regions with higher temperature toward regions with lower temperature. In a porous medium saturated with a fluid, convection is when the motion of the fluid assists heat transfer from a surface. When the fluid motion is caused by expansion and buoyancy forces, the situation is called natural convection. Buoyancy forces are caused by a density difference in the fluid, which occur when the fluid's density is temperature dependent, such as water. Natural convection creates convection currents, which are circulation patterns for the saturating fluid sustained by buoyancy forces.
 We will in this paper focus on how induced convective currents affect the production from a BHE. When a BHE is producing heat, the borehole is filled with fluid having a temperature that is lower than the surrounding porous medium. The cooler borehole triggers convection currents in the subsurface as a horizontal temperature gradient always causes fluid motion [Vadasz et al., 1993]. A problem similar to ours was studied in Zhao et al. ; through experimental and theoretical studies they studied the heat transfer around a BHE in saturated soil. The authors did not investigate the effect of convection explicitly, but found borehole temperature, initial ground temperature, and flow rate in the porous medium to have an affect on the heat transfer. Depending on the heat extraction scenario, induced convection currents may increase or decrease the heat flux into a heat producing borehole compared to when all heat transfer is due to conduction, but it is not obvious how these currents distributes around the borehole. This effect should also be taken into account when calculating the extractable heat potential from a reservoir, but to the authors' knowledge, it has not previously been studied. In the current work, we consider convective currents caused by natural convection that develop due to the horizontal and vertical temperature differences in the system and by the conduction initially present. To isolate the effect of the induced convection, we assume the system to have no net groundwater flow. For studies investigating the effect of advective groundwater flow, we refer to Eskilson , Chiasson et al. , and Diao et al. . The BHE is assumed to be of a coaxial type having an inner and an outer pipes. The outer pipe of the coaxial BHE is modeled in a simplified manner, assuming the velocity profile of the fluid to be known. For studies of the heat transfer mechanisms inside the BHE, we refer to Gustafsson et al.  and Zeng et al. . Some previous studies involving BHEs and natural convection include a convection promoter, which introduce tubes around the borehole for the groundwater to flow in, to extract more heat from the natural convection. This modification of the borehole is beyond the scope of this work, but we refer to Carotenuto et al.  for how a convection promoter could affect the production from a BHE.
 To model the porous medium and the BHE, we have chosen pseudospectral methods. Spectral and pseudospectral methods are widely used when high accuracy in the data is required and was recently applied for a geothermal problem in Tilley and Baumann , who modeled the temperature distribution inside a geothermal well. The authors considered an open system where water was injected through one well and produced in another, finding the temperature for the production well using a spectral decomposition method.
 The outline of the paper is as follows: We begin by presenting the model and governing equations in section 2, while in section 3, the high-order pseudospectral numerical solution method is presented in combination with a novel domain decomposition strategy handling different rock properties of different layers in the model. Section 4 details the model setup and presents the numerical results. Finally, conclusions are made in section 5.
2. Model Formulation
 We study an idealized geothermal system containing a single, heat producing BHE. The borehole is sealed in the sense that there is no injection or production of fluid in the reservoir, which is typical for shallow and medium depth systems used mainly for heating and cooling applications. Our model setup consists of a saturated porous layer situated between heat conducting, unsaturated rock, which acts as heat reservoirs and heat receivers for the saturated layer. The borehole produces heat only from the saturated layer and not from the layers below and above, which is a realistic idealization as the temperature difference would normally be too low to produce heat from the top layer, and the bottom layer is below the extension of the borehole. We assume for simplicity all three layers to be homogeneous, and the porous medium to be isotropic. A similar model geometry was also studied in Bringedal et al. . Two models are considered: In the first model, the initial temperature variations in the surrounding reservoir are neglected, which typically is realistic for shallow heat exchangers. For example, if the initial temperature in the ground varies between 20 and 25°C, while the production fluid has a temperature lower than 5°C before it is pumped into the borehole, then the initial temperature variations in the ground can be neglected. The other model is initialized with a vertical temperature gradient and represents a system where the initial temperature variations are too large, compared to the borehole temperature, to be neglected. For an intermediate-depth system of 1000–3000 m, the temperature gradient model is most likely the preferred model as the initial temperature variations in the subsurface are normally large. For example, in the Weggis plant from Switzerland, as studied by Kohl et al. , the ground temperatures varied between 45°C at the top of where heat were extracted and 65°C from the bottom of the borehole, while the inlet temperature in the borehole was 35°C. In this scenario, the vertical temperature gradient must be taken into account. For the rest of this article, these two models will be known as the constant temperature (CT) model and the temperature gradient (TG) model, respectively.
 We thus consider a three-layer model representing a geothermal reservoir where the lower and upper layers are heat conducting, unsaturated rocks, while the middle layer is a permeable, saturated, and porous medium. The three-dimensional domain is shaped as an annular cylinder and is sketched in Figure 1. The outer cylinder is assumed to be impermeable and perfectly heat conducting and models the boundary of the heat reservoir. We only model the outer pipe of the coaxial borehole. Heat is only extracted from the middle layer of the porous medium and does not affect the heat transfer processes happening in the other two layers and is hence modeled facing only the middle layer.
 We use Darcy's law to describe the fluid flow in the saturated porous medium,
where v is the fluid velocity; K is the permeability of the porous medium; μ and ρ are the viscosity and density of the fluid, respectively; P is the pressure; g is the gravitational acceleration; and k is the vertical unit vector pointing upward. The density is given by the equation of state
where at some reference temperature , and β is the thermal expansion coefficient. Note that the density of water is normally also dependent on pressure. However, Table 4 in Fine and Millero  reveals that for realistic temperature and pressure domains, the density variations with temperature is the most dominant; hence, we neglect the pressure dependence. If the pressure dependency of water density had been included, this would impair the natural convection as water becomes denser with higher pressure. As Table 4 in Fine and Millero  clearly shows that temperature gives the most significant effect on the density variations in our case, our negligence of the pressure dependency only cause us to slightly overestimate the strength of the natural convection.
 As the density variations are small, we apply the Boussinesq approximation, which states that density differences in the fluid can be neglected unless they occur together in terms multiplied with the gravity acceleration g. Hence, we can neglect the density differences in the mass conservation equation and apply the continuity equation for an incompressible fluid
 We further assume energy conservation for both fluid and solid, that is
 In the above equation, subscript f refers to the fluid and m to the medium. Furthermore, is the overall heat capacity per unit volume where c is the specific heat and km is the overall thermal conductivity of the fluid and the solid combined. When we use the overall heat capacity and the overall thermal conductivity, we are using porosity-weighted averages of the heat capacities and thermal conductivities of the fluid and solid. Finally, T is the temperature of fluid and solid. No equations are needed to describe the fluid flow in the lower and upper layer, hence only
has to be solved here. The subscript s refers to the solid. Inside the borehole, the velocity field is assumed to be known, hence only an energy equation,
is needed here as well. The borehole velocity is assumed to be equal to the injection velocity, depends only on r and has only a component in the vertical direction. To estimate the effect of convection on the heat production, we calculate the heat fluxes into the borehole using Fourier's law,
where is the amount of heat transferred per unit time, n is a outward unit normal for the inner cylinder, and dA is a surface element. The integral is to be taken over the sidewalls of the inner cylinder facing the saturated layer.
 To nondimensionalize the equations, we use a coordinate transform based on the coordinate transform by Lewis and Seetharamu in Lewis et al. :
 Here, is the height of the saturated layer, is thermal diffusivity, and is the ratio of the volumetric heat capacities of medium and fluid. The two temperatures Tw and Tc are reference temperatures and represent a typical temperature difference in the system. In the CT model, Tw and Tc are the initial temperatures in the porous medium and in the borehole, respectively. In the TG model, Tw and Tc are the initial temperatures at the bottom and top of the saturated layer. The superscript denotes that the variable has no dimension. Substituting the above dimensionless variables into the equations will introduce the dimensionless Rayleigh number given by
where is the kinematic viscosity of the fluid. The Rayleigh number works as a measure of the strength of the convection. Since we are dealing with a temperature gradient with a horizontal component, convection always occurs and a larger Rayleigh number corresponds to stronger convection [Vadasz et al., 1993]. However, a Rayleigh number of zero provides no convection and corresponds to the saturated layer being impermeable. If heat is no longer extracted from the borehole; that is, no cooling from the side, stable convection currents only develop if the Rayleigh number is larger than the critical Rayleigh number. This critical Rayleigh number depends on the geometry of the domain and the boundary conditions, see for instance Bringedal et al. . Different choices for Tw and Tc in the two models lead to different scaling of the corresponding Rayleigh numbers, which results in the Rayleigh numbers corresponding to the two models not to be directly comparable to each other.
 Substituting the dimensionless variables into our model equations yields a new system of equations. Darcy's law equation (1) is transformed into
 The energy equation for the lower and upper layer is
where is the ratio between the heat conductivity of the solid in layer 1/3, and the combined heat conductivity of solid and fluid in layer 2. Furthermore, the energy conservation equation for the borehole is
where . We have inserted the equation of state for the density equation (2) into the equations when necessary. Using nondimensional lengths, the porous medium fills an annular cylinder with inner radius and outer radius . The saturated layer has height , while layers 1 and 3 have heights and , respectively. The borehole is an annular cylinder with inner radius and outer radius .
3. Numerical Solution Approach: Pseudospectral Methods and Domain Decomposition
 A time stepping 3-D solver that approximates the solution of the original nonlinear equations (10)-(14) has been written using pseudospectral methods in space and MATLAB's built-in package ODE15s in time. The solver finds the temperature distribution and velocity field for given boundary and initial conditions and for given values of the Rayleigh number. Hence, it is possible to investigate how the heat transfer into the inner cylinder is affected by the Rayleigh number in the two models.
 Pseudospectral and spectral methods are higher order numerical methods known for their good convergence properties. We have chosen pseudospectral methods to obtain high resolution of the temperature distribution near the borehole, which is an important aspect of our study. Also, pseudospectral methods allow easy incorporation of boundary conditions. Previously, we have successfully applied these methods to investigate onset and stability of convection cells [Bringedal et al., 2011]. Herein, we give a short review of the pseudospectral methods, and refer to Boyd [Boyd, 2001] for a more thorough introduction.
 Spectral methods belong to the class of methods that approximate the unknown solution u(x) by a sum of basis functions that span a finite subset of the full solution space,
 The coefficients are chosen such that the residual is minimized. In Galerkin spectral methods, the basis function is orthogonal in a given inner product and the residual is minimized in this inner product. The resulting matrix equation is found using orthogonality properties of the basis function and quadrature formulas when necessary. For pseudospectral methods, the residual is minimized in some chosen collocations points . The basis functions could still be the same orthogonal functions used in spectral methods, but transforming the basis into a cardinal basis has been found to be convenient. In the cardinal basis, the basis functions are nonlinear interpolating functions having the value 1 at one collocation point and 0 at all the others; that is, . Hence, the coefficients are the function values of the approximated solution uN in the nodes .
 Using the cardinal basis in the pseudospectral methods, each line in the matrix equation represents an equation for the function value in a specific collocation point. Boundary conditions are handled by finding the matrix lines corresponding to the nodes to which the boundary conditions are applied and substituting these lines with a discrete version of the boundary condition. Boundary conditions could also have been incorporated using basis recombination such that the basis functions themselves always fulfill the boundary conditions. The resulting system of equations is then allowed to be smaller as no matrix lines are needed to describe the boundary conditions. However, a new basis recombination is needed if the boundary condition is slightly changed and has not been used here.
 In pseudospectral methods, selecting the grid points is important to ensure that the numerical solution is of high accuracy. The optimal choice of grid points depends on the geometry of the domain. As we use cylindrical coordinates, we apply different choices of grid points for the radial, azimuthal, and vertical directions. The azimuthal direction is the finite interval having the extra property of the solution being periodic. Here, the optimum choice is the Fourier nodes [Trefethen, 2000].
 In the vertical direction, we have a finite interval, , without any periodicity, which motivates us to choose the Chebyshev points [Trefethen, 2000]. For a finite interval without periodicity, the Chebyshev nodes are normally the optimum choice as they provide fastest possible convergence. For completion, we do mention that in frequency-dominating problems such as in electromagnetics, prolate speroidal wave functions (PSWF) would be a better choice as basis as this method also gives spectral convergence, and requires less grid point to obtain the same accuracy as when using Chebyshev points, see for example Kovvali et al. . However, as our problem is not expected to produce solutions where PSWF would give an advantage, we choose the more well-known Chebyshev basis in stead. Using Chebyshev points, two grids are possible: the Gauss-Radau-Chebyshev points and the Gauss-Lobatto-Chebyshev (GLC) points. Only the latter include the boundary points and are therefore preferred. However, when discretizing the porous medium in the vertical direction, we have two different energy equations that are to be solved in the various layers, either equation (12) or equation (13). However, this difficulty is solved by applying domain decomposition in the vertical direction; using one domain for each layer. Within each layer, we apply the GLC nodes to discretize the subinterval. This choice of decomposing the vertical direction also enables us to use a finer grid in any of the layers and has the advantage of always locating nodes at the internal boundaries between the layers. Within each layer, we discretize the relevant energy equation. This results in a double set of nodes at the internal boundaries belonging to both layers, but different discretizations. By forcing continuity of the solution between the layers, half of the double nodes can be removed, such that only one node is present at each point at the internal boundary. Also, instead of solving the energy equation (12) or equation (13), we demand the heat flux to be continuous over the internal boundary; that is,
where is either κ or 1 depending on whether we are in layer 1 or 3, or in layer 2.
 The radial direction is the finite interval ( ), which consists of the outer part of the borehole ( ) and the porous medium ( ). As we apply different equations in the two intervals, we apply domain decomposition also here, using one set of GLC nodes in each interval and demanding the heat flux to be continuous over the internal boundary
 As the GLC nodes are clustered near the boundaries of the interval, a good resolution of the solution near the borehole is ensured.
4. Model Setup, Results, and Discussion
 The governing equations (10)-(14) are solved by time stepping the relevant energy equation; equations (12), (13), or (14), and updating the velocity field for layer 2 using Darcy's Law equation (10) and the Mass equation (11) in each time step. The production period for a BHE depends on the geological conditions and usage, but is expected to be less than 50 years for the deeper boreholes, while heat is normally produced from shallow boreholes only during the winter season (approximately 6 months). From equation (8) for dimensionless time, these time spans correspond to up to in nondimensional time units for the most shallow boreholes, and somewhat shorter for the deeper boreholes. Solving the above system of PDE's requires an initial condition for temperature, and boundary conditions for both temperature and velocity.
 For both models, we have performed simulations where the parameters , and have been varied. Decreasing the size of corresponds to the heat conductivity being lower in layers 1 and 3, which is often the case for geothermal reservoirs. A lower value of causes the vertical heat diffusivity into layer 2 to be somewhat lower. Increasing the height of layers 1 and 3 increases the distance from the unphysical boundary condition of the top and bottom of the annular cylinder, hence creating a more realistic model for subsurface temperature exchange. Varying corresponds to varying the strength of heat conductivity in water compared to heat conductivity in the porous medium and affects the rate of heat transfer into the borehole. The parameter σ is the ratio of volumetric heat capacities in medium and fluid and determines the difference in heat accumulation in the various regions. We also vary the Rayleigh number; simulations for , which corresponds to no convection, are used for comparison. According to Hickox and Chu , realistic Rayleigh numbers for deep boreholes; that is, boreholes to depths lower than 2 km, are up to . Rayleigh numbers close to 50 are only possible for a shallow borehole when the porous medium has high permeability, but this is often the case when the BHE is placed in unconsolidated soils. For shallow boreholes placed in rocks, the permeability, and hence the Rayleigh number, is expected to be lower. We have performed simulations for Rayleigh numbers up to 150; mainly for more easily to observe trends following the Rayleigh number, but a Rayleigh number of 150 is also possible for a medium depth borehole when the surrounding porous medium is highly permeable.
 In all simulations, the nondimensional heat produced into the inner cylinder is calculated using
where n is the outward unit normal vector of this cylinder. The inner integral is to be taken over the surface of the inner cylinder facing the saturated layer. As there is no injection and production of fluid through the borehole, this conductive heat flux into the inner cylinder is the only way to extract heat.
 Finally, note that even though the simulations have been performed with a large outer radius (up to ) in order to decrease the effect of the outer boundary, the boundary condition posed here will have an effect on the results after sometime. We performed the simulations presented in sections 4.3 and 4.4 with the outer radius being insulated and found this to give a small ( ) effect on the heat flux after sometime ( ), but the results remains qualitatively the same. However, since the interesting time period in our case is upto , the influence from the boundary conditions is negligible.
4.1. Initial and Boundary Conditions
 To perform the simulations, initial and boundary conditions are necessary. The CT model is initialized with the constant temperature , while the TG model is initialized with the temperature gradient corresponding to pure heat diffusion such that at the bottom of the saturated layer and at the top. Since layers 1 and 3 may have heat conductivities different from layer 2, the initial temperature profile depends on κ such that the vertical heat flux is continuous over the boundaries between the layers.
 Boundary conditions for temperature and fluid velocity are required for both models. For velocity, the CT and TG model is subject to the boundary condition of impermeable walls, meaning that no fluid is flowing into layer 2 from any direction. The outer cylinder is considered impermeable as it represents the end of the heat reservoir, while the inner cylinder is impermeable since we only consider a system with a sealed borehole.
 For boundary conditions on the temperature, we refer to Figure 2, which shows the temperature conditions applied to the various boundaries. The top, bottom, and outer boundaries of the cylinder are Dirichlet boundaries, meaning they are assumed perfectly heat conducting. These boundaries are kept at temperatures corresponding to the ones given by the initial condition for both models. In layers 1 and 3, at , the boundaries have Neumann conditions and are kept insulated as the borehole does not extract heat from these two layers. The borehole has three outer boundaries: the top is a Dirichlet boundary kept at a constant temperature equal to the injection temperature of the borehole fluid. For the CT model, this means that , while for the TG model we are allowed to vary the value of . The left and the lower boundaries for the borehole are both Neumann boundaries. These two boundaries are kept insulated as they face the inner part of the borehole and we assume there is no heat transfer between the inner and outer pipe in the borehole. Finally, we have three internal boundaries: between layers 1 and 2, and 2 and 3, and between layer 2 and the borehole. These all satisfy conditions for continuity in heat flux across the boundary as stated earlier.
 In warmer countries, a BHE could also be used for cooling purposes during parts of the year. In this case, the borehole is filled with fluid that is warmer than the ground with the purpose to get colder fluid back. Our models are able to describe this scenario by changing some initial and boundary conditions, hence allowing us to investigate the effect of natural convection on a warm borehole as well. For the CT model, we only need to switch the temperatures in the initial condition and the boundary condition on the borehole, hence initializing the porous medium with and injecting water with temperature into the borehole. The initial condition in the TG model is left unchanged and we can apply values of higher than 1 to obtain a cooling effect.
 Note that an operating BHE would use production fluid with a calculated temperature such that a wanted effect is obtained during production. Hence, the fluid temperature in the borehole would change with time depending on how much heating is necessary. On cold winter days, the borehole would contain very cold fluid to obtain a higher produced effect, while production could be completely shut down on warmer days. The same boreholes can also be used for cooling purposes during summer. As our purpose in this paper is only to investigate the effect of convection on the heat transfer into the borehole when the BHE is operating, these varying heat production conditions will not be taken into account, and we assume a constant injection temperature . Comparing to a real-life BHE, this condition for is not realistic and our model is not able to give quantitative information of exactly how much a BHE would produce during the production time. However, this condition on is chosen to isolate the effect of convection, and the model can be used to give an idea of when convection is an important effect.
4.2. Convergence Study
 When using spectral methods to discretize in space, we expect the method to potentially converge as [Boyd, 2001; Trefethen, 2000] as long as the solution is sufficiently smooth. However, two aspects may detract from this theoretical rate. First, the time discretization has only polynomial convergence rate. We use MATLAB's ODE15s package, which is an adaptive solver based on the backward differentiation formula [Reichelt and Shampine, 1997]. ODE15s is designed for stiff differential algebraic problems, with adaptive first-order accuracy to fifth-order accuracy. Second, due to the discontinuous heat conduction coefficient, the solution may not have the necessary smoothness. As we apply the continuity in heat flux across the internal boundaries, formulated in equations (16) and (17), we loose continuity in the first-order derivative of temperature when the heat conductivity has different values in the various regions. This loss in continuity in the first-order derivative creates a singularity in the model that only allows the pseudospectral method to converge as [Boyd, 2001]. The reason for still using pseudospectral methods even though spectral convergence cannot be obtained for our model problem is that the truncation error from pseudospectral methods is in general smaller than from comparable methods; hence, greater accuracy can be obtained for the same number of unknowns compared to other numerical methods.
 A convergence test is performed to illustrate the convergence properties of the code. A representative model problem is solved on increasingly finer grids, and the solution on the finest grid is taken as a reference solution. At two points in time, corresponding to a transient and close to stationary solution, respectively, the reference solution is compared to coarser grid solutions. This procedure will indicate the grid convergence of the code. For the model problem, we consider an annular cylinder measuring and , and with and . Since and are not equal to 1, we have discontinuity in the heat conductivity and hence in the first-order derivative of across the internal boundaries. We have only performed the convergence test with boundary conditions consistent with the borehole being used for heat production.
 From previous studies of convection in a coaxial cylinder [Bringedal et al., 2011], we know that convection currents can change abruptly in both radial and azimuthal directions, requiring a higher resolution in these two directions than in the vertical direction. However, the convergence test is performed using uniform refinement in all three spatial directions. This choice of refinement is made only for convenience to more easily show the indicated convergence rate when refining the grid. We let N be the degree of the pseudospectral discretization in each subdomain, which corresponds to points in radial direction, N in azimuthal direction, and in vertical direction. We increase N from 4 to as high as possible before the dimensions of the vector equation becomes too large for the computer to handle. The coarser solutions are interpolated (by either a linear or a quadratic method) onto the fine grid and we calculate the error by
where the integral is to be taken over the whole annular cylinder and V is the volume of the domain. The discretization is consistent to the formal orders, thus only stability needs to be verified. This justifies the use of a numerical reference solution, obtained from the finest possible discretization. The resulting error plot is shown in Figure 3, for four different cases corresponding to the TG and CT models at two different points in time: corresponding to the transient phase, and when the solution is close to stationary. As seen from the log-log plot in Figure 3, the tendency in error development indicates quadratic convergence rate for the early time cases and the steady state CT case (the steeper curve at higher discretizations is likely an artifact of comparing numerical solutions). However, for the TG steady state case, the data points are not sufficient to draw conclusion beyond that the method is at least first-order convergent for the steady state case. From this, we draw the tentative conclusion that the method is stable, and thus convergent, and that the limiting factor in terms of accuracy is the temporal integration and the regularity of the solution itself. The interpolation method used to transfer a coarse-grid solution onto the finer, could also be a source of error. However, we saw no difference in the error between the two applied interpolation methods and have not investigated the possibility of a dominating error from the interpolation method as three of the methods do show quadratic convergence as expected.
 Note that for the CT model, we could assume axisymmetry when performing the convergence analysis, hence neglecting the azimuthal direction and obtain a larger value for the largest possible N. This was also possible for the TG model when , while for convection currents developed in the azimuthal direction after sometime. Hence, only N = 20 was possible for this case, while for the three other convergence tests, N = 80 could be used.
 For code validation, we compared the obtained convection patterns with the mode maps given in Bringedal et al. . In this paper, a linear stability analysis is performed on the governing equations when the domain is a one-layered porous medium contained in a vertical annular cylinder. The analysis provides a critical Rayleigh number, which is a criterion for when natural convection is possible, and the preferred convection pattern at the onset of convection. Using small values of and and a Rayleigh number slightly larger than the critical in our simulations, the obtained modes were the same.
4.3. Results for the CT Model
 In the CT model with a borehole filled with cold fluid, the convection currents, when present, always distribute such that hot groundwater is transported toward the upper half of the annular cylinder in layer 2, then down along the inner cylinder where it is gradually cooled by the borehole, and then transported away from the inner cylinder at the bottom of layer 2. See Figure 4 for temperature distributions near the borehole. For the CT model with a borehole containing warm fluid, the convection currents would distribute oppositely such that the groundwater becomes gradually warmer when it flows upward along the borehole.
 From Figure 4, it is clear that convection currents provide a larger heat flux into the borehole in the upper half of layer 2 and a lower heat flux in the lower half, when compared to the pure conductive case. Altogether, the convection currents give a slightly larger heat production during the simulation period. Plots of the produced heat flux as a function of time during the simulation period reveal the same trend at all times. Figure 5 shows a typical example of heat fluxes as a function of time for some Rayleigh numbers.
 See Figure 6a for a comparison of some considered cases for the CT model when the borehole contains cold fluid. Figure 6b shows the corresponding results when the borehole contains warm fluid. The results indicate a small positive effect from convection: The producing borehole can potentially provide slightly larger production when the surrounding porous medium is saturated and permeable compared to when the porous medium is impermeable. However, the difference is only modest.
 The displayed results have all been made using , and max , which are all physically relevant for a shallow BHE system. Simulations with parameters corresponding to a medium depth BHE reveal the same trend in the results. We see small effects from varying the parameters , and σ. However, the results remain qualitatively the same. Within our time interval of interest ( ), varying the height of layers 1 and 3 had no effect on the temperature in layer 2 as long as the heights were larger than 1.
4.4. Results for the TG Model
 When using a borehole contained with cold fluid in the TG model, the convection currents distribute in the same manner as for the CT model, with groundwater flowing toward the inner cylinder in the upper half of layer 2 and away from the inner cylinder in the lower half. As the groundwater transported toward the borehole is much colder than the fluid transported away from the borehole, due to the initial temperature gradient, the cooling of the porous medium near the borehole is much more significant compared to the pure conductive case, when convection is present. See Figure 7 for temperature distribution and fluid velocities near the borehole when . When the borehole contains warm fluid, the opposite occurs: the warmer underlying groundwater flows toward the borehole, while the colder overlying groundwater is transported away, giving significantly less cooling of the borehole compared to the pure conductive case.
 The simulations shown in Figure 7 were made with . This value for corresponds to the injection temperature being very close the coldest ground temperature from where heat is extracted and is an extreme case. However, it is not uncommon for long-term heat extraction. From Figure 7, we observe that the convection currents now give a negative effect: even though there is more heat transport in the system, it is the colder, upper lying fluid that is transported toward the borehole. Figure 8a shows the extracted heats for various Rayleigh numbers when . In Figure 8b, the extracted heats when are shown. This is the extreme case when the borehole is used for cooling purpose and the borehole contains fluid having temperature close to the warmest ground temperature.
 Using temperatures in the borehole further away from the extreme case revealed a significant effect on how convection affects the heat production. Lowering the injection temperature from 0 to −2 when the borehole is used for heating, will, for larger Rayleigh numbers, cause the heat flux into the borehole to increase compared to when the Rayleigh number is zero. With a value of lower than 0, the initial temperature variations in the ground water are less important. Convection still transports the colder, upper lying fluid toward the borehole, but even the coldest groundwater is significantly warmer than the borehole. Especially for larger Rayleigh numbers, the dominating effect when using a low is that the convection currents provide more heat transport and the BHE produce more heat during the simulation period. Heat fluxes for various Rayleigh numbers and lower values of is shown in Figure 9a. In the figure, we observe two trends: first of all, we obtain in general larger heat productions for all Rayleigh numbers due to there being a larger temperature difference between the borehole and the ground. Also, comparing the produced heat for the same value of we see that for larger Rayleigh numbers, the convection can give a positive effect on the heat production. For gradually colder this occurs for even smaller Rayleigh numbers. This is as expected as the TG model with a very low value of should act as the CT model. When becomes significantly lower than 0, the initial temperature variations in the ground become even less important and the CT model could be used instead. Simulations where gave results in heat production showing the same trend as observed for the CT model.
 In Figure 10, we see how the heat flux into the borehole changes with time during the simulation period. In Figure 10a, the heat fluxes when are shown, while Figure 10b shows results for . In Figure 10a, we see how the heat flux for larger Rayleigh numbers is always lower than in the case when there is no convection, while in Figure 10b we see how the heat flux gradually increase with time and eventually provides a positive effect for larger Rayleigh numbers. Lowering the injection temperature further would give plots looking more like in Figure 5.
 To illustrate the effect of convection when is close to the ground temperature, we present an example to show how should have been in order to give the same produced heat during production time, compared to when and no convection is present. When and the Rayleigh number is zero, an amount of nondimensional heat is produced during production time. Increasing the Rayleigh number decreases the heat flux; hence, the injection temperature must also be lowered to obtain the same amount of produced heat. Simulations show that for a Rayleigh number of 50, the injection temperature must be lowered to to obtain the same amount of produced heat during production time, while the corresponding injection temperatures for Rayleigh numbers of 100 and 150 are and , respectively. This example indicates how the injection temperature should change if a given heat is required during production, if convection is present.
 We obtain similar results when we increase the value of when the borehole is used for cooling. When increasing , the convection currents still distribute in the same manner as when , but when gradually increasing we see the convection currents giving a positive effect. In Figure 9b, the produced heats for various Rayleigh numbers and between 1 and 3 are shown. Increasing the injection temperature further, gave results where the heat production showed the same trend as for the CT model when the borehole is used for cooling purposes.
 As for the CT model, the displayed results have all been made using , and max , which are all physically relevant for a shallow BHE system. Simulation with parameters corresponding to a medium depth BHE reveal the same trend also here. We still see small effects from varying the parameters , and σ, but the results remain qualitatively the same. Also for the TG model, varying the height of layers 1 and 3 had no effect on the temperature in layer 2 as long as the heights were larger than 1.
 Using pseudospectral discretization combined with domain decomposition, we have made a convergent solver for modeling the heat transfer processes in a layered porous media when a borehole is extracting heat. Our high-order numerical simulations show how the heat transfer into a borehole heat exchanger is affected by the presence of natural convection currents initialized by the induced horizontal temperature gradient. For a porous medium with a constant temperature distribution as initial condition and using the borehole for heating purposes, convection provides a small positive effect to the heat production as the convection currents retrieve some extra heat toward the borehole. Stronger convection always results in a larger heat flux into the borehole. For a porous medium having a vertical temperature gradient as initial condition, the effect of convection depends on the injection temperature into the borehole. When the injection temperature is close to the coldest temperature observed initially in the layer where heat is extracted from, convection gives a negative effect on the production as the coldest groundwater is transported toward the borehole giving a much smaller heat flux. For stronger convection, the heat flux into the borehole becomes even smaller. When the injection temperature is decreased, the situation gradually shifts as the initial temperature variations in the subsurface become less significant and the system acts more like the model initialized with a constant temperature in the porous medium.
 For borehole heat exchangers, our results affect the choice of injection temperature in the borehole. Injecting a fluid into the borehole with a temperature close to the groundwater temperature is typical for long-term borehole heat exchangers as this provides the ground not cooling down so quickly. As we see in this paper, a borehole temperature close to the ground temperature results in producing less heat than expected if the ground is permeable and saturated with water so that convection currents can evolve. Using an injection temperature much lower than the ground temperature (such that when the initial temperature in the ground is between 0 and 1), convection currents gives a positive effect on the heat extraction as more heat is transported toward the borehole in this scenario.
 As a BHE can also be used for cooling purposes, we simulated the heat transfer processes in the porous medium when the borehole contains warm fluid. Similarly, we find that convection provides a small positive effect when the difference in temperature between the porous medium and the borehole is large, while we obtain a negative effect from convection when the temperature in the borehole is of the same order of magnitude as the temperature variations in the porous medium.
 This work was in part funded by the Research Council of Norway (grant number 190761/S60).