Finite difference schemes with transferable interfaces for ... - DiVA

1 downloads 0 Views 454KB Size Report
At such interfaces, the numerical solution has a double representation, with one ...... Journal of Scientific Computing, DOI: 10.1007/s10915-017-. 0569-6, 2017. ... SIAM Journal on Numerical Analysis, 43(3):1231–1255, 2005. [14] M. Svärd and ...
Department of Mathematics

Finite difference schemes with transferable interfaces for parabolic problems Sofia Eriksson & Jan Nordstr¨om

LiTH-MAT-R--2018/01--SE

Department of Mathematics Link¨oping University S-581 83 Link¨oping

Finite difference schemes with transferable interfaces for parabolic problems Sofia Eriksson

Jan Nordstr¨om Abstract

We derive a method to locally change the order of accuracy of finite difference schemes that approximate the second derivative. The derivation is based on summation-by-parts operators, which are connected at interfaces using penalty terms. At such interfaces, the numerical solution has a double representation, with one representation in each domain. We merge this double representation into a single one, yielding a new scheme with unique solution values in all grid points. The resulting scheme is proven to be stable, accurate and dual consistent.

Keywords: Finite difference methods, summation-by-parts, high order accuracy, dual consistency, superconvergence, interfaces

1

Introduction

We consider summation-by-parts (SBP) finite difference methods with weakly imposed boundary and interface conditions using simultaneous approximation terms (SAT). The main advantages of the SBP-SAT technique are high accuracy, computational efficiency and provable time-stability. For a background on the SBP-SAT technique, see [15, 5]. Characterizing for the SAT interface treatment, is that it has free parameters that stabilize the scheme, and that the numerical solutions on both sides of the interface differ [2, 12]. SAT interfaces are useful when generating grids for complex geometries or – as in our case – when changing the properties of the scheme in parts of the computational domain. However, if the interface must be moved, it is more convenient with one single representation of the solution in each grid point. Our approach to derive such single-valued interfaces, is to use the double-valued SAT interface treatment as a starting point, merge the double representation at the interface into a single one and obtain a new set of operators. This was done in [4] for hyperbolic problems and here we extend that methodology to parabolic problems. The paper is organized as follows: In Section 2, we present our parabolic model problem; the heat equation with an artificial interface. This problem is discretized in space in Section 3, using a standard SAT interface. Next, in Section 4, we merge the double representation at the SAT interface into a single representation, giving us the new scheme, which is shown to be stable, accurate and dual consistent in Section 5. The theoretical results are confirmed by numerical experiments in Section 6, and a summary is given in Section 7, concluding the paper. 1

2

The model problem

To introduce our technique we consider the one-dimensional scalar heat equation, with an interface at an interior point xˆ, as L utL = εuxx ,

utR

=

x ∈ Ω L = [0, xˆ],

R εuxx ,

x ∈ Ω R = [ˆ x, 1],

(1)

which is complemented with an interface condition at x = xˆ, boundary conditions at x = 0, 1 and initial data at t = 0.

2.1

Well-posedness

The problem (1) is well-posed if it has a unique solution and if it is bounded by data, see [13, 7]. To show boundedness, we use the energy method. We multiply the two equations in (1) by u L,R and integrate over their respective domains. Using integration by parts, and thereafter adding the two results, yields   d ku L k2 + ku R k2 + 2ε kuxL k2 + kuxR k2 = BT + IT dt

(2)

R1 where kuk2 = 0 u2 dx. To make the presentation clear, we ignore the boundary terms  BT = − 2εu L uxL 0 + 2εu R uxR 1 and focus on the interface terms IT = 2ε u L uxL − u R uxR xˆ . We need IT ≤ 0 to bound the growth of the solution. Here we aim for an artificial interface and first demand continuity, that is u L |xˆ = u R |xˆ . To achieve IT = 0, we also need uxL |xˆ = uxR |xˆ . Hence, the interface conditions related to (1) are x, t) = u R (ˆ x, t), u L (ˆ

3

x, t) = uxR (ˆ x, t). uxL (ˆ

(3)

Discretization

We use the method of lines and discretize the spatial domain Ω = [0, 1] using N + 1 equidistant grid points xj = jh, where h = 1/N is the grid spacing and j = 0, 1, . . . , N . Next, we introduce a numerical interface at xˆ, where xˆ coincides with some interior grid point xˆı . This gives us NL + 1 grid points in Ω L and NR + 1 grid points in Ω R , where NL = ˆı and NR = N − ˆı.

3.1

The SBP operators

Let the vector f = [f0 , f1 . . . , fN ]T be a discrete representation of the continuous function f (x, t), such that fj (t) = f (xj , t). A discrete differential operator D1 , that approximates ∂/∂x such that (D1 f )j (t) ≈ fx (xj , t), is an SBP-operator if it can be factorized as D1 = P −1 Q,

P = P T > 0,

Q + QT = EN − E0 ,

(4)

where E0 = e0 eT0 , EN = eN eTN , e0 = [1, 0, . . . , 0]T and eN = [0, . . . , 0, 1]T . Later we use that P is diagonal, and hence D1 consists of central, 2p-order accurate finite difference stencils in the interior and one-sided, p-order accurate stencils at the boundaries [9, 10]. 2

To approximate the second derivative operator ∂ 2 /∂x2 we use the operator D2 , and – in addition to consistency – demand that it fulfills the SBP properties  A = AT ≥ 0, (5) D2 = P −1 −A + eN dTN − e0 dT0 ,

where dT0 f ≈ fx (0, t) and dTN f ≈ fx (1, t). For stability A + AT ≥ 0 suffice, but for dual consistency we need A to be symmetric [3]. The notations > and ≥ refer to positive definite and positive semi-definite matrices, respectively, and the vectors e0 , eN , d0 and dN have dimensions (N + 1) × 1. The form of D2 in (5) is consistent with the wide-stencil case where D2w ≡ D12 , since we, using the properties in (4), can write D2w = P −1 (−D1T P D1 + eN eTN D1 − e0 eT0 D1 ). Identifying the terms in (5), we see that in the wide-stencil case they are Aw = D1T P D1 ,

T dw 0 = D1 e0 ,

T dw N = D1 eN .

In the general case (including narrow-stencil operators) we let A = S T M S,

d0 = S T e0 ,

dN = S T eN ,

(6)

where the first and last row of the matrix S are consistent difference stencils [2]. The interior of S is not uniquely defined and neither is the matrix M , but they can be chosen such that M > 0. The operators used in this work can all be found in [11].

3.2

The SAT interface treatment

We return to the two coupled heat equations in (1). Let u L,R denote the semi-discrete approximations of u L,R . We approximate ∂ 2 /∂x2 by D2,L and D2,R in the two domains, respectively, both fulfilling the properties in (5). However, since we ignore the outer boundaries, we simplify and write   D2,L = P L−1 −A L + eN,L dTN,L , D2,R = P R−1 −A R − e0,R dT0,R , (7)

for ease of presentation. The vectors u L , eN,L and dN,L have dimensions (NL + 1) × 1 and the vectors u R , e0,R and d0,R have dimensions (NR + 1) × 1, where NL + NR = N . The two interface conditions from (3) are imposed using penalty terms proportional T to eN,L u L − eT0,R u R ≈ u L (ˆ x, t) − u R (ˆ x, t) and to dTN,L u L − dT0,R u R ≈ uxL (ˆ x, t) − uxR (ˆ x, t), respectively. The spatial discretization of (1) is thus given by d T u L = εD2,L u L + P L−1 (σ 1L eN,L + σ 2L dN,L )(eN,L u L − eT0,R u R ) dt + P L−1 (σ 3L eN,L + σ 4L dN,L )(dTN,L u L − dT0,R u R ), d T u R = εD2,R u R + P R−1 (σ 1R e0,R + σ 2R d0,R )(e0,R u R − eTN,L u L ) dt T + P R−1 (σ 3R e0,R + σ 4R d0,R )(d0,R u R − dTN,L u L ),

(8)

where the penalty parameters σ 1,2,3,4 and σ 1,2,3,4 will be chosen such that the scheme L R (8) becomes accurate, stable and dual consistent. Remark 3.1. Choosing σ 4L,R 6= 0 can decrease the accuracy, but for the sake of generality we keep these parameters in the derivations. 3

3.3

Dual consistency

above such that the scheme becomes dual We will choose the penalty parameters σ 1,2,3,4 L,R consistent [8]. We start by rewriting (8) more compactly, as d ~u = L~u, dt where

(9)

  1   3  σ L eN,L + σ 2L dN,L σ L eN,L + σ 4L dN,L ~ T −1 −1 D2,L 0 T ~e + P L=ε +P d −σ 1R e0,R − σ 2R d0,R −σ 3R e0,R − σ 4R d0,R 0 D2,R

and

~u =





uL uR



,

P =



PL 0 0 PR



,

~e =



eN,L −e0,R



,

~d =



dN,L −d0,R



.

(10)

Note that the differences between the double interface representations can be expressed T T as ~eT ~u = eN,L u L − eT0,R u R and ~dT ~u = dN,L u L − dT0,R u R . The vectors ~u, ~e and ~d have dimensions (N + 2) × 1, and L and P are (N + 2) × (N + 2)-matrices. Now consider a continuous equation ut = Lu, where L is a linear, spatial differential operator. Its so called dual (or adjoint) equation is −vt = L∗ v, where the dual Roperator 1 L∗ is specified by hv, Lui = hL∗ v, ui and where the inner product is hv, ui ≡ 0 vu dx. For a scheme ~ut = L~u to be a dual consistent approximation of ut = Lu, we need L∗ , where L∗ is the discrete dual operator, to be a consistent approximation of L∗ . Using the relation h~v, L~uiP = hL∗~v, ~uiP , with h~v, ~uiP ≡ ~vT P ~u, we find that the discrete dual −1 operator is L∗ ≡ P LT P [1]. In our case we consider ut = εuxx , thus L = ε∂ 2 /∂x2 . Next, we note that L is a selfadjoint operator, since L∗ = ε∂ 2 /∂x2 . This means that for (9) to be dual consistent, not only L but also L∗ must be a consistent numerical approximation of L = L∗ = ε∂ 2 /∂x2 . −1 We compute the discrete dual operator L∗ = P LT P . Using the SBP-properties (5) (here we need A L , A R to be symmetric) we obtain    1  3 T −(σ 1R eN,L + σ 3R dN,L )eT0,R −1 (σ L eN,L + (σ L + ε)dN,L )eN,L D2,L 0 ∗ L =ε +P T T 0 D2,R −(σ 1L e0,R + σ 3L d0,R )eN,L (σ 1R e0,R + (σ 3R − ε)d0,R )e0,R   2 4 T −(σ 2R eN,L + σ 4R dN,L )dT0,R −1 ((σ L − ε)eN,L + σ L dN,L )dN,L . +P ((σ 2R + ε)e0,R + σ 4R d0,R )dT0,R −(σ 2L e0,R + σ 4L d0,R )dTN,L

For L∗ to be a consistent approximation of L∗ = ε∂ 2 /∂x2 , it must have the same form as L in (9). To be exact, the penalty portion of L∗ must consists of one part proportional to ~e and one part proportional to ~d. This is only possible if the relations σ 1L = σ 1R ,

σ 3L + ε = σ 3R ,

σ 2L − ε = σ 2R ,

σ 4L = σ 4R

(11)

hold. The proportionality with ~e and ~d is necessary since it means that the coupling conditions ~eT ~u = eTN,L u L − eT0,R u R ≈ 0 and ~dT ~u = dTN,L u L − dT0,R u R ≈ 0 are imposed. If the penalty part of L∗ does not have this form, some other coupling conditions are imposed on the dual problem. The specific choices in (11) leads to  1   2    σ R eN,L + σ 3R dN,L σ R eN,L + σ 4R dN,L ~ T −1 −1 D2,L 0 ∗ T ~e + P L =ε +P d , −σ 1L e0,R − σ 3L d0,R −σ 2L e0,R − σ 4L d0,R 0 D2,R which indeed is a consistent approximation of ε∂ 2 /∂x2 . 4

3.4

Stability

We multiply the two equations in (8) by uTL P L and uTR P R , respectively. By adding the results, we obtain the discrete analogue to (2),   d uTL P L u L + uTR P R u R + 2ε uTL A L u L + uTR A R u R = dt  T T   T  eN,L u L + eT0,R u R eN,L u L + eT0,R u R 0 0 0 0 T  eTN,L u L − e0,R 0  eTN,L u L − eT0,R u R  uR  2σ 1L ε σ 2L + σ 3L       =  dTN,L u L + dT0,R u R   0   dTN,L u L + dT0,R u R  , ε 0 0 T 0 σ 2L + σ 3L 0 2σ 4L dTN,L u L − d0,R uR dTN,L u L − dT0,R u R

(12)

1 T T wTL M L w L = uTL AL u L − dN,L u L (eTN,L u L − e0,R u R ) + q L (eTN,L u L − eT0,R u R )2 , 4 1 T T T u R (eTN,L u L − e0,R u R ) + q R (eTN,L u L − e0,R u R )2 , wTR M R w R = uTR AR u R − d0,R 4

(13)

where we have used the dual consistency demands (11). To show stability, the quadratic form above (containing the interface deviations) must be non-positive. However, the related matrix is indefinite for all ε 6= 0, regardless of the choice of penalty parameters. To get around this, we use a variant of the technique in [3]. As indicated in (6), let T dN,L = S LT eN,L , d0,R = S RT e0,R and A L,R = S L,R M L,R S L,R . We define the auxiliary variables −1 1 T T w L = S L u L − 2 M L eN,L (eN,L u L − e0,R u R ) and w R = S R u R − 12 M R−1 e0,R (eTN,L u L − eT0,R u R ) and compute

T where q L = eTN,L M L−1 eN,L and q R = e0,R M R−1 e0,R . By replacing the terms uTL A L u L and T u R A R u R in (12) using the relations in (13), we obtain another discrete analogue to (2),

  d uTL P L u L + uTR P R u R + 2ε wTL M L w L + wTR M R w R = dt   T T   T  eN,L u L − eT0,R u R eN,L u L − eT0,R u R 2 σ 1L + 4ε q L + 4ε q R σ 2L + σ 3L = . dTN,L u L − dT0,R u R dTN,L u L − dT0,R u R σ 2L + σ 3L 2σ 4L Our particular choice of auxiliary variables w L and w R has removed the problematic mixed terms in (12). The scheme will be stable (and dual consistent) for all sets of interface penalty parameters having the form σ 1L = σ 1R = s1 − ε

qL + qR , 4

σ 2L = s2 + ε/2 , σ 2R = s2 − ε/2

σ 3L = s3 − ε/2 , σ 4L = σ 4R = s4 , (14) σ 3R = s3 + ε/2

where the parameters s1,2,3,4 must fulfill s1 ≤ 0, s4 ≤ 0 and (s2 + s3 )2 ≤ 4s1 s4 .

Remark 3.2. Just as S L,R u L,R , the auxiliary variables w L,R , which have been modified with penalty-like terms, are consistent approximations of ux in the first and last row. Remark 3.3. For narrow-stencil second derivative operators, the stability demands on the penalty parameters actually depend on both boundaries. Here we have neglected the outer boundaries when defining the auxiliary variables w L,R , but if they are included in the derivation, it affects q L,R slightly. This modification (insignificant for fine grids), is accounted for in the q-values tabulated in [3]. 5

4

Transformation into a single-valued interface

Equipped with a stable and dual consistent multi-domain formulation, we now turn to our main task. Using (7) and (14), the scheme (9) can be written     d −1 −1 −1 AL 0 (ε/2 + s2 )dN,L T 1 ~u = −εP ~u + σ L,R P ~e~e ~u + P ~eT ~u 0 AR (ε/2 − s2 )d0,R dt (15) T  −1 −1 (ε/2 + s3 )dN,L T ~u + s4 P ~d~d ~u. + P ~e (ε/2 − s3 )d0,R T Note that both eN,L u L and eT0,R u R in ~eT ~u = eTN,L u L − eT0,R u R ≈ 0 are approximations of the exact solution value u(ˆ x, t). Our aim is to modify the scheme such that it operates without this double representation at the interface.

4.1

Derivation of the new scheme

e and I. e Their respective purpose is to merge and to We start by defining the matrices K duplicate interface values. They are similar to the identity matrix, but their dimensions are (N + 1) × (N + 2) and they are modified in the interior: Around row ˆı and columns ˆı and ˆı + 1 they have the entries     ... ...     1 0 0 0 1 0 0 0        e = e 0 α 1 − α 0 0 1 1 0 K , I = (16)    ,     0 0 0 1 0 0 0 1     ... ... T P L eN,L + eT0,R P R e0,R ). For later reference, we note that where α = eTN,L P L eN,L /(eN,L

  c L eN,L e I = (c L + c R )eˆı , c R e0,R

e eˆTı K



T αeN,L = , (1 − α)e0,R

eˆı = [0, . . . , 0, 1, 0, . . . , 0]T,

(17)

where c L,R are arbitrary scalars and eˆı is a (N + 1) × 1-vector, non-zero only in row ˆı. ee = (1 − 1)eˆı = 0, where ~e = [0, . . . , 0, 1, −1, 0, . . . , 0]T is given In particular, note that I~ in (10). e and Ie as specified Proposition 4.1. Consider the diagonal matrix P in (10). With K −1 −1 e e IeT . in (16), the relation KP = Pe Ie holds, where Pe is defined as Pe ≡ IP T Assumption 4.2. eTN,L u L ≡ e0,R uR.

e u, where ~u is given in Corollary 4.3. Assumption 4.2 leads to the relation ~u = IeT K~ e e (10) and K and I are given in (16).

Corollary 4.3 and Proposition 4.1 are proven in [4]. For completeness we provide the proofs in Appendix A.

6

We are now ready to derive the new scheme: Since we aim for a single solution e from value at the interface instead of two, we multiply our original scheme (15) by K −1 e the left. We thereafter use KP = Pe−1 Ie from Proposition 4.1, yielding     d 0 −1 e (ε/2 + s2 )dN,L −1 e A L 1 e −1 e T e e e ~u + σ L,R P I~e~e ~u + P I ~eT ~u K ~u = −εP I 0 AR (ε/2 − s2 )d0,R dt  T (ε/2 + s3 )dN,L −1 e e ~u + s4 Pe−1 Ie~d~dT ~u. + P I~e (ε/2 − s3 )d0,R e be constant, such that K~ e ut = (K~ e u)t and define u e u. The vector u e ≡ K~ e is one Let K element shorter than ~u and identical to ~u in all points, except at the interface, where T T e = αeN,L u L + (1 − α)e0,R u R. eˆTı u T Next, Assumption 4.2 yields ~eT ~u = eN,L u L − eT0,R u R = 0, which removes the first ee = 0 from (17) removes the third penalty two penalty terms above. The relation I~ e u by u e and thereafter, using Corollary 4.3, every term. We proceed by replacing K~ T T e u = Ie u e . These steps yield remaining ~u by Ie K~   d A 0 L −1 e = −εPe Ie e + s4 Pe−1 Ie~d~dT IeT u e, u IeT u 0 A dt R

with s4 ≤ 0 as an optional damping parameter. If the second order accurate narrow-stencil operator is used in both domains, s4 = 0 will result in the second order stencil in the whole domain, without any special features at the interface. Moreover, numerical experiments suggests that s4 6= 0 gives higher cancellation errors. This, in addition to simplicity, speaks in favor for s4 = 0. With that choice, our final scheme is     d 0 0 P A L L −1 T eu, e = Ie e = −εPe Ae u Pe = Ie Ie , A IeT . (18) 0 P 0 A dt R R This concludes the derivation. At this point we can forget Assumption 4.2, since (18) is a new scheme, independent of the original one.

5

Properties of the new scheme

In the derivation of the new scheme (18), we rather boldly required that the original e was solution vector ~u fulfilled Assumption 4.2, and initially the new solution vector u related to ~u. Below we show that our final scheme (18) is in fact a stand-alone scheme, with the SBP-properties preserved.

5.1

Stability

e ≥ 0. Multiplying First, it is easily seen that the scheme is stable, since Pe > 0 and A e T Pe, we directly obtain the energy decay (18) from the left by u d  Te  eu = 0. e Pu e + 2εe u uT Ae dt 7

e TR ]T , where u e L refers to the left part of u e (including the e = [e Exploiting that IeT u uTL , u T e ) and u e R refers to the right part of u e (also including eˆTı u e ), we can interface value eˆı u rewrite the above growth rate in an equivalent form, as   d e TL P L u eL + u e TR P R u e R + 2ε u e TL A L u eL + u e TR A R u e R = 0, u dt

which more clearly resembles (2). Recall that we omit the contribution from the outer boundaries.

5.2

Accuracy

Next, we show that the new scheme is accurate. Using (5), Proposition 4.1 and (17), the scheme (18) can be rewritten as   d e D u L 2,L T e e = εK e L − dT0,R u e R ). − εPe−1 eˆı (dN,L (19) u u eR D2,R u dt

Evaluating (19) point-wise, we obtain

 d T T e ) = ε α(D2,L u e L )NL + (1 − α)(D2,R u e L − dT0,R u e R) e R )0 − εeˆTı Pe−1 eˆı (dN,L (eˆı u u dt

at the interface and

d T e) = (e u dt j



e L )j ε(D2,L u e R )j−ˆı , ε(D2,R u

0 ≤ j < ˆı ˆı < j ≤ N

elsewhere. At the interface, the scheme is hence nothing but two one-sided operators weighted together, plus an in-built internal penalty on the second interface condition. Let u, u L and u R denote the exact solution (projected on to the grids in Ω, Ω L and Ω R , respectively). Note that eTN,L u L = eˆTı u = eT0,R u R . Inserting u L,R into (8) yields the truncation errors d u − εD2,L u L − P L−1 (σ 3L eN,L + σ 4L dN,L )(dTN,L u L − dT0,R u R ), dt L d TeR = u R − εD2,R u R − P R−1 (σ 3R e0,R + σ 4R d0,R )(dT0,R u R − dTN,L u L ), dt TeL =

and inserting u into the new scheme (19) produces the truncation error   d D u 2,L L e Tee = u − εK + εPe−1 eˆı (dTN,L u L − dT0,R u R ). D u dt 2,R R

With the penalty parameters in (8) chosen according to (14), it can be shown that  L  L 0 ≤ j < ˆı  (Te )j Te Te L R e e j = ˆı Te = K , ej Te = α(Te )NL + (1 − α)(Te )0 , TeR  R (Te )j−ˆı ˆı < j ≤ N.

The truncation errors from the original SAT interface scheme and from the new scheme are thus identical, except at the interface. Just as for the original scheme, the global order of accuracy of the new scheme is the same as that of the operator D2,L or D2,R which has the lowest order. 8

5.3

Dual consistency

e = −εPe−1 A e denote the linear, spatial operator in (18). Computing its Finally, let L e∗ = Pe−1 L eT Pe, we obtain L e∗ = −εPe−1 A eT = L, e where the last equality dual operator as L e is symmetric. Thus L e is self-adjoint and the scheme (18) is dual consistent holds since A (given that the outer boundary conditions are imposed in a dual consistent manner).

6

Numerical simulations

Consider the advection-diffusion equation with Dirichlet boundary conditions, that is ut + aux = εuxx + f, u = gL, u = gR,

x ∈ (0, 1), x = 0, x = 1,

(20)

where f , g L and g R are given data. We want to solve (20) using the new scheme   eT − e d eT u + f e = εPe−1 −A e + eN d ut + aPe−1 Qu N 0 0 e 0 )(eT u − g ) + Pe−1 (µ0 e0 + ν0 d L 0 −1 T e + Pe (µN eN + νN dN )(eN u − g R ),

(21)

e are given in (18), and the difference where f is the restriction of f to the grid. Pe and A e = IQ e IeT , with Q given below, was derived in [4]. Moreover, since we now matrix Q e N = IS e 0 = IS e T IeT eN , with S given e T IeT e0 and d include the outer boundaries, we need d below (together with M which is needed for the penalty parameters). We have       QL 0 SL 0 ML 0 Q= S= M= , , , (22) 0 QR 0 SR 0 MR where Q L,R are both fulfilling (4) and where S L,R and M L,R are associated with A L,R in e as specified in (5) and (6). In (21), we use the penalty parameters A, a + ωL − q L ε, 2 a − ωR − q R ε, µN = 2 µ0 = −

ν0 = −ε,

ω L > 0,

νN = ε,

ω R > 0,

(23)

from [3], which are designed to give a stable and dual consistent numerical solution. T e −1 IeT e0 = e0,L e −1 IeT e = eTN,R M −1 eN,R , we use For q L = eT0 IM M L−1 e0,L and q R = eTN IM N R the values tabulated in [3]. In Appendix B we show that (21) with (23) is stable.

6.1

The Poisson equation

We employ the method of manufactured solutions, and start by solving −uxx = f (x) with Dirichlet boundary conditions, using the steady version of the scheme (21) with a = 0 and ε = 1. In this case we use ω L,R = q L,R in (23). In the simulations, we are interested in the discrete L2 -norm of the solution error, i.e. kekPe , where e = u − u and kek2Pe = eT Pee. 9

2

2

1

1

Numerical solution

Numerical solution

We solve this problem with f (x) = 302 cos(30x), such that the exact solution is u = cos(30x), using schemes that changes order at xˆ = 0.5. We construct one scheme using wide-stencil operators and one scheme using narrow-stencil operators, and let the left part have interior order 2 and the right part have interior order 6. The resulting solutions and absolute values of the errors are shown in Figure 1, and the corresponding rates of convergence are given in Table 1. As expected, both schemes show second order convergence rate, which is the lowest order of accuracy of the included operators.

0 -1 N=32 N=64 N=128

-2 -3

0 -1 N=32 N=64 N=128

-2 -3

0

0.2

0.4

0.6

0.8

1

0

0.2

0.4

x 100 -1

10

10-2 10-3 N=32 N=64 N=128

10-4 10

0.8

1

0.6

0.8

1

100

Solution errors

Solution errors

10

0.6

x

0.2

10-2 10-3 N=32 N=64 N=128

10-4

-5

0

-1

0.4

0.6

0.8

10

1

x

-5

0

0.2

0.4

x

Figure 1: The schemes are composed by operators with interior order 2 to the left and interior order 6 to the right. The interface is positioned at x ˆ = 0.5 and the exact solution is u = cos(30x). Left: Wide-stencil operators. Right: Narrow-stencil operators.

Wide-stencil operators ke(N/2)k  N kekPe log2 ke(N )k ePe P 32 0.35539437 – 64 0.07548625 2.2351 128 0.01786133 2.0794 256 0.00443970 2.0083 512 0.00110933 2.0008 1024 0.00027733 2.0000

Narrow-stencil operators ke(N/2)k  kekPe log2 ke(N )k ePe P 0.23478998 – 0.06015881 1.9645 0.01502129 2.0018 0.00375199 2.0013 0.00093777 2.0003 0.00023443 2.0001

Table 1: Errors and convergence rates corresponding to Figure 1. 10

6.1.1

Superconvergent functionals

In many applications, functionals are more important than the primary solution itself (for example lift and drag coefficients in computational fluid dynamics). As mentioned, for operators D1 with interior order of accuracy 2p (which fulfill (4) with a diagonal P ), the accuracy at the boundaries are restricted to order p [9]. Similarly, narrow-stencil operators D2 with interior order 2p and boundary order p (fulfilling (5) with a diagonal P ) are constructed in [11]. This, in turn, limits the order of accuracy of the resulting L∞ -errors to p + 1 for the wide-stencil operators and to p + 2 for the narrow-stencil operators [14, 16]. For more details on accuracy, see also the discussions in [18, 17]. Even so, when the scheme is dual consistent, the output functional can be computed with the full inner order of accuracy 2p [8]. R We consider linear functionals J (u) = Ω gu dx, approximated by J(u) = gT Peu, and in addition to the solution error, we study the functional error E = |J(u) − J (u)|. The numerical simulations confirm that the new scheme preserves the superconvergence property. In fact, even when having a wide-stencil operator in one domain and a narrowstencil operator (with the same interior order) in the other domain, the functional converges with full order 2p. This is quite remarkable since the wide- and narrow-stencil operators produce solution errors of different orders. In Figure 2, the resulting errors when using schemes with interior order 6 are shown. The exact solution is u = cos(30x) and the weight function is g = cos(30x). Figure 2 also shows that the new scheme has the same global order of accuracy as the operator with the lowest order.

4

10-5

100

Wide Narrow Mix

Functional error

Solution error

100

5.5

10-10

10-15 1 10

10

2

10

3

10

10-5

10-10 6

10-15 1 10

4

Wide Narrow Mix

Number of grid points N

10

2

10

3

10

4

Number of grid points N

Figure 2: The mixed schemes are composed by wide-stencil operators to the left and narrowstencil operators to the right of the interface at x ˆ = 0.5. We use u = g = cos(30x) and the operators have interior order 6. Left: Solution errors kekPe . Right: Functional errors E.

6.2

The advection-diffusion equation

Next, we consider the steady version of (20). We use a = 1, ε = 0.01, f = 0, g L = 1 and g R = 0, which leads to an exact solution with a steep gradient at x = 1. To solve this problem, we use the time-independent version of (21), with interior order 2 in the left domain (where the solution is almost flat), and interior order 6 in the right domain (where the boundary layer is located). The penalty parameters µ0 , ν0 , µN 11

1.2

1.2

1

1

Numerical solution

Numerical solution

and νN are chosen according to (23), with ω L,R = |a| + εq L,R in case of narrow-stencil operators and ω L,R = |a| in case of wide-stencil operators (this choice is derived to cancel oscillations [3]). We first place the interface at xˆ = 0.5, as before. The resulting numerical solutions and errors can be seen in Figure 3. The convergence plots that correspond to Figure 3 are shown in Figure 4. Since the main contribution to kekPe stems from the right part of the domain, there is almost no difference between the new schemes with mixed order and the interface-free schemes with interior order 6.

0.8 0.6 0.4 N=32 N=64 N=128

0.2

0.8 0.6 0.4 N=32 N=64 N=128

0.2

0

0 0

0.2

0.4

0.6

0.8

1

0

0.2

0.4

x 0

10 N=32 N=64 N=128

10-4

Solution errors

Solution errors

10

10-8

10

-12

10-16

0

0.2

0.4

0.6

0.8

1

0.6

0.8

1

x

0.6

0.8

0

10-4

10-8

10

-12

10-16

1

x

N=32 N=64 N=128

0

0.2

0.4

x

Figure 3: The schemes are composed by operators with interior order 2 in the left part of the domain and interior order 6 in the right part of the domain. The interface is positioned at x ˆ = 0.5. Left: Wide-stencil operators. Right: Narrow-stencil operators.

Remark 6.1. It is well known that wide-stencil schemes can produce oscillating solutions, but the oscillations decrease as the grid is refined [6]. However, thanks to the particular choice of penalty parameters used here, the interior oscillations are removed completely, as can be seen in Figure 3. In this case the wide-stencil schemes are actually preferable to the narrow-stencil schemes when the resolution is poor, i.e. when |a|h/ε is large [3].

Finally, we place the interface at xˆ = 0.9375 instead. (The standard SBP operators need at least 4p grid points, and hence the new scheme under consideration needs NR ≥ 12. We must thus use N ≥ 192 when the interface is this close to the boundary.) The resulting convergence plots are displayed in Figure 5. Now the second order errors 12

make an impact earlier, and we see that asymptotically, the new schemes converge with second order accuracy, as expected. 0

10

10-4

Solution error

Solution error

10

2

10-8 Interior order: 2 Interior order: 6 Left: 2, right: 6

10-12 101

4

102

0

10-4

2

10-8 Interior order: 2 Interior order: 6 Left: 2, right: 6

103

10-12 101

104

Number of grid points N

5

102

103

104

Number of grid points N

Figure 4: The convergence rates of kekPe corresponding to Figure 3 and compared with schemes without interfaces. Left: Wide-stencil operators. Right: Narrow-stencil operators. 100

2

10-4

10-8 Interior order: 2 Interior order: 6 Left: 2, right: 6

10

Solution error

Solution error

100

4

102

2

10-8 Interior order: 2 Interior order: 6 Left: 2, right: 6

-12

101

10-4

103

10

104

5

-12

101

Number of grid points N

102

103

104

Number of grid points N

Figure 5: The convergence rates of kekPe when the interface is located in xˆ = 0.9375. Left: Wide-stencil operators. Right: Narrow-stencil operators.

7

Summary

A procedure to locally change the type of finite difference stencils in a numerical scheme is developed. The development concerns operators approximating the second derivative, which complements work done earlier for the first derivative. The procedure is useful when the order of a numerical scheme has to be lowered or raised in a specific region of the computational domain. The new operators are based on summation-by-parts operators with simultaneous approximation term interfaces, but modified such that the numerical solutions have a unique representation in all grid points. This facilitates the process of transferring the interface, which could be especially advantageous for time-dependent problems. 13

The transition from one type of stencil to another is done in a time-stable and dual consistent manner, and the resulting operators have the same overall accuracy as the lowest included summation-by-parts operator. This is verified by numerical experiments on the Poisson equation and on the steady advection-diffusion equation.

A

Proofs of Proposition 4.1 and Corollary 4.3

e and Ie from (16) and Proof of Proposition 4.1. Consider P , which is given in (10), K T T T e IeT . With α = eN,L e we have Pe ≡ IP P L eN,L /(eN,L P L eN,L + e0,R P R e0,R ) inserted into K, 

   e e PK =     

   =    

   =  

  .. .  1    0    0 

...

N −1

PL L

N

P L L + P R0

..

P R1

...

N −1

...

0 N

PL L 0

0 0 0 PR 0 0 P R1 



  1 0 0 0   0 1 1 0   0 0 0 1    .. .

..

N P L L P L +P 0 R L N

0

0 0 PR

N

P L +P 0 R L

0

0 0 1 ...



. PL L 0 0

0

.. .

.

       N

PL L

       



N −1

PL L



P R0

P R1

...

    e ,  = IP    

where P Lj and P Rj refer to the j th diagonal entry of P L or P R , respectively. Having shown e = IP e for diagonal matrices P , the relation KP e −1 = Pe−1 Ie follows. that PeK

Proof of Corollary 4.3. From given in (10), we compute  . ..  1 0 0   0 α 1−α eu =  IeT K~  0 α 1−α   0 0 0 

e and I, e given in (16), and ~u, which is the definitions of K 

0 0 0 1 ...

       

.. . (u L )NL −1 (u L )NL (u R )0 (u R )1 .. .





        =      

.. . (u L )NL −1 α(u L )NL + (1 − α)(u R )0 α(u L )NL + (1 − α)(u R )0 (u R )1 .. .



    .   

Assumption 4.2, that is that (u L )NL = (u R )0 , leads to α(u L )NL + (1 − α)(u R )0 = (u L )NL e u holds. and α(u L )NL + (1 − α)(u R )0 = (u R )0 . Thus ~u = IeT K~ 14

B

Stability of the advection-diffusion scheme

We multiply the scheme (21) (for simplicity with f = 0 and g L,R = 0) by uT Pe from the e+Q eT = e eT − e eT , yields left, and add the transpose. Thereafter using that Q 0 0 N N d Te T eT e T e = auT e eT u − 2εuT e d (u P u) + 2εuT Au 0 0 0 0 u + 2u (µ0 e0 + ν0 d0 )e0 u dt e N )eT u. e T u + 2uT (µN eN + νN d − auT eN eTN u + 2εuT eN d N N

e = S IeT u + M Next, we define w (22), and compute

−1 T e

I e0 eT0 u − M

−1 T e

(24)

I eN eTN u, with S and M given in

e T ueT u − 2d e T ueT u + q L (eT u)2 + q R (eT u)2 , e + 2d e = uT Au e TM w w 0 0 N N 0 N

(25)

where we have exploited that e eT0 IM

e eTN IM

−1 T e

T M L−1 e0,L ≡ q L , I e0 = e0,L

−1 T e

T I eN = eN,R M R−1 eN,R ≡ q R ,

Using (25) in (24) leads to the energy growth rate

e eTN IM

e eT0 IM

−1 T e

I e0 = 0,

−1 T e

I eN = 0.

d Te e TM w e = −ω L (eT0 u)2 − ω R (eTN u)2 ≤ 0, (u P u) + 2εw dt

where we have also used the choice of penalty parameters suggested in (23). Remark B.1. In contrast to what is generally the case when using narrow-stencil second derivative operators, the modification of q L,R mentioned in Remark 3.3 is not needed. e −1 IeT e0 = eT IM e −1 IeT eN = 0. This is because M is block-diagonal, which leads to eTN IM 0

References

[1] J. Berg and J. Nordstr¨om. On the impact of boundary conditions on dual consistent finite difference discretizations. Journal of Computational Physics, 236:41–55, 2013. [2] M. H Carpenter, J. Nordstr¨om, and D. Gottlieb. A stable and conservative interface treatment of arbitrary spatial accuracy. Journal of Computational Physics, 148(2):341–365, 1999. [3] S. Eriksson. A dual consistent finite difference method with narrow stencil second derivative operators. Journal of Scientific Computing, DOI: 10.1007/s10915-0170569-6, 2017. [4] S. Eriksson, Q. Abbas, and J. Nordstr¨om. A stable and conservative method for locally adapting the design order of finite difference schemes. Journal of Computational Physics, 230(11):4216–4231, 2011.

15

[5] D. C. Del Rey Fern´andez, J. E. Hicken, and D. W. Zingg. Review of summation-byparts operators with simultaneous approximation terms for the numerical solution of partial differential equations. Computers & Fluids, 95:171–196, 2014. [6] H. Frenander and J. Nordstr¨om. Spurious solutions for the advection-diffusion equation using wide stencils for approximating the second derivative. Numerical Methods for Partial Differential Equations, 34(2):501–517, 2018. [7] B. Gustafsson, H.-O. Kreiss, and J. Oliger. Time-Dependent Problems and Difference Methods. John Wiley & Sons, Inc., 2013. [8] J. E. Hicken and D. W. Zingg. Superconvergent functional estimates from summation-by-parts finite-difference discretizations. SIAM Journal on Scientific Computing, 33(2):893–922, 2011. [9] H.-O. Kreiss and G. Scherer. Finite element and finite difference methods for hyperbolic partial differential equations, in: Mathematical Aspects of Finite Elements in Partial Differential Equations. Academic Press, Inc., 1974. [10] V. Linders, T. Lundquist, and J. Nordstr¨om. On the order of accuracy of finite difference operators on diagonal norm based summation-by-parts form. Accepted in SIAM Journal on Numerical Analysis, 2018. [11] K. Mattsson and J. Nordstr¨om. Summation by parts operators for finite difference approximations of second derivatives. Journal of Computational Physics, 199(2):503–540, 2004. [12] J. Nordstr¨om, J. Gong, E. van der Weide, and M. Sv¨ard. A stable and conservative high order multi-block method for the compressible Navier-Stokes equations. Journal of Computational Physics, 228(24):9020–9035, 2009. [13] J. Nordstr¨om and M. Sv¨ard. Well-posed boundary conditions for the Navier-Stokes equations. SIAM Journal on Numerical Analysis, 43(3):1231–1255, 2005. [14] M. Sv¨ard and J. Nordstr¨om. On the order of accuracy for difference approximations of initial-boundary value problems. Journal of Computational Physics, 218(1):333– 352, 2006. [15] M. Sv¨ard and J. Nordstr¨om. Review of summation-by-parts schemes for initialboundary-value problems. Journal of Computational Physics, 268:17–38, 2014. [16] M. Sv¨ard and J. Nordstr¨om. On the convergence rates of energy-stable finitedifference schemes. Technical Report LiTH-MAT-R–2017/14–SE, Link¨oping University, Department of Mathematics, 2017. [17] M. Sv¨ard and J. Nordstr¨om. Response to ”Convergence of summation-by-parts finite difference methods for the wave equation”. Journal of Scientific Computing, 74(2):1188–1192, 2018. [18] S. Wang and G. Kreiss. Convergence of summation-by-parts finite difference methods for the wave equation. Journal of Scientific Computing, 71(1):219–245, 2017. 16

Suggest Documents