### Unfitted finite element approximation

In the present work, the unfitted finite element method proposed by Hansbo and Hansbo [19] is employed. An example of this approach for a 1D problem with an interface is illustrated in Fig. 1. The coupling of the solutions in each overlapping element is determined by the interface conditions that are typically weakly enforced using Nitsche’s method [21].

The finite element mesh is given by first defining a uniform background mesh, to which the physical domain is embedded. Following this, any elements that have zero intersection with the physical domain are removed, such that the computational mesh, \(T_{h}\), is given as:

$$ T_{h} = \left\{ {T \in \left. {T_{h}^{0} } \right|T \cap \Omega \ne \emptyset } \right\} $$

(3)

where \(T\) denotes an element in the mesh and \(T_{h}^{0}\) is the background mesh.

This process is illustrated in Fig. 2, where it can be seen that the computational domain, \(\Omega_{h}\), extends beyond the physical domain.

In the present work, the level set method is used to describe the domain boundary and material interfaces, and Q4 elements are used throughout. The boundary and interfaces are discretised using piecewise linear segments within each element.

Applying this approach to the Poisson problem, and integrating by parts over the computational domain, the weak form is given as:

Find \(u \in H^{1} \left( \Omega \right)\), such that:

$$ \int_{\Omega } {\nabla va \cdot \nabla u} + \int_{{\Gamma_{N} }} {v \cdot \nabla_{n} u} = \int_{\Omega } {vf} + \int_{{\Gamma_{N} }} {vh} ,\;\;\;\;\;\forall v \in H^{1} \left( \Omega \right) $$

(4)

where \(u\) is the solution vector and \(v\) are the test functions.

Employing the Galerkin weighted residual method for spatial discretisation gives:

$$ K\overline{u} = F $$

(5)

where the primary variables are interpolated from the nodal value, i.e. \(u = N\overline{u}\), where \(N\) is the vector of shape functions.

The global system matrix and right hand side vector are given as:

$$ \begin{aligned}& K = {\rm A}_{e} \left( {\int_{{\Omega_{e} }} {\nabla N^{T} a\nabla N} + \int_{{\Gamma_{Ne} }} {N^{T} \nabla_{n} N} } \right) \hfill \\ &F = {\rm A}_{e} \left( {\int_{{\Omega_{e} }} {N^{T} f} + \int_{{\Gamma_{Ne} }} {N^{T} h} } \right) \hfill \\ \end{aligned} $$

(6)

where \({\rm A}_{e}\) is the element assembly operator.

An important aspect of Eq. (4) is that the divergence theorem is applied over the computational domain. This leads to a flux term associated with the boundary of the computational domain, \(\partial \Omega_{h}\). This term does not appear in (4) as the degrees of freedom to which it applies, i.e. those that lie on \(\partial \Omega_{h}\) are constrained and therefore are removed from the global system of equations. In addition, the integrals found in (4) are carried out over the physical domain that does not conform to the computational mesh. This implies that special integration rules are required for integrals over elements intersected by the problem boundary and/or interfaces (so-called cut elements). In the present work, volume integrals are carried out through the subdivision of cut elements into integration elements, to which the standard Gauss rule is applied; whilst surface integrals are taken over the piecewise linear approximation of the boundary and/or interfaces. A depiction of the subdivision can be seen in Fig. 3, where the shaded area indicates the physical domain.

Before describing the approach to enforcing constraints, the sets of nodes to which they are applied are first defined. Let \(I_{gh} = \left\{ {i \in \left. I \right|x_{i} \in \Omega_{h} \backslash \Omega } \right\}\) be the set of global ghost nodes, where \(I\) is the global set of nodes and \(x_{i}\) are the coordinates of node \(i\). The set of ghost nodes to which essential boundary conditions are applied is \(I_{gh}^{D} \subset I_{gh} = \left\{ {i \in \left. {I_{gh} } \right|x_{i} \in T_{h}^{D} \wedge \left| {x_{i} - x_{i}^{P} } \right| < \left( {1 - \lambda } \right)h} \right\}\), in which, \(T_{h}^{D}\) is the set of elements that contains a part of the boundary to which essential boundary conditions are applied, \(x_{i}^{P}\) are the coordinates of the projection point for node \(i\) (to be introduced in following Section), \(h\) is the element size, \(\lambda\) is a user defined parameter and || denotes the Euclidean distance. The last condition given in the set arises as the result of an assumption introduced to ensure boundedness of the solution, following the approach of Pande et al. [48]. The assumption is that any node at a distance \(d \le \lambda h\) from the boundary in fact lies on the boundary. As a result, the essential boundary condition is applied directly to such nodes, and multi-point constraints are not utilised for those points on the boundary. The set of ghost nodes to which interface conditions are applied can be defined similarly as \(I_{gh}^{I} \subset I_{gh} = \left\{ {i \in \left. {I_{gh} } \right|x_{i} \in T_{h}^{i} \wedge \left| {x_{i} - x_{i}^{P} } \right| < \left( {1 - \lambda } \right)h} \right\}\), where \(T_{h}^{i}\) is the set of elements that contain a material interface. Finally, the set of nodes that are constrained to ensure cut element stability can be defined as \(I_{gh}^{CE} = \left\{ {i \in \left. {I_{gh} } \right|i \notin I_{gh}^{D} \wedge i \notin I_{gh}^{I} } \right\}\). In the present work, the parameter \(\lambda\) was set to 0.001 throughout.

### Essential boundary conditions

The approach for enforcing essential boundary conditions follows the approach van den Boom et al. [30], and employs the interpolation of Pande et al. [48]. Following the approach of Pande et al. [48], a projection of the ghost nodes onto unique points on the physical boundary is employed. Four-noded bilinear elements (Q4 elements) are used for the present work, which implies that there may be either one, two or three ghost nodes. For a single ghost node, the projection is onto the centre of the boundary segment within that element, whereas for two ghost nodes the projection is onto the points of intersection of the boundary segment with the element edges. Finally, for three ghost nodes, a combination of the projections for a single and two ghost nodes is used. A depiction of the problem can be seen in Fig. 4, where \(\Omega\) indicates the physical domain and the projection points are indicated by the crosses. Once the projection is established, the essential boundary condition is given as:

$$ g(x,y) = N^{T} (x,y)u_{e} $$

(7)

where \(u_{e}\) is the vector of element nodal values.

In the work of Pande et al. [48], this condition replaces the equations for the ghost nodes in the system of equations. In the present work, the approach of van den Boom et al. [30] is followed and (7) is employed in the form of a multi-point constraint:

$$ u_{e}^{gh} = - A^{ - 1} Bu_{e}^{r} + A^{ - 1} G $$

(8)

where \(u_{e}^{gh}\) and \(u_{e}^{r}\) are the vectors of degrees of freedom associated with ghost and regular nodes respectively, \(G\) is the vector of prescribed values and \(A\) and \(B\) are the matrices of shape functions of ghost and regular degrees of freedom respectively, evaluated at the projection points. Using (8), the element matrix and right-hand side vector are modified as follows:

$$ \begin{aligned}& \hat{K}_{e} = T_{I} ^{\prime}K_{e} T_{D} \hfill \\& \hat{F}_{e} = T_{I} ^{\prime}(F_{e} - K_{e} G_{T} ) \hfill \\ \end{aligned} $$

(9)

where \(T_{D}\) is the transformation matrix that contains the contributions of the regular degrees of freedom to the ghost nodes, and \(G_{T}\) is comprises the prescribed values.

Finally, \(T_{I} = \delta_{ij} \forall i \in n_{r} \wedge T_{I} = 0\forall i \in n_{gh}\), where \(n_{r}\) is the set of local regular nodes and \(n_{gh}\) is the set of local ghost nodes, is used to eliminate the ghost nodes from the system of equations.

In the reduced matrices described in (9), the boundary conditions are strongly enforced.

To illustrate the procedure, consider a Q4 element crossed by a boundary such that there are three ghost nodes (see Fig. 4), subject to essential boundary conditions. In this case Eq. (8) becomes:

$$ \begin{aligned} \left[ \begin{aligned} \begin{array}{*{20}c} {u_{2} } \\ {u_{3} } \\ u_{4} \\ \end{array} \hfill \\ \end{aligned} \right] = - \left[ {\begin{array}{*{20}c} {N_{2} (x_{1} ,y_{1} )} & {N_{3} (x_{1} ,y_{1} )} & {N_{4} (x_{1} ,y_{1} )} \\ {N_{2} (x_{2} ,y_{2} )} & {N_{3} (x_{2} ,y_{2} )} & {N_{4} (x_{2} ,y_{2} )} \\ {N_{2} (x_{3} ,y_{3} )} & {N_{3} (x_{3} ,y_{3} )} & {N_{4} (x_{3} ,y_{3} )} \\ \end{array} } \right]^{ - 1} \left[ {\begin{array}{*{20}c} {N_{1} (x_{1} ,y_{1} )} \\ \begin{aligned} N_{1} (x_{2} ,y_{2} ) \hfill \\ N_{1} (x_{3} ,y_{3} ) \hfill \\ \end{aligned} \\ \end{array} } \right]\left[ {u_{1} } \right] \hfill \\ + \left[ {\begin{array}{*{20}c} {N_{2} (x_{1} ,y_{1} )} & {N_{3} (x_{1} ,y_{1} )} & {N_{4} (x_{1} ,y_{1} )} \\ {N_{2} (x_{2} ,y_{2} )} & {N_{3} (x_{2} ,y_{2} )} & {N_{4} (x_{2} ,y_{2} )} \\ {N_{2} (x_{3} ,y_{3} )} & {N_{3} (x_{3} ,y_{3} )} & {N_{4} (x_{3} ,y_{3} )} \\ \end{array} } \right]^{ - 1} \left[ {\begin{array}{*{20}c} {g_{x1} } \\ \begin{aligned} g_{x2} \hfill \\ g_{x3} \hfill \\ \end{aligned} \\ \end{array} } \right] \hfill \\ \end{aligned} $$

(10)

where the coordinates correspond to the projection points. The non-zero terms of the transformation matrix become:

$$ \begin{aligned}& T_{D11} = 1 \hfill \\& T_{D21} = A_{11}^{ - 1} B_{1} + A_{12}^{ - 1} B_{2} + A_{13}^{ - 1} B_{3} \hfill \\& T_{D31} = A_{21}^{ - 1} B_{1} + A_{22}^{ - 1} B_{2} + A_{23}^{ - 1} B_{3} \hfill \\& T_{D41} = A_{31}^{ - 1} B_{1} + A_{32}^{ - 1} B_{2} + A_{33}^{ - 1} B_{3} \hfill \\ \end{aligned} $$

(11)

whilst the terms of the vector of prescribed values read:

$$ \begin{aligned} G_{T2} = A_{11}^{ - 1} g_{x1} + A_{12}^{ - 1} g_{x2} + A_{13}^{ - 1} g_{x3} \hfill \\ G_{T3} = A_{21}^{ - 1} g_{x1} + A_{22}^{ - 1} g_{x2} + A_{23}^{ - 1} g_{x3} \hfill \\ G_{T4} = A_{31}^{ - 1} g_{x1} + A_{32}^{ - 1} g_{x2} + A_{33}^{ - 1} g_{x3} \hfill \\ \end{aligned} $$

(12)

### Interface conditions

The approach to enforcing interface conditions follows the same procedure as that for enforcing essential boundary conditions. The key difference is that now jump conditions are enforced, in both the solution itself and in the solution gradient. In addition, in this case the number of ghost nodes is always equal to the number of nodes of the element, irrespective of how the discontinuity crosses the element. In the present case as Q4 elements are employed, there are four ghost nodes. As before, the approach begins with a projection of the ghost nodes onto the physical interface. The projection points are at the points of intersection between the boundary segment and the element edges. A depiction of this can be seen in Fig. 5, where \(\Omega_{1}\) and \(\Omega_{2}\) indicate the physical domain on the positive and negative sides of the interface respectively and where it is noted that at each projection point, both interface conditions are evaluated. Once the projection is established, the interface conditions that depend upon the problem considered are given as:

$$ \begin{aligned}& j(x,y) = \left[\kern-0.15em\left[ {N^{T} (x,y)u_{e} } \right]\kern-0.15em\right] \hfill \\& h(x,y) = \left[\kern-0.15em\left[ {\nabla_{n} N^{T} (x,y)u_{e} } \right]\kern-0.15em\right] \hfill \\ \end{aligned} $$

(13)

The first equation in (13) enforces the condition on the jump in the solution, whilst the second enforces the condition on the jump in the solution gradient. Using (13), the same procedure as before is followed that leads to reduced matrices, in which the interface conditions are strongly enforced. In this case, the matrices \(A\) and \(B\) (see Eq. (8)) are of shape functions and shape function derivatives of the ghost and regular nodes respectively, evaluated at the projection points, and \(G\) (Eq. (8)) is the vector of the prescribed jumps in both the solution and in the solution gradient.

To illustrate the difference to enforcing essential boundary conditions, consider a Q4 element crossed by a boundary such that there are three ghost nodes associated with \(\Omega_{1}\), and one ghost node associated with \(\Omega_{2}\) (see Fig. 5), subject to the interface conditions described in (13). In this case, Eq. (8) becomes:

$$ \left[ \begin{aligned} \begin{array}{*{20}l} {u_{2}^{1} } \\ {u_{3}^{1} } \\ \end{array} \hfill \\ \begin{array}{*{20}l} {u_{4}^{1} } \\ {u_{1}^{2} } \\ \end{array} \hfill \\ \end{aligned} \right] = - A^{ - 1} B\left[ \begin{aligned} \begin{array}{*{20}l} {u_{1}^{1} } \\ {u_{2}^{2} } \\ \end{array} \hfill \\ \begin{array}{*{20}l} {u_{3}^{2} } \\ {u_{4}^{2} } \\ \end{array} \hfill \\ \end{aligned} \right] + A^{ - 1} \left[ \begin{aligned} {\begin{array}{*{20}l} {j_{x1}} \\ {h_{x1}} \\ {j_{x2}} \\ {h_{x2}} \\ \end{array}} \hfill \\ \end{aligned} \right] $$

(14)

where the superscript denotes the domain (i.e. \(u_{1}^{i} \in \Omega_{i}\)) and the matrices are given as:

$$ A = \left[ {\begin{array}{*{20}l} {N_{2}^{1} (x_{1} ,y_{1} )} & {N_{3}^{1} (x_{1} ,y_{1} )} & {N_{4}^{1} (x_{1} ,y_{1} )} & { - N_{1}^{2} (x_{1} ,y_{1} )} \\ {\nabla_{n} N_{2}^{1} (x_{1} ,y_{1} )} & {\nabla_{n} N_{3}^{1} (x_{1} ,y_{1} )} & {\nabla_{n} N_{4}^{1} (x_{1} ,y_{1} )} & { - \nabla_{n} N_{1}^{2} (x_{1} ,y_{1} )} \\ {N_{2}^{1} (x_{2} ,y_{2} )} & {N_{3}^{1} (x_{2} ,y_{2} )} & {N_{4}^{1} (x_{2} ,y_{2} )} & { - N_{1}^{2} (x_{2} ,y_{2} )} \\ {\nabla_{n} N_{2}^{1} (x_{2} ,y_{2} )} & {\nabla_{n} N_{3}^{1} (x_{2} ,y_{2} )} & {\nabla_{n} N_{4}^{1} (x_{2} ,y_{2} )} & { - \nabla_{n} N_{1}^{2} (x_{2} ,y_{2} )} \\ \end{array} } \right] $$

(15)

$$ B = \left[ {\begin{array}{*{20}l} {N_{1}^{1} (x_{1} ,y_{1} )} & { - N_{2}^{2} (x_{1} ,y_{1} )} & { - N_{3}^{2} (x_{1} ,y_{1} )} & { - N_{4}^{2} (x_{1} ,y_{1} )} \\ {\nabla_{n} N_{1}^{1} (x_{1} ,y_{1} )} & { - \nabla_{n} N_{2}^{2} (x_{1} ,y_{1} )} & { - \nabla_{n} N_{3}^{2} (x_{1} ,y_{1} )} & { - \nabla_{n} N_{4}^{2} (x_{1} ,y_{1} )} \\ {N_{1}^{1} (x_{2} ,y_{2} )} & { - N_{2}^{2} (x_{2} ,y_{2} )} & { - N_{3}^{2} (x_{2} ,y_{2} )} & { - N_{4}^{2} (x_{2} ,y_{2} )} \\ {\nabla_{n} N_{1}^{1} (x_{2} ,y_{2} )} & { - \nabla_{n} N_{2}^{2} (x_{2} ,y_{2} )} & { - \nabla_{n} N_{3}^{2} (x_{2} ,y_{2} )} & { - \nabla_{n} N_{4}^{2} (x_{2} ,y_{2} )} \\ \end{array} } \right] $$

(16)

The terms of (14) can then be used to define the transformation matrix and vector of prescribed values as before. The only difference being their dimension is now doubled as the transformation is now applied to the two overlapping elements. The resulting reduced matrices have the same dimension as a standard element.

### Cut element stability

Stability issues associated with cut elements arise from the fact that some of the degrees of freedom have very small support in the physical domain. This can lead to severe ill-conditioning of the system of equations and can have a detrimental affect on convergence [50]. In Rüberg et al. [44] (see also Höllig et al. [51]); stability was ensured through coupling degrees of freedom with small support to degrees of freedom within the interior of the domain using constraints.

In the present work, all degrees of freedom that lie outside of the physical domain (ghost degrees of freedom) are constrained. The ghost degrees of freedom are then removed from the system of equations. Before describing the approach, it is emphasised that this type of constraint is only applied to ghost nodes that are not already constrained by either essential boundary, or interface conditions.

The first step in the approach is, for all eligible ghost nodes, the nearest element, \(T_{nr}\), that lies entirely within the physical domain is found. Following this, the constraint equation is evaluated as:

$$ u^{gh} (x,y) = N^{T} (x,y)u_{e} - fd^{2} $$

(17)

where the vector of shape functions and nodal values are those associated with \(T_{nr}\) and \(d\) is the distance to the centre of \(T_{nr}\), from the centre of the nearest element to which \(u^{gh}\) belongs. A key thing to note about (17) is the fact that the shape functions are evaluated at the ghost node location that lies outside of the reference element. In the present work, the shape functions that are used in (17) use global coordinates, and as such their evaluation outside of the reference element is straightforward. The last term in (17) is included in order to account for the effect of the source term on the extrapolation.

Using (17), we can follow a similar procedure to before that leads to reduced matrices within which, the constraints are strongly enforced. A key difference is the fact that constraints of the type described in (17) lead to a larger support size and as such, the constraints are applied in the system assembly rather than at the element level.

To illustrate the procedure consider the two elements in Fig. 6, the first of which lies completely inside the physical domain, whilst the second is crossed by the domain boundary. In this case the nearest element interior to the domain has been identified and will be used to constrain the degree of freedom associated with the ghost node,\(gh\).