1 Introduction

Natural interfaces exist in many situations, for example between the ocean and atmosphere and when different materials are combined. In addition, the use of artificial interfaces is standard practice in many fields of computational mechanics and computational physics. Practical examples include the introduction of mesh-refinement or coarsening to increase accuracy and/or efficiency. By also considering uncertain external data in the boundary conditions and forcing functions, the question arises: can we use different uncertainty quantification (UQ) methods in different regions of the computational domain separated by interfaces?

In [18] it was shown that intrusive polynomial chaos with stochastic Galerkin projection (PC) is more efficient than non-intrusive numerical integration (NI) for slowly varying (in stochastic space) stochastic problems, while NI is more efficient for rapidly varying problems. This result suggests that a combination of the two techniques could be efficient. These methods must of course be coupled in an accurate and stable way, and this is the topic of this paper.

We aim for a method which couples an intrusive and non-intrusive UQ method. The intrusive method combines a polynomial chaos basis with stochastic Galerkin projection [4, 10, 19]. The non-intrusive method uses the combination of a quadrature rule and the probability density functions of the uncertainties prescribed [1, 3, 15]. The proposed interface coupling for the different UQ methods is proven to be stable, by extending the work in [5], for non-conforming spatial finite difference methods [2, 16, 17]. Our intention is to exploit the different properties of intrusive and non-intrusive UQ methods and obtain a higher efficiency by combining them.

The rest of the paper proceeds as follows. The hyperbolic system of equations is introduced in Sect. 2. Section 3 presents the intrusive method and Sect. 4, the non-intrusive one. Section 5 describes the interface coupling treatment. A stable and accurate finite difference formulation is presented in Sect. 6. The theoretical results are confirmed using numerical experiments in Sect. 7. Finally, conclusions are drawn in Sect. 8.

2 The continuous problem

To present the technique it suffices to consider a hyperbolic system of equations posed on two adjacent spatial domains (\(\varOmega _L\) and \(\varOmega _R\))

$$\begin{aligned} u_t + A u_x&= 0,&x \in&\varOmega _L,&t > 0, \end{aligned}$$
(2.1a)
$$\begin{aligned} L_L u&= g_L(x,t,\xi ),&x \in&\partial \varOmega _L {\setminus } \varGamma ,&t > 0, \end{aligned}$$
(2.1b)
$$\begin{aligned} u&= f_L(x, \xi ),&x \in&\varOmega _L,&t = 0, \end{aligned}$$
(2.1c)
$$\begin{aligned} v_t + A v_x&= 0,&x \in&\varOmega _R,&t > 0, \end{aligned}$$
(2.1d)
$$\begin{aligned} L_R v&= g_R(x,t, \xi ),&x \in&\partial \varOmega _R {\setminus } \varGamma ,&t > 0, \end{aligned}$$
(2.1e)
$$\begin{aligned} v&= f_R(x, \xi ),&x \in&\varOmega _R,&t = 0, \end{aligned}$$
(2.1f)
$$\begin{aligned} u&= v,&x \in&\varGamma ,&t > 0. \end{aligned}$$
(2.1g)

The solutions on the left and right domains are denoted by u \(=\) \([u_1(x, t, \xi ),\) \(\dots ,\) \(u_M(x, t, \xi )]\) and \(v = [v_1(x, t, \xi ), \dots , v_M(x, t, \xi )]\), respectively. Moreover, the random variable \(\xi \) models the uncertainty. The boundary operators defined on the boundaries \(\partial \varOmega _L\) and \(\partial \varOmega _R\) are denoted \(L_L\) and \(L_R\), while \(f_L(x, \xi )\), \(f_R(x, \xi )\) and \(g_L(x,t, \xi )\), \(g_R(x,t, \xi )\) are the stochastic initial and boundary data, respectively. The data is assumed to be fully compatible at the boundaries and interface. Further, we let \(\varOmega _L\), \(\varOmega _R\) and \(\varGamma \) represent the left and right domains, and interface boundary, respectively, see Fig. 1. Further, we consider the \(M \times M\) matrix A to be

$$\begin{aligned} A = \begin{bmatrix} \Lambda _A^+ &{} 0 \\ 0 &{} \Lambda _A^- \end{bmatrix}, \end{aligned}$$
(2.2)

where \(\Lambda _{A}^+\) and \(\Lambda _{A}^{-}\) are positive and negative definite diagonal matrices (In the case where the matrix A is not diagonal, we assume that it can be symmetrized and diagonalized).

Fig. 1
figure 1

An illustration of the computational domains, where u and v are defined in \(\varOmega _L\) and \(\varOmega _R\)

2.1 Well-posedness

Applying the energy method to (2.1) (that is multiply (2.1a) and (2.1d) by u and v, respectively, and integrate over the particular spatial domain and adding them together), considering only the terms at the interface (\(x = 0\)) and using the interface condition \(u \big |_{x = 0} = v \big |_{x = 0}\), yields

$$\begin{aligned} \frac{d}{dt} \left( \left\| u \right\| ^2 + \left\| v \right\| ^2 \right) = 0, \end{aligned}$$
(2.3)

where \(\left\| u \right\| ^2 = \int _{\varOmega _L} u^T u \, dx\) and \(\left\| v \right\| ^2 = \int _{\varOmega _R} v^T v \, dx\). We can conclude that the energy in (2.3) is preserved and that proper outer boundary conditions leads to well-posedness.

3 Polynomial chaos

In the polynomial chaos method, the solution is expanded in a polynomial basis,

$$\begin{aligned} u(t,x,\xi ) = \sum _{i=0}^{\infty } u_i(t,x) \psi _i(\xi ). \end{aligned}$$
(3.1)

In (3.1), \(u_k\) denotes a vector of expansion coefficients. We choose the polynomial basis functions \(\{\psi (\xi ) \}_{i=0}^{\infty }\) to be orthonormal with respect to the inner product

$$\begin{aligned} \langle f(\xi ), g(\xi ) \rangle = \int _{\varOmega _{\xi }} f (\xi ) g(\xi ) \, d P(\xi ). \end{aligned}$$
(3.2)

In (3.2), \(P(\xi )\) is the probability measure of \(\xi \) defined on the stochastic domain \(\varOmega _{\xi }\). The coefficients \(u_k\) in (3.1) are given by the projection

$$\begin{aligned} u_k(x,t) = \langle u(x,t,\xi ), \psi _k(\xi )\rangle . \end{aligned}$$
(3.3)

The mean can be expressed in terms of the coefficients as

$$\begin{aligned} {\mathbb {E}}[u] = \int _{\varOmega _{\xi }} u \, d P(\xi ) = u_0, \end{aligned}$$
(3.4)

since \({\mathbb {E}}[\psi _0] = 1\) and \({\mathbb {E}}[\psi _k] = 0, \forall k > 0\). Moreover, the variance is given by

$$\begin{aligned} Var[u] = \int _{\varOmega _{\xi }} [u - {\mathbb {E}}[u]]^2 \, d P(\xi ) = \sum _{k = 1}^{\infty } u_k^2. \end{aligned}$$
(3.5)

Further details of the PC framework can be found in [14].

3.1 Stochastic Galerkin projection

In order to apply the stochastic Galerkin projection method in the left domain \(\varOmega _L\), we start by truncating the series (3.1) as

$$\begin{aligned} u = \sum _{k=0}^{M_{PC}} u_k(x,t) \psi _k(\xi ), \end{aligned}$$
(3.6)

where a slight abuse of notation has been used. Inserting (3.6) into the problem in the left domain \(\varOmega _L\) in (2.1) yields

$$\begin{aligned} \begin{array}{rclll} \displaystyle \sum _{k=0}^{M} (u_k)_t \psi _k + \sum _{k=0}^{M} A (u_k)_x \psi _k &{}=&{} 0, &{} x \in \varOmega _L, &{} t> 0, \\ \displaystyle \sum _{k=0}^{M} L u_k \psi _k &{}=&{} g(x,t,\xi ), &{} x \in \partial \varOmega _L {\setminus } \varGamma , &{} t> 0, \\ \displaystyle \sum _{k=0}^{M} u_k \psi _k &{}=&{} f(x, \xi ), &{} x \in \varOmega _L, &{} t = 0, \\ \displaystyle \sum _{k=0}^{M} u_k \psi _k &{}=&{} v, &{} x \in \varGamma , &{} t > 0, \end{array} \end{aligned}$$
(3.7)

where v is the solution from the right domain \((\varOmega _R)\). By multiplying (3.7) with \(\psi _l\), for \(l = 0,1,\dots ,M_{PC}\) and integrating over the stochastic domain \(\varOmega _{\xi }\), we obtain

$$\begin{aligned} \begin{array}{rclll} (u_l)_t + A (u_l)_x &{} = &{} 0, &{} x \in \varOmega _L, &{} t> 0, \\ L u_l &{} = &{} \langle g(x,t,\xi ),\psi _l \rangle , &{} x \in \partial \varOmega _L {\setminus } \varGamma &{} t> 0, \\ u_l &{}=&{} \langle f(x, \xi ),\psi _l \rangle , &{} x \in \varOmega _L, &{} t = 0, \\ u_l &{}=&{} \langle v, \psi _l \rangle , &{} x \in \varGamma , &{} t > 0, \end{array} \end{aligned}$$
(3.8)

for \(l = 0,\dots ,M_{PC}\). The deterministic coefficients \(u_l(x,t)\) and all relevant statistics can now be computed by solving (3.8).

4 Numerical integration

Numerical integration in one dimension is formulated as

$$\begin{aligned} \int _a^b f(\xi ) \rho (\xi ) \, d\xi \approx \sum _{m=1}^{M_{NI}} f(\xi _m)w_m, \end{aligned}$$
(4.1)

where f is the function being integrated and \(\rho \) is the density function. The integer \(M_{NI}\) denotes the number of quadrature points \(\xi _m\), and \(w_m\) denotes the quadrature weights.

Extending (4.1) to higher dimensions can be done in a straightforward manner as

$$\begin{aligned} \displaystyle \int _{\varOmega _{\xi }} f({\tilde{\xi }}) \rho ({\tilde{\xi }}) \, d{\tilde{\xi }} \approx \sum _{m_1 = 1}^{M_1} \cdots \sum _{m_p = 1}^{M_p} f(\xi _1^{m_1}, \dots , \xi _p^{m_p}) w^{m_{1}} \cdots w^{m_{p}}, \end{aligned}$$
(4.2)

where \(\varOmega _{\xi }\) is the p-dimensional domain and \({\tilde{\xi }} = (\xi _1, \dots , \xi _p)\). The quadrature points and weights for dimension i are denoted \(\xi ^{m_i}\) and \(w^{m_i}\) respectively. Adaptive sparse grid techniques for high-dimensional problems [1] can be used to improve efficiency and ease the “curse of dimensionality” of the quadrature rule. In this work however, the 4th-order accurate Simpson’s rule [3] is used for all computations.

Remark 4.1

When computing statistical quantities using NI, the functions f and \(\rho \) are replaced by a functional (depending on which statistical quantity is beting computed) of the numerical solutions u(or v) and the probability density function of \(\xi \). The quadrature (4.1) is then evaluated using the computed solution u (or v) for different values of \(\xi \), for all time and space coordinates.

Remark 4.2

The extension to higher dimensions (4.2) in the stochastic setting requires the random variables to be independent.

5 Interface treatment

To couple the problem (2.1) in the stochastic dimension at an interface in space, a stable interface treatment is required. The specific interface treatment we consider applies and extends the work done in [5]. In this technique, an intermediate so-called glue grid \({\mathscr {G}}_h\) (with a corresponding glue space \({\mathscr {G}}\)), together with a set of projection operators is introduced. The solutions at the interface are projected onto the glue grid where their difference is penalized, leading to a provably stable method.

The glue space consists of piecewise polynomials of a sufficiently high degree. We choose Legendre polynomials since they form an orthogonal basis with respect to the uniform density function on the interval \((-1, 1)\). Further, we let \(\tilde{{\mathscr {F}}}_{l2g}\) and \(\tilde{{\mathscr {F}}}_{g2l}\) be the projection operators between the left grid l and the glue grid \({\mathscr {G}}\) and vice verse, respectively. The operators projecting values on the right grid to the glue grid and back are denoted \(\tilde{{\mathscr {F}}}_{r2g}\) and \(\tilde{{\mathscr {F}}}_{g2r}\). The projection operators are constructed to satisfy the following inner product preserving relation [5, 11]

$$\begin{aligned} \tilde{{\mathscr {F}}}_{g2l}^T P_{\xi _L} = \tilde{{\mathscr {F}}}_{l2g} M, \qquad \tilde{{\mathscr {F}}}_{g2r}^T P_{\xi _R}= \tilde{{\mathscr {F}}}_{r2g} M, \end{aligned}$$
(5.1)

where \(M = \int _{\gamma } \psi (\xi ) \psi ^T(\xi ) \, d \xi \) is a symmetric positive semi-definite matrix and the \(\psi \)’s are basis functions of the glue grid. The matrices \(P_{\xi _L}\) and \(P_{\xi _R}\) represent suitable quadrature rules on the left and right side of the interface. Further, the projection operators are required to satisfy a set of accuracy conditions, namely that the glue grid can represent qth order polynomials exactly. This means that a polynomial (in \(\xi \)) of order q projected onto a grid is mapped exactly onto the glue grid by \(\tilde{{\mathscr {F}}}_{l2g}\) (or \(\tilde{{\mathscr {F}}}_{r2g}\)). The order q is chosen based on the order of accuracy of the uncertainty quantification methods used on the left and right domain, see below for details.

Remark 5.1

Note that we do not require \(\tilde{{\mathscr {F}}}_{l2g} \tilde{{\mathscr {F}}}_{g2l} = I\) or \(\tilde{{\mathscr {F}}}_{r2g} \tilde{{\mathscr {F}}}_{g2r} = I\). This means that a projection from the left (or right) to the glue grid and back is not required to be exact.

The reader is referred to [5] for a detailed description of the projection operators. Next, we briefly describe the cases that we will consider.

  • Coupling: NI to NI The glue grid and projection operators are analogous to the ones in [5]. A brief presentation of these operators and the corresponding glue grid technique can be found in Appendix A.1.

  • Coupling: PC to PC When coupling PC to PC, the glue grid consists of a polynomial basis of the same degree as the maximum degree on the left and right domain (in order to satisfy the accuracy conditions). The projection operators are constructed in a straightforward manner, projecting a set of polynomials to another set (see Appendix A.2 for a simple example).

  • Coupling: NI to PC The coupling between NI and PC is done in a similar way as in the coupling between NI and NI. The number of polynomial basis functions per subinterval in the glue grid is chosen to be same as the number of basis functions of the PC grid to maintain the accuracy conditions in the coupling. For more details, see Appendix 3.

6 The semi-discrete formulation

The numerical approximation of (2.1) based on summation-by-parts (SBP) operators with simultaneous approximation terms (SAT) [2, 8, 12, 17] is

$$\begin{aligned} U_t + \mathbf{D}_L \mathbf{A}_L U&= ({\mathbb {E}}_{0})_L ({{{\tilde{\Sigma }}}}_0)_L (\mathbf{L}_L U - (e_0)_L \otimes \mathbf{g}_{-1}) \nonumber \\&+ ({\mathbb {E}}_{N})_L ({{{\tilde{\Sigma }}}}_N)_L {\mathscr {F}}_{g2l} ({\mathscr {F}}_{l2g}U - {\mathscr {F}}_{r2g} V) \nonumber \\&+ ({\mathbb {E}}_{N})_L ({{{\tilde{\Sigma }}}}_I)_L ({\mathscr {F}}_{g2l} {\mathscr {F}}_{l2g} U - U) \nonumber \\&V_t + \mathbf{D}_R \mathbf{A}_R V = z ({\mathbb {E}}_{N})_R ({{{\tilde{\Sigma }}}}_N)_R (\mathbf{L}_R V - (e_{N})_R \otimes \mathbf{g}_1) \nonumber \\&+ ({\mathbb {E}}_{0})_R ({{{\tilde{\Sigma }}}}_0)_R {\mathscr {F}}_{g2r} ({\mathscr {F}}_{r2g}V - {\mathscr {F}}_{l2g}U) \nonumber \\&+ ({\mathbb {E}}_{0})_R ({{{\tilde{\Sigma }}}}_I)_R ({\mathscr {F}}_{g2r} {\mathscr {F}}_{r2g} V - V) \nonumber \\ U(0)&= \mathbf{f}_L \nonumber \\ V(0)&= \mathbf{f}_R \end{aligned}$$
(6.1)

where

$$\begin{aligned} \begin{array}{rclrcl} ({\mathbb {E}}_0)_{L,R} &{} = &{} (P_{L,R}^{-1}(E_0)_{L,R} \otimes I_{\xi _{L,R}} \otimes I_M), \\ ({\mathbb {E}}_{N})_{L,R} &{} = &{} (P_{L,R}^{-1}(E_{N})_{L,R} \otimes I_{\xi _{L,R}} \otimes I_M), \\ \mathbf{D}_{L,R} &{} = &{} (D_{L,R} \otimes I_{\xi _{L,R}} \otimes I_M), \\ \mathbf{A}_{L,R} &{} = &{} (I_{L,R} \otimes I_{\xi _{L,R}} \otimes A), \\ \mathbf{L}_{L,R} &{} = &{} (I_{L,R} \otimes I_{\xi _{L,R}} \otimes L_{L,R}), \\ {\mathscr {F}}_{g2l} &{} = &{} (I_L \otimes \mathscr {\tilde{F}}_{g2l}), \qquad {\mathscr {F}}_{l2g} = (I_L \otimes \mathscr {\tilde{F}}_{l2g}), \\ {\mathscr {F}}_{g2r} &{} = &{} (I_R \otimes \mathscr {\tilde{F}}_{g2r}), \qquad {\mathscr {F}}_{r2g} = (I_R \otimes \mathscr {\tilde{F}}_{r2g}), \\ \mathscr {\tilde{F}}_{\cdot g \cdot } &{} = &{} (F_{\cdot g \cdot } \otimes I_M), \qquad ({{{\tilde{\Sigma }}}}_{0,I,N})_{L,R} = (I_{L,R} \otimes (\Sigma _{0,I,N})_{L,R}). \end{array} \end{aligned}$$
(6.2)

In (6.1), \(D_{L,R} = P_{L,R}^{-1} Q_{L,R}\) are SBP operators approximating the derivatives in the x-direction on the left and right domain, respectively. The matrices \(P_{L,R}\) are positive definite and diagonal and \(Q_{L,R}\) are almost skew-symmetric satisfying \(Q_{L,R}^T + Q_{L,R} = (E_{N})_{L,R} - (E_{0})_{L,R} = {\mathbb {B}}_{L,R} = diag(-1, 0, \dots , 0, 1)\). Moreover, the identity matrices \(I_{\xi _{L,R}}\), \(I_{L,R}\) and \(I_M\) are of dimension \(M_L+1\), \(M_R+1\), \(N_L+1\), \(N_R+1\) and M, respectively. The integers \(N_{L,R}\) and \(M_{L,R}\) are the number of spatial and stochastic grid points (or coefficients in PC) on the left and right domain, respectively while M denotes the size of the system. Further, \((E_{N})_{L,R}\) and \((E_0)_{L,R}\) are zero matrices except for the element (1, 1) and \((N_{L,R} + 1, N_{L,R} + 1)\) which are one, respectively. Finally, \((e_0)_L\) and \((e_{N})_R\) are zero vectors of size \(N_L+1\) and \(N_R+1\) except for the elements 1 and \(N_R+1\) which are one, respectively.

To impose the boundary and interface conditions the so-called SAT technique is used. The terms that contains the \(\Sigma \)’s are the so-called SAT penalty terms, which forces the solution to satisfy the boundary and interface conditions weakly. The penalty matrices \((\Sigma _{0})_L\) and \((\Sigma _N)_R\) will be chosen such that a stable spatial boundary treatment in the left and right domain is obtained. Furthermore, \((\Sigma _N)_L\) and \((\Sigma _0)_R\) are used to enforce continuity of the solution at the interface. Finally, \((\Sigma _I)_{L,R}\) are correction penalty matrices used to cancel the interface contributions in stochastic space coming from the operators \(\mathbf{D}_{L,R}\). To clarify: the indices (0, IN) represent the first, the interface, and the last grid points in space, respectively. Similarly, L and R represent the right and left domain.

The numerical solution on the left sub-domain U is arranged as

$$\begin{aligned} U = \begin{bmatrix} U_0 \\ U_1 \\ \vdots \\ U_{i} \\ \vdots \\ U_{N_L} \end{bmatrix}\!, \quad U_i = \begin{bmatrix} U_{i0} \\ U_{i1} \\ \vdots \\ U_{ij} \\ \vdots \\ U_{iM_L} \end{bmatrix}, \quad U_{ij} = \begin{bmatrix} U_{ij1} \\ U_{ij2} \\ \vdots \\ U_{ijm} \\ \vdots \\ U_{ijM} \end{bmatrix}, \end{aligned}$$

and the numerical solution V in the right sub-domain is organized in the same way. Numerically \(U_{ijm}\) and \(V_{ijm}\) approximate \(u_m(x_i, t, \xi _j)\) and \(v_m(x_i, t, \xi _j)\) for NI, where \(\xi _j\) denotes the jth grid point in \(\xi \). For PC, \(U_{ijm}\) and \(V_{ijm}\) approximate \(u_m^{j}(x_i, t)\) and \(v_m^{j}(x_i, t)\), where m denotes the vector component and j the PC coefficient. The data is organized depending on the stochastic method as

$$\begin{aligned} \mathbf{g} = \begin{bmatrix} \langle {\bar{g}}(t, \xi ), \psi _0(\xi ) \rangle \\ \vdots \\ \langle {\bar{g}}(t, \xi ), \psi _{M_{L,R}}(\xi ) \rangle \\ \end{bmatrix}, \qquad \mathbf{f}_{L,R} = \begin{bmatrix} \langle {\bar{f}}(x_0, \xi ), \psi _0(\xi ) \rangle \\ \vdots \\ \langle {\bar{f}}(x_0, \xi ), \psi _{M_{L,R}}(\xi ) \rangle \\ \vdots \\ \langle {\bar{f}}(x_{N_{L,R}}, \xi ), \psi _0(\xi ) \rangle \\ \vdots \\ \langle {\bar{f}}(x_{N_{L,R}}, \xi ), \psi _{M_{L,R}}(\xi ) \rangle \\ \end{bmatrix}, \end{aligned}$$
(6.3)

for PC and

$$\begin{aligned} \mathbf{g} = \begin{bmatrix} {\bar{g}}(t, \xi _0) \\ \vdots \\ {\bar{g}}(t, \xi _{M_{L,R}}) \\ \end{bmatrix}, \qquad \mathbf{f}_{L,R} = \begin{bmatrix} {\bar{f}}(x_0, \xi _0) \\ \vdots \\ {\bar{f}}(x_0, \xi _{M_{L,R}}) \\ \vdots \\ {\bar{f}}(x_{N_{L,R}}, \xi _0) \\ \vdots \\ {\bar{f}}(x_{N_{L,R}}, \xi _{M_{L,R}}) \end{bmatrix}, \end{aligned}$$
(6.4)

for NI. In (6.3) and (6.4), \({\bar{f}}\) and \({\bar{g}}\) are the initial and boundary vectors as a function of \(\xi \), respectively.

6.1 Stability

The discrete energy method is applied to (6.1) (we multiply the equations in (6.1) by \(U^T (P_L \otimes P_{\xi _L} \otimes I_M)\) and \(V^T (P_R \otimes P_{\xi _R} \otimes I_M\)), respectively, add them together, and use the SBP property (\(Q_{L,R}\) are almost skew-symmetric)). This yields

$$\begin{aligned} \begin{array}{rcl} \displaystyle \frac{d}{dt} (\left\| U \right\| _{P_L}^2 &{} + &{} \left\| V \right\| _{P_R}^2) = - U^T ({\mathbb {B}}_L \otimes P_{\xi _L} \otimes A) U - V^T ({\mathbb {B}}_R \otimes P_{\xi _R} \otimes A) V \\ &{} + &{} 2 U_I^T {\mathbb {P}}_{\xi _L} \mathscr {\tilde{F}}_{g2l} (\Sigma _{N})_{L} \mathscr {\tilde{F}}_{l2g} U_I - U_I^T {\mathbb {P}}_{\xi _L} \mathscr {\tilde{F}}_{g2l} (\Sigma _{N})_{L} \mathscr {\tilde{F}}_{r2g} V_I \\ &{} - &{} V_I^T ({\mathbb {P}}_{\xi _L} \mathscr {\tilde{F}}_{g2l} (\Sigma _{N})_{L} \mathscr {\tilde{F}}_{r2g})^T U_I + 2 U_I^T {\mathbb {P}}_{\xi _L} \mathscr {\tilde{F}}_{g2l} (\Sigma _{I})_{L} \mathscr {\tilde{F}}_{l2g} U_I \\ &{} + &{} 2 V_I^T {\mathbb {P}}_{\xi _R} \mathscr {\tilde{F}}_{g2r} (\Sigma _{0})_{R} \mathscr {\tilde{F}}_{r2g} V_I - V_I^T {\mathbb {P}}_{\xi _R} \mathscr {\tilde{F}}_{g2r} (\Sigma _{0})_{R} \mathscr {\tilde{F}}_{l2g} U_I \\ &{} - &{} U_I^T ({\mathbb {P}}_{\xi _R} \mathscr {\tilde{F}}_{g2r} (\Sigma _{0})_{R} \mathscr {\tilde{F}}_{l2g})^T V_I + 2 V_I^T {\mathbb {P}}_{\xi _R} \mathscr {\tilde{F}}_{g2r} (\Sigma _{0})_{R} \mathscr {\tilde{F}}_{r2g} U_I \\ &{} + &{} 2 U_I^T {\mathbb {P}}_{\xi _L} (\Sigma _{I})_{L} U_I + 2 V_I^T {\mathbb {P}}_{\xi _R} (\Sigma _{I})_R V_I, \end{array} \end{aligned}$$
(6.5)

when letting \({\mathbb {P}}_{\xi _{L,R}} = (P_{\xi _{L,R}} \otimes I_M)\) and ignoring the outer boundary terms as in Sect. 2.1. The norms used in (6.5) are \(\left\| U \right\| _{P_{L}}^2 = U^T (P_{L} \otimes P_{\xi _{L}} \otimes I_M) U\) and \(\left\| V \right\| _{P_{R}}^2 = V^T (P_{R} \otimes P_{\xi _{R}} \otimes I_M) V\).

Further, using (5.1) in (6.5), (for example the term \(2 U_I^T {\mathbb {P}}_{\xi _L} \mathscr {\tilde{F}}_{g2l} (\Sigma _{N})_{L} \mathscr {\tilde{F}}_{l2g} U_I\) \(=\) \(2 (\mathscr {\tilde{F}}_{l2g} U_I)^T M (\Sigma _{N})_{L} (\mathscr {\tilde{F}}_{l2g} U_I\))), gives

$$\begin{aligned} \begin{array}{rcl} \displaystyle \frac{d}{dt} (\left\| U \right\| _{P_L}^2 + \left\| V \right\| _{P_R}^2) = &{} - &{} U_I^T (P_{\xi _L} \otimes ( A + 2({\bar{\Sigma }}_{I})_L)) U_I \\ &{} + &{} V_I^T(P_{\xi _R} \otimes (A - 2({\bar{\Sigma }}_{I})_R)) V_I \\ &{} + &{} \begin{bmatrix} \mathscr {\tilde{F}}_{l2g} U_I \\ \mathscr {\tilde{F}}_{r2g} V_I \\ \end{bmatrix}^T (M \otimes {\mathbb {K}}) \begin{bmatrix} \mathscr {\tilde{F}}_{l2g} U_I \\ \mathscr {\tilde{F}}_{r2g} V_I \\ \end{bmatrix}, \end{array} \end{aligned}$$
(6.6)

where

$$\begin{aligned} {\mathbb {K}} = \begin{bmatrix} 2(({\bar{\Sigma }}_{N})_L + ({\bar{\Sigma }}_{I})_L) &{} - (({\bar{\Sigma }}_{N})_L + ({\bar{\Sigma }}_{0})_R) \\ - (({\bar{\Sigma }}_{N})_L^T + ({\bar{\Sigma }}_{0})_R^T) &{} 2 (({\bar{\Sigma }}_{0})_R + ({\bar{\Sigma }}_{I})_R) \end{bmatrix}, \end{aligned}$$
(6.7)

and we have decomposed the SAT penalty terms as

$$\begin{aligned} (\Sigma _{0,I,N})_{L,R} = (I_{\xi _{L,R}} \otimes ({\bar{\Sigma }}_{0,I,N})_{L,R}). \end{aligned}$$
(6.8)

In (6.6), the first two terms on the right-hand side come from the correction terms (the difference between U or V and its projection to the glue grid and back) in (6.1), while the third term contains the interface terms on the glue grid.

To cancel the interface terms not involving the operators \(\mathscr {\tilde{F}}_{\cdot 2 \cdot }\) we let \(({\bar{\Sigma }}_{I})_L = -A/2\) and \(({\bar{\Sigma }}_{I})_R = A/2\), (other choices are also possible, see for example [13]) which results in

$$\begin{aligned} \frac{d}{dt} (\left\| U \right\| _{P_L}^2 + \left\| V \right\| _{P_R}^2) = \begin{bmatrix} \mathscr {\tilde{F}}_{l2g} U_I \\ \mathscr {\tilde{F}}_{r2g} V_I \\ \end{bmatrix}^T (M \otimes {\mathbb {K}}) \begin{bmatrix} \mathscr {\tilde{F}}_{l2g} U_I \\ \mathscr {\tilde{F}}_{r2g} V_I \\ \end{bmatrix}, \end{aligned}$$
(6.9)

where now

$$\begin{aligned} {\mathbb {K}} = \begin{bmatrix} 2(({\bar{\Sigma }}_{N})_L - A/2) &{} - (({\bar{\Sigma }}_{N})_L + ({\bar{\Sigma }}_{0})_R) \\ - (({\bar{\Sigma }}_{N})_L^T + ({\bar{\Sigma }}_{0})_R^T) &{} 2 (({\bar{\Sigma }}_{0})_R + A/2) \end{bmatrix}. \end{aligned}$$
(6.10)

The choices \(({\bar{\Sigma }}_{N})_L = A/2\), \(({\bar{\Sigma }}_{0})_R = -A/2\) now yields

$$\begin{aligned} \begin{array}{rcl} \displaystyle \frac{d}{dt} (\left\| U \right\| _{P_R}^2 + \left\| V \right\| _{P_L}^2)= & {} 0, \end{array} \end{aligned}$$
(6.11)

which implies that the energy is preserved (ignoring the outer boundary treatment) just as in (2.3).

Remark 6.1

The quadratures \(P_{\xi _L}\) and \(P_{\xi _R}\) can be replaced by any other positive definite matrix without loss of stability, however, to ensure accuracy, the operators \(F_{\cdot 2 g}\) and \(F_{g 2 \cdot }\) have to satisfy certain accuracy conditions. These accuracy conditions involve projecting polynomials of a specific degree. In all our computations, we have, as in [5] used SBP quadratures of the same accuracy as the number of polynomial basis functions of the glue space.

7 Numerical experiments

In this section we will illustrate the coupling technique by considering applications in one and two dimensions.

7.1 Advection in one dimension

We consider (2.1) with

$$\begin{aligned} A = \begin{bmatrix} 2 &{} 0 \\ 0 &{} -3 \end{bmatrix}, \qquad L_L = \begin{bmatrix} 1 &{} 0 \\ 0 &{} 0 \end{bmatrix}, \qquad L_R = \begin{bmatrix} 0 &{} 0 \\ 0 &{} 1 \end{bmatrix}. \end{aligned}$$
(7.1)

As a measure of comparison, the quantity

$$\begin{aligned} \text {Var}_{U} = \int _0^T \left\| \text {Var}[U] - \text {Var}[U_a] \right\| _2 \, dt \end{aligned}$$
(7.2)

is used. In (7.2), U is the computed numerical solution (on both domains) and \(U_a\) a high resolution (in \(\xi \)) numerical solution on the same spatial deterministic grid as U. In the computations below, 5th order SBP-operators with 50 grid points in each domain and the classical 4th order Runge-Kutta as time integrator are used when computing U and \(U_a\). The uncertainty \(\xi \) is uniformly distributed between \(-1\) and 1. Finally, the spatial domains we consider are \(\varOmega _L = (-1, 0)\) and \(\varOmega _R = (0, 1)\), hence the interface is located at \(x = 0\).

7.1.1 Accuracy and efficiency

The order of accuracy \(p_{NI}\) when computing the variance (7.2) numerically, for the case of coupling NI with NI is measured as

$$\begin{aligned} p_{NI} = \log \left( \frac{ \text {Var}_{U_{M_L, M_R}} }{ \text {Var}_{U_{(m M_L), (mM_R)}}} \right) / \log \left( \frac{1}{m} \right) . \end{aligned}$$
(7.3)

The variance in \(\text {Var}_{U_{X,Y}}\) is computed using NI with X and Y number of stochastic grid points in the left domain and right domain, respectively. The constant m denotes the refinement factor of the stochastic grids. To reduce the influence of the deterministic errors, a high resolution solution using 200 stochastic grid points on a single deterministic domain using the same number of deterministic grid points was used. Initial and boundary data and a forcing function was extracted from the following manufactured solution

$$\begin{aligned} u(x,t,\xi ) = \begin{bmatrix} \sin (2 \pi (x - t)) + \xi \sin (\xi /2 - t) \cos (x - \xi ) \\ \sin (2 \pi (x - t)) + \xi \sin (\xi /2 - t) \cos (x - \xi ) \end{bmatrix}. \end{aligned}$$
(7.4)

The order of accuracy is computed and shown in the one dimensional case, results in multiple dimensions are analogous. As can be seen from Table 1, the order of accuracy converges to 4, in line with the accuracy of the 4th order Simpson’s rule. The spatial operators and time integrator are 5th and 4th order accurate, respectively.

Table 1 The order of accuracy for NI for different number of grid points

The gains in efficiency and accuracy that we will show computationally below, rely on the cost of the glue grid procedure being cheap. The glue grid is only applied at the interface, hence contributes linearly to the total computational cost (which overall is quadratic) with respect to the number of stochastic quadrature points and PC coefficients. The computational cost of the interface treatment is hence small compared to the overall computational cost.

7.1.2 Numerical restults: coupling NI to NI

To exemplify the potential efficiency gain in the coupling procedure, the problem (2.1) using a manufactured solution is constructed in such a way that the uncertainty is varying slowly in the left domain compared to the right. We choose

$$\begin{aligned} u(x,t,\xi ) = \begin{bmatrix} e^{-100(x-1/2)^2}/(1 + e^{-0.1 \xi }) + \sin (\xi /2 - t) \cos (x - \xi ) \\ e^{-100(x-1/2)^2}/(1 + e^{-0.1 \xi }) + \sin (\xi /2 - t) \cos (x - \xi ) \end{bmatrix}. \end{aligned}$$
(7.5)

The manufactured solution (7.5) contains the term \(1 / (1 + e^{-0.1 \xi })\) which is a S-shaped function ranging from 0 to 1 or as in this particular case between 0 and the factor \(e^{-100 (x - 1/2)^2}\). A sine function is then added to produce variations. A smaller factor (as in the left domain (\(-1<x<0\))) gives a slower varying solution and larger factor gives a faster varying solution (as in the right domain (\(0<x<1\))). As before we use 200 stochastic grid points for our reference solution.

Figure 2 shows the error of the variance as a function of the total number of stochastic grid points. As can be seen, a higher number of grid points in the right (more rapidly varying) domain reduces the error in the variance compared to the other cases. Since all cases have the same total number of grid points, we can conclude that having a higher number of grid points in the right (more rapidly varying) part of the domain is also more efficient.

Fig. 2
figure 2

The error in the variance as a function of the total number of stochastic grid points when coupling NI with NI for different number of stochastic grid points on the left and right domain

7.1.3 Numerical results: coupling PC to PC

The coupling between PC and PC is exemplified using the manufactured solution (7.5). As a reference, a solution using 25 PC coefficients in each domain is used. Figure 3 illustrates the error as a function of the total number of basis functions. Similarly to the NI-NI case above, a higher number of PC coefficients in the right (more rapidly varying) domain results in a lower error in the variance. Similarly to the case above, we can conclude that having a higher number of PC coefficients in the right (more rapidly varying) part of the domain is the most efficient.

Fig. 3
figure 3

The error in the variance as a function of the total number of basis functions when coupling PC with PC for different number of basis functions on the left and right domain

7.1.4 Numerical results: coupling NI to PC

To illustrate the coupling between NI and PC, the manufactured solution (7.5) is used. Figure 4 shows the error in the variance as a function of the number of stochastic grid points (for NI) and basis functions (for PC). In the comparison, we increase the number of stochastic grid points \(M_{NI}\) with the number of basis functions as \(M_{NI}(M_{PC}) = 30(M_{PC} - 3)\), e.g. if \(M_{PC} = 5\), then \(M_{NI} = 60\). As can be seen, the combination of using NI on the rapidly varying part (in terms of \(\xi \)) and PC on the slowly varying part of the domain performs better than the reverse combination. This is an indication that combining NI and PC could outperform the use of the same UQ method in the whole domain. The results in Fig. 4 shows an error reduction by approximately one order of magnitude, which show that choosing a suitable UQ method in certain regions is important. The most efficient choice is having NI in the rapidly varying part and PC in the slowly varying part of the domain.

Fig. 4
figure 4

The error in the variance as a function of the number of PC basis functions when coupling NI with PC

7.2 Maxwell’s equations

To exemplify the technique in multiple dimensions, we consider Maxwell’s equations in two dimensions [17].

The equations relating the electric and magnetic fields are

$$\begin{aligned} \begin{array}{rclrcl} \displaystyle {\mu \frac{\partial H}{\partial t} }&{} = &{} - \nabla \times E, &{} \displaystyle {\epsilon \frac{\partial E}{\partial t}} &{} = &{} \nabla \times H - J, \\ \nabla \cdot \epsilon E &{} = &{} \rho , &{} \nabla \cdot \mu H &{} = &{} 0, \end{array} \end{aligned}$$
(7.6)

where, \(E = [E_x, E_y, E_z]^T\), \(H = [H_x, H_y, H_z]^T\), J, \(\rho \), \(\epsilon \) and \(\mu \) correspond to the electric field, magnetic field, electric current density and charge density, permittivity and permeability. We simplify (7.6) by letting \(J = 0\) and \(\rho = 0\) and rewrite it on matrix form as

$$\begin{aligned} S u_t + A u_x + B u_y = 0. \end{aligned}$$
(7.7)

The matrices in (7.7) are

$$\begin{aligned} \begin{array}{rclrcl} S = \begin{bmatrix} \mu &{} 0 &{} 0 \\ 0 &{} \epsilon &{} 0 \\ 0 &{} 0 &{} \epsilon \end{bmatrix}, \qquad A = \begin{bmatrix} 0 &{} 0 &{} 1 \\ 0 &{} 0 &{} 0 \\ 1 &{} 0 &{} 0 \end{bmatrix}, \qquad B = \begin{bmatrix} 0 &{} -1 &{} 0 \\ -1 &{} 0 &{} 0 \\ 0 &{} 0 &{} 0 \end{bmatrix}. \end{array} \end{aligned}$$

with the solution \(u = \left[ H_z, E_x, E_y \right] ^T\). Similar to the one dimensional case, we have an interface at \(x = 0\), \( 0 \le y \le 1 \).

For simplicity, the boundary conditions are chosen to be the characteristic ones, i.e. we specify

$$\begin{aligned} \begin{array}{rrcllll} West (x &{}=&{} -1) : &{} E_x - H_z &{} = &{} g_W, \\ East (x &{}= &{} 1) : &{} E_x + H_z &{} = &{} g_E, \\ Sout (y &{}=&{} 0) : &{} H_z + E_y &{} = &{} g_S, \\ North (y &{}=&{} 1) : &{} H_z - E_y &{} = &{} g_N. \end{array} \end{aligned}$$
(7.8)

In the numerical experiments we let \(\epsilon = 1\) and \(\mu = 1\) be defined on the spatial domains \(\varOmega _L = (-1, 0) \times (0, 1) \) and \(\varOmega _R = (0, 1) \times (0, 1)\). The coupling is exemplified using the manufactured solution

$$\begin{aligned} u(x,y,t,\xi ) = \begin{bmatrix} \sin (\xi \pi (x - 0.5)^2 - t) + \sin (y - t) \\ \sin (\xi \pi (x - 0.5)^2 - t) + \sin (y - t) \\ \sin (\xi \pi (x - 0.5)^2 - t) + \sin (y - t) \end{bmatrix}, \end{aligned}$$
(7.9)

which varies more stochastically in the left domain compared to the right.

7.2.1 Coupling NI to NI

Numerical results when coupling NI with NI were computed using a reference solution calculated using 150 stochastic grid points in the left and right domain using NI in both domains. The reference solution is computed using an interface in order to reduce the deterministic errors in the comparison.

Figure 5 illustrates the error in the variance with respect to the total number of stochastic grid points. As in the one dimensional case, we note that a higher number of grid points in the more rapidly varying (left) part of the domain gives the smallest total error in the variance, as well as a higher efficiency.

Fig. 5
figure 5

The error in the variance as a function of the total number of stochastic grid points when coupling NI with NI for different number of stochastic grid points on the left and right domain

7.2.2 Coupling PC to PC

Coupling PC with PC was exemplified using a reference solution computed with 25 PC coefficients in both domains. The numerical results are depicted in Fig. 6, where the error in the variance is shown as a function of the number of PC coefficients. Again, we note that a higher number of points in the more rapidly varying (left) domain reduces the error in the variance the most. As before we can conclude that the above mentioned case is the most efficient one.

Fig. 6
figure 6

The error in the variance as a function of the total number of basis functions when coupling PC with PC for different number of basis functions on the left and right domain

7.2.3 Coupling NI to PC

The numerical results when coupling NI with PC were performed with a reference solution computed using 150 stochastic grid points in the left and right domain using NI in both domains. Figure 7 shows the error in the variance as a function of stochastic grid points (in NI) and PC coefficients (in PC). Results when combining PC on the left with NI on the right domain and vice verse are illustrated. We note that, as in the one dimensional case, having NI in the rapidly varying domain and PC in the slowly varying domain outperforms the reverse combination. The reduction of errors in the variance is approximately two orders of magnitude. Finally, we can conclude that the most efficient case coincides with the results in the one dimensional setting, i.e. having NI in the rapidly varying domain and PC in the slowly varying domain.

Fig. 7
figure 7

The error in the variance as a function of the number of PC basis functions when coupling NI with PC

8 Conclusions

A stable, accurate interface coupling between the uncertainty quantification methods NI-NI, PC-PC and NI-PC has been constructed. The coupling procedure consisted of constructing an intermediate so-called glue grid, onto where the solutions at the interface were projected and penalized using corresponding projection operators. The coupling procedure was exemplified using hyperbolic systems of equations in one and two dimensions.

Numerical results when coupling NI-NI and PC-PC clearly showed that a higher proportion of grid points/coefficients in a more rapidly varying part of the domain gives the smallest error in the variance. Coupling NI-PC gave better results when having NI in the more rapidly varying domain, resulting in a reduction of the errors in the variance of 1-2 orders of magnitude compared to the reverse combination. The performance benefits shown by the numerical experiments when using different UQ methods in different regions, gives a strong indication that combining different UQ techniques can be efficient for certain types of problems.

To extend the technique to multiple stochastic dimensions, is in principle straightforward, but some technical problems requires further research. One has to construct stable interface couplings in multiple dimensions, which can be done following the guidelines in [6, 7, 9].