1 Introduction

Computational modeling has become an integral part of engineering of all types, and developments in manufacturing and design have increased the complexity of the models required. Multi-material problems are now ubiquitous, appearing in the design and analysis of composites [56], advanced additive manufacturing products [50], and multi-phase system analysis [72]. These new design spaces present challenges to modeling methods, primarily in the discretization of intricate geometries and domain interfaces, and the unique discontinuities in solutions that result from material interactions. Finite element methods (FEMs) are among the most widely used computational tools for structural analysis. Classical FEM relies on sufficiently refined boundary-fitted meshes to discretize both the geometric domain of a material and its solution’s function space. The accuracy of these methods is closely tied to mesh quality [12], especially when high-order methods are employed [22]. Thus, considerable care must be taken in mesh construction before analysis can be performed [41]. As the complexity of multi-material problems increases, generating these high-quality conforming meshes required by FEM becomes increasingly challenging, especially in three dimensions. Even for single material problems, mesh generation and refinement can consume up to 80% of the design-through-analysis time of engineers [10]. More complicated PDEs involving multiple state variables also present unique modeling challenges. In such multi-physics problems, the various fields may have distinct discretization needs and the fields must be coupled.

Immersed boundary methods circumvent conforming mesh generation by embedding the geometric problem domain into a background grid constructed on a geometrically simple domain. Initially proposed to track fluid–structure interfaces in [55], similar classes of immersed methods were likewise developed by the solid mechanics community to accommodate discontinuities in solution fields without remeshing to create boundary-fitted meshes. The partition of unity method (PUM), introduced in [4], leverages the concept of enriching solution functions using a priori knowledge of the location of discontinuities. This was combined with classical FEM in [65] and [64] to introduce the generalized finite element method (GFEM). A similar enriched method, characterized by adaptive enrichment schemes, known as the “eXtended" finite element method (XFEM) [8, 9, 48], was also introduced to model crack propagation and other discontinuous problems. Immersed boundary methods have also been extended to include high-order methods. The finite cell method [54, 57] utilizes p refinement of Lagrange polynomial basis functions to increase convergence rates within an immersed framework. In the field of meshfree methods, the concepts of immersed or embedded methods have been used to model heterogeneous materials [60] and to enhance solution accuracy and stability near material interfaces in fluid–structure interaction problems [32].

Isogeometric analysis (IGA) directly utilizes the geometric representation used in most computer-aided design (CAD) software in analysis [33] and was initially proposed to address the issue of generating high-quality boundary-fitted meshes. The B-spline basis functions used in IGA offer additional advantages over classical FEM including improved geometric representation, higher levels of continuity, and improved per-degree-of-freedom accuracy compared to more common nodal finite element basis functions [34, 35]. The combinations of IGA and immersed boundary methods are often called immersogeometric methods [39], and have been validated for use with hierarchically refined T-spline CAD models [58] and for ‘trimmed’ CAD geometries [14]. The XFEM class of enriched methods was applied to IGA to create the eXtended isogeometric method (XIGA) in [52], exploiting level-set geometric descriptions and sophisticated integration algorithms to solve complicated PDEs involving multiple materials. XIGA was extended to use truncated hierarchically refined B-splines (THB-splines) for multi-physics problems in [61].

While offering elegant solutions to the problem of modeling complex geometries, existing immersed boundary software is currently limited to custom research codes. This is in part due to the complexity of generating custom quadrature rules on each cut background element [19]. These custom quadrature rules require implementations that depart significantly from the highly optimized integration algorithms used in classical FEM codes. For example, an immersed boundary functionality called MultiMesh [36] was developed for the popular open-source FEM software FEniCS [1], however it proved too difficult to maintain and was not ported to the more recent FEniCSx [6].

Some classes of immersed boundary methods are specially formulated to reduce the difficulty of integrating over cut cells, including approximate domain methods and specifically the shifted boundary method [42, 43]. The shifted boundary method maps the boundaries of a computational domain to a mesh conforming surrogate domain and has been extended to high-order methods in [3]. Similar to the shifted boundary method, interpolation-based immersed methods like the one presented in this work provide the benefits of immersed methods without requiring invasive implementation of custom quadrature methods.

This work utilizes approximate extraction to retrofit classical FEM codes to perform immersed analysis. Extraction was introduced to represent B-spline basis functions with Bézier polynomials for implementation of IGA [11], and was generalized to Lagrange extraction in [59]. With Lagrange extraction, each spline in a B-spline function space is represented as a linear combination of Lagrange polynomials belonging to an interpolatory function basis \(\{N_i\}\), which satisfies the Kronecker delta property \(\delta _{ij} = N_i(\varvec{x}_j)\), where \(\varvec{x}_j\) are the nodal coordinates. Because of this interpolatory property, Lagrange extraction-based methods are also called interpolation-based methods. IGA and other partition of unity methods are challenging to implement as shape functions are not the same from element to element [47] making interpolation-based methods attractive. Lagrange extraction has been utilized to implement IGA within existing finite element software in [37, 38], which uses the software FEniCS, and in [68], which uses the software Code_Aster.

In [26], approximate extraction was applied to immersed boundary methods. In interpolation-based immersed boundary methods, a domain is embedded in a structured background mesh, which is used to define a background basis. A boundary-fitted foreground mesh is quickly generated by decomposing the cut elements of the background mesh. The foreground mesh, which does not need to adhere to the usual mesh quality metrics [41], is used to define a boundary-fitted Lagrange polynomial foreground basis. The background basis is interpolated with the foreground basis, and the interpolated basis can then be used to solve PDEs with Galerkin-type methods. As the interpolated basis is represented as a linear combination of Lagrange polynomials defined upon a boundary-fitted mesh, the integration can be performed with classical FE software, as illustrated with FEniCS in [26]. This work also employed B-spline background bases, combining immersed and isogeometric methods for an immersogeometric method. The interpolation-based immersogeometric method differs from previous extraction-based IGA methods in its use of approximate instead of exact extraction. With approximate extraction, the interpolated background basis is not everywhere equivalent to the actual background basis, resulting in additional interpolation error. The additional interpolation error is demonstrated to be bounded by the optimal method error, thus the method still yields optimal convergence rates. Easing exact interpolation constraints to permit approximate extraction allows for easier and more efficient implementation.

Previous work using interpolation-based immersed-boundary methods used a single uniform background basis for single material and single physics problems [26]. This work expands the applications of this method to multi-material and multi-physics problems with the following contributions:

  • Discontinuous state variable fields are approximated by background bases with Heaviside enrichment applied at material interfaces.

  • Material interfaces are described by level sets, and hierarchical refinement allows for local refinement.

  • Local foreground refinement is applied independently of background refinement, improving geometric approximation of material interfaces without increasing the number of system degrees of freedom.

  • Separate background bases are used to approximate different fields in multi-physics applications, which are interpolated using a single foreground basis, allowing for easy coupling.

An interpolation-based immersed boundary framework utilizing these developments is implemented in the next generation open-source software library FEniCSx [6], with code available at [25]. Multi-material heat conduction and linear elasticity are modeled to demonstrate the convergence rates of the proposed workflow. A coupled thermo-mechanical problem illustrates the combined multi-material and multi-physics capabilities of the interpolation-based immersed boundary framework.

The outline of this paper is as follows: Sect. 2 provides an overview of hierarchical B-splines and the generation of the THB-splines used for local refinement. Section 3 describes this method’s treatment of the geometric description of material interfaces and the Heaviside enrichment of solution spaces with discontinuities at material interfaces. Section 4 details the novel interpolation-based immersed boundary method’s application to multi-material and multi-physics problems and its implementation workflow within existing FEM codes. Section 5 provides numerical results validating and expanding upon this method, and finally Sect. 6 draws conclusions and suggests future work that can be done with this method.

2 Hierarchical B-splines

Immersogeometric analysis combines aspects of two classes of methods, immersed methods and isogeometric methods. As in isogeometric methods, this work employs splines to represent state variable fields. A review of multivariate B-spline functions spaces is provided in “Appendix A”. The following is a discussion of hierarchical refinement of B-spline functions spaces and an overview of the THB-spline spaces used in the application of interpolation-based immersogeometric methods to multi-material problems.

2.1 Hierarchically refined B-spline function spaces

Fig. 1
figure 1

Local refinement is applied through truncated hierarchically-refined B-splines (THB)

Hierarchiacally refined B-splines (HB-splines) are constructed using nested sequences of spline spaces created by repeated knot insertion. Following the algorithms presented in [27], an HB-spline basis begins with the construction of a sequence of r tensor-product spline spaces \(\mathcal {V}^l \),

$$\begin{aligned} \mathcal {V}^{0} \subset \mathcal {V}^{1} \subset \cdots \subset \mathcal {V}^{r-1}, \end{aligned}$$
(1)

each of which has an accompanying B-spline basis \(\mathcal {B}^l = \{B^l_{\varvec{i}}\}\), and tensor-product Cartesian mesh \(\mathcal {K}^l\), where elements are denoted by K. A sequence of subdomains \(\Omega ^l\) are chosen, such that \(\Omega ^{l+1}\) is a subregion of \(\Omega ^l\),

$$\begin{aligned} \Omega ^{0} \supseteq \ \Omega ^{1} \supseteq \cdots \supseteq \Omega ^{r-1}, \end{aligned}$$
(2)

and each \(\Omega ^l\) can be discretized with mesh elements \(K\in \mathcal {K}^l\). Here r is the depth of refinement.

The HB-spline basis \(\mathcal {H}:= \mathcal {H}^{r-1}\) is constructed recursively by the algorithm:

$$\begin{aligned} {\left\{ \begin{array}{ll} \mathcal {H}^0 &{}:=\mathcal {B}^0, \\ \mathcal {H}^{l+1} &{}:= \{ B \in \mathcal {H}^l \ \big | \ \text {supp}(B) \not \subset \Omega ^{l+1} \} \ \cup \\ &{} \quad \ \{ B \in \mathcal {B}^{l+1} \ \big | \ \text {supp}(B)\subset \Omega ^{l+1} \}, \\ &{} l \in \{ 0, \ldots , r-2\}. \end{array}\right. } \end{aligned}$$
(3)

In essence, each subsequent level’s basis \(\mathcal {H}^{l+1}\) is formed from the union of the set of basis functions from the previous level whose support is not in the new level’s subdomain \(\Omega ^{l+1}\), and the set of functions from the new basis \(\mathcal {B}^{l+1}\) whose support is within \(\Omega ^{l+1}\). This is illustrated with a 1D mesh in Fig. 1.

The hierarchically refined basis \(\mathcal {H}\) is associated with a hierarchically refined mesh \(\mathcal {K}\), defined as

$$\begin{aligned} \mathcal {K} := \bigcup _{l=0}^{r-1} \{K \in \mathcal {K}^l \ \big | \ K \in \Omega ^l \text { and } K \notin \Omega ^{l+1} \}. \end{aligned}$$
(4)
Fig. 2
figure 2

The function-wise enrichment strategy considers the material connectivity within a basis functions support. The function \(B_k\) spans two material subdomains, denoted \(\Omega ^1\) and \(\Omega ^2\), forming three disconnected material subregions \(\Omega ^{l=1}_k\), \(\Omega ^{l=2}_k\), and \(\Omega ^{l=3}_k\)

2.2 Enforcing the partition of unity property through truncation

While a useful tool for applying adaptive refinement to IGA, HB-spline bases violate the partition of unity (PU) property. To regain the this property, the hierarchically refined bases are truncated as in [27] and [28]. In addition to forming a partition of unity, truncation reduces the size of some basis functions’ supports, thereby reducing the bandwidth of the resulting system of equations when compared to a non-truncated HB-spline basis.

A given multivariate basis function \(B^l \in \mathcal {B}^l\) can be represented as a linear combination of the more refined functions of level \(\mathcal {B}^{l+1}\):

$$\begin{aligned} B^l = \sum _{B^{l+1} \in \mathcal {B}^{l+1}} c^{B^{l+1}}\big (B^l\big ) \ B^{l+1}, \end{aligned}$$
(5)

where \(c^{B^{l+1}} \big (B^{l}\big )\) are coefficients relating the coarse basis function \(B^l\) to the finer function \(B^{l+1}\).

The truncation of \(B^l\) removes the contributions from \(B^{l+1} \in \mathcal {B}^{l+1}\) with support contained within \(\Omega ^{l+1}\), such that

$$\begin{aligned} \text {trun}^{l+1}(B^l) = B^l - \! \! \! \! \! \! \! \! \! \! \sum _{\begin{array}{c} B^{l+1} \in \mathcal {B}^{l+1} , \\ \text {supp}(B^{l+1}) \subseteq \Omega ^{l+1} \end{array}} \! \! \! \! \! \! \! \! \! \! c^{B^{l+1}}\big (B^l\big ) \ B^{l+1}. \end{aligned}$$
(6)

Using a similar algorithm to that given in Eq. (3), the truncated basis \(\mathcal {T}:= \mathcal {T}^{r-1}\) can be constructed by

$$\begin{aligned} {\left\{ \begin{array}{ll} \mathcal {T}^0 &{}:= \mathcal {B}^0 , \\ \mathcal {T}^{l+1} &{}:= \{ \text {trun}^{l+1}(B) \ \big | \ B \in \mathcal {T}^l, \ \text {supp}(B) \not \subset \Omega _{l+1} \} \\ &{} \quad \cup \ \{ B \in \mathcal {B}^{l+1} \ \big | \ \text {supp}(B)\subset \Omega _{l+1} \}, \\ &{} l \in \{ 0, \ldots , r-2\}, \end{array}\right. } \end{aligned}$$
(7)

as illustrated in Fig. 1b. This truncated basis forms a partition of unity, as is proven in Theorem 10 of [28].

3 Immersed material interfaces

Workflows to solve multi-material PDEs require functionalities to both describe the geometry of material interfaces and to represent the associated discontinuities in the state variable fields. In this work, level set functions (LSFs) are utilized to implicitly describe the geometry of material interfaces, and a generalized Heaviside enrichment strategy in conjunction with a set of interface terms is employed to represent the required discontinuities at material interfaces.

3.1 Representing interface geometry through level set functions

The level set method, developed in [53], has been used to describe interfaces in the extended finite element method (XFEM) [8, 48] and extended isogeometric analysis (XIGA) [52, 61]. Following these works, the domain geometry is implicitly represented using LSFs \(\phi _i(\varvec{x})\). An iso-level \(\phi _t\) of the LSF describes the interface \(\Gamma _\pm \) between two subdomains \(\Omega _+\) and \(\Omega _-\) such that

$$\begin{aligned} \phi (\varvec{x})&< \phi _t, \varvec{x} \in \Omega _{+}, \nonumber \\ \phi (\varvec{x})&>\phi _t, \varvec{x} \in \Omega _{-} ,\nonumber \\ \phi (\varvec{x})&= \phi _t, \varvec{x} \in \Gamma _{\pm }. \end{aligned}$$
(8)

With n LSFs, this method can represent up to \(2^n\) subdomains. Materials are then associated with these subdomains using a multi-phase level set model as in [69], where phases are identified by phase indices \(\mathcal {P}\). Phase indices \(\mathcal {P}\) are assigned with characteristic functions \(f_i\),

$$\begin{aligned} f_i(\varvec{x}) = {\left\{ \begin{array}{ll} 0, \text { }&{} \phi _i(\varvec{x}) < \phi _t, \\ 1,\text { }&{} \phi _i(\varvec{x}) \ge \phi _t,\\ \end{array}\right. } \end{aligned}$$
(9)

such that

$$\begin{aligned} \mathcal {P}(\varvec{x}) = \sum _{j=1}^n 2^{j-1} f_j(\varvec{x}). \end{aligned}$$
(10)

Phases are then mapped onto material subregions.

In this work LSFs are discretized using linear basis functions from a THB-spline basis \(B_k \in \mathcal {T}\),

$$\begin{aligned} \phi ^h_i (\varvec{x}) = \sum _{k} B_k(\varvec{x}) \phi _i^k , \end{aligned}$$
(11)

where \(\phi _i^k\) are the coefficients associated with LSF \(\phi _i\). The LSF are linearly interpolated such that the coefficients are the nodal values \(\phi _i^k \equiv \phi _i(\varvec{x}_k)\). This discretization is used to construct material characteristic functions and to enrich background basis functions.

3.2 Heaviside enrichment of basis functions at material interfaces

Fig. 3
figure 3

A B-spline basis is defined on a structured background mesh and an example function \(B_k\) is depicted in (a). Using the geometry description of the material subdomains in (b), Heaviside enrichment is applied to form the discontinuous functions \(\psi ^1_k B_k\) and \(\psi ^2_kB_k\), depicted in (c) and (d) respectively. A Lagrange foreground function space is defined on the boundary-fitted mesh in (e). The function space is used to interpolate the enriched background functions \(\hat{\psi }^1_k \hat{B_k}\) and \(\hat{\psi }^2_k \hat{B_k}\), depicted in (f) and (g), respectively

Heaviside enrichment have been widely used in PUM [4], GFEM [65], and XFEM [9] as a means to represent strong discontinuities within elements. The enrichment strategies presented in most existing literature, such as in [31, 67], add enriched basis functions for each material domain.

While effective, these global enrichment strategies can lead to artificial numerical stiffening around small geometric features. This stiffening is caused by interpolation of a state variable field in locally disconnected domains of the same material by the same basis function as shown in Fig. 2. The high-order, higher-continuity B-spline basis functions with large supports employed in this work, alongside the complex material layouts presented in Sect. 5.3, would exacerbate local stiffening effects and lead to an increased solution error. Typically, h-refinement is used to avoid locally disconnected same-material domains within the region of support of any given basis function, increasing overall system size. This work instead adopts the enrichment strategy presented by [52] which considers the material connectivity in the individual basis functions’ supports.

As shown in Fig. 2, for a given function \(B_k\) with support \(supp (B_k)\), the phase IDs, defined in Eq. (10), are used to identify the \(L_k\) distinct but connected material subregions \(\Omega _k^m\), such that supp\((B_k) = \cup _{m=1}^{L_k} \Omega _k^m\). For \(L_k\) distinct subregions, the basis function \(B_k\) requires \(L_k\) enrichment levels.

This enrichment is then achieved through characteristic functions \(\psi _k^m\),

$$\begin{aligned} \psi _k^m(\varvec{x}) = {\left\{ \begin{array}{ll} 1, \text { if } \varvec{x} \in \Omega _k^m\\ 0, \text { else,} \end{array}\right. } \end{aligned}$$
(12)

such that the enriched basis functions can be expressed as

$$\begin{aligned} B^m_k(\varvec{x}) = \psi _k^m (\varvec{x}) B_k(\varvec{x}), \ \ \forall \ m \in \{1, \ldots , L_k\}. \end{aligned}$$
(13)

The enriched basis functions constructed from a single non-enriched basis function, are shown in Fig. 3 for a two-material configuration. The bi-quadratic B-spline \(B_k\) depicted in Fig. 3a is enriched assigning one material to the inside and one material to the outside of the ellipse shown in Fig. 3(b). The basis function \(B_k\) is split into two enriched functions, \(B^1_k(\varvec{x}) = \psi _1^m (\varvec{x}) B_k(\varvec{x})\) in Fig. 3c and \(B^2_k(\varvec{x}) = \psi _k^2 (\varvec{x}) B_k(\varvec{x})\) in Fig. 3d allowing for the representation of strong discontinuities at the material interface. Interface conditions are enforced weakly; for example \(C^0\) continuity can be enforced at the interface using Nitsche’s method [2].

4 The interpolation-based immersed boundary method

One of the core challenges associated with classic immersed methods is the construction of custom quadrature rules for the various material regions within each intersected background element. Numerous solutions exist and have been used in custom research codes, such as octree refinement [20, 39, 57], interface reconstruction and tessellation [15, 24, 46], moment-fitting [49, 66], and quadrature schemes using generalized Stokes theorem [29, 30, 63]. However, the generation of such quadrature rules can generally not be implemented within existing finite element software without major changes to the software itself.

The interpolation-based immersed approach is instead designed to utilize the integration subroutines of existing FEM codes. To this end, a boundary-fitted foreground mesh is constructed with only minimal requirements on mesh quality. Element formation is then performed on the poor quality boundary-fitted mesh using existing standard finite element routines. Using Lagrange extraction operators [59] the resulting tangent matrix and force vector are projected into the enriched THB-spline space. This can be done either on an elemental level during assembly, or globally afterwards. The resulting final problem uses an approximation of the enriched function space of the background mesh which is interpolated by the basis functions of the foreground mesh.

The following Sect. 4.1 will first introduce the thermo-elastic model problem. Section 4.2 will provide an overview of the interpolation-based approach specific to the multi-material, multi-physics problems presented in this paper. For a more general and comprehensive introduction to the approach, we refer the reader to the authors’ previous work on the topic [26]. The generation of the boundary-fitted foreground mesh is discussed in Sect. 4.3.

4.1 Multi-material and multi-physics model problem

To illustrate the application of interpolation-based immersed boundary methods to multi-material and multi-physics problems, a thermo-elastic problem is introduced. This problem can be broken into a thermal subproblem and a structural subproblem.

Let a domain of interest \(\Omega \) with closure denoted \(\overline{\Omega }\) be composed of n material subdomains \(\mathcal {M} = \{1, \cdots , n \}\)

$$\begin{aligned} \overline{\Omega } = \bigcup _{m \in \mathcal {M} } \overline{\Omega }^{m} \quad \subset \mathbb {R}^{d_p}. \end{aligned}$$
(14)

A different thermal conductivity \(\kappa ^m\) may be associated with each material m

$$\begin{aligned} \kappa (\varvec{x}) = \kappa ^m \text {, } ~&\varvec{x} \in \Omega ^m, \end{aligned}$$
(15)

for \(m \in \mathcal {M}\). A source term \(f:\Omega \rightarrow \mathbb {R}\), a boundary heat flux term \(\overline{q}:\partial \overline{\Omega }\rightarrow \mathbb {R}\) on \(\Gamma _{\bar{q}} \!\subset \! \partial \overline{\Omega }\), and Dirichlet boundary data \(\overline{T}:\partial \overline{\Omega }\rightarrow \mathbb {R}\) on \(\Gamma _{\overline{T}} \! \subset \!\partial \overline{\Omega }\) are ascribed. The strong form for the thermal problem then reads as: Find \(T: \Omega \rightarrow \mathbb {R}\) such that \(\forall \) \(m\in \mathcal {M}\)

$$\begin{aligned} -\varvec{\nabla }\varvec{\cdot } ( \kappa (\varvec{x})\varvec{\nabla }T )= & {} f ~~~ \text { in } \Omega ^m \text {,} \nonumber \\ {[}\![ T]\!]= & {} 0 ~~~ \text { on all } \Gamma _{km}, \nonumber \\ {[}\![ \varvec{q}]\!]= & {} 0 ~~~ \text { on all } \Gamma _{km}, \nonumber \\ - \kappa (\varvec{x}) \varvec{\nabla }T \cdot \varvec{n}= & {} \overline{q} ~~~ \text { on } \Gamma _{\bar{q}}^m \text {,} \nonumber \\ T= & {} \overline{T} ~~~ \text { on } \Gamma _{\overline{T}}^m \text {,} \end{aligned}$$
(16)

where \(\Gamma _{km }= \overline{\Omega }^k \cap \overline{\Omega }^m \ne \emptyset \), with \(k\in \mathcal {M}\) and \( k \ne m\), are the material interfaces, and \([\![ \cdot ]\!] = (\cdot )^{k} - (\cdot )^{m}\) is the jump of a given quantity over an interface \(\Gamma _{km}\). The material fields are defined \(T^m =T(\varvec{x})\), \(\varvec{x} \in \Omega ^m\), and \( \varvec{q}^m = - \kappa ^m \varvec{\nabla }T^m\). The domains \(\Gamma _{\bar{q}}^m = \Gamma _{\bar{q}} \cup \partial \overline{\Omega }^m\), and \(\Gamma _{\overline{T}}^m = \Gamma _{\overline{T}} \cup \partial \overline{\Omega }^m\) are the intersections of the domain boundaries with the material subdomain boundaries. \(\varvec{n}\) denotes the surface normal.

The domain of interest \(\overline{\Omega }\) is embedded into a hierarchically refined background mesh \(\mathcal {K}_T\), generated using the sequence of refined meshes \(\mathcal {K}^l\) and subdomains \(\Omega _{T}^l\).Footnote 1 Note that the largest subdomain \(\Omega _{T}^0\) must be chosen such that the closure of the domain of interest is a subset, \(\overline{\Omega }\subset \Omega _T^0\). The mesh \(\mathcal {K}_T\) is associated with the enriched THB-spline basis \(\mathcal {T}_T = \{B^T_{i}\}\). The temperature field is discretized using the function space

$$\begin{aligned} \mathcal {V}^h_T = \text {span}\{B^T_i \ \big | \ \text {supp}(B^T_i) \cap \overline{\Omega }\ne \emptyset \}. \end{aligned}$$
(17)

The discrete form can then be defined as: Find \(T^h \in \mathcal {V}^h_T\) such that \(\forall \) \(\theta ^h\in \mathcal {V}^h_T\),

$$\begin{aligned}&\sum _{m=1}^n \left[ \int _{\Omega ^m} \! \! \kappa \varvec{\nabla }T^h \varvec{\cdot } \varvec{\nabla }\theta ^h d\Omega \right] - \int _{\Omega } f \theta ^h d\Omega - \int _{\Gamma _{\overline{q}}} \overline{q} \theta ^h d\Gamma \nonumber \\&\quad = \mathcal {R}^{D}_T + \mathcal {R}^I_T \text { ,} \end{aligned}$$
(18)

where \(\mathcal {R}^{D}_T\) and \( \mathcal {R}^{I}_T\) are Dirichlet and interface residual terms. The temperature Dirichlet residual is the result of Nitsche’s method [51] enforcement of the Dirichlet boundary condition,

$$\begin{aligned} \mathcal {R}^{D}_T =&\sum _{m=1}^n \Bigg [\mp \int _{\Gamma _{\overline{T}}^m} \kappa (T^h - \overline{T}) (\varvec{\nabla }\theta ^h \cdot \varvec{n}) \,d\Gamma \nonumber \\&-\int _{\Gamma _{\overline{T}}^m} \kappa \theta ^h(\varvec{\nabla }T ^h\cdot \varvec{n})\,d\Gamma \nonumber \\&+ \int _{\Gamma _{\overline{T}}^m}\frac{\beta ^{D}_T \kappa }{h}(T^h - \overline{T} ) \theta ^h\,d\Gamma \Bigg ], \end{aligned}$$
(19)

where \(\beta ^{D}_T \ge 0\) is a user defined constant. The first integral of Eq. (19) will be negative for the symmetric version of Nitsche’s method (which is employed in numerical examples in this work) or positive for the non-symmetric version. h is taken as the characteristic element size on the foreground mesh, differing from the usual implementation where h is the element size on the background mesh.

The temperature interface conditions, lines 2 and 3 of Eq. (16), are also enforced through a Nitsche-like method, resulting in the temperature interface residual

$$\begin{aligned} \mathcal {R}^{I}_T =&\sum \limits _{i=1}^n \sum \limits _{j=i+1}^n \Bigg [- \int _{\Gamma _{ij}} [\![ T^h ]\!] \{ \kappa \varvec{\nabla }\theta ^h \} \cdot \varvec{n}) \,d\Gamma \nonumber \\&- \int _{\Gamma _{ij}} [\![ \theta ^h ]\!] \{\kappa \varvec{\nabla }T ^h\} \cdot \varvec{n})\,d\Gamma \nonumber \\&+ \int _{\Gamma _{ij}} \gamma ^{ij}_T [\![ T^h ]\!] [\![ \theta ^h]\!] \,d\Gamma \Bigg ], \end{aligned}$$
(20)

where \(\{\cdot \} = w^{i}(\cdot )^{i} - w^{j}(\cdot )^{j}\) is the weighted average of a given quantity. Motivated by the formulation in [2], these weights are defined as

$$\begin{aligned} w^{i}&= \dfrac{ (h^{i})^{d_p} / \omega ^{i} }{(h^{i})^{d_p} / \omega ^{i} + (h^{j})^{d_p} / \omega ^{j} } \ \text { and } \nonumber \\ w^{j}&= \dfrac{ (h^{j})^{d_p} / \omega ^{j} }{(h^{i})^{d_p} / \omega ^{i} + (h^{j})^{d_p} / \omega ^{j} } , \end{aligned}$$
(21)

where \(h^{m}\) is the characteristic size of the foreground element in domain \(\Omega ^{m}\) bordering the interface facet, \(\omega ^m\) is the characteristic material parameter, which for the thermal subproblem is \(\kappa ^m\), and \(d_p\) is the domain dimension. The penalty parameter \(\gamma ^{ij}_T \) is defined as

$$\begin{aligned} \gamma ^{ij}_T = 2 \beta ^{I}_T \dfrac{(h^{i})^{d_p-1} + (h^{j})^{d_p-1}}{(h^{i})^{d_p} / \omega ^{i} + (h^{j})^{d_p} / \omega ^{j} }, \end{aligned}$$
(22)

where \(\beta ^{I}_T \ge 0\) is a user specified constant.

The thermal subproblem can be stated compactly as the variational problem: Find \(T^h \in \mathcal {V}^h_T\) such that \(\forall \ \theta ^h\in \mathcal {V}^h_T\)

$$\begin{aligned} a_T(T^h, \theta ^h) = L_T(\theta ^h), \end{aligned}$$
(23)

where \(a_T(T,\theta )\) and \(L_T(\theta )\) can be computed from Eq. (18).

The structural subproblem may utilize a differently refined background discretization. In this case a separate sequence of refined domains \(\Omega _{u}^l\) may be selected. The structural subproblem’s background mesh \(\mathcal {K}_u\) is constructed with this sequence of subdomains and the same sequence of refined tensor-product Cartesian grids \(\mathcal {K}^l\). The basis \(\mathcal {T}_u = \{B^u_{i}\}\) associated with the mesh is used for the components of the displacement field \(\varvec{u}\). Each displacement component is discretized using the function space

$$\begin{aligned} \mathcal {V}^h_u = \text {span}\{B^u_i\ \big | \ \text {supp}(B^u_i) \cap \Omega \ne \emptyset \}. \end{aligned}$$
(24)

Using a similar derivation (given in full in “Appendix B”) as applied to the temperature subproblem the mechanical variation problem is compactly written as: Find \(\varvec{u}^h \in \varvec{\mathcal {V}}^h_u = [\mathcal {V}^h_u, \mathcal {V}^h_u]\) such that, \(\forall \varvec{v}^h\in \varvec{\mathcal {V}}^h_u\)

$$\begin{aligned} a_u(\varvec{u}^h,\varvec{v}^h) = L_u(\varvec{v}^h). \end{aligned}$$
(25)

The two subproblems are coupled through a constitutive model accounting for the thermal expansion by computing the mechanical strain \(\varvec{\varepsilon }_{m}\) as

$$\begin{aligned} \varvec{\varepsilon }_m (\varvec{u},T)&= \varvec{\varepsilon }_{u}(\varvec{u}) - \varvec{\varepsilon }_T(T) \nonumber \\&= \dfrac{1}{2}\left( \varvec{\nabla }\varvec{u}+ (\varvec{\nabla }\varvec{u})^{\text {T}} \right) - \alpha (T - T_0)\varvec{I}, \end{aligned}$$
(26)

where \(\alpha \) is the thermal expansion coefficient and \(T_0\) is the temperature in the reference configuration. \(\varvec{I}\) is the identity matrix.

The fully coupled system is then given by the variational problem: Find \((\varvec{u}^h,T^h) \in [\varvec{\mathcal {V}}^h_u, \mathcal {V}^h_T]\) such that, \(\forall \) \((\varvec{v}^h,\theta ^h)\in [\varvec{\mathcal {V}}^h_u, \mathcal {V}^h_T]\)

$$\begin{aligned} a_T(T^h, \theta ^h)&= L_T(\theta ^h) \text { and } \nonumber \\ a_u(\varvec{u}^h, \varvec{v}^h) - b (T^h,\varvec{v}^h)&= L_u(\varvec{v}^h), \end{aligned}$$
(27)

where the form \(b (T,\varvec{v})\) is a result of the coupling conditions and is given by

$$\begin{aligned} b(T,\varvec{v}) =&\sum _{m=1}^n \Bigg [ \int _{\Omega ^m}\varvec{\varepsilon }^u(\varvec{v}) : \varvec{\varepsilon }^T( T) \text {d}\Omega \Bigg ] \nonumber \\&+ \int _{\Gamma _{\overline{u}}} \varvec{C}:\varvec{\varepsilon }^T(T) \cdot \varvec{n} \cdot \varvec{v}^h \text {d}\Gamma \nonumber \\&-\sum \limits _{i=1}^n \sum \limits _{j=i+1}^n \Bigg [ \int _{\Gamma _{ij}} [\![ \varvec{v} ]\!] \cdot \{\varvec{C}:\varvec{\varepsilon }^T(T)\} \cdot \varvec{n}\,d\Gamma \Bigg ]. \end{aligned}$$
(28)

4.2 Interpolated basis functions

In traditional immersed boundary methods custom quadrature rules would be used to evaluate the integral in the weak form of the coupled problem, given in Eq. (27). The main idea of the interpolation-based immersed paradigm is to interpolate the background basis functions using a space of Lagrange functions defined on a foreground mesh, which can be integrated with classical quadrature methods. This workflow thus introduces an interpolated background function space for the thermal subproblem

$$\begin{aligned} \widehat{\mathcal {V}}^h_T&= \text {span}\{\widehat{B}^T_i \ \big | \ \text {supp}(\widehat{B}^T_i) \cap \Omega \ne \emptyset \}, \end{aligned}$$
(29)

where the interpolated basis functions are defined as

$$\begin{aligned} \widehat{B}^T_i&:=\sum _{j=1}^\nu M_{ij}^T N_j \end{aligned}$$
(30)

where

$$\begin{aligned} M^T_{ij} := B^T_i(\varvec{x}_j) \end{aligned}$$
(31)

is the Lagrange extraction operator. \(\{N_j\}_{j=1}^\nu \) is the basis of a Lagrange FE space with nodal points \(\varvec{x}_j\) such that \(N_i(\varvec{x}_j) = \delta _{ij}\). Here \(\nu \) is the number of foreground basis functions. The same foreground space is used to interpolate the background bases for both the temperature and the displacement state variables.

The approximations of the temperature field becomes

$$\begin{aligned} T^h&= \sum _{i=1}^{n_T} \widehat{B}^T_i d^T_i= \sum _{i=1}^{n_T} \sum _{j=1}^{\nu } M^T_{ij} N_j d^T_i , \end{aligned}$$
(32)

where \(\{d^{T}_i\}_{i=1}^{n_{T}}\) are the unknown coefficients and \(n_T\) is the number of basis functions in the temperature field’s interpolated background B-spline basis. The displacement is similarly discretized with vector valued function spaces as

$$\begin{aligned} \varvec{u}^h&= \sum _{I=1}^{(d_p\cdot n_u)} \widehat{\varvec{B}}^u_I d^{\varvec{u}}_I= \sum _{I=1}^{(d_p\cdot n_u)} \sum _{J=1}^{(d_p\cdot \nu )} M^{\varvec{u}}_{IJ} \varvec{N}_J d^{\varvec{u}}_I. \end{aligned}$$
(33)

Details regarding this discretization are given in “Appendix B”.

The variational problem in Eq. (27) can be assembled using the interpolated bases in Eqs. (32) and (33) to form the linear system

$$\begin{aligned} \begin{bmatrix} \varvec{K}^{\theta \theta } &{} \varvec{0} \\ \varvec{K}^{\theta \varvec{v}} &{} \varvec{K}^{\varvec{v} \varvec{v}} \end{bmatrix} \begin{bmatrix} \varvec{d}^T \\ \varvec{d}^{\varvec{u}} \end{bmatrix} = \begin{bmatrix} \varvec{f}^{\theta } \\ \varvec{f}^{\varvec{v}} \end{bmatrix}, \end{aligned}$$
(34)

where

$$\begin{aligned} K^{\theta \theta }_{ij}&= a_{T}(\widehat{B}^T_i, \widehat{B}^T_j), \end{aligned}$$
(35)
$$\begin{aligned} K^{\theta \varvec{v}}_{iJ}&= b(\widehat{B}^T_i, \widehat{\varvec{B}}^{\varvec{u}}_J), \end{aligned}$$
(36)
$$\begin{aligned} K^{\varvec{v} \varvec{v}}_{IJ}&= a_{\varvec{u}}(\widehat{\varvec{B}}^{\varvec{u}}_I, \widehat{\varvec{B}}^{\varvec{u}}_J), \end{aligned}$$
(37)
$$\begin{aligned} f_i^{\theta }&= L_T( \widehat{B}^T_i), \quad \text { and } \end{aligned}$$
(38)
$$\begin{aligned} f_i^{\varvec{v}}&= L_u(\widehat{\varvec{B}}^{\varvec{u}}_I) \end{aligned}$$
(39)

are the matrix entries.

By consolidating the extraction operators for all components in a single matrix

$$\begin{aligned} \varvec{M} = \begin{bmatrix} \varvec{M}^{T} &{} \varvec{0} \\ \varvec{0} &{} \varvec{M}^{\varvec{u}} \end{bmatrix} \end{aligned}$$
(40)

the linear system can be rewritten as

$$\begin{aligned} \varvec{M}^{\text {T}} \begin{bmatrix} \varvec{A}^{\theta \theta }&{} \varvec{0} \\ \varvec{A}^{\theta \varvec{v}} &{} \varvec{A}^{\varvec{v} \varvec{v}} \end{bmatrix} \varvec{M} \begin{bmatrix} \varvec{d}^T \\ \varvec{d}^{\varvec{u}} \end{bmatrix} = \varvec{M}^{\text {T}} \begin{bmatrix} \varvec{b}^{\theta } \\ \varvec{b}^{\varvec{v}} \end{bmatrix}, \end{aligned}$$
(41)

where

$$\begin{aligned} A^{\theta \theta }_{ij}&= a_{T}(N_i, N_j), \end{aligned}$$
(42)
$$\begin{aligned} A^{\theta \varvec{v}}_{iJ}&= b(N_i, \varvec{N}_J), \end{aligned}$$
(43)
$$\begin{aligned} A^{\varvec{v} \varvec{v}}_{IJ}&= a_{\varvec{u}}(\varvec{N}_I, \varvec{N}_J), \end{aligned}$$
(44)
$$\begin{aligned} b_i^{\theta }&= L_T(N_i), \quad \text { and } \end{aligned}$$
(45)
$$\begin{aligned} b_I^{\varvec{v}}&= L_u(\varvec{N}_I). \end{aligned}$$
(46)

The quantities \(\varvec{A}^{\theta \theta }\), \(\varvec{A}^{\theta \varvec{v}}\), \(\varvec{A}^{\varvec{v} \varvec{v}}\), \(\varvec{b}^{\theta }\), and \(\varvec{b}^{\varvec{v}}\) are evaluated and assembled on the boundary-fitted foreground mesh. As the foreground basis is the typical conforming Lagrange polynomial basis, existing commercial or open-source FE software applying standard quadrature rules may be utilized.

The extraction operators can either be computed globally, as suggested in Eq. (42), or on an element level for more efficient implementation. However, the latter option requires a modification of the assembly maps in existing FE software. After solving the linear system in Eq. (41) with the interpolated basis, the solution is post-processed by projecting the solution for each field onto the foreground basis.

A visual example of the interpolation of an enriched B-spline basis function is given in Fig. 3. The boundary-fitted foreground mesh in Fig. 3(e) is used to define a discontinuous Lagrange polynomial foreground function space. The enriched background functions \(B_k^1\) and \(B_k^2\) are interpolated with this function space, as shown in Fig. 3(f) and (g).

In this work, B-spline background spaces are utilized to exploit their superior approximation properties as compared to traditional finite element function spaces [23] and to build upon previous work done with enriched THB-splines in XIGA implementations [61]. The interpolation scheme presented here can be utilized with other background basis functions as in the previous work by the authors [26], where both B-splines and classic Lagrange polynomial bases were used. The method can be applied to multi-material problems provided the background basis used is sufficiently enriched at material interfaces.

4.3 Foreground mesh generation

Fig. 4
figure 4

A series of uniformly refined meshes \(\mathcal {K}^l\) is shown in the top row. Series of nested subdomains, \(\Omega ^{l+1}_T \subseteq \Omega ^l_T\), shown in the second row, and \(\Omega ^{l+1}_u \subseteq \Omega ^l_u\), shown in the third row, are defined for each state variable. For the decomposition mesh the series of subdomains \(\Omega ^l_{D}\), shown in the last row, is defined such that the domain on each level l contains the union of the \(l^{\text {th}}\) level domains for both variable fields. The hierarchically refined meshes \(\mathcal {K}_T\), \(\mathcal {K}_u\), and \(\mathcal {K}_D\), shown in the rightmost column, are constructed with the mesh series \(\mathcal {K}^l\) in the top row and their respective subdomain series

Both state variable fields are interpolated using the same Lagrange FE space \(\{N_j\}_{j=1}^\nu \) which is constructed on a boundary-fitted foreground mesh. To generate this foreground mesh, the elements of a background mesh intersected by interfaces are decomposed into triangles and tetrahedrons whose facets approximately reconstruct the interfaces.

To ensure the foreground mesh is sufficiently refined, a background mesh for decomposition \(\mathcal {K}_{D}\) is constructed from the series of hierarchically refined meshes \(\mathcal {K}^l\),

$$\begin{aligned} \mathcal {K}_{D} := \bigcup _{l=0}^{r-1} \{K \in \mathcal {K}^l| K \in \Omega _{D}^l \text { and } K \notin \Omega _{D}^{l+1} \}, \end{aligned}$$
(47)

where \(\Omega _{D}^l \supseteq \Omega _{T}^l \cup \Omega _{u}^l \) is a series of subdomains containing the union of the subdomains used for each subproblem’s discretization. This ensures that \(\mathcal {K}_{D}\) is at least as refined as the meshes used for each subproblem’s discretization and allows for additional refinement of the foreground to improve geometric resolution. The construction of a decomposition mesh \(\mathcal {K}_{D}\) is illustrated in Fig. 4.

The decomposition mesh \(\mathcal {K}_{D}\) is triangulated by first applying a pre-defined triangulation to the intersected background elements, as shown in Fig. 5a, b. This pre-defined triangulation forms 4 triangular elements in 2D domains or 24 hexahedral elements in 3D. Through root finding along elemental edges, the location of the isocontour is found, indicated by the black dots in Fig. 5b. A subdivision template is then applied to each intersected triangle/tetrahedron, as shown in Fig. 5c, to further subdivide the triangles/tetrahedrons into a set of triangles and tetrahedrons whose facets follow the LS isocontour. The last step is repeated recursively for each individual LSF \(\phi ^h_i\) which enables sharp geometric corners and edges to be captured where multiple interfaces meet. This approach has been used previously by, e.g., [62]. The resulting approximation of the interface is piecewise linear and depends on the resolution of the decomposition mesh \(\mathcal {K}_{D}\).

Fig. 5
figure 5

Foreground integration meshes are formed by triangulating cut elements of the decomposition mesh \(\mathcal {K}_{D}\). a A cell is intersected by the isocontour of the discretized level set function \(\phi ^h = \phi _t\) defining a material interface. b The cell is subdivided into triangular cells and isocontour-edge intersections (indicated by black cicles) are computed. c Using the intersection points as nodal points, the cell is further subdivided

Note that the sliver elements and poor aspect ratios in meshes produced by this method are still suitable for the interpolation of the background basis functions which is not bound by the typical mesh quality constraints of traditional FEM [40]. The resulting foreground mesh is of mixed element type (triangles and quadrilaterals in 2D, or hexahedrons and tetrahedrons in 3D) and contains hanging nodes. To accommodate the hanging nodes on the foreground mesh and to adequately interpolate the discontinuous enriched background basis functions described in Sect. 3.2, this method employs discontinuous Galerkin type elements for foreground function spaces. As the original THB-spline background basis maintains at minimum \(C^{p-1}\) continuity within each material domain, the continuity of the interpolated basis is likewise \(C^{p-1}\) continuous where interpolation is exact [59]. This work expands upon previous results using approximate extraction methods [26], where the constraints placed on the foreground Lagrange basis are lessened while numerical accuracy is maintained.

The sliver elements resulting from this procedure do not themselves present problems with the interpolation-based workflow. However, due to the arbitrary location of material interfaces with respect to cell boundaries, it is possible for cells to be cut such that only a small portion of a basis function’s support resides inside a given material domain. These small cell cuts result in sparsely supported basis functions, which can present issues with stability and linear conditioning.

Numerous strategies exist to mitigate these issues and were recently reviewed in [18]. Strategies include basis function removal [21], ghost stabilization [13], and basis function agglomeration [5] or extension [14], and have the potential to be implemented within the presented interpolation-based framework. The benchmark problems presented in this work do not require special treatment of sparsely support basis functions and the authors leave the implementation of these stabilization strategies to future work.

5 Numerical results

The accuracy of the proposed method is demonstrated through the study of several benchmark problems. Problems were defined in the Python-based open-source FE code FEniCSx, using foreground meshes and extraction operators generated by the open-source XIGA code MORIS, available at github.com/kkmaute/moris [45]. The source code with which the results were generated is also available at github.com/jefromm/EXHUME_dolfinX [25].

5.1 Resolving discontinuities in solution fields through Heaviside enrichment

Fig. 6
figure 6

The geometric configurations for the 2D (left) and 3D (right) domains. A three-material beam is embedded in a structured background grid and rotated such that material interfaces do not align with element edges (in 2D) or facets (in 3D). Elements intersected by the level set functions defining the beam geometry are triangulated to form a boundary-fitted foreground mesh

Fig. 7
figure 7

The temperature solution field plotted for both domain geometries, using a bi(tri)-quadratic B-spline basis interpolated with a bi(tri)-quadratic foreground Lagrange space. The solution is weakly discontinuous at material interfaces

Fig. 8
figure 8

Ideal convergence rates are seen for both bi(tri)-linear and quadratic B-spline basis functions, which were interpolated with equal order foreground Lagrange function spaces. The convergence rates are ideal for both the 2D domain (top) and 3D domain (bottom)

In this Subsection, a multi-material beam undergoing a spatially varying heat load presents a weakly discontinuous temperature solution field. In this work, weak discontinuities refer to discontinuities in the gradients of solution fields. The solution is approximated with an interpolated Heaviside-enriched background basis, using the interpolation-based immersed boundary workflow. The convergence results from this study demonstrate the accuracy of this method’s enrichment scheme for multi-material problems. Beams in both 2D and 3D domains are considered.

The beam is initially defined with corner coordinates (0, 0) and (LH) in 2D, and (0, 0, 0) and (LHH) in 3D, with \(L=5\) and \(H = 1\). The beam is divided into 3 sections, with interfaces at \(x = L/4\) and \(x= 3\,L/4\). Each section of the beam is assigned a thermal conductivity \(\kappa _1 = 1.0\), \(\kappa _2 = 0.1\), and \(\kappa _3 = 1.0\). To ensure the non-conformity of the material interfaces with respect to the background mesh facets, the 2D beam is rotated about the origin by angle \(\phi = 20^\circ \), while the 3D beam is rotated about y- and z-axes by angles \(\phi _y = -5^\circ \) and \(\phi _z = 5^\circ \), respectively. The 2D beam is embedded into rectangle with corner coordinates (\(-\)1.0, \(-\)0.5) and (5,3) and the 3D beam is embedded into a rectangular prism with corner coordinates (\(-\)0.5, \(-\)0.25,\(-\)0.25) and (5.5,1.75,1.75). The geometric configurations are shown in Fig. 6. Each edge (in 2D) or plane (in 3D) of the beam is defined by a level set function which extends beyond the beam domain in the mesh. The functions are extended through the entire mesh to fully resolve the corners (in 2D) or edges (in 3D) of the beam.

Thermal diffusion is governed by the Poisson equation. The strong and weak forms of this problem are given by Eqs. (16) and (18) in Sect. 4.1. The source term

$$\begin{aligned} q_{B} = - \varvec{\nabla }\cdot (\kappa \varvec{\nabla }T_{ex}) \end{aligned}$$
(48)

is constructed from the exact solution

$$\begin{aligned} T_{ex}(x') = \dfrac{1}{\kappa }\sin \left( \dfrac{4\pi }{L} x'\right) . \end{aligned}$$
(49)

In 2D the beam-aligned coordinate is expressed in global coordinates as

$$\begin{aligned} x' = x \cos (-\phi ) - y \sin (-\phi ), \end{aligned}$$
(50)

and in 3D

$$\begin{aligned} x' = z \sin (-\phi _y) + \big (x \cos (-\phi _z)\!-\!y \sin (-\phi _z)\big ) \cos (-\phi _y), \end{aligned}$$
(51)

where \(\varvec{x} = [x,y,z]\) are the mesh coordinates. The exact solution is imposed as Dirichlet boundary data on the ends of the bar, \(x'=0\) and \(x'=L\).

For the 2D domains a suite of meshes with average background element sizes \(h\in 0.5 \times [1,0.5,0.25,0.125,0.0625]\) was used. In 3D, the background element sizes \(h\in 0.58\times [1, 0.5,0.25,0.125]\) were used. The foreground meshes were constructed with the workflow described in Sect. 4.3. Results from the 2D mesh with background element size \(h = 0.5\) and from the 3D mesh with background element size \(h = 0.29\) using bi(tri)-quadratic Lagrange foreground bases to interpolate bi(tri)-quadratic enriched B-spline bases are shown in Fig. 7. Convergence rates are plotted in Fig. 8 for both bi(tri)-linear and quadratic enriched background spline spaces interpolated with equal-order foreground bases. Ideal convergence rates validate the interpolation-based immersed boundary workflow for multi-material problems.

5.2 Approximating curved geometries through local foreground refinement

Fig. 9
figure 9

Approximated radial displacement of the eigenstrain problem. The background mesh is shown in white, while the foreground integration mesh is overload in black. The background mesh remains the same as local refinement is applied to the foreground for improved geometric resolution. The images correspond to the coarsest refinement level with background element size \(h = 0.625\)

Fig. 10
figure 10

Error convergence data for the eigenstrain problem, illustrating the efficacy of foreground refinement. With no foreground refinement, the \(L^2\) convergence rate is limited by the geometric error. With sufficient foreground refinement (3x LR), the convergence rate approaches the ideal of 3

A major challenge in the modeling of multi-material problems is the discretization of material interfaces. In this work, local refinement of the foreground mesh is performed to increase geometric resolution without affecting the number of degrees of freedom in the solution space. In this example the linear elastic behavior of an infinite plate with an embedded circular inclusion of radius \(R=0.5\) is modeled, with local refinement employed to improve the approximation of the inclusion geometry.

The inclusion is comprised of Material 1 with Lamé constants \(\lambda _1= 497.16\) and \(\mu _1= 390.63\), while the exterior plate is made of Material 2 with \(\lambda _2 = 656.79\), and \(\mu _2 = 338.35\). A uniform isotropic eigenstrain of \(\varepsilon _0=0.1\) is imposed on the inclusion. The weakly discontinuous analytic solution for the radial displacement is given in [70] as

$$\begin{aligned} u_r = {\left\{ \begin{array}{ll} C_1 r, &{} r\le R, \\ C_1 \dfrac{R^2}{r}, &{} r\ge R, \\ \end{array}\right. } \end{aligned}$$
(52)

where

$$\begin{aligned} C_1 = \dfrac{(\lambda _1 + \mu _1)\varepsilon _0}{\lambda _1 + \mu _1 + \mu _2}. \end{aligned}$$
(53)

Exploiting symmetry, only the upper right quadrant of the plate is modeled as shown in Fig. 9. Symmetry conditions are enforced on the left and bottom edges of the domain, and the exact displacement is prescribed on the right and top edges. The solution domain is a \(5\times 5\) square, with a quarter circle at the lower left corner.

The strong and discrete forms of the multi-material linear elasticity PDE are detailed in “Appendix B”. For this example the mechanical strain is computed by

$$\begin{aligned} \varvec{\varepsilon }_m (\varvec{u}) = {\left\{ \begin{array}{ll} \varvec{\varepsilon }_u(\varvec{u}) - \varepsilon _0 \varvec{I} \text {, } &{}\varvec{x} \in \Omega _1\\ \varvec{\varepsilon }_u(\varvec{u}) \text {, } &{}\varvec{x} \in \Omega _2\\ \end{array}\right. } \end{aligned}$$
(54)

where the total strain \(\varvec{\varepsilon }_u(\varvec{u}) = \frac{1}{2} ( \varvec{\nabla }\varvec{u} + (\varvec{\nabla }\varvec{u})^\text {T})\).

The domain \(\Omega \) is immersed into an axis-aligned \(5 \times 5\) square on which the enriched background B-spline spaces are constructed. A suite of background meshes with characteristic element lengths \(h \in 0.625 \times [1, 0.5, 0.25, 0.125, 0.0625, 0.03125]\) are used to generate convergence data.

The foreground meshes used here are locally refined about the material interfaces, as seen in Fig. 9. The background basis functions remain constant, meaning that there is no increase to the number of solution degrees of freedom with foreground refinement.

The convergence plots in Fig. 10 show the expected convergence rates for the bi-linear B-spline function space. With the bi-quadratic function space and no foreground refinement, the dominating effects of geometric error are shown with degraded \(L^2\) convergence rates. Geometric error is reduced through local foreground refinement, allowing the function approximation error to dominate the overall convergence. With local foreground refinement the convergence rates approach the ideal rates exhibited by the method for problems without geometric approximation error, as in Sect. 5.1.

The foreground meshes generated using this octree local refinement strategy include hanging nodes, which are difficult for most commercial or open-source finite element software to handle. To accommodate these hanging nodes, this interpolation-based workflow employs \(C^{-1}\) discontinuous foreground Lagrange polynomial basis functions,. Classical discontinuous Galerkin methods require augmentation of the variational form to enforce continuity at cell interfaces [16], but this augmentation is not done within this workflow. The results in this work suggest that for a problem where conforming FE methods would require \(C^0\) continuity, a \(C^{-1}\) interpolated basis can be employed provided the background basis is at least \(C^0\) continuous. More generally, so long as the background basis is sufficiently continuous it may be interpolated with a less-continuous foreground basis. This attribute of interpolated-based methods was first exploited in [26] to approximate fourth-order PDEs with a background basis of quadratic B-spline bases, which are \(C^1\) continuous, interpolated with a foreground basis of quadratic Lagrange polynomials, which are only \(C^0\) continuous.

5.3 Image-based thermo-mechanical analysis of composite materials, utilizing multiple levels of local refinement

The capability of this method to tackle distinct discretization requirements of state variable fields within a multi-physics problem is illustrated here in a coupled thermo-elastic problem. This problem is posed on an alumina-epoxy composite sample undergoing simultaneous heating and loading conditions. Separate background discretizations are interpolated with a single foreground discretization for the two fields.

Fig. 11
figure 11

Top:Micro-CT image of alumina-epoxy composite, where the white sections signify alumina particles and the grey is the surrounding epoxy. Bottom: Smoothed image used to generate the LSF geometric description

Fig. 12
figure 12

The whole domain is shown in the images on the left with the box indicating the region shown in the zoomed in view on the left

The geometry of the composite sample is taken from a real micro-CT image converted to an implicit level-set description. The micro-CT image, from [71] and shown in Fig. 11a, is made up of \(200\times 200\) pixels, with a pixel size of \(8\mu \)m, and the specimen is 1.6mm by 1.6mm. The epoxy is represented by the grey background while the alumina particles appear white. The image was then manually processed to generate the smoothed image shown in 11b, which was then converted to the implicit level-set description. The following material properties, from [7, 44], were used: Poisson ratios \( \nu _{\text {Al}} = 0.23\) and \(\nu _{\text {Ep}} = 0.358\), elastic moduli \( E _{\text {Al}} = 320e^9\) Pa and \(E _{\text {Ep}} = 3.66 e^9\) Pa, thermal conductivities \(\kappa _{\text {Al}} = 25.0\) W/mK and \( \kappa _{\text {Ep}} = 0.14\) W/mK, and thermal expansion coefficients \( \alpha _{\text {Al}} = 15e^{-6}\) 1/C\(^o\) and \(\alpha _{\text {Ep}} = 65e^{-6}\) 1/C\(^o\).

The process described in Sect. 4.3 was used to construct a foreground integration mesh, beginning with a uniform 80 element by 80 element axis aligned decomposition mesh. Two levels of local refinement were applied about the material interfaces, and the refined decomposition mesh was triangulated. The resulting foreground mesh, shown in 12a, contains 81,809 cells.

For comparison purposes, a similar workflow was used to generate a boundary-fitted mesh for use in classical FEM. Classical FEM with FEniCSx requires a single element type mesh without hanging nodes. To avoid hanging nodes and to sufficiently resolve the gradients of the state variable fields the decomposition mesh was uniformly refined three times forming a 640 element by 640 element square mesh. The cut cells were triangulated to create a boundary-fitted mesh, and then the remaining quadrilateral elements were triangulated. The mesh was then modified with the software package Coreform Cubit 2023.11 to improve mesh quality metrics. The resulting mesh, shown in Fig. 12b, contains 1,675,860 cells. The method described here was used to ensure the level set descriptions of the material interfaces matched between this mesh and the foreground mesh used with the interpolation-based immersed boundary method.

Fig. 13
figure 13

The temperature field results are compared for four different mesh configurations. The left shows the entire domain with the box indicating the region shown in the zoomed in view on the right

Fig. 14
figure 14

The the temperature gradient magnitude field is compared for four different mesh configurations. The left shows the entire domain with the box indicating the region shown in the zoomed in view on the right

Fig. 15
figure 15

The displacement magnitude field results are compared for four different mesh configurations. The left shows the entire domain with the box indicating the region shown in the zoomed in view on the right

Fig. 16
figure 16

The mechanical strain magnitude field results are compared for four different mesh configurations. The left shows the entire domain with the box indicating the region shown in the zoomed in view on the right

With this sample, a heated compression-shear test was simulated. The top and bottom displacements were imposed as \(\varvec{u}_{top} = [ -0.01, -0.01]\) mm and \(\varvec{u}_{bottom} = [ 0, 0]\) mm. The temperature at the top and bottom edges were specified as \(T_{top} = 0^{\circ }\)C and \(T_{bottom}= 100^{\circ }\)C. The environmental temperature was \(T_0= 0^oC\). The sides were left both traction and heat flux free.

The governing equations for heat conduction and linear elasticity were coupled via the constitutive law adding a thermal expansion component to the total strain as in Eq. (26). Dirichlet boundary conditions for each field were imposed using Nitsche’s method. Nitsche’s terms enforcing continuity in T and \(\varvec{u}\) were also imposed upon the allumina-epoxy interfaces.

Bi-linear B-splines are used for the temperature field and bi-quadratic B-splines are used for each component of the displacement field, and both fields are interpolated using bi-quadratic Lagrange polynomials. For the boundary-fitted FEM comparison, Dirichlet boundary conditions were likewise enforced using Nitsches method, a bi-linear Lagrange basis was used for the temperature field, and a bi-quadratic Lagrange basis was used for the displacement. The results for the temperature field, the temperature gradient magnitude, the displacement magnitude, and the strain magnitude are shown in Figs. 13, 14, 15, and 16, respectively. Within the figures, the foreground meshes are drawn in black while the background meshes are overlaid in white. The same foreground mesh, with two levels of local refinement to resolve the composite geometries, is used for each discretization.

Table 1 Degrees of freedom (DOFs) associated with the background function spaces at various levels of local refinement and with the uniformly refined FEM function spaces

Progressive levels of local refinement were applied to the background B-spline function spaces, as seen in the rows of Figs. 13, 14, 15, and 16. This local refinement was implemented with THB-splines, as described in Sect. 2.2. The regions of refinement with high-order splines are larger than those for the low-order to adequately support the truncated basis. This can be seen by comparing the white background meshes used for the temperature field depicted in Figs. 13 and 14 with those used for the displacement field in Figs. 15 and 16. The number of degrees of freedom associated with the various background discretizations are shown in Table 1.

With two levels of local refinement, the results were in qualitative agreement with the ones of the uniformly refined classical FEM example with far fewer degrees of freedom. As previously noted, the uniformly refined meshes were initially generated with the same workflow used to create the boundary conforming foreground meshes, a ‘hands-off’ method requiring only a bitmap image file. A more efficient mesh with fewer elements could be created for use in classical FEM but only with either significant user intervention or with sophisticated meshing software. Additionally, the workflow used here can easily be extended to 3D image stacks, which are not easily processed for classical FEM.

6 Conclusions

This work presents a new interpolation-based immersed boundary method for multi-material and multi-physics problems. This method employs enriched truncated hierarchically refined B-spline background spaces and discontinuous hierarchically refined Lagrange integration spaces.

Domain geometry and material interfaces are represented by level set functions, which can be generated by, for example, geometric primitives or from 2D or 3D images. The domain is embedded in a grid with an associated B-spline basis and the level set function is discretized and used to compute Heaviside characteristic functions. Basis functions are inspected and individually enriched with respect to the disconnected material subregions within their supports.

Subdivision is used to generate a sequence of refined B-spline function spaces and associated tensor-product meshes from the original function space and mesh. In this work, the meshes are refined along domain interfaces. A hierarchically refined B-spline function space is defined recursively, along with its associated hierarchically refined mesh. This hierarchical function space is then truncated to form a partition of unity. The refined basis functions can then be enriched using the Heaviside enrichment functions when intersecting material interfaces.

The enriched and refined background bases are interpolated by a discontinuous foreground basis. This foreground basis requires a boundary-fitted mesh, but is not subject to usual mesh conditioning constraints. The foreground meshes are thus constructed by the discretized level set function boundary descriptions and hierarchically refined quadrilateral meshes. Cells in the refined quadrilateral mesh intersected by the domain and material interface geometry are triangulated to form a mixed-element type foreground mesh, which can be used by classical finite element codes to define a foreground basis. The level of refinement used to create the foreground mesh may exceed the level of refinement used for the background basis, allowing for greater geometric resolution without increasing the system’s degrees of freedom associated with the background basis.

The background basis is interpolated using extraction operators. Extraction operators are constructed by evaluating the background basis at the locations of the foreground basis nodes. Existing classical finite element codes assemble the linear systems using the Lagrange foreground basis. The linear system is then projected onto the interpolated basis with the extraction operators and the system is solved with the interpolated basis. Interpolation allows the enriched and refined B-splines basis to be utilized in traditional finite element codes without the addition of complex integration subroutines, broadening the applicability of this method.

Several benchmark problems validated this method. Interpolated enriched bases were used in both 2D and 3D for a multi-material thermal diffusion problem with exact geometric representation. The numerical approximations were compared with analytic solutions and errors were computed. The \(L_2\) and \(H_1\) errors converged at ideal rates with mesh refinement. Foreground only refinement was implemented for a multi-material linear elasticity PDE involving a circular domain. When compared to the analytic solution, errors from a non-refined foreground mesh converged ideally with a bi-linear basis, but the \(L_2\) convergence rate of the bi-quadratic basis was limited to \(2^\text {nd}\) order due to geometric error in the discretization of the domain boundary. With sufficient foreground refinement, the ideal \(3^\text {rd}\) order convergence for the bi-quadratic basis was observed. Lastly, micro-CT images were used to generate a geometric discretization of an alumina-epoxy composite sample. Thermo-elastity was simulated, coupling separately discretized temperature and displacement fields through a thermal expansion component. Unique THB-spline bases were used for each field, bi-linear for temperature, and bi-quadratic for displacement. The results were in qualitative agreement with the ones of a uniformly refined traditional boundary conforming finite element simulation.

In this work, the open-source code FEniCSx is used to demonstrate the efficacy of interpolation-based immersed boundary methods, and future work will expand implementation to other existing finite element codes. Within FEniCSx, additions to the interpolation-based immersed boundary workflow will be the implementation of stabilization techniques to address issues of linear conditioning. The method will also be further developed for additional applications, including transient and optimization problems.