# Geometry of the Computational Domain

### Discretization in Space&#x20;

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:&#x20;



![The figure shows three rectangles representing the rock and two representing drill holes. The computational grid (both dotted and plain lines) is built so it accommodates the the well elements.](https://1901482827-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgbgDihqdYuxtPooIin%2F-M6_1imd_wiZ7tOS9mw5%2F-M6_Fkjl2H1ItXb6FaDv%2FWellTempCells.png?alt=media\&token=731990a9-4870-4d7b-8abd-2a17515e6644)

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 Δs1 = Δs2. 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).](https://1901482827-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgbgDihqdYuxtPooIin%2F-M6_GdVHWwkLvL94i7pz%2F-M6_RI20oVrgQNMCoJuz%2FWellTempCells_r_modif.png?alt=media\&token=a30a58ed-04d1-4878-8271-04203543723f)



