1 Introduction

The two main approaches for solving partial differential equations with random inputs can roughly be categorized in intrusive and non-intrusive methods. Semi-intrusive methods do exist, combining intrusive and non-intrusive techniques [1], but are rare. Non-intrusive methods solve the original problem multiple times using fixed samples of the inputs [5, 7]. Next, numerical integration (NI) and interpolation techniques are used to compute statistics of the solution. Intrusive methods based on a polynomial chaos (PC) expansion and Galerkin projection, result in a system of equations for the expansion coefficients [18]. Non-intrusive versions of spectral projection and polynomial chaos expansion also exist [12], but are not considered here. Non-intrusive methods, unlike intrusive ones, typically relies on already existing deterministic solvers.

The aim of this note is to compare the performance of a typical non-intrusive sample-based method using NI with a typical intrusive method using PC with the stochastic Galerkin approach. We focus on problems related to fluid dynamics and as representative example, study the viscous Burgers’ equation (a well known scalar model problem for the Navier–Stokes equations) [2, 3]. The results are compared in terms of efficiency, error in the estimated variance and accuracy. A comparison between these techniques is of course problem-dependent and several versions of both methods exist. Nevertheless, a comparison like this could provide insights and inspiration for further investigations.

The rest of the paper proceeds as follows. Section 2 introduces the non-linear viscous Burgers’ equation. Next, we construct the system of expansion coefficients of the continuous problem using the PC technique with the stochastic Galerkin approach and introduce the NI technique used throughout the paper. Section 4 presents a stable and accurate semi-discrete finite difference formulation based on summation-by-parts (SBP) operators with simultaneous approximation terms (SATs). In Sect. 5, numerical results and comparisons are presented, and conclusions are drawn in Sect. 6.

2 The Continuous Problem

We consider the viscous Burgers’ equation in one space dimension

$$\begin{aligned} \begin{array}{rclllcl} u_t + u u_x &{}=&{} \epsilon u_{xx}, &{}\quad x \in \varOmega _x, \,\, t&{}>&{} 0, \\ L u &{}=&{} g(x,t,{{\varvec{\xi }}}), &{}\quad x \in \partial \varOmega _x, \,\, t &{}>&{} 0, \\ u &{}=&{} f(x,{{\varvec{\xi }}}), &{}\quad x \in \varOmega _x, \,\, t &{}=&{} 0. \end{array} \end{aligned}$$
(1)

The solution is denoted \(u = u(x, t, {{\varvec{\xi }}})\), where, \({{\varvec{\xi }}} = (\xi _1, \xi _2,\dots ,\xi _P)\) is the vector of variables representing the uncertainty in the solution. The viscosity \(\epsilon \) is a positive constant. Further, \(\varOmega _x\) denotes a general spatial domain with boundary \(\partial \varOmega _x\) and \(\varOmega _{\xi }\) a P-dimensional stochastic domain. The boundary operator defined on the boundary \(\partial \varOmega _x\) is denoted by L. Further, the initial and boundary data \(f(x, {{\varvec{\xi }}})\) and \(g(x,t, {{\varvec{\xi }}})\) are smooth stochastic initial and boundary data which results in a smooth solution u.

3 The Intrusive and Non-intrusive Method

The foundation of polynomial chaos was first introduced in [6] and later generalized in [17]. We will for simplicity and clarity only consider one random variable. A generalization including multiple random variables is straightforward but cumbersome and would increase the complexity of the analysis.

Performing a stochastic Galerkin projection of (1) yields

$$\begin{aligned} \begin{array}{rclll} \displaystyle (u_k)_t + \displaystyle \sum _{i=0}^M \sum _{j=0}^M u_i (u_j)_x \langle \psi _i \psi _j, \psi _k \rangle &{}=&{} \displaystyle \epsilon (u_k)_{xx}, &{} \quad x \in \varOmega _x, \,\, t &{}> 0, \\ \displaystyle L u_k &{}=&{} \langle g(x,t,\xi ), \psi _k \rangle , &{}\quad x \in \partial \varOmega _x, \,\, t &{}> 0, \\ u_k &{}=&{} \langle f(x, \xi ), \psi _k \rangle , &{}\quad x \in \varOmega _x, \,\, t &{}= 0, \\ \end{array} \end{aligned}$$
(2)

for \(k = 0,1,\dots ,M\), where the \(\psi \)’s are the usual PC expansion coefficients. Hence, a deterministic system of partial differential equations of dimension \(M+1\) multiplied by the size of the original system is obtained. From (2), the deterministic coefficients \(u_0(x,t)\), \(u_1(x,t),\dots ,u_M(x,t)\) are computed. For details about the PC expansion and stochastic Galerkin procedure, see [10].

The system (2) can be written in the general form as

$$\begin{aligned} \begin{array}{rclll} \mathbf{u}_t + A(\mathbf{u}) \mathbf{u}_x &{}=&{} \epsilon \mathbf{u}_{xx}, &{}\quad x \in \varOmega _x, \,\, t &{}> 0, \\ L \mathbf{u} &{}=&{} g, &{}\quad x \in \partial \varOmega _x, \,\, t&{} > 0, \\ \mathbf{u} &{}=&{} f, &{}\quad x \in \varOmega _x, \,\, t &{}= 0, \end{array} \end{aligned}$$
(3)

where \(\varOmega _x = (0, 1)\). By choosing orthonormal basis functions, \(A(\mathbf{u})\) becomes symmetric

$$\begin{aligned} \begin{array}{rclrcl} \mathbf{u} &{}=&{} [u_0, \dots , u_M]^T, &{}\quad A(u)_{jk} &{}=&{} \displaystyle \sum _{i=0}^M u_i \langle \psi _i \psi _j, \psi _k \rangle , \\ g &{}=&{} [\hat{g}_0, \dots , \hat{g}_M], &{}\quad f &{}=&{} [f_0, \dots , f_M], \\ \hat{g}_k &{}=&{} \langle g(t,\xi ), \psi _k \rangle , &{}\quad f_k &{}=&{} \langle f(x, \xi ), \psi _k \rangle . \end{array} \end{aligned}$$
(4)

An energy estimate for the problem (3) can derived using the procedure in [8, 11].

To compute statistics (e.g. mean and variance) of statistical quantities using sample-based non-intrusive methods, integrals need to be approximated using quadrature rules [13]. The 4th-order accurate Simpson’s rule [4] is used as the integration technique in the rest of the paper.

4 The Semi-discrete Formulation

The problem (2) or equivalently (3) is solved using a finite difference formulation based on the SBP–SAT technique [9, 14, 15]. A stable and accurate semi-discrete formulation of (3) on SBP–SAT form using a split form is

$$\begin{aligned} \mathbf{v}_t + \frac{1}{3} (D \otimes I_M) \mathbf{A} \mathbf{v}+ & {} \frac{1}{3} \mathbf{A} (D \otimes I_M) \mathbf{v} - \epsilon (D^2 \otimes I_M) \mathbf{v} \nonumber \\= & {} (P^{-1} E_0 \otimes I_M){{\varvec{\Sigma }}}_0(\mathbf{L}_0 \mathbf{v} - e_0\otimes {\tilde{\mathbf{g}}}_0) \nonumber \\+ & {} (P^{-1} E_N \otimes I_M){{\varvec{\Sigma }}}_1(\mathbf{L}_1 \mathbf{v} -e_{N_x} \otimes {\tilde{\mathbf{g}}}_1) \nonumber \\ \mathbf{v}(0)= & {} \mathbf{f}, \end{aligned}$$
(5)

where \(\otimes \) denotes the Kronecker product, \({\tilde{\mathbf{g}}}_0 = [\mathbf{g}_0^T, 0]^T\) and \({\tilde{\mathbf{g}}}_1 = [0,\mathbf{g}_1^T]^T\). In (5), \(\mathbf{v}\) is the numerical approximation of \(\mathbf{u}\), in the same way as \(\mathbf{g}_{\mathbf{0}}\), \(\mathbf{g}_{\mathbf{1}}\) and \(\mathbf{f}\) are approximations of \(\langle g_0(t, \xi ), \psi _l \rangle \), \( \langle g_1(t, \xi ), \psi _l \rangle \), and \(\langle f(x, \xi ), \psi _l \rangle \) for \(l = 0,1,\dots ,M\), respectively. The penalty matrices \({{\varvec{\Sigma }}}_0\) and \({{\varvec{\Sigma }}}_1\) are chosen to ensure stability as

$$\begin{aligned} {{\varvec{\Sigma }}}_0 = diag\big (-\mathbf{L}_0^T, 0\big ), \quad {{\varvec{\Sigma }}}_1 = diag\big (0, -\mathbf{L}_1^T\big ). \end{aligned}$$
(6)

The numerical solution \(\mathbf{v}\) is arranged in a tensor product fashion where its components \(v_{im}\) approximates the polynomial chaos coefficient \(u_m(x_i, t)\). Further, \(v_i\) is an approximation of \(\mathbf{u}_{[x = x_i]}\).

Remark 1

The problem of computing the quadrature points in NI can be written in an equivalent form where the vector \(v_{im}\) approximates \(u(x_i, t, \xi _m)\). Moreover, for NI, the system (5) is uncoupled and hence can be solved in parallel.

The approximate derivative in the x-direction is approximated by the SBP operator \(D = P^{-1} Q\). The matrix P is a positive definite diagonal matrix and Q is almost skew-symmetric satisfying \(Q + Q^T = E_{N} - E_{0} = \mathbb {B} = diag[-1, 0, \dots ,0, 1]\). We denote the identity matrix of dimension \(M+1\) by \(I_M\). The matrices \(E_{0}\) and \(E_{N}\) are zero except for the element (1, 1) and \((N_x+1, N_x+1)\) respectively, which is 1. Finally, \(e_{N_x}\) denotes a zero vector with the exception of the last element which is 1.

The data \(\mathbf{f}\), \({\tilde{\mathbf{g}}}_0\) and \({\tilde{\mathbf{g}}}_1\) are grid functions consisting of the projections of the original initial and boundary data. The inner products are computed numerically using numerical integration (making sure that the error related to the quadrature was small compared to the truncation errors related to the PC expansion). The matrix \(\mathbf{A}\) in (5) is given by

$$\begin{aligned} \mathbf{A} = diag\big (\bar{A}_{0}, \dots , \bar{A}_{N_x}\big ), \quad (\bar{A}_{i})_{jk} = \displaystyle \sum _{l=0}^{M} v_{il} \langle \psi _l, \psi _j, \psi _k \rangle . \end{aligned}$$
(7)

Remark 2

When using a sample-based method together with NI, the vectors \(\mathbf{g}_0\), \(\mathbf{g}_1\) and \(\mathbf{f}\) instead denote \(\mathbf{g}_{0,1} = [\bar{g}_{0,1}(t, \xi _0), \dots , \bar{g}_{0,1}(t, \xi _M)]^T\) and \(\mathbf{f} = [\bar{f}(x_0, \xi _0), \dots , \bar{f}(x_0, \xi _M), \dots , \bar{f}(x_{N_x}, \xi _0), \dots , \bar{f}(x_{N_x}, \xi _M)]^T\). Consequently, the boundary and initial data \(\bar{g}_0(\xi )\), \(\bar{g}_1(\xi )\) and \(\bar{f}(\xi )\) are grid functions in \(\xi \). Moreover, the matrix blocks \(\bar{A}_i\) in the NI framework correspond to

$$\begin{aligned} (\bar{A}_i) = diag(v_{i0}, \dots , v_{iM}). \end{aligned}$$
(8)

To prove stability, the procedure in [8] was used.

Fig. 1
figure 1

The uncertainty in all computations is uniformly distributed in \([-\,1, +\,1]\). M denotes the number of coefficient and samples for PC and NI, respectively

5 Numerical Experiments

To exemplify the difference between NI and PC, we consider (5) with characteristic boundary conditions. The initial and boundary data are given by the manufactured solution

$$\begin{aligned} w(x,t,\xi ) = \displaystyle 5 + e^{-\xi /2} \sin \left( \mu \pi e^{-\xi ^2/2}x - t\right) , \quad \text {with}\quad \xi \sim U(-1, 1) \end{aligned}$$
(9)

In (9), an increased \(\mu \) leads to an increased variation in stochastic space.

The model problem considered for the numerical experiments is (1) augmented with the forcing function \(F = w_t + w w_x - \epsilon w_{xx}\), and \(\epsilon = 0.01\). As a measure of comparison, the error in the variance is used

$$\begin{aligned} Var_V = \displaystyle \int _{0}^{T} \left\| Var[U] - Var[V] \right\| _2 \, dt. \end{aligned}$$
(10)

In (10), U denotes a PC computation using 25 basis functions. The deterministic errors are reduced by using the same deterministic grid. U becomes a sufficiently accurate representation of the “exact” solution, while V denotes the computed numerical solution.

Remark 3

Both problems are written as a system of equations as stated in Sect. 4 and are solved in the same way to ensure a fair comparison. We made sure that the deterministic errors from the discretization were negligible.

The comparison is done using a slow \((\mu = 1)\) and fast \((\mu = 5)\) varying stochastic solution. The different scenarios in the comparison could for example arise when having a smooth or rough surface in a flow problem [16]. In the calculations below a 3rd-order SBP-operator with 40 grid points in space, and a 4th-order Runge–Kutta scheme in time is used. To ensure a fair comparison, both problems are written as a system of equations and solved in the same way.

Figure 1a, b illustrate the error of the variance as a function of number of coefficients/evaluations (M) for PC and NI using \(\mu = 1\) and \(\mu = 5\), respectively. Figure 1c, d show the CPU time as a function of M for PC and NI for the same two cases. Finally, Fig. 1e, f depict the error of the variance as a function of CPU time for PC and NI using again \(\mu = 1\) and \(\mu = 5\). Note from Fig. 1e, f that the NI method seems to be more efficient if large tolerances of the error in the estimated variance is accepted, while the PC seems more efficient than NI for slow varying problems. This indicate that combining NI and PC could be advantageous.

6 Summary and Conclusions

We have analyzed and compared the efficiency of PC and NI for fast and slow varying stochastic solutions. The study has been carried out on the viscous Burgers’ equation as a representative model for fluid dynamics problems.

The PC framework is employed to the continuous problem, and a stable high-order finite difference formulation on SBP–SAT form was constructed. A similar but more simplified numerical formulation was constructed for NI in order to streamline the comparison.

The difference in the variance was used as a measure of comparison. The numerical results suggest that the PC procedure outperforms NI for slow varying problems, while NI seems to be more efficient for fast varying problems. The difference in performance opens the door for possible gains in efficiency using a combination of PC and NI methods in uncertainty quantification of fluid problems.