1 Introduction

The numerical implementation of mathematical models, just as every program code, is rarely error-free during development. This can often lead to wrong results, if the bug is undetected, or to long and tedious debugging sessions [1]. Thus, testing the code against existing solutions that are proven to be correct plays an important role in the field of computational mechanics [2]. For this purpose, often benchmark problems are used, which are either derived analytically, or solved numerically with exceptionally high accuracy. A recent collection of benchmark problems for structural mechanics can be found in Ref. [3]. In our contribution however, we focus on an alternative approach, i.e., the method of manufactured solutions (MoMS), which allows for testing codes against closed-form reference solutions derived by a simple, yet robust approach [4]. In particular, our main goal is the investigation of MoMS in the context of immersed boundary methods, where accurate code validation is of great importance due to the numerous special algorithms associated with these approaches. Despite its simplicity and capabilities, there is very little literature so far regarding the MoMS applied to immersed problems. Although it is mentioned briefly by some articles [5, 6], generally, no details on the derivation of the manufactured solution are given. In our opinion, the topic deserves more attention and therefore, in this contribution, some key insights and different strategies for manufacturing the displacement field are discussed, while also addressing some possible issues. While this work is concerned with static and transient problems of linear elasticity, for the application of our derived concepts to non-linear problems, we refer to our recent article [7].

The outline of the article is as follows: In the remainder of this section, first, the general concept of immersed boundary problems is presented in Sect. 1.1, then, the governing equations for the upcoming problems are given in Sect. 1.2, and finally, the MoMS is introduced briefly in Sect. . After the introduction, the FCM is discussed in Sect. 2. This is followed by the main part of the paper, Sect. 3, where manufactured solutions in the context of immersed boundary methods are derived for various structural mechanical problems with hole regions and material inclusions. In Sect. 3, the main focus is the derivation of carefully tailored manufactured solutions, whose simulation via unfitted meshes does not require weak boundary conditions. The derived approaches are based on different strategies and coordinate systems, and are demonstrated via several numerical examples.

1.1 Immersed boundary problems

In immersed boundary methods, such as the finite cell method (FCM) [8, 9], the spectral cell method (SCM) [10, 11], the cut finite element method (CutFEM) [12], and the extended finite element method (XFEM) [13], the considered domain generally has a complicated shape, such that a geometry-conforming spatial discretization is often cumbersome to achieve. Thus, the general approach of these methods is to embed the region of interest into a larger domain of simple shape, which is easy to discretize by Cartesian meshes. Beyond structures with highly complex outer boundaries, these methods also often deal with problems, where the material domain contains void regions and/or inclusions of additional materials,Footnote 1 as depicted in Fig. 1a. Here, \(\Omega _{\textrm{mat}}\) is the domain of the matrix material, \(\Omega _{\textrm{void}}\) of the void, and \(\Omega _{\textrm{inc}}\) of the inclusion, with their corresponding boundaries \(\partial \Omega _{\textrm{mat}}\), \(\partial \Omega _{\textrm{void}}\), and \(\partial \Omega _{{\textrm{inc}}}\), respectively. Finally, the unit normal vectors belonging to the different domain boundaries are denoted by \({\varvec{n}}\). The embedding of the original problem into the extended domain \(\Omega _{{\textrm{e}}}\) and the meshing of the new problem are depicted in Fig. 1b and c. Here, \(\Omega _{{\textrm{fict}}}\) is the fictitious domain with theoretically zero stiffness, which also includes all void regions within the physical domain \(\Omega _{\textrm{void}} \subseteq \Omega _{{\textrm{fict}}}\).

Fig. 1
figure 1

FCM concept

The numerical challenges faced in these methods are typically caused by the fact that elements are intersected by the boundaries (see Fig. 1c), leading to important simulation aspects, such as the

  1. 1.

    Integration of discontinuous element matrices (FCM: [5, 14,15,16,17], XFEM: [18,19,20,21], CutFEM: [22]),

  2. 2.

    Stabilization schemes for ill-conditioned problems (FCM: [23,24,25], XFEM: [13, 26, 27], CutFEM: [28, 29]),

  3. 3.

    Implementation of weak boundary conditions on immersed boundaries (FCM: [30], XFEM: [13], CutFEM: [31]),

  4. 4.

    Accurate capturing of weakly or strongly discontinuous displacement fields (FCM: [32], XFEM: [33, 34], CutFEM: [6]),

  5. 5.

    Mass lumping and time integration schemes for transient problems (SCM: [10, 35]),

to just name a few. The list given above demonstrates the multitude of important topics related to immersed boundary methods, which are entire research areas on their own. Since the listed challenges are often tackled using novel algorithms and advanced computational concepts, reliable and easy testing of the different features used in these methods is of significant importance.

1.2 Governing equations

Let \(\Omega \in {\mathbb {R}}^d\) and \(\partial \Omega \in {\mathbb {R}}^d\) denote a material domain and its boundary in a d-dimensional space, respectively, while an arbitrary point space is denoted by \({\varvec{x}}\in {\mathbb {R}}^d\). Furthermore, \(T\in {\mathbb {R}}\) is the time domain in the interval \([t_0,\,t_{\textrm{end}}]\). Without derivation, the governing equations for structural linear elasto-dynamics read [36, 37]

$$\begin{aligned} {\textrm{Div}}(\varvec{\sigma })+ {\varvec{b}}&=\kappa \dot{{\varvec{u}}} + \rho \ddot{{\varvec{u}}}&~~~&\text {in}~\Omega \times T\,, \end{aligned}$$
(1)
$$\begin{aligned} {\varvec{u}}&= \tilde{{\varvec{u}}} \qquad \qquad{} & {} \text {on}~\Gamma _{{\textrm{D}}} \,\times T,\end{aligned}$$
(2)
$$\begin{aligned} \varvec{\sigma }\cdot {\varvec{n}}&= \tilde{{\varvec{t}}} \qquad \qquad{} & {} \text {on}~\Gamma _{{\textrm{N}}} \times T\,,\end{aligned}$$
(3)
$$\begin{aligned} {\varvec{u}}&={\varvec{u}}_0 \qquad \qquad{} & {} \text {in}~\Omega ~~\text {and for}~~ t=t_0\,,\end{aligned}$$
(4)
$$\begin{aligned} \dot{{\varvec{u}}}&= \dot{{\varvec{u}}}_0 \qquad \qquad{} & {} \text {in}~\Omega ~~\text {and for}~~ t=t_0\,, \end{aligned}$$
(5)

where \({\varvec{u}}\) is the displacement, \(\dot{{\varvec{u}}}\) the velocity, \(\ddot{{\varvec{u}}}\) the acceleration, and \({\varvec{b}}\) the body force field. The parameter \(\rho \) denotes the mass density, while \(\kappa \) stands for the isotropic damping parameter. The boundary \(\partial \Omega \) is the disjoint set of Neumann \(\Gamma _{{\textrm{N}}}\) and Dirichlet boundaries \(\Gamma _{{\textrm{D}}}\), on which prescribed tractions \(\tilde{{\varvec{t}}}\) and displacements \(\tilde{{\varvec{u}}}\) are defined, respectively. Furthermore, \({\varvec{u}}_0\) and \(\dot{{\varvec{u}}}_0\) denote initial values for the time \(t=t_0\). Finally, \(\varvec{\sigma }\) is the symmetric Cauchy stress tensor resulting from Eq. (6), where \({\mathbb {C}}\) is the fourth-order constitutive tensor and \(\varvec{\varepsilon }\) the linearized (Cauchy–Green) strain tensor, defined as the symmetric gradient of \({\varvec{u}}\)

$$\begin{aligned} \varvec{\sigma }= & {} {\mathbb {C}}: \varvec{\varepsilon }, \end{aligned}$$
(6)
$$\begin{aligned} \varvec{\varepsilon }= & {} \dfrac{1}{2}\big [{\textrm{Grad}}({\varvec{u}})+{\textrm{Grad}}({\varvec{u}})^{\textrm{T}}\big ]. \end{aligned}$$
(7)

If the given problem contains material inclusions, i.e. \(\Omega = \Omega _{\textrm{mat}}\cup \Omega _{\textrm{inc}}\), the displacement field \({\varvec{u}}\) is generally only weakly continuous along the material interface \(\partial \Omega _{{\textrm{inc}}}\) and the stress and strain tensors obey certain jump conditions [13]. On the one hand, the continuity of the normal stress vectors is required

$$\begin{aligned} \big (\varvec{\sigma }_{\textrm{mat}}({\varvec{x}}) - \varvec{\sigma }_{\textrm{inc}}({\varvec{x}})\big ) \cdot {\varvec{n}}_{\textrm{inc}}({\varvec{x}}) = {\varvec{0}}~~\forall {\varvec{x}} \in \partial \Omega _{{\textrm{inc}}}, \end{aligned}$$
(8)

where \(\varvec{\sigma }_{\textrm{mat}}\) and \(\varvec{\sigma }_{\textrm{inc}}\) denote the stress fields in \(\Omega _{\textrm{mat}}\) and \(\Omega _{\textrm{inc}}\), respectively. On the other hand, the strain tensors must fulfill the Hadamard jump condition

$$\begin{aligned} \varvec{\varepsilon }_{\textrm{mat}}({\varvec{x}}) - \varvec{\varepsilon }_{\textrm{inc}}({\varvec{x}})= & {} \dfrac{1}{2} \big ( {\varvec{a}}({\varvec{x}})\otimes {\varvec{n}}_{\textrm{inc}}({\varvec{x}}) + {\varvec{n}}_{\textrm{inc}}({\varvec{x}}) \otimes {\varvec{a}}({\varvec{x}})\big )\nonumber \\{} & {} \forall {\varvec{x}} \in \partial \Omega _{{\textrm{inc}}}, \end{aligned}$$
(9)

where \({\varvec{a}}\) is the jump of the directional derivatives of \({\varvec{u}}\) with respect to \({\varvec{n}}_{\textrm{inc}}\) at the interface [38].

1.3 Method of manufactured solutions

A closed-form solution to the governing Eqs. (1)–(7) is generally not possible, and thus, for given external loads and boundary conditions, the problem is solved in a weak sense using different numerical methods [36, 37]. In the context of the MoMS, the problem is reversed: Instead of solving for \({\varvec{u}}\), one manufactures (assumes) \({\varvec{u}}\), whose spatial and time derivatives are known. This can be easily inserted in the strong form (1) to compute the body load analytically

$$\begin{aligned} {\varvec{b}} = -{\textrm{Div}}(\varvec{\sigma }) + \kappa \dot{{\varvec{u}}} + \rho \ddot{{\varvec{u}}}. \end{aligned}$$
(10)

Note that besides \({\varvec{b}}\), generally, other relevant quantities, such as stresses or the strain energy, can be computed analytically as well. For every partial differential equation (PDE), the solution fields should be constrained by suitable boundary conditions (BCs). For traditional problems where \({\varvec{u}}\) is sought, BCs are readily given on \(\Gamma _{{\textrm{N}}}\) and \(\Gamma _{{\textrm{D}}}\). On the contrary, in the manufactured solution, no BCs are given, but the manufactured solution yields the BCs. That is, when the manufactured problem is reproduced numerically, the BCs required for the numerical framework derive from manufactured solution itself as prescribed displacements or tractions. Depending on which option is chosen, the corresponding boundary pieces are classified as \(\Gamma _{{\textrm{N}}}\) or \(\Gamma _{{\textrm{D}}}\) for the simulation. It is clear that for the computed body load and appropriate BCs, the manufactured displacement field, in fact, satisfies Eqs. (1)–(7). Thus, in case of a correct implementation of the numerical approach, \({\varvec{b}}\) acting in the domain,Footnote 2 and appropriate BCs on its boundary should lead to an approximate solution \({\varvec{u}}^{\textrm{h}}\) that converges to the manufactured reference solution in a suitable error measure.

As pointed out in Ref. [4], it is important to realize that the manufactured solution does not necessarily have to be a physically realistic solution; the only requirement is that it satisfies the chosen PDE. In the simplest cases, manufactured solutions can be derived even by hand, however, for robust derivations of more complex problems, computer algebra systems (CAS) are favored, allowing a great flexibility when solving PDEs symbolically. For this purpose, all the manufactured solutions discussed in this paper are derived using Wolfram Mathematica [39]. The Mathematica notebooks used for the analytical derivations of the numerical examples in Sect. 3 can be found as supplementary material in Ref. [40].

Due to its simplicity and effectiveness, the MoMS is listed by the American Society of Mechanical Engineers as part of the Guide for verification and validation in computational solid mechanics [41, 42]. Additionally, it offers a convenient and more accurate approach for code verification, than testing against an overkill FEM solution, whose accuracy is limited, and derivation is not only often cumbersome and time consuming, but in some cases, simply not possible. For further reading on the topic, we refer to Refs. [4, 43].

Remark on immersed boundary methods: Note that when reproducing the manufactured solution in an immersed boundary framework, the numerical solution should be constrained on all boundaries, including \(\partial \Omega _{\textrm{void}}\) and \(\partial \Omega _{{\textrm{inc}}}\) as well. As it will be shown in Sect. 2.2, enforcement of field values at the immersed boundaries requires additional computational effort, which we seek to eliminate in this contribution.

2 Finite cell method

In this paper, we use the FCM [8, 9, 44] as a representative for immersed boundary problems, which is typically based on the discretization explained by Fig. 1 and high-order shape functions [45, 46], enabling an efficient and accurate simulation on coarse meshes. The FCM is covered in a wide range of contributions, which is why we only provide a brief introduction at this point. For more details, the interested reader is referred to Refs. [46, 47]. Without derivation, the weak formulation of the governing Eqs. (1)–(7) in the context of the FCM reads

$$\begin{aligned} {\mathcal {B}}_{\textrm{e}}({\varvec{u}},{\varvec{v}}) = {\mathcal {F}}_{\textrm{e}}({\varvec{v}}) \end{aligned}$$
(11)

where the bilinear and linear functionals are defined over the extended domain \( \Omega _{\textrm{e}} \) as

$$\begin{aligned} {\mathcal {B}}_{\textrm{e}}({\varvec{u}},{\varvec{v}})= & {} \int \limits _{ \Omega _{\textrm{e}} } \varvec{\varepsilon }[{\varvec{u}}]: \alpha \varvec{{\mathbb {C}}}: \varvec{\varepsilon }[{\varvec{v}}]\,{\textrm{d}}{\varvec{x}}+ \int \limits _{ \Omega _{\textrm{e}} } \alpha \kappa \dot{{\varvec{u}}} \cdot {\varvec{v}}\,{\textrm{d}}{\varvec{x}}\nonumber \\{} & {} + \int \limits _{ \Omega _{\textrm{e}} } \alpha \rho \ddot{{\varvec{u}}} \cdot {\varvec{v}}\,{\textrm{d}}{\varvec{x}}, \end{aligned}$$
(12)
$$\begin{aligned} {\mathcal {F}}_{\textrm{e}}({\varvec{v}})= & {} \int \limits _{ \Omega _{\textrm{e}} } \alpha {\varvec{b}} \cdot {\varvec{v}}\,{\textrm{d}}{\varvec{x}}+ \int \limits _{\Gamma _{{\textrm{N}}}} \tilde{{\varvec{t}}}\cdot {\varvec{v}}\,{\textrm{d}}{\varvec{x}}. \end{aligned}$$
(13)

Above, \({\varvec{v}}\) denotes the test function, and \(\varvec{\varepsilon }[{\varvec{u}}]\) together with \(\varvec{\varepsilon }[{\varvec{v}}]\) are the strain tensors based on \({\varvec{u}}\) and \({\varvec{v}}\), respectively. Furthermore, \(\alpha \) is the indicator function

$$\begin{aligned} \alpha = {\left\{ \begin{array}{ll} 1 &{}\text {in}~~\Omega _{\textrm{mat}} \cup \Omega _{\textrm{inc}}\\ 10^{-q} &{}\text {in}~~\Omega _{{\textrm{fict}}} \end{array}\right. } , \end{aligned}$$
(14)

which penalizes the energy contribution of the fictitious domain. Considering a two-dimensional setting, in each finite cell, the displacement field \({\varvec{u}}^{(c)} = [u_1^{(c)}, u_2^{(c)}]^{\textrm{T}}\) is approximated using smooth shape functions

$$\begin{aligned} {\varvec{u}}^{(c)} = \sum _{j=1}^{p+1} N_{j}^{} {\varvec{U}}^{\mathrm {(c)}}_{j}, \end{aligned}$$
(15)

where \(N_{j}\) is the \(j^\text {th}\) shape function, \({\varvec{U}}^{\mathrm {(c)}}_{j}\) the displacement associated with the given shape function, and p the polynomial degree of the approximation.Footnote 3 The integration of the cell matrices is often performed using a local integration mesh (LIM) with \(n_{{\textrm{sc}}}\) sub-cells [5, 9, 14, 16]. Then, e.g., the cell-specific stiffness matrix is computed as

$$\begin{aligned} {\varvec{K}}^{(c)}= & {} \int \limits _{\Omega ^{(c)}_{}} {\varvec{B}} ^{\textrm{T}}{\varvec{C}}{\varvec{B}} \,{\textrm{det}}({\varvec{J}}_{\xi \rightarrow x}) {\textrm{d}}\varvec{\xi }= \sum _{k=1}^{n_{{\textrm{sc}}}}\, \int \limits _{ \omega _k} {\varvec{B}}^{\textrm{T}}{\varvec{C}}{\varvec{B}}\nonumber \\{} & {} {\textrm{det}}({\varvec{J}}_{\eta \rightarrow \xi }) \,{\textrm{det}}({\varvec{J}}_{\xi \rightarrow x}) {\textrm{d}}\varvec{\eta }, \end{aligned}$$
(16)

where \(\Omega _{}^{(c)}\) is the cell domain and \(\omega _k \subset \Omega _{}^{(c)}\) is the domain of the \(k^\text {th}\) sub-cell. Furthermore, \({\textrm{det}}({\varvec{J}}_{\eta \rightarrow \xi })\) and \({\textrm{det}}({\varvec{J}}_{\xi \rightarrow x})\) denote the Jacobi determinants of the mappings from the local space of the sub-cell to the local space of the cell, and from there to the global space, respectively [16]. Note that in Eq. (16), \({\varvec{C}}\) is the elasticity matrix in Voigt notation and \({\varvec{B}}\) contains the derivatives of the shape functions. Finally, assembling the cell matrices leads to the system of equations

$$\begin{aligned} {\varvec{K}}{\varvec{U}} + {\varvec{D}}\dot{{\varvec{U}}} + {\varvec{M}} \ddot{{\varvec{U}}} = {\varvec{F}}, \end{aligned}$$
(17)

where \({\varvec{K}}\), \({\varvec{D}}\), and \({\varvec{M}}\) are the global stiffness, damping, and mass matrices, respectively, and \({\varvec{F}}\) is the load vector. Furthermore, \({\varvec{U}}\), \(\dot{{\varvec{U}}}\), \(\ddot{{\varvec{U}}}\) denote the nodal unknowns, i.e., displacements, velocities, and accelerations, respectively.

2.1 Local enrichment

In case of multi-material problems, the \(C^0\)-continuous displacement field within a cell is poorly approximated by Eq. (15), leading to severe oscillations in the strain and stress fields, significantly deteriorated simulation accuracy, and finally, sub-optimal convergence rates [32]. Instead, for cells with material interfaces, \({\varvec{u}}^{(c)} \) is often approximated using a local enrichment approach originating from the XFEM [13, 19, 49], and applied in the context of FCM in Refs. [5, 15, 32]. The key idea is to compose \({\varvec{u}}\) by the smooth \({\varvec{u}}_{\textrm{s}}\) and enriched displacements \({\varvec{u}}_{\textrm{e}}\), such that \({\varvec{u}} = {\varvec{u}}_{\textrm{s}} + {\varvec{u}}_{\textrm{e}}\). Thus, Eq. (15) turns into [50]

$$\begin{aligned} {\varvec{u}}^{(c)} = \sum _{i=1}^{p+1} N_i^{} {\varvec{U}}^{(c)}_{i} + \sum _{m=1}^{n_{\textrm{inc}}^{(c)}}\sum _{j=1}^{p+1} \psi _{m} N_j^{} \varvec{{\mathcal {E}}}_{m,j}^{(c)}, \end{aligned}$$
(18)

where in the second term, \(n_{\textrm{inc}}^{(c)}\) is the number of inclusions present in the cell, \(\varvec{{\mathcal {E}}}_{m,j}^{\mathrm {(c)}}\) is the degree of freedom (DOF) associated with the enrichment of the \(m^\text {th}\) interface with its corresponding enrichment function \(\psi _m\). There are multiple ways how \(\psi _m\), which ensures the \(C^0\)-continuity of \({\varvec{u}}^{(c)} \), can be defined. In this contribution, we follow the modified-abs enrichment proposed by Moës et al. [49]

$$\begin{aligned} \psi _m = \sum _{l=1}^{p_\psi +1} N_l^{} |\varphi _m({\varvec{x}}_l)| - \left| \sum _{l=1}^{p_\psi +1} N_l^{} \varphi _m ({\varvec{x}}_l) \right| , \end{aligned}$$
(19)

which by definition, vanishes at the uncut element boundaries and thus, parasitic terms and partially enriched transition elements can be avoided [34]. In Eq. (19), \(\varphi _m\) is the level-set function of the immersed inclusions, where the domain and its boundary are defined by

$$\begin{aligned} \Omega _{\textrm{inc}}^{(m)}= & {} \{ {\varvec{x}} ~|~ \varphi _m({\varvec{x}}) < 0 \} , \end{aligned}$$
(20)
$$\begin{aligned} \partial \Omega _{{\textrm{inc}}}^{(m)}= & {} \{ {\varvec{x}} ~|~ \varphi _m({\varvec{x}}) = 0 \} . \end{aligned}$$
(21)

Furthermore, \(p_\psi \) is the polynomial degree for approximating \(\psi \). Thus, \(p_\psi \) is typically chosen based on the complexity of \(\partial \Omega _{{\textrm{inc}}}\) [32].

2.2 Boundary conditions

Due to the unfitted discretization used in the FCM, direct enforcement of the BCs on a set of boundary nodes is not an option. Since Neumann BCs are already included in the weak problem statement (second term on the right-hand side of Eq. (13)), they can be readily enforced by integrating over \(\Gamma _{{\textrm{N}}}\), which generally cuts through the finite cells. Dirichlet BCs require additional weak constraints to the system by using the penalty method [51, 52], Lagrange multiplier method [53, 54], or the Nitsche method [55, 56]. As mentioned before, in this contribution, the prime goal is to manufacture analytical solutions where weak boundary conditions are not necessary. However, for sake of completeness, in Sect. 3.1.1, one example is presented using the Nitsche method, which is typically favored in the context of FCM [24, 57,58,59]. Without derivation, in case of static problems, \({\mathcal {B}}_{\textrm{e}}\) and \({\mathcal {F}}_{\textrm{e}}\) for the symmetric Nitsche method read [60]

$$\begin{aligned} {\mathcal {B}}_{\textrm{e}}({\varvec{u}},{\varvec{v}})= & {} \int \limits _{ \Omega _{\textrm{e}} } \varvec{\varepsilon }[{\varvec{u}}]: \alpha \varvec{{\mathbb {C}}}: \varvec{\varepsilon }[{\varvec{v}}]\,{\textrm{d}}{\varvec{x}}- \int \limits _{\Gamma _{{\textrm{D}}}} {\varvec{u}}\cdot (\varvec{\sigma }[{\varvec{v}}] \cdot {\varvec{n}})\,{\textrm{d}}{\varvec{x}}\nonumber \\{} & {} -\int \limits _{\Gamma _{{\textrm{D}}}} (\varvec{\sigma }[{\varvec{u}}] \cdot {\varvec{n}}) \cdot {\varvec{v}}\,{\textrm{d}}{\varvec{x}}+\beta \int \limits _{\Gamma _{{\textrm{D}}}} {\varvec{u}}\cdot {\varvec{v}}\,{\textrm{d}}{\varvec{x}}, \end{aligned}$$
(22)
$$\begin{aligned} {\mathcal {F}}_{\textrm{e}}({\varvec{v}})= & {} \int \limits _{ \Omega _{\textrm{e}} } \alpha {\varvec{v}} \cdot {\varvec{b}}\,{\textrm{d}}{\varvec{x}}+ \int \limits _{\Gamma _{{\textrm{N}}}} {\varvec{v}} \cdot \tilde{{\varvec{t}}}\,{\textrm{d}}{\varvec{x}}\nonumber \\{} & {} - \int \limits _{\Gamma _{{\textrm{D}}}} {\tilde{{\varvec{u}}}} \cdot (\varvec{\sigma }[{\varvec{v}}]\cdot {\varvec{n}}) \,{\textrm{d}}{\varvec{x}}+\beta \int \limits _{\Gamma _{{\textrm{D}}}} {\tilde{{\varvec{u}}}} \cdot {\varvec{v}}\,{\textrm{d}}{\varvec{x}}, \end{aligned}$$
(23)

where \(\beta \) is a stability parameter, which should be high enough to ensure the coercivity of the weak form [61]. The value for \(\beta \) depends on multiple factors, such as mesh size, polynomial degree of the Ansatz space, and material properties [58]. The value for \(\beta \) can be estimated by solving a generalized eigenvalue problem globally [62], or locally in the individual elements [61, 63].

3 Manufactured solutions without weak boundary conditions

In this section, manufactured solutions are formulated, such that boundary conditions along the intersecting boundaries and interfaces are naturally fulfilled. This means zero tractions along free surfaces and continuous normal stresses along internal material interfaces are required. Since the BCs are already fulfilled, no weak enforcement of them is necessary. Such manufactured solutions are ideal for (i) the testing of codes which do not support weak BCs, or when (ii) the problem complexity should be purposely low while validating other features of the program. The numerical examples presented in this section are performed using our in-house Matlab code based on spectral cells with Lagrangian shape functions [35, 64, 65]. For the analytical derivation of the given examples, see the supplementary material in Sect. [40]

Fig. 2
figure 2

Plate with a circular hole loaded by body force field in the domain and prescribed displacements on its boundary

3.1 Void regions with radial displacements

For problems with void regions, the key idea is to assume a manufactured displacement \({\varvec{u}}\), which results in a stress field \(\varvec{\sigma }\) for which the tractions along the void’s boundary are vanishing

$$\begin{aligned} {\varvec{t}}({\varvec{x}}) = \varvec{\sigma }({\varvec{x}}) \cdot {\varvec{n}}_{\textrm{void}}({\varvec{x}}) = {\varvec{0}} ~~~\forall {\varvec{x}} \in \partial \Omega _{\textrm{void}}. \end{aligned}$$
(24)

Then, \(\partial \Omega _{\textrm{void}}\) is treated as a Neumann BC in the FCM simulation, on which \({\varvec{t}}^{\textrm{h}} = {\varvec{t}}\) needs to be enforced. However, since \({\varvec{t}}\) is vanishing at hole’s boundary, \(\Omega _{\textrm{void}}\) is essentially a free boundary, and the BC is readily fulfilled. In the following, for problem with void regions, a circular/spherical geometry for \(\Omega _{\textrm{void}}\) is assumed and a radial displacement field is constructed defined in a polar/spherical coordinate system (see Appendix A.1.2 and A.2.2)

$$\begin{aligned} {\textrm{2D}}:~{\varvec{u}}(r) = \begin{bmatrix} u_{r}(r)\\ 0 \end{bmatrix} \quad \text {or}\quad {\textrm{3D}}:~{\varvec{u}}(r) = \begin{bmatrix} u_{r}(r)\\ 0\\ 0 \end{bmatrix}. \end{aligned}$$
(25)

In this case, the zero traction condition involving tensor-valued variables reduces to a one-dimensional condition on a scalar field

$$\begin{aligned} \text {Eq.~(24)}~~\longrightarrow ~~\sigma _{\textrm{rr}}(r=R) = 0, \end{aligned}$$
(26)

where R is the circle’s/sphere’s radius. In 2D (plane stress state) for example, Eq. (26) reads

$$\begin{aligned} \sigma _{\textrm{rr}}(r=R) = \dfrac{E}{1-\nu ^2}\left( \dfrac{{\textrm{d}}u_{\textrm{r}}}{{\textrm{d}}r}\bigg |_{r=R} + \nu \dfrac{ u_{\textrm{r}}(r=R)}{R}\right) = 0. \end{aligned}$$
(27)

Zero tractions for the manufactured solution are obtained if the value within the brackets vanishes at the free boundary. This is possible in the following three cases:

  1. 1.

    If \(\nu =0\) is assumed, the above expression reduces to the requirement of vanishing derivatives of \(u_{r}\) at \(r=R\), regardless of \(u_{\textrm{r}}(r=R)\).

  2. 2.

    In case of \(E\ne 0\) and \(\nu \ne 0\), a simple approach is to construct \(u_{r}\), such that at \(r=R\), both the displacement and its first derivative with respect to r are zero, i.e., \(u_{r}(r=R)=0 \) and \(u_{{\textrm{r}},r}(r=R) = 0\).

  3. 3.

    In the general case, where none of the material properties and field values are zero at \(r=R\), zero tractions can be achieved by fine tuning \(u_{r}\) and its derivative, such that Eq. (27) is fulfilled. This is typically achieved by introducing an additional parameter (see Sect. 3.1.1).

3.1.1 Plate with circular hole—static analysis

First, a static case featuring a rectangular plate \(\Omega _{{\textrm{phys}}}\) with a circular hole \(\Omega _{\textrm{void}}\) is investigated. Due to its symmetry, only a quarter of the problem is simulated, while appropriate symmetry BCs are applied, as depicted in Fig. 2a. For the material properties, \(E=1\) Pa and \(\nu = 0.3\) are chosen, while a plane stress state is considered. Furthermore, a radius of \(R=2\) m is chosen for the circular void and the manufactured displacement field is defined as

$$\begin{aligned} u_{r}= r\ln (c\,r), \end{aligned}$$
(28)

which will be prescribed to the numerical solution along the red boundaries, as indicated in Fig. 2a. In the static case of Eq. (10), Eq. (28) leads to the body load

$$\begin{aligned} b_{\textrm{r}}= \dfrac{2}{r}\dfrac{E}{\nu ^2-1} . \end{aligned}$$
(29)

In this sub-section, two values of c are investigated

$$\begin{aligned}&\text {a)}&c = 1 \qquad \qquad \quad \longrightarrow \text {weak BC via Nitsche method} \end{aligned}$$
(30)
$$\begin{aligned}&\text {b)}&c = \dfrac{1}{R} \exp \left( \dfrac{-1}{1+\nu } \right) \longrightarrow \text {weak BC directly fulfilled} \nonumber \\ \end{aligned}$$
(31)
Fig. 3
figure 3

Manufactured solution along the cut line A–A’ of Fig. 2a. The parts lying in \(\Omega _{\textrm{void}}\) are blurred out, indicating that they are not of interest

leading to the radial field values depicted in Fig. 3. On the one hand, in case of a), c is chosen arbitrarily, leading to non-zero field values at \(r=R\), which need to be enforced in a weak sense. Here, we use the Nitsche method to prescribe the displacement value \(u_{r}(r=R) = 2\ln (2)\) (i.e., \(\partial \Omega _{\textrm{void}} \in \Gamma _{{\textrm{D}}}\) in Fig. 2a). On the other hand, in case of b), the parameter c is derived carefully (see Appendix B.1.1), such that \(\sigma _{\textrm{rr}}\) given by Eq. (27) vanishes at \(r=R\). Thus, \(\partial \Omega _{\textrm{void}}\) is a free boundary with readily fulfilled Neumann BC (i.e., \(\partial \Omega _{\textrm{void}} \in \Gamma _{{\textrm{N}}}\) in Fig. 2a). A numerical reproduction of the displacement field for case b) is depicted in Fig. 2b, where the simulation domain is discretized by \(13^2\) cells with \(p=5\). Note that the entirely fictitious cells are discarded, leading to 141 active finite cells. For more discussion regarding the numerical solution, see the end of this sub-section. The strain energy in the physical domain is computed analytically as (Appendix B.1.2)

$$\begin{aligned} \Pi _{\Omega _{\textrm{phys}}}{} & {} = \Pi _{\Omega _{\textrm{e}}} - \Pi _{\Omega _{\textrm{void}}}\nonumber \\{} & {} = {\left\{ \begin{array}{ll} 57.86222286702496\,{\textrm{J}} &{}\text {for case a)} \\ 4.745538525601361\,{\textrm{J}} &{}\text {for case b)} \end{array}\right. } , \end{aligned}$$
(32)

where \(\Pi _{\Omega _{\textrm{e}}}\) is the strain energy in the square-shaped embedding domain

$$\begin{aligned} \Pi _{\Omega _{\textrm{e}}} = \dfrac{1}{2} \int \limits _0^4 \int \limits _0^4 \varvec{\sigma }(r): \varvec{\varepsilon }(r)\, \text {dxdy}, \end{aligned}$$
(33)

and \(\Pi _{\Omega _{\textrm{void}}}\) denotes the integral of the strain energy function over \(\Omega _{\textrm{void}}\), which is computed in polar coordinates (see Appendix A.1.3)

$$\begin{aligned} \Pi _{\Omega _{\textrm{void}}} = \dfrac{1}{2} \int \limits _0^{\nicefrac {\pi }{2}} \int \limits _0^R \varvec{\sigma }(r): \varvec{\varepsilon }(r)\, r\, \text {drd}{{\theta }}. \end{aligned}$$
(34)

In the current example, various h-refinements are conducted using polynomial degrees of \(p=1,\ldots ,5\), and discretizations by 1, \(3^2\), \(7^2\), \(9^2\) and \(11^2\) finite cells. As of the numerical integration, an LIM with boundary aligned sub-cells based on the blending function method are used [14]. In the sub-cells, \((p+m)^2\) integration points are used, with \(m =\)1, 2, 2, 3, and 5 for \(p=\)1, 2, 3, 4 and 5, respectively.Footnote 4 In every simulation, for the uncut phyical cells, \(m=\)1 is chosen, and for integration points in \(\Omega _{\textrm{void}}\), \(\alpha = 10^{-12}\) is used.

Additional settings for the Nitsche method in case a): The curve integrals are computed directly on the circular arc with an exact mapping. For the integration along curve, \(p+k\) integration points are used with \(k=1\), 1, 2, 3, and 3 for the investigated polynomial degrees. Finally. the penalty parameter in Eqs. (22) and (23) is chosen as \(\beta = C E/h\).Footnote 5 Here, h is the edge length of the cells and C is chosen as \(C = 10^2\), \(10^3\), \(10^3\), \(10^3\), and \(10^5\) for \(p=1,\ldots ,5\).

Fig. 4
figure 4

Relative error in the energy norm \(e_{\textrm{E}}^{\textrm{rel}}\,[\%]\) for problems with enforced and directly fulfilled weak boundary conditions

The simulation quality is measured by the relative error in the energy norm

$$\begin{aligned} e_{\textrm{E}}^{{\textrm{rel}}} = \sqrt{\dfrac{|\Pi - \Pi ^{\textrm{h}}|}{\Pi }} \cdot 100\%, \end{aligned}$$
(35)

where \(\Pi ^{\textrm{h}}\) is the strain energy computed by FCM. The corresponding convergence curves over the degrees of freedom (DOF) are depicted in Fig. 4, where theoretical convergence rates with p/2 [37, 66], indicated by the black triangles, are obtained for both cases. Note that while the Nitsche method requires additional computational effort, Fig. 4b demonstrates that using the proposed approach (Eq. (31)), the manufactured solution can be reproduced with a really high accuracy without the need for a weak imposition of the boundary conditions. Here, we refer again to Fig. 2b, where the vanishing values of \(\sigma _{\textrm{rr}}\) on the circular boundary can be observed.

3.1.2 Plate with circular hole—undamped frequency domain analysis

In this section, a frequency domain analysis is conducted in order to verify the implementation of dynamic features such as the mass matrix. The manufactured solution in this example exhibits a harmonic time dependence

$$\begin{aligned} u_{r}(r,t)= & {} {\hat{u}}_{\textrm{r}}(r) \cdot \exp ({\textrm{i}}\Omega t), \end{aligned}$$
(36)
$$\begin{aligned} \ddot{u}_{\textrm{r}}(r,t)= & {} -\Omega ^2 {\hat{u}}_{\textrm{r}}(r) \cdot \exp ({\textrm{i}}\Omega t), \end{aligned}$$
(37)

where \({\hat{u}}_{\textrm{r}}\) is the amplitude of the displacement field based on Eqs. (28) and (31),Footnote 6 and \(\Omega =2\pi f\) [Hz] is the circular frequency defined by the excitation frequency f [Hz]. Note that all other quantities, such as

$$\begin{aligned} \varvec{\varepsilon }= & {} \hat{\varvec{\varepsilon }} \cdot \exp ({\textrm{i}}\Omega t), \end{aligned}$$
(38)
$$\begin{aligned} \varvec{\sigma }= & {} \hat{\varvec{\sigma }} \cdot \exp ({\textrm{i}}\Omega t),\end{aligned}$$
(39)
$$\begin{aligned} {\varvec{b}}= & {} \hat{{\varvec{b}}} \cdot \exp ({\textrm{i}}\Omega t) \end{aligned}$$
(40)

are oscillating with the same harmonic function, or with the square of the harmonic function

$$\begin{aligned} \Pi = {\hat{\Pi }} \cdot \exp ({\textrm{i}}\Omega t)^2. \end{aligned}$$
(41)

Note that since \(\hat{{\varvec{u}}}\) equals \({\varvec{u}}\) from the previous example, and the material properties are also the same, \({\hat{\Pi }}\) is equal to the value defined in Eq. (32) for case b). Due to the same harmonic time dependence of the solution fields and body load, rather than solving Eq. (17) in space and time, the steady state problem

$$\begin{aligned} ({\varvec{K}} - \Omega ^2 {\varvec{M}} ) \hat{{\varvec{U}}} = \hat{{\varvec{F}}} \end{aligned}$$
(42)

is solved. In the current case, the static body load of Eq. (29) is extended by an inertia term according to Eq. (10). Following from the accelerations given in Eq. (37), the magnitude of the harmonic radial body load is

$$\begin{aligned} {\hat{b}}_{\textrm{r}} =\dfrac{2}{r}\dfrac{E}{\nu ^2-1} - \rho \Omega ^2 {\hat{u}}_{\textrm{r}}(r) . \end{aligned}$$
(43)
Fig. 5
figure 5

Global simulation accuracy over the frequency range when using Eqs. (29) and (43) for the computation of body loads

Fig. 6
figure 6

Convergence rates of the relative error in energy norm \(e_{\textrm{E}}^{\textrm{rel}}\,[\%]\) for different excitation frequencies

Here, the second term should counteract the inertia effects, such that the manufactured displacement field is indeed reproduced by the numerical model. This is demonstrated in Fig. 5a, where a body load without the \(\rho \Omega ^2{\hat{u}}_{\textrm{r}}\) term results in a typical frequency plot with resonance amplitudes at the location of the system’s eigenfrequencies (red curve). However, counteracting the inertia forces enables an approximate reproduction of the manufactured displacement and strain energy regardless of \(\Omega \) (blue curve). Note that despite its constant appearance, the strain energy is not really constant, and the relative error in the energy norm reveals in Fig. 5b, that even with the presence of the \(\rho \Omega ^2{\hat{u}}_{\textrm{r}}\) term, excitation with a particular eigenfrequency leads to the decay of simulation accuracy.

Fig. 7
figure 7

Convergence rates for the damped frequency domain analysis for \(f=100\) Hz

For further analysis, the excitation frequencies \(f=1000\) Hz and \(f=3900\) Hz are selected (indicated in Fig. 5b) and the convergence results of the relative error in the energy norm are depicted in Fig. 6. For the h-refinement, the same settings are used as in the previous example. For an excitation frequency far away from an eigenfrequency (Fig. 6a), optimal convergence rates are obtained, demonstrating the capabilities of the current manufactured solution for verification of steady state FCM problems. However, a preliminary study should always be conducted, such that possible eigenfrequencies are avoided, since they spoil the convergence rates (Fig. 6b) and thus, the code verification.

3.1.3 Plate with circular hole—damped frequency domain analysis

In this section, the problem of Sect. 3.1.2 is extended by a velocity proportional damping term, for which, the body force vector is given in Eq. (10). Due to the presence of first time derivatives, Eqs. (36)–(37) are extended by

$$\begin{aligned} \dot{{\varvec{u}}} = {\textrm{i}}\Omega \hat{{\varvec{u}}} \exp ({\textrm{i}}\Omega t) \end{aligned}$$
(44)

where, \(\hat{{\varvec{u}}}\) is the same as defined in Eqs. (28) and (31). Since the problem is solved in the frequency domain, only the spatial terms of Eq. (10) are of interest, thus, the magnitude of body load reads

$$\begin{aligned} \hat{{\varvec{b}}} = -{\textrm{Div}}(\hat{\varvec{\sigma }})+ {\textrm{i}}\Omega \kappa \hat{{\varvec{u}}} -\Omega ^2 \rho \hat{{\varvec{u}}}. \end{aligned}$$
(45)

For now, a stiffness proportional loss factor damping is used, which is typically defined for the global system of Eq. (17) as

$$\begin{aligned} {\varvec{D}} = \dfrac{\kappa }{\Omega }{\varvec{K}}. \end{aligned}$$
(46)

By reverse engineering from Eq. (46), the closed-form expression for the manufactured body force reads

$$\begin{aligned} \hat{{\varvec{b}}} ~= & {} ~ -{\textrm{Div}}(\hat{\varvec{\sigma }})+ {\textrm{i}}\kappa \,{\textrm{Div}}(\hat{\varvec{\sigma }}) -\Omega ^2 \rho \hat{{\varvec{u}}}\nonumber \\ ~= & {} ~ (-1+{\textrm{i}}\kappa ){\textrm{Div}}(\hat{\varvec{\sigma }}) -\Omega ^2 \rho \hat{{\varvec{u}}} . \end{aligned}$$
(47)

Note that Eq. (17) is a system of equations, where both the coefficient matrix and the right-hand side contain complex numbers, and thus, the global displacement vector \(\hat{{\varvec{U}}}\) is complex. Most solvers can handle complex inputs, however, if the used code does not provide this feature, the problem can be solved by separating the real and imaginary parts according to Ref. [67]. For the current example, all simulation settings are the same as before, with the exceptions, that \(f=100\,{\textrm{Hz}}\) is chosen, and additionally, a loss factor damping with \(\kappa =0.01\) is assumed. In Fig. 7a, the relative error in the energy norm \(e_{\textrm{E}}^{\textrm{rel}}\) is depicted, however, since the reference displacement field is known at every point, other standard error estimators can be used as well, such as the relative error of the displacement in the \(L_2\)-norm

$$\begin{aligned} e_{L2}^{\textrm{rel}} = \dfrac{ ||{\varvec{e}}||_{L_2} }{ ||{\varvec{u}}||_{L_2} } \cdot 100\%, \end{aligned}$$
(48)

as depicted in Fig. 7b. In Eq. (48), \({\varvec{e}} = {\varvec{u}}-{\varvec{u}}^{\textrm{h}}\), and for a given vector field \({\varvec{f}}\), and inner product defined as \(\langle \cdot , \cdot \rangle \), the \(L_2\)-norm reads

$$\begin{aligned} ||{\varvec{f}}||_{L_2}= & {} \left( \int _\Omega \langle {\varvec{f}}, {\varvec{f}} \rangle \,{\textrm{d}}{\varvec{x}}\right) ^{1/2} . \end{aligned}$$
(49)
Fig. 8
figure 8

Problem setup and global accuracy of the simulation

For both error measures, theoretical convergence rates are obtained, i.e., p/2 and \((p+1)/2\) for \(e_{\textrm{E}}^{rel}\) and \(e_{\textrm{L2}}^{rel}\) over DOF, respectively, as indicated by the black slopes. Thus, the verification of damped steady state problems in an embedded framework is also demonstrated. Note that for low levels of error, the integration accuracy and precision of the computational program and language can be limiting factors for the simulation quality, as seen by the plateau in the curve for \(p=5\).

3.1.4 Cube with spherical hole—static analysis

The manufactured solution given in Eq. (28) for the 2D case can be extended to 3D, however, in this case, the zero traction condition of Eq. (27) modifies to

$$\begin{aligned} \sigma _{\textrm{rr}} ~= & {} ~ \dfrac{E}{(1+\nu )(2\nu -1)}\bigg [(\nu -1) \dfrac{{\textrm{d}} u_{r}}{{\textrm{d}} r}\bigg |_{r=R} \nonumber \\{} & {} - 2\nu \dfrac{u_{r}(r=R)}{r} \bigg ]=0\,, \end{aligned}$$
(50)

leading to the c-parameter (cf. 2D case in Appendix B.1.1)

$$\begin{aligned} c = \dfrac{1}{R} \exp \left( \dfrac{-1+\nu }{1+\nu } \right) . \end{aligned}$$
(51)

Finally, based on the chosen displacement field and constitutive law, the body load applied in the physical domain reads

$$\begin{aligned} b_{\textrm{r}}= \dfrac{-3E(\nu -1)}{r(1 + \nu )(2\nu -1)}. \end{aligned}$$
(52)

The simulation domain for the current problem with a spherical void region is depicted in Fig. 8a. Note that for the current 3D case, the chosen displacement field leads to a strain energy, whose computation involves integrals of the form

$$\begin{aligned} \iiint {\textrm{ln}}(\sqrt{x^2+y^2+z^2})\,{\textrm{d}}x\,{\textrm{d}}y\,{\textrm{d}}z, \end{aligned}$$
(53)

which unfortunately, cannot be computed symbolically. Although, in a sense, this poses a limitation, a comparison of the numerical solution to the manufactured one is still possible, if e.g., the \(L_2\)-norm of the displacements is computed according to Eq. (48). For the current problem, h-refinements with \(p=1\), 2, and 3 are performed using discretizazions by 1, \(3^3\), \(7^3\), and \(11^3\) cells. The numerical integration is carried out using a novel integration scheme with merged octree sub-cells [16]. Here, the refinement level of the octree is set to \({\mathcal {R}}=p+2\), and in the physical cells as well as in the integration sub-cells, \((p+1)^3\) integration points are used. The corresponding results are depicted in Fig. 8b, where the black slopes indicate the theoretical convergence rates with \((p+1)/3\) for relative error in the \(L_2\)-norm \(e_{\textrm{L2}}^{\textrm{rel}}\) over DOF. The obtained excellent results indicate an error-free implementation and demonstrate the suitability of the MoMS in the context of 3D problems.

3.2 Inclusion regions with radial displacements

Manufactured radial displacement fields formulated in polar/spherical coordinate systems can be applied to problems with inclusions as well. In this case, the tensor-valued normal stress jump condition for the interface is reduced to the simple scalar condition

$$\begin{aligned} \text {Eq.~(8)}~~\longrightarrow ~~\sigma _{\textrm{rr}}^{\textrm{inc}}(r=R)-\sigma _{\textrm{rr}}^{\textrm{mat}}(r=R)= 0. \end{aligned}$$
(54)

In particular, for a 2D case with a plane stress state, the above equation reads

$$\begin{aligned} \sigma _{\textrm{rr}}^{\textrm{inc}}= & {} \dfrac{E_{\textrm{inc}}}{1-\nu _{\textrm{inc}}^2}\left( \dfrac{{\textrm{d}}u_{r}^{\textrm{inc}} }{{\textrm{d}}r}\bigg |_{r=R} + \nu _{\textrm{inc}} \dfrac{ u_{r}^{\textrm{inc}}}{r}\right) \nonumber \\= & {} \dfrac{E_{\textrm{mat}}}{1-\nu _{\textrm{mat}}^2}\left( \dfrac{{\textrm{d}}u_{r}^{\textrm{mat}} }{{\textrm{d}}r}\bigg |_{r=R}+ \nu _{\textrm{mat}} \dfrac{ u_{r}^{\textrm{mat}}}{r}\right) = \sigma _{\textrm{rr}}^{\textrm{mat}}, \end{aligned}$$
(55)

where for the displacement field along the interface, the equality

$$\begin{aligned} u_{r}^{\textrm{inc}}(r=R) =u_{r}^{\textrm{mat}}(r=R) \end{aligned}$$
(56)

must hold. Similar to Eq. (27), there exist multiple ways for choosing the material properties and manufacturing the displacement, such that the stress-continuity is fulfilled. For now,

$$\begin{aligned} u_{r}^{\textrm{inc}}(r=R) = u_{r}^{\textrm{mat}}(r=R) = 0 \end{aligned}$$
(57)

is assumed. In this case, radial stress continuity is fulfilled if

$$\begin{aligned} \dfrac{{\textrm{d}}u_{r}^{\textrm{inc}} }{{\textrm{d}}r}\bigg |_{r=R} = c\, \dfrac{{\textrm{d}}u_{r}^{\textrm{mat}} }{{\textrm{d}}r}\bigg |_{r=R}, \end{aligned}$$
(58)

where

$$\begin{aligned} c = \dfrac{E_{\textrm{mat}}(1-\nu _{\textrm{inc}}^2)}{E_{\textrm{inc}}(1-\nu _{\textrm{mat}}^2)}. \end{aligned}$$
(59)

3.2.1 Cube with spherical inclusion—static analysis

In this section, a 3D test is conducted involving a cube of side length \(a=4\) m (\(\Omega _{\textrm{mat}}\)) and a spherical inclusion with a radius of \(R=2\) m (\(\Omega _{\textrm{inc}}\)), as depicted in Fig. 9a. While on the three faces indicated by red, the manufactured displacement is prescribed, on the remaining faces, symmetry boundary conditions are used. For \(\Omega _{\textrm{mat}}\) in the given example, a radial displacement field defined in spherical coordinates is chosen

$$\begin{aligned} u_{\textrm{r}}^{\textrm{mat}}(r) = s \left( r^5-4r^3\right) , \end{aligned}$$
(60)

where s is a scaling factor chosen to be \(s=1/(1.6 \cdot 10^5)\). Furthermore, the displacement field in \(\Omega ^{\textrm{inc}}\) reads

$$\begin{aligned} u_{\textrm{r}}^{\textrm{inc}}(r) = c\,u_{\textrm{r}}^{\textrm{mat}}(r). \end{aligned}$$
(61)

Note that in this case, Eq. (58) holds, and c is defined based on Eq. (59). For \(u_{\textrm{r}}^{\textrm{mat}}(r=R) = 0\) and for any \(c\ne 1\), the manufactured displacement field exhibits a kink at the interface (Fig. 10b). In the current example, the material properties \(E_{\textrm{mat}} = 10\) Pa, \(E_{\textrm{inc}}=0.1\) Pa and \(\nu _{\textrm{mat}} = \nu _{\textrm{inc}} = 0.3\) are chosen, leading to \(c=100\). The deformed shape of the simulation domain is depicted in Fig. 9b. The body loads in spherical coordinate system read

$$\begin{aligned} b_{\textrm{r}}^{\textrm{mat}}= & {} -\dfrac{4sE_{\textrm{mat}} r (\nu _{\textrm{mat}}-1) (7r^2-10)}{2\nu _{\textrm{mat}}^2+\nu _{\textrm{mat}}-1}, \end{aligned}$$
(62)
$$\begin{aligned} b_{\textrm{r}}^{\textrm{inc}}= & {} -c\dfrac{4sE_{\textrm{inc}} r (\nu _{\textrm{inc}}-1) (7r^2-10)}{2\nu _{\textrm{inc}}^2+\nu _{\textrm{inc}}-1}, \end{aligned}$$
(63)

for the inclusion and matrix, respectively, which are, in fact, equal due to the choice of c. The strain energy for the multi-material domain \(\Omega _{\textrm{mat}} \cup \Omega _{\textrm{inc}}\) reads

$$\begin{aligned} \begin{aligned} \Pi ~=~&\dfrac{2048s^2}{17325} \Big (704c^2(2933371\lambda _\textrm{mat}+3328226\mu _\textrm{mat})\\&+1075\pi \big [c^2(\lambda _\textrm{inc}+2\mu _\textrm{inc})-(\lambda _\textrm{mat}+2\mu _\textrm{mat})\big ]\Big )\\ ~=~&9.664790469963024 \cdot 10^{-2}\,\textrm{J}\,. \end{aligned} \end{aligned}$$
(64)
Fig. 9
figure 9

Simulation of a 3D inclusion problem with a single finite cell

Fig. 10
figure 10

Global results and local field values along the cut line B–B’ indicated in Fig. 9a

For the current example, the domain is discretized by a single cell only and a p-refinement is conducted with \(p=1,\,\ldots ,\, 6\). The computation of the enriched cell matrix is performed using a novel octree-based, Boolean integration approach (B-FCM) for multi-material problems [5]. The simulation accuracy is investigated in Fig. 10. Here, the global result is measured by the relative error in the energy norm \(e_{\textrm{E}}^{\textrm{rel}}\) in Fig. 10a, while in Fig. 10b–d, local results along the cut line B–B’ of Fig. 9a are depicted for \(p=6\), i.e., weakly continuous displacements, discontinuous strains, and continuous stresses. Both the global and local results indicate an accurate FCM approximation of the multi-material manufactured solution, even in the presence of embedded interfaces.

3.3 Multi-material manufactured solutions based on level-set functions

In this section, an alternative framework is introduced for deriving the manufactured solution, which is (i) based on Cartesian coordinates, (ii) ideal for problems with inclusions, and (iii) supports a much larger range of immersed geometries than the approach discussed so far. As point of departure,

$$\begin{aligned} {\varvec{u}} = {\left\{ \begin{array}{ll} {\varvec{u}}_{\textrm{mat}}~~&{}\text {in}~\Omega _{\textrm{mat}}\\ {\varvec{u}}_{\textrm{inc}}~~&{}\text {in}~\Omega _{\textrm{inc}} \end{array}\right. } \end{aligned}$$
(65)

is assumed, where \({\varvec{u}}_{\textrm{inc}}\) and \({\varvec{u}}_{\textrm{mat}}\) are the displacement fields on the two sides of the material interface \(\partial \Omega _{{\textrm{inc}}}\). A convenient way for introducing a kink in the displacement field along \(\partial \Omega _{{\textrm{inc}}}\) is where \({\varvec{u}}_{\textrm{inc}}\) is a uniformly scaled version of \({\varvec{u}}_{\textrm{mat}}\)

$$\begin{aligned} {\varvec{u}}_{\textrm{inc}} = c\, {\varvec{u}}_{\textrm{mat}}, \end{aligned}$$
(66)

with vanishing displacements along the interface

$$\begin{aligned} {\varvec{u}}_{\textrm{inc}}({\varvec{x}}) = {\varvec{u}}_{\textrm{mat}}({\varvec{x}}) = {\varvec{0}} ~~~\forall {\varvec{x}} \in \partial \Omega _{{\textrm{inc}}}. \end{aligned}$$
(67)

Note that if Eq. (67) is violated, Eq. (66) would actually introduce a jump in the displacements, rather than a kink. Since level-set functions \(\varphi \) are, by definition, vanishing at \(\partial \Omega _{{\textrm{inc}}}\) (cf. Equation (21)), it is very convenient to manufacture \({\varvec{u}}\) using \(\varphi \). The parameter c in Eq. (66) will be defined soon, such that stress continuity along the interface normal \({\varvec{n}}_{\textrm{inc}}\) is fulfilled. As point of departure, instead of requiring the fulfillment of the original stress continuity condition given in Eq. (8), we rather seek a more general restriction in the whole domain

$$\begin{aligned} \varvec{\sigma }_{\textrm{inc}}({\varvec{x}}) = \varvec{\sigma }_{\textrm{mat}}({\varvec{x}}) ~~\forall {\varvec{x}} \in \Omega , \end{aligned}$$
(68)

which naturally fulfills Eq. (8), yet it does not require specific knowledge of the interface normal \({\varvec{n}}_{\textrm{inc}}\). Thus, more general geometries can also be tested. From Eq. (66), it naturally follows that

$$\begin{aligned} \varvec{\varepsilon }_{\textrm{inc}} = c \, \varvec{\varepsilon }_{\textrm{mat}}. \end{aligned}$$
(69)

and in case of a plane stress state in Cartesian coordinates, equality of the functions \(\sigma _{\textrm{xx}}^{\textrm{inc}}\) and \(\sigma _{\textrm{xx}}^{\textrm{mat}}\) implies

$$\begin{aligned}{} & {} \sigma _{\textrm{xx}}^{\textrm{inc}} = \sigma _{\textrm{xx}}^{\textrm{mat}}, \end{aligned}$$
(70)
$$\begin{aligned}{} & {} c\left[ \dfrac{E_{\textrm{inc}}}{1-\nu _{\textrm{inc}}^2} \left( \varepsilon _{\textrm{xx}}^{\textrm{mat}} + \nu _{\textrm{inc}} \varepsilon _{\textrm{yy}}^{\textrm{mat}} \right) \right] \nonumber \\{} & {} \quad = \dfrac{E_{\textrm{mat}}}{1-\nu _{\textrm{mat}}^2} \left( \varepsilon _{\textrm{xx}}^{\textrm{mat}} + \nu _{\textrm{mat}} \varepsilon _{\textrm{yy}}^{\textrm{mat}}\right) \end{aligned}$$
(71)

which is fulfilled for all values of \(\varepsilon _{\textrm{xx}}^{\textrm{mat}}\) and \(\varepsilon _{\textrm{yy}}^{\textrm{mat}}\) if

$$\begin{aligned} c = \dfrac{E_{\textrm{mat}}}{E_{\textrm{inc}}}~~\text {and}~~\nu _{\textrm{inc}} = \nu _{\textrm{mat}}. \end{aligned}$$
(72)

This condition also ensures the continuity of the stresses \(\sigma _{\textrm{yy}}^{\textrm{inc}} = \sigma _{\textrm{yy}}^{\textrm{mat}}\). Regarding the shear stresses, equality is fulfilled for

$$\begin{aligned} \sigma _{\textrm{xy}}^{\textrm{inc}}= & {} \sigma _{\textrm{xy}}^{\textrm{mat}}, \end{aligned}$$
(73)
$$\begin{aligned} c \dfrac{E_{\textrm{inc}}}{1-\nu _{\textrm{inc}}} \varepsilon _{\textrm{xy}}^{\textrm{mat}}= & {} \dfrac{E_{\textrm{mat}}}{1-\nu _{\textrm{mat}}} \varepsilon _{\textrm{xy}}^{\textrm{mat}},\end{aligned}$$
(74)
$$\begin{aligned} c= & {} \dfrac{E_{\textrm{mat}}}{E_{\textrm{inc}}} \dfrac{1-\nu _{\textrm{inc}}}{1-\nu _{\textrm{mat}}} \end{aligned}$$
(75)

which is, if \(\nu ^{\textrm{inc}}=\nu ^{\textrm{mat}}\) is assumed, identical to Eq. (72). In the following sub-sections, the capabilities of this approach are presented for deriving closed-form reference solutions for inclusions of different geometries.

Remark on the assumption in Eq. (68): Note that the assumption is not valid for real physical problems, however, in the framework of MoMS, this issue does not constitute a problem. Despite the equality of the stress tensors, the (i) Young’s moduli in \(\Omega _{\textrm{mat}}\) and \(\Omega _{\textrm{inc}}\) are still different, and (ii) the displacement field is still \(C^0\)-continuous. Thus, the above introduced approach represents a legitimate inclusion and allows for validation of multi-material immersed boundary codes.

Remark on void regions: While the presented level-set-based approach is really convenient for problems with material interfaces, its application to problems with hole regions is more tedious. In the multi-material case, instead of requiring the stress fields to have a specific value along the material interface, only their continuity is required by the special case posed by Eq. (68). For hole regions, vanishing tractions have to be ensured, i.e., \(\varvec{\sigma }\) must take a specific value at the free boundary, such that

$$\begin{aligned} \sigma _{\textrm{xx}}n_{\textrm{x}}+ \sigma _{\textrm{xy}}n_{\textrm{y}}= & {} 0, \end{aligned}$$
(76)
$$\begin{aligned} \sigma _{\textrm{xy}}n_{\textrm{x}}+ \sigma _{\textrm{yy}}n_{\textrm{y}}= & {} 0, \end{aligned}$$
(77)

is fulfilled in a 2D setting. Note that when assuming a radial displacement field in polar/spherical coordinates with circular/spherical geometries (Sects. 3.1 and 3.2), the above system of equations reduces to Eqs. (26) and (54), and manufacturing \({\varvec{u}}\) for which Eq. (24) holds, is trivial. However, regardless of the chosen coordinate system, for hole regions with more complex shape, there is no way around taking \({\varvec{n}}_{\textrm{void}}\) into account.

Finally, we would like to point out, that these issues only arise if zero traction conditions should be naturally fulfilled by the manufactured displacement field. In case of weak boundary conditions (Sect. 2.2), no restrictions apply regarding the shape of the void region and the chosen coordinate system.

Fig. 11
figure 11

Problem setup. All dimensions and displacements are given in [mm]

3.3.1 Plate with elliptic inclusion—static analysis

For demonstration of the methodology described above, a square domain with an elliptic inclusion is investigated (Fig. 11a), where the manufactured displacement field in \(\Omega _{\textrm{mat}}\)

$$\begin{aligned} {\varvec{u}}_{\textrm{mat}}(x,y) = \begin{bmatrix} u_{\textrm{x}}(x,y)\\ u_{\textrm{y}}(x,y) \end{bmatrix} = \begin{bmatrix} \varphi (x,y)\\ \varphi (x,y) \end{bmatrix} \end{aligned}$$
(78)

is based on the level-set function of the ellipse

$$\begin{aligned} \varphi (x,y) = \left( \dfrac{x}{R_{\textrm{x}}}\right) ^{2} - \left( \dfrac{y}{R_{\textrm{y}}}\right) ^{2} - 1, \end{aligned}$$
(79)

and \({\varvec{u}}_{\textrm{inc}}\) in \(\Omega _{\textrm{inc}}\) is computed based on Eq. (66). For the Young’s moduli, \(E_{\textrm{mat}}=1\) Pa and \(E_{\textrm{inc}}=10\) Pa are chosen, while in both domains, \(\nu _{\textrm{mat}} = \nu _{\textrm{inc}} = 0.3\) applies. Based on the chosen material parameters and Eq. (72), \(c=0.1\) holds for the current problem, and the corresponding \(C^0\)-continuous displacement field is depicted in Fig. 11b along the cut line C–C’ of Fig. 11a. Furthermore the body load vectors are defined as

$$\begin{aligned}{} & {} {\varvec{b}}_{\textrm{mat}} = \begin{bmatrix} ~\dfrac{E_{\textrm{mat}}(3-2\nu _{\textrm{mat}})}{2(\nu _{\textrm{mat}}^2-1)}\\ -\dfrac{E_{\textrm{mat}}(-9+\nu _{\textrm{mat}})}{4(\nu _{\textrm{mat}}^2-1)} \end{bmatrix} ~~~\text {and}\nonumber \\{} & {} \quad {\varvec{b}}_{\textrm{inc}} = \begin{bmatrix} ~\dfrac{c\,E_{\textrm{inc}}(3-2\nu _{\textrm{inc}})}{2(\nu _{\textrm{inc}}^2-1)}\\ -\dfrac{c\,E_{\textrm{inc}}(-9+\nu _{\textrm{inc}})}{4(\nu _{\textrm{inc}}^2-1)} \end{bmatrix}, \end{aligned}$$
(80)

which are for \({\varvec{b}} = -{\textrm{Div}}(\varvec{\sigma })\) in the static case, in fact, equalFootnote 7. Additionally, due to Eq. (78) being a second order polynomial in the current example, the body force field is constant. Finally, the closed-form expression for the strain energy reads

$$\begin{aligned}{} & {} \Pi _{\textrm{ref}} = \dfrac{5 c^2 E_{\textrm{inc}} (\nu _{\textrm{inc}}-3) \pi }{8 (\nu _{\textrm{inc}}^2-1)} - \dfrac{E_{\textrm{mat}} (\nu _{\textrm{mat}}-3) (5 \pi -918)}{8 (\nu _{\textrm{mat}}-1) (\nu _{\textrm{mat}}+1)} \nonumber \\{} & {} \quad = \dfrac{1215}{728} (204-\pi )\,[{\textrm{J}}] = 335.2238529201764\,[{\textrm{J}}]. \end{aligned}$$
(81)

Since the manufactured solution is a quadratic polynomial and the elliptic interface can also be exactly approximated by 2\(^{\textrm{nd}}\) order polynomials, \(p = 2\) and \(p_\psi =2\) should yield basically exact results, provided that other numerical errors are also marginal. Indeed, a discretization of \(\Omega \) by \(2\times 2\) cells and numerical integration via sub-cells based on the blending function method yield practically exact results in the energy norm when compared to Eq. (81)

$$\begin{aligned} e_{\textrm{E}}^{\textrm{rel}} = 6.1078\cdot 10^{-6}\,\%. \end{aligned}$$
(82)

In Fig. 12a, the discontinuous strains are visualized for the chosen problem, where Eq. (69) holds, while Fig. 12b depicts a continuous stress field, which follows from the requirement posed in Eq. (68).

Fig. 12
figure 12

Visualization of the discontinuous strain and continuous stress fields for the given problem. The dashed line indicates the location of the elliptic material interface

Fig. 13
figure 13

Real and imaginary parts of the complex displacement field over \(\Omega _{\textrm{mat}}\cup \Omega _{\textrm{inc}}\)

3.3.2 Plate with elliptic inclusion—damped frequency domain analysis

The previous example offers a great way for testing inclusions of more complex shapes in a single step. However, if a convergence analysis is desired, the initially polynomial displacement field can be multiplied by non-polynomial terms. For the current example, the same domain setup is used as in Fig. 11a, but Eq. (78) is extended by a trigonometric term

$$\begin{aligned} \hat{{\varvec{u}}}(x,y) = {\left\{ \begin{array}{ll} \hat{{\varvec{u}}}_{\textrm{mat}}(x,y) = \begin{bmatrix} \varphi (x,y)\sin (x)\\ \varphi (x,y)\sin (x) \end{bmatrix} &{}\text {in}~\Omega _{\textrm{mat}} \\ \hat{{\varvec{u}}}_{\textrm{inc}}(x,y) = c\, \hat{{\varvec{u}}}_{\textrm{mat}}(x,y) &{}\text {in}~\Omega _{\textrm{inc}} \end{array}\right. }. \end{aligned}$$
(83)

Furthermore, this time, a damped frequency domain analysis is conducted for \(f=100\) Hz, where the manufactured displacement is of the form

$$\begin{aligned} {\varvec{u}}(x,y,t) = \hat{{\varvec{u}}}(x,y)\,\exp ({\textrm{i}} 2 \pi f t) \end{aligned}$$
(84)

The material properties are chosen as \(E_{\textrm{mat}}=1.5\cdot 10^9\) Pa, \(\kappa _{\textrm{mat}}=1\) and \(\rho _{\textrm{mat}}=1\,{\textrm{kg}}/{\textrm{m}}^3\) in the matrix \(\Omega _{\textrm{mat}}\), and \(E_{\textrm{inc}}=6\cdot 10^9\) Pa, \(\kappa _{\textrm{inc}}=0.5\) and \(\rho _{\textrm{inc}}=2\,{\textrm{kg}}/{\textrm{m}}^3\) in the inclusion \(\Omega _{\textrm{inc}}\). In case of the current multi-material problem with loss factor damping, a complex c-parameter is used

$$\begin{aligned} c = \dfrac{E_{\textrm{mat}}(1+{\textrm{i}}\kappa _{\textrm{mat}})}{E_{\textrm{inc}}(1+{\textrm{i}}\kappa _{\textrm{inc}})} = 0.3 + 0.1{\textrm{i}}, \end{aligned}$$
(85)

leading to a displacement field, which has a real part over \(\Omega _{\textrm{mat}}\cup \Omega _{\textrm{inc}}\) and imaginary part over \(\Omega _{\textrm{inc}}\), as depicted in Fig. 13 for a discretization by \(4\times 4\) spectral cells with quintic shape functions. Note that unlike \(\mathfrak {Im}({\varvec{u}})\) in \(\Omega _{\textrm{mat}}\), \(\mathfrak {Re}({\varvec{u}})\) in \(\Omega _{\textrm{inc}}\) is not zero, it is only scaled down, similar to Fig. 11.

Fig. 14
figure 14

Relative error in the \(L_2\)-norm \([\%]\)

For multi-material problems in general, the damping parameter is yet another discontinuous material property. Thus, Eq. (46) cannot be applied globally to the assembled system matrices, but has to be realized on sub-cell-level during the numerical integration

$$\begin{aligned} {\varvec{D}}^{(c)} = \sum _{i=1}^{n_{\textrm{d}}} \kappa _i {\varvec{K}}^{(c)}_i, \end{aligned}$$
(86)

where \(n_{\textrm{d}}\) is the number of material sub-domains in the cell c, while \(\kappa _i\) and \({\varvec{K}}^{(c)}_i\) are the damping parameter and stiffness matrix corresponding to the \(i^\text {th}\) material sub-domain, respectively. In the following, we perform h-refinements using discretization by \(2^2\), \(4^2\), \(8^2\), and \(15^2\) finite cells while approximating the displacements by polynomial degrees of \(p=1,2,\ldots ,5\). Due to the elliptic inclusion, the enrichment term is realized using \(p_\psi =2\) for all settings. The relative error in the \(L_2\)-norm indicates optimal convergence rates in Fig. 14 for the real and imaginary parts of \({\varvec{u}}\), which are both weakly continuous at the material interface, as depicted in Fig. 13.

3.3.3 Plate with elliptic inclusion—transient analysis

In the current example, a transient problem is considered by extending the manufactured solution of Sect. 3.3.1 by a time-dependent term

$$\begin{aligned} {\varvec{u}}({\varvec{x}},t) = \hat{{\varvec{u}}}({\varvec{x}}) \cdot \tau (t), \end{aligned}$$
(87)

for which \(\tau (t) = \sin (\Omega \,t)\) is chosen with \(\Omega =10\,[{\textrm{Hz}}]\). The magnitude of the displacement field \(\hat{{\varvec{u}}}({\varvec{x}})\), the material properties, and the discretization are identical to those in Sect. 3.3.1. Additionally, in both domains, i.e., matrix and inclusion, \(\rho _{\textrm{mat}}=\rho _{\textrm{inc}}=1\) is chosen, and according to Eq. (10), the corresponding transient body forces read

$$\begin{aligned} {\varvec{b}}_{\textrm{mat}}({\varvec{x}},t)= & {} \left( \begin{bmatrix} ~\dfrac{E_{\textrm{mat}}(3-2\nu _{\textrm{mat}})}{2(\nu _{\textrm{mat}}^2-1)}\\ -\dfrac{E_{\textrm{mat}}(-9+\nu _{\textrm{mat}})}{4(\nu _{\textrm{mat}}^2-1)} \end{bmatrix} - \rho _{\textrm{mat}} \Omega ^2 \hat{{\varvec{u}}}_{\textrm{mat}}({\varvec{x}}) \right) \nonumber \\{} & {} \quad \sin (\Omega \,t) , \end{aligned}$$
(88)
$$\begin{aligned} {\varvec{b}}_{\textrm{inc}}({\varvec{x}},t)= & {} \left( \begin{bmatrix} ~\dfrac{c\,E_{\textrm{inc}}(3-2\nu _{\textrm{inc}})}{2(\nu _{\textrm{inc}}^2-1)}\\ -\dfrac{c\,E_{\textrm{inc}}(-9+\nu _{\textrm{inc}})}{4(\nu _{\textrm{inc}}^2-1)} \end{bmatrix} - \rho _{\textrm{inc}} \Omega ^2 \hat{{\varvec{u}}}_{\textrm{inc}}({\varvec{x}}) \right) \nonumber \\{} & {} \quad \sin (\Omega \,t). \end{aligned}$$
(89)

Instead of solving the problem in the frequency domain, the Newmark time integration scheme is used in a time interval from \(t_0= 0\,[{\textrm{s}}]\) to \(t_{\textrm{end}}=1\,[{\textrm{s}}]\) using different numbers of time steps \(n_{\textrm{T}} = 2^m\), with \(m=3,4,\ldots ,12\)Footnote 8.

Initial conditions. For the transient solution, appropriate initial displacements and velocities are required according to Eqs. (4) and (5), respectively. These can be easily derived for the manufactured solution, where for the current case

$$\begin{aligned} {\varvec{u}}_0({\varvec{x}})= & {} \hat{{\varvec{u}}}({\varvec{x}}) \cdot \tau (t_0) = 0, \end{aligned}$$
(90)
$$\begin{aligned} \dot{{\varvec{u}}}_0({\varvec{x}})= & {} \hat{{\varvec{u}}}({\varvec{x}}) \cdot {\dot{\tau }}(t_0) = \Omega \hat{{\varvec{u}}}({\varvec{x}}). \end{aligned}$$
(91)
Fig. 15
figure 15

Unsatisfactory solution in the time domain when setting the initial conditions based on Eqs. (92) and (93)

Since the multi-material problem at hand is solved using the local enrichment approach, the mesh consists of a base mesh for the standard shape functions and an overlay mesh for the enrichment shape functions, with their associated DOFs \(\{{\varvec{U}}_{\alpha }\}_{\alpha =1}^{n_{\textrm{N}}}\) and \(\{\varvec{{\mathcal {E}}}_\alpha \}_{\alpha =1}^{n_{\textrm{N}}}\), respectively.Footnote 9 Consequently, initial values have to be assigned to both \({\varvec{U}}_{\alpha }\) and \(\varvec{{\mathcal {E}}}_\alpha \), such that \(\hat{{\varvec{u}}}^{\textrm{h}}\) is an appropriate approximation of \(\hat{{\varvec{u}}}\) in Eq. (91). Since it is not known a priori how the base and overlay meshes participate in the approximation of the \(C^0\)-continuous \(\hat{{\varvec{u}}}\), the direct assignment of initial values to \({\varvec{U}}_{\alpha }\) and \(\varvec{{\mathcal {E}}}_\alpha \) based on the known \(\hat{{\varvec{u}}}\) is not possible. As a solution to this problem, we propose the following approach: Prior to the transient analysis, a static manufactured problem is constructed with the displacement field \(\hat{{\varvec{u}}}\). For the current problem, the static analysis is nothing else than Sect. 3.3.1, where it was shown, that obtained nodal results yield the theoretically exact solution.Footnote 10 These nodal results, which include both \({\varvec{U}}_{\alpha }\) and \(\varvec{{\mathcal {E}}}_\alpha \), can be directly used for setting the initial conditions.

Remark. Note that the above mentioned issue only arises for numerical methods utilizing base and overlay meshes to account for material interfaces. For transient manufactured problems featuring only void regions, initial values only have to be assigned to \({\varvec{U}}_{\alpha }\). In this case, the known manufactured displacement field \(\hat{{\varvec{u}}}\) can be directly used to set

$$\begin{aligned} {\varvec{U}}_{\alpha } ~=~ \hat{{\varvec{u}}}({\varvec{x}}_\alpha ), \end{aligned}$$
(92)

where \({\varvec{x}}_\alpha \) denotes the position of the node \(\alpha \).

Results. Let us evaluate the strain energy and displacement in x-direction at the point \({\varvec{p}}=[0,0]\) over the simulation time, denoted by \(\Pi ^{\textrm{h}}(t)\) and \(u_{\textrm{x}}^{\textrm{h}}({\varvec{p}},t)\), respectively, using different numbers of time steps (\(n_{\textrm{T}}=16\), 32 and 128), and compare them to the reference solutions \(\Pi (t)\) and \(u_{\textrm{x}}({\varvec{p}},t)\).

First, Fig. 15 demonstrates the necessity of the a priori static solution. Here, Eq. (92) is used for the initial values on the base mesh, while

$$\begin{aligned} \varvec{{\mathcal {E}}}_\alpha = {\varvec{0}} \end{aligned}$$
(93)

is set on the overlay mesh. In addition to Fig. 15, the severely deteriorated results are also depicted in convergence analysis in Fig. 17, demonstrating how the wrong initial conditions can spoil the code verification of multi-material simulations in the context of the MoMS.

The correct results using the proposed approach for obtaining the initial conditions are depicted in Fig. 16. Already here, an increasing accuracy can be observed for finer time discretizations, reassuring about the code testing capabilities of the MoMS for enriched transient SCM simulations. That the numerical solution indeed converges to the manufactured one, is demonstrated in the remainder of this section.

Fig. 16
figure 16

Solution in the time domain using different number of time steps

Fig. 17
figure 17

Convergence analysis for the transient multi-material SCM problem

For an arbitrary time-dependent function \(\chi (t)\), we denote the \(L_2\)-norm over the time domain \(T = [t_0,\, t_{\textrm{end}}]\) by

$$\begin{aligned} ||\chi (t)||_{L_2(T)} = \left( \int \limits _{t_0}^{t_{\textrm{end}}} \chi (t)^2\,{\textrm{d}}t\right) ^{1/2}, \end{aligned}$$
(94)

which can be simply computed for the discrete time data. Using Eq. (94), the relative error in the strain energy and displacement over time are computed as

$$\begin{aligned} \epsilon _\Pi ^{\textrm{t}} = \dfrac{ ||\Pi (t)-\Pi ^{\textrm{h}}(t)||_{L_2(T)} }{ ||\Pi (t)||_{L_2(T)} } \cdot 100\,\% \end{aligned}$$
(95)

and

$$\begin{aligned} \epsilon _u^{\textrm{t}} = \dfrac{ ||u_{\textrm{x}}({\varvec{p}},t)-u_{\textrm{x}}^{\textrm{h}}({\varvec{p}},t)||_{L_2(T)} }{ ||u_{\textrm{x}}({\varvec{p}},t)||_{L_2(T)} } \cdot 100\,\% \end{aligned}$$
(96)

The evaluation of Eqs. (95) and (96) for the investigated time discretization leads to quadratic convergence rates depicted in Fig. 17, as expected for the Newmark algorithm.

3.3.4 Plate with multiple inclusions—static analysis

In this section, the capabilities of the level-set-based approach are further demonstrated for the analysis of a problem involving multiple inclusions. In particular, a two-dimensional domain is considered including a matrix material \(\Omega _{\textrm{mat}}\) and four circular inclusions \(\{\Omega ^{(m)}_{\textrm{inc}}\}_{m=1}^4\), as depicted in Fig. 18a, where the level-set function

$$\begin{aligned} \varphi _m = (x-O_{\textrm{x}}^{(m)})^2 + (y-O_{\textrm{y}}^{(m)})^2 - R_i^2. \end{aligned}$$
(97)

defines the \(m^\text {th}\) inclusion (Fig. 18b). The origins and radii of the inclusions are given in Table 1. The manufactured displacement field for the given problem is defined as

$$\begin{aligned} {\varvec{u}}({\varvec{x}}) = {\left\{ \begin{array}{ll} {\varvec{u}}_{\textrm{mat}}({\varvec{x}}) = \begin{bmatrix} \varphi ({\varvec{x}})\\ 0 \end{bmatrix} &{}\text {in}~\Omega _{\textrm{mat}} \\ {\varvec{u}}_{\textrm{inc}}({\varvec{x}}) = c_m\, {\varvec{u}}_{\textrm{mat}}({\varvec{x}}) &{}\text {in}~\Omega _{\textrm{inc}}^{(m)} \end{array}\right. }, \end{aligned}$$
(98)
Fig. 18
figure 18

Multi-material problem with four inclusions and level-set functions used for defining the manufactured displacement field

where \(\varphi ({\varvec{x}})\) is a common level-set function

$$\begin{aligned} \varphi ({\varvec{x}}) = \varphi _1({\varvec{x}})\,\varphi _2({\varvec{x}})\,\varphi _3({\varvec{x}})\,\varphi _4({\varvec{x}}), \end{aligned}$$
(99)

which vanishes at all of the four interfaces (Fig. 18c)

$$\begin{aligned} \varphi ({\varvec{x}}) = 0~~~\forall {\varvec{x}} \in \partial \Omega _{{\textrm{inc}}}^{(1)} \,\cup \, \partial \Omega _{{\textrm{inc}}}^{(2)} \,\cup \, \partial \Omega _{{\textrm{inc}}}^{(3)} \,\cup \, \partial \Omega _{{\textrm{inc}}}^{(4)}. \end{aligned}$$
(100)
Table 1 Dimensions and material properties of the different domains

Hence, the chosen manufactured displacement field fulfills Eq. (67). In our implementation, \(\varphi \) is only used for the manufactured displacement \({\varvec{u}}\); the geometry description and the construction of the enrichment functions are both based on the individual level-set functions \(\varphi _i\) (\(i = 1,2,3,4\)).Footnote 11 While in certain cases, the geometry description can be switched from \(\varphi _i\) to \(\varphi \), care must be taken when the geometries are overlapping,Footnote 12 as the resulting common \(\varphi \) can interfere with inside-outside tests and the definition of the manufactured solution. For the current example, the general case is investigated, where all inclusions have different material properties (Table 1), leading to scaling parameters unique to the individual material interfaces

$$\begin{aligned} c_m = \dfrac{E_{\textrm{mat}}}{E_{{\textrm{inc}}}^{(m)}} . \end{aligned}$$
(101)

Finally, the strain energy for the entire system is obtained by adding up the strain energies of the four quadrants indicated by the blue dashed lines in Fig. 18a, where for the \(i^\text {th}\) quadrant, the strain energy reads

$$\begin{aligned} \Pi _i&=~&\dfrac{A_1}{A_5 (\nu _{\textrm{inc},i}^2-1)(\nu _\textrm{mat}^2-1)}\nonumber \\{} & {} \cdot \Big [A_2 c^2 E_{\textrm{inc},i} (\nu _{\textrm{inc},i}-3) (\nu _\textrm{mat}^2-1) \pi \nonumber \\{} & {} - E_\textrm{mat}(\nu _{\textrm{inc},i}^2-1)(\nu _\textrm{mat}-3)(A_3 + A_4\pi )\Big ]\,. \end{aligned}$$
(102)

Here, \(A_1\), \(A_2\), \(\ldots \), \(A_5\) are constants defined in Appendix B. For the current problem, a p-refinement with \(p=1\), 2, \(\ldots \), 8 is performed, while the domain is discretized by \(3^2\) and \(4^2\) finite cells according to Fig. 19. Although these meshes are almost identical, in the latter case, cells are exclusively cut by a single interface (light gray cells), in the former case, intersections by 2 (purple) and even 4 interfaces (yellow) per cell arise as well. Therefore, \(n_{\textrm{inc}}^{(c)}\) in Eq. (18) is either 1, 2, or 4, and the number of DOFs associated with the different cells is not uniform, which can be a potential source of error during code development. For both meshes, the numerical integration is carried out via sub-cells with blending geometry mapping and \((p+1)^2\) integration points are used. For the enrichment function defined in Eq. (19), \(p_\psi =2\) is used. According to Fig. 19, both of the investigated meshes lead to similar convergence curves and very low errors, reassuring about (i) the correct implementation of cells with multiple enrichment terms in the code and (ii) suitability of the current manufactured solution for problems with multiple inclusions. Additionally, the red curve, where no enrichment is used, demonstrates the results of an unsatisfactory simulation.

Fig. 19
figure 19

Global accuracy of the simulation using different meshes and cells that are cut by multiple interfaces

Fig. 20
figure 20

Local results of the simulation evaluated along the indicated diagonal cut lines

The local accuracy of the simulation is demonstrated below, where Fig. 20a depicts for \(3^2\) cells with \(p=8\) the accurately approximated \(C^0\)-continuous displacement field along the indicated two cut lines. Note that the different material properties (cf. Table 1) lead to displacement fields in the inclusions, which are only differing in their c-parameters. Finally, Fig. 20b depicts the continuous \(\sigma _{\textrm{xx}}\)-field for the correct results, and the typical oscillations when no enrichment is used, causing the sub-optimal convergence observed in Fig. 19. In conclusion, the current sub-section demonstrates that the MoMS can be simply applied to code verification even when simulating highly complex heterogeneous structures with multiple interfaces per cell.

4 Conclusion

The Method of Manufactured Solutions (MoMS) is a powerful tool for verifying the accuracy and correctness of numerical simulations based on carefully constructed reference solutions. In this contribution, the MoMS was successfully extended to immersed boundary methods, enabling an easy and robust testing of the advanced algorithms, typically used in such approaches. When deriving manufactured solutions for immersed problems, the unfitted nature of the mesh poses the need for additional considerations, such as whether the given problem should be reproduced with or without weak boundary conditions, and whether the immersed geometries are void regions or material inclusions. Our findings and conclusion regarding these topics and the derivation of more complex manufactured solutions are given below.

Boundary conditions: When reproducing the manufactured problem numerically, the required boundary conditions originate from the boundary values of the manufactured solution. Note that this not only includes the outer boundaries, but all immersed boundaries as well. The boundary values on these parts can be enforced in a weak sense, as demonstrated in Sect. 3.1.1, already enabling a verification of immersed simulation codes. However, in Sect. 3, the options for deriving manufactured solutions, which yield readily fulfilled boundary conditions for the immersed boundaries, are discussed. In this case, no weak boundary conditions are required, which decreases the simulation complexity by a considerable amount. On the other hand, however, more care is needed when deriving the manufactured solution. The workflow and characteristic features of this approach are thoroughly discussed in Sect. 3.1 for problems with void regions and in Sects. 3.2 and 3.3 for material inclusions. In all cases, the obtained theoretical convergence rates illustrate the capabilities of the proposed approach to be used in a robust code testing framework.

Void regions: If the immersed geometry represents a void region, weak boundary conditions can be avoided by manufacturing a displacement field resulting in zero tractions on the void’s boundary. According to our investigations, such displacement fields are best derived in cylindrichal/spherical coordinate systems, while assuming non-zero displacement components in the radial direction only. By additionally assuming a circular/spherical shape for the void, the necessary conditions for deriving the right displacement field reduce to an easily solvable single equation with only one unknown, as given in Eqs. (27) and (50).

Material interfaces: The above strategy (i.e., radial manufactured displacement field + circular/spherical geometry) is also applicable to problems with inclusions, as shown in Sect. 3.2. However, manufactured fields for multi-material problems are much more robustly derived by following the approach in Sect. 3.3, that features a carefully constructed \(C^0\)-continuous displacement field, which, together with the correct material properties, results in equal stress fields in the matrix and inclusion domains (remark in the next paragraph). A great advantage of this method is that the normal stress continuity is fulfilled regardless of the inclusion’s shape, thus, more complicated geometries can be considered. Finally, the problem can be easily stated in Cartesian coordinates, and a level-set function defining the inclusion can be directly used for constructing the displacement field. In Sect. 3.3.4, it is demonstrated that this approach can be even used for deriving manufactured analytical solutions involving multiple inclusions as well.

Physical nature of the manufactured solution: Working in the context of MoMS requires to think differently about solutions to PDEs. As long a manufactured solution satisfies the given mechanical governing equations, it can be tailored freely to exhibit certain properties. This freedom was exploited in Sect. 3.1 to achieve vanishing tractions for void regions. However, an even better example for this is the approach proposed in Sect. 3.3 for multi-material problems: While in reality, stress fields are hardly equal in the matrix and inclusion, the existence of such a case is not forbidden. Although common loading states usually do not cause such a behavior of the problem, via the carefully designed material properties, body loads and boundary conditions of a manufactured solution, the desired state can be achieved without violating the mechanical principles.

Extensions: Our investigations demonstrate that for both voids and inclusions, the static manufactured solutions can be easily extended to more complex mechanical frameworks, such as quasi-static problems without (Sect. 3.1.2) and with damping (Sects. 3.1.3 and 3.3.2), as well as to transient problems (Sect. 3.3.3). Furthermore, as shown in Sects. 3.1.2 and 3.1.4, the derived concepts for radial displacement fields can be also easily extended from 2D to 3D. Although not demonstrated in this paper, it is conjectured that the same applies to the multi-material manufactured solutions of Sect. 3.3 as well. Finally, as an extension to geometrically and physically non-linear problems, we refer to our recent article demonstrating the capabilities and robustness of our proposed code testing framework [7].

Using the introduced concepts, the paper demonstrates a wide application range of the MoMS in the context of immersed frameworks, that is easy to derive and to extend. We believe, that using the discussed techniques, the MoMS has a great potential when testing the desired parts of all immersed simulation tools.

Fig. 21
figure 21

Visual representation of the curvilinear coordinate systems used in this paper