# Geometry of the Computational Domain

## Dicretization in Space#

It is assumed that the computational domain can be mapped to a straight circular cylinder, with a common center line to that of the well. The rectangle section of the cylinder is partitioned into a two-dimensional array of grid cells. This grid must fulfill two requirements:

• It must be able to accommodate all the elements of the well (drilling holes, casings, cement, tubing, drill pipes, riser, ...).
• The grid must be fine enough so the temperature is solved with enough accuracy.

The figure below shows the principle for how the first requirement get fulfilled:

All the minimum and maximum radial and depth coordinates for the well elements are used as gridlines of the computational grid. This defines a 'minimum grid' that is used as a starting point for building a more refined computational grid. To further improve the resolution, the number of grid cells in the radial direction ($r$) and in depth ($z$) is then increased. This is done in two steps: The first step is to add gridlines in the $z$ direction 1 m above and below locations where there is a material transition (for instance in the annulus, around the cement/mud transition). Doing so, the computation is done on an 'improved grid' that gives a better resolution at the material transition.

As the heat conduction in the axial direction is included, the program is able to include the effect of the cooling from the sea bottom on the first few tens of meters of the well. To observe this effect a much finer discretization in the axial direction just below the sea bottom is done, by adding 10 points spread along the first 10 meters below the seafloor.

The second step is to increase the number of cells in both the $r$ and $z$ directions, and to spread these new cells on the entire grid. The boundaries of the refined grid must include the boundaries of the 'improved grid', so it fits with the well elements and it keeps the improved resolution at the material transitions. To increase the number of gridcells in the $z$ direction, the largest gridcell is bisected. This is repeated up to the number of gridcells is obtained. This process will tend to generate a fairly equidistant grid.

In the $r$ direction the gridcells must be smaller next to the center of the well, where the computation must be done with a finer grid resolution. In the surrounding rock, a fine grid is not necessary. To get a grid spacing that increases with increasing $r$, the mapping illustrated in the figure below is used.

The boundary coordinates of a cell in the original minimum grid are shown as blue markers on the r axis. These coordinates are mapped to the s axis. The cell in the s domain is bisected in two equal cells so that $\Delta s_1 = \Delta s_2$. When the new cell boundaries are mapped back to the r domain, the cell closer to the center of the well is smaller than the other one ($\Delta r_1 < \Delta r_2$). The mapping function is here chosen as s(r) = ln( 1 + r ) (it must be a monotonic increasing function with a monotonic decreasing derivative).