OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand...

35
On Spatial Distribution of the Discretization and Algebraic Error in Numerical Solution of Partial Differential Equations Jan Papež Zdeněk Strakoš Charles University, Prague, Czech Republic, and Academy of Sciences of the Czech Republic, Prague, Czech Republic SIAM Annual Meeting, July 8, 2013 Implicitly Constituted Fluids and Solids: Modelling and Analysis

Transcript of OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand...

Page 1: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

On Spatial Distribution of the Discretization andAlgebraic Error in Numerical Solution of Partial

Differential Equations

Jan Papež Zdeněk Strakoš

Charles University, Prague, Czech Republic,

and

Academy of Sciences of the Czech Republic, Prague, Czech Republic

SIAM Annual Meeting, July 8, 2013Implicitly Constituted Fluids and Solids: Modelling and Analysis

Page 2: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

Outline

1. Introduction

2. Errors in the simplest 1D model problem and their analysis

3. Locality of the errors in 2D examples

4. Conclusions

Page 3: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

1. Introduction

Real-world problem

↓ modelling

↓ error of the model

Mathematical model, solution u

↓ discretization

↓ discretization error

Discretized problem, discrete solution uh, uh = Φx, Ax = b

↓ algebraic solution

↓ algebraic error (truncation + roundoff)

Approximation x ≈ x, uh ≈ uh, uh = Φx

Page 4: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

1. Introduction

u − uh︸ ︷︷ ︸total error

= u − uh︸ ︷︷ ︸discretization error

+ uh − uh︸ ︷︷ ︸algebraic error

FEM discretizationInfinite dimensional problem in Ω

↓ basis functions with local support

sparse system matrix

↓ algebraic solver

coefficients for the global approximation uh ≈ uh

What is the distribution of the algebraic error in the functionalspace?

Page 5: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

1. Introduction

u − uh︸ ︷︷ ︸total error

= u − uh︸ ︷︷ ︸discretization error

+ uh − uh︸ ︷︷ ︸algebraic error

FEM discretizationInfinite dimensional problem in Ω

↓ basis functions with local support

sparse system matrix

↓ algebraic solver

coefficients for the global approximation uh ≈ uh

What is the distribution of the algebraic error in the functionalspace?

Page 6: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

1. Introduction

u − uh︸ ︷︷ ︸total error

= u − uh︸ ︷︷ ︸discretization error

+ uh − uh︸ ︷︷ ︸algebraic error

FEM discretizationInfinite dimensional problem in Ω

↓ basis functions with local support

sparse system matrix

↓ algebraic solver

coefficients for the global approximation uh ≈ uh

What is the distribution of the algebraic error in the functionalspace?

Page 7: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. 1D Poisson problem (on purpose!)

−u′′(x) = f (x) , x ∈ (0, 1)

u(0) = u(1) = 0

with the solution

u(x) = exp(−5(x − 0.5)2)− exp(−5/4) ,

see Eriksson et al. (1995).

Discretized using the piecewise linear basis functions on uniformmesh with 19 inner nodes (i.e. with the mesh size h = 1/20).

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−0.2

0

0.2

0.4

0.6

0.8

1

1.2

Page 8: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. 1D problem - solution, discretization error

0 0.2 0.4 0.6 0.8 1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0 0.2 0.4 0.6 0.8 1−1.5

−1

−0.5

0

0.5

1

1.5

2

2.5

3

3.5x 10

−3

The exact solution u (left) and the discretization error u − uh(right); the right vertical axis is scaled by 10−3.

Page 9: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. 1D problem - error norms

Simple consequence of the Galerkin orthogonality, u(n)h = Φxn,

‖(u − u(n)h )′‖2 = ‖(u − uh)′‖2 + ‖(uh − u(n)

h )′‖2

= ‖(u − uh)′‖2 + ‖x− xn‖2A .

Discretization error‖(u − uh)′‖2 = 6.8× 10−3

Algebraic error (at the 9th iteration of CG with x0 = 0)‖x− x9‖2A = 1.2× 10−3

Total error‖(u − u(9)

h )′‖2 = 8.0× 10−3

Page 10: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. 1D problem - algebraic and total error

0 0.2 0.4 0.6 0.8 1−5

−4

−3

−2

−1

0

1

2

3

4

5x 10

−3

The algebraic error uh − u(9)h (dashed-dotted line) is strongly

localized in the middle of the domain and substantially affects theshape of the the total error u − u(9)

h (solid line).

Recall‖x− x9‖A < ‖(u − uh)′‖ !

Page 11: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Analysis of the algebraic error

λ1 < . . . < λ19 eigenvalues of Ayi normalized eigenvector of A corresponding to λi

spectral decomposition of error x− xk

x− xk =19∑i=1

(x− xk , yi ) yi

(x− xk , yi ) ith spectral component of the error x− xk

Page 12: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Spectral components of the algebraic error

1 3 5 7 9 11 13 15 17 1910

−10

10−8

10−6

10−4

10−2

100

102

init erroriteration #7iteration #8iteration #9

0 10 20 30 40 50 60 70 80

1

2

3

4

5

6

7

8

9

10

itera

tion

num

ber

eigenvaluesRitz values

Development of the squared size of the spectral components of theerror (left), the convergence of Ritz values to the eigenvalues of A(right).

The (irregular) spatial distribution of algebraic error u − u(9)h is

caused by the nonuniform changes in the spectral components.

Page 13: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Interpretation of the error

We need fully computable a posteriori error bounds (no hiddenconstants) which are:

I Locally efficient,I and allow to compare the local contribution of the

discretisation error and the algebraic error to the total error.

Interpretation of the error:

I Functional backward error (perturbation of the bilinear form)modifies the problem to be solved.

I Projecting the backward error into the FEM basis makes thebasis functions non-local.

Page 14: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Loss of locality

Consider the transformation of the FEM basis functionsΦ = [ϕ1, . . . , ϕn] (in the model problem the continuous piecewiselinear hat functions) to the basis Φ = [ϕ1, . . . , ϕn] represented bya square matrix D ∈ Rn×n , D = [D`j ] ,

ϕj = ϕj +n∑`=1

D`j ϕ` , j = 1, . . . , n .

or, in the compact form

Φ = Φ (I + D) ,

where D accounts for the numerical errors in solving thediscretized finite dimensional algebraic problem.

Gratton, Jiránek, and Vasseur (2012); P, Liesen, Strakoš (2013)

Page 15: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Loss of locality - meaning of D

We look for D such that the Galerkin solution

uh = Φx , Ax = b , Aji = a(ϕi , ϕj)

of the discretized formulation

a(uh, ϕi ) = `(ϕi ), i = 1, . . . , n

can be expressed as the Petrov-Galerkin solution

uh = Φx = Φ(I + D)x , Ax = b , Aji = a(ϕi , ϕj)

of the same discretized formulation

a(uh, ϕi ) = `(ϕi ), i = 1, . . . , n .

Page 16: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Petrov - Galerkin discretization

In the second case, the variational formulation is discretized via thetransformed basis functions

Φ = Φ(I + D)

and the original test functions ϕi , i = 1, . . . , n, which results inthe matrix of the linear algebraic system

A = A (I + D) .

Here the algebraic vector x which approximates x solves exactlythe algebraic system determined by the Petrov-Galerkindiscretization of the infinite dimensional problem.

Page 17: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Determining D in (A + AD) x = b

Using the algebraic backward error we immediately get that thegiven approximate solution x of Ax = b solves exactly theperturbed algebraic system

(A + E) x = b , where E =(b− Ax) xT

‖x‖2.

This finally gives

AD = E i.e. D = A−1E .

Other choices of E are possible, but with no effect to the mainpoint.

Page 18: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

2. Transformed FEM basis has global support

05

1015

20 0

5

10

15

20−2

−1.5

−1

−0.5

0

0.5

1

1.5

2

2.5

x 10−3

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−1.5

−1

−0.5

0

0.5

1

1.5x 10

−3

MATLAB surf plot of the transformation matrix D (left) and thedifference ϕj − ϕj (right) for x ≡ x8.

Page 19: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. 2D case, L-shape problem

−∆u = 0 in Ω , u = uD on ∂Ω ,

in L-shaped domain

Ω ≡ (−1, 1)× (−1, 1) \ (0, 1)× (−1, 0)

with the solution (given in polar coordinates)

u(r , θ) = r2/3 sin(23θ

);

see, e.g., Luce and Wohlmuth (2004), Ainsworth (2005).

Page 20: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. L-shape problem - solution

−1 −0.5 0 0.5 1 −1

0

1

0

0.2

0.4

0.6

0.8

1

1.2

1.4

−1 −0.5 0 0.5 1

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

The solution u of the L-shape problem (left),the adaptively refined mesh with 1738 nodes (right).

Page 21: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Problem with inhomogeneous diffusion tensor

−∇ · (S∇u) = 0 in Ω ,

u = uD on ∂Ω .

in domain Ω ≡ (−1, 1)× (−1, 1) divided into four subdomains Ωiwith the solution (given in polar coordinates)

u(r , θ)|Ωi = rα(ai sin(αθ) + bi cos(αθ)) .

see, e.g., Rivière, Wheeler, and Banas (2000),Jiránek, Strakoš, and Vohralík (2010).

Page 22: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Problem with inhomogeneous diffusion tensor

The diffusion tensor S|Ωi = si I. The diffusion coefficients arechosen s1 = s3 = 100, s2 = s4 = 1.

−1 −0.5 0 0.5 1

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

s4=1

s2=1

s3=100

s1 = 100

Page 23: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Problem with inhomogeneous diffusion tensor - solution

−1 −0.5 0 0.5 1−1

0

1

−1.5

−1

−0.5

0

0.5

1

1.5

−1 −0.5 0 0.5 1

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

The solution u of the problem with inhomogeneous diffusiontensor (left), the adaptively refined mesh with 3589 nodes (right).

Page 24: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. 2D examples - discretization

We consider a sequence of adaptively refined meshes. On a givenmesh we discretize the problem using the piecewise linear basisfunctions with local support (hat-functions).

Adaptive refinement by Adaptive Finite Element Method

SOLVE - the discretized system is solved using the MATLABbackslash solver (Cholesky decomposition)

ESTIMATE - the local discretization error is estimated using theresidual-based local error estimator

MARK - marking the elements using the greedy-algorithm;see, e.g.,Carstensen, Merdon (2010)

REFINE - refinement by Newest-Vertex-Bisection, seeMorin, Nochetto, and Siebert (2000)

Page 25: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. 2D examples - discretization

We consider a sequence of adaptively refined meshes. On a givenmesh we discretize the problem using the piecewise linear basisfunctions with local support (hat-functions).

Adaptive refinement by Adaptive Finite Element Method

SOLVE - the discretized system is solved using the MATLABbackslash solver (Cholesky decomposition)

ESTIMATE - the local discretization error is estimated using theresidual-based local error estimator

MARK - marking the elements using the greedy-algorithm;see, e.g.,Carstensen, Merdon (2010)

REFINE - refinement by Newest-Vertex-Bisection, seeMorin, Nochetto, and Siebert (2000)

Page 26: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. L-shape problem

Final mesh with 1738 nodes.

Discretization error‖∇(u − uh)‖2 = 4.8× 10−4

Algebraic error (at the 73th iteration of CG with x0 = 0)‖∇(uh − u(73)

h )‖2 = 3.6× 10−6

Total error‖∇(u − u(73)

h )‖2 = 4.8× 10−4

For the purpose of the numerical experiments we substitute for the(unknown) algebraic exact solution x the MATLAB backslashsolution.

Page 27: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Discretization and algebraic error

−1 −0.5 0 0.5 1 −1

0

1

−6

−4

−2

0

2

4

6

x 10−4

−1 −0.5 0 0.5 1 −1

0

1

−6

−4

−2

0

2

4

6

x 10−4

MATLAB trisurf plot of the discretization error u − uh (left),algebraic error uh − u(73)

h (right).

Page 28: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Discretization and total error

−1 −0.5 0 0.5 1 −1

0

1

−6

−4

−2

0

2

4

6

x 10−4

−1 −0.5 0 0.5 1 −1

0

1

−6

−4

−2

0

2

4

6

x 10−4

MATLAB trisurf plot of the discretization error u − uh (left)and of the total error u − u(73)

h (right).

Page 29: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Problem with inhomogeneous diffusion tensor

Final mesh with 3589 nodes.

Discretization error‖S1/2∇(u − uh)‖2 = 4.7× 10−1

Algebraic error (at the 217th iteration of CG with x0 = 0)‖S1/2∇(uh − u(217)

h )‖2 = 4.5× 10−3

Total error‖S1/2∇(u − u(217)

h )‖2 = 4.7× 10−1

Page 30: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Discretization and algebraic error

−1 −0.5 0 0.5 1−1

0

1

−0.01

−0.005

0

0.005

0.01

−1 −0.5 0 0.5 1−1

0

1

−0.01

−0.005

0

0.005

0.01

MATLAB trisurf plot of the discretization error u − uh (left),algebraic error uh − u(217)

h (right).

Page 31: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

3. Discretization and total error

−1 −0.5 0 0.5 1−1

0

1

−0.01

−0.005

0

0.005

0.01

−1 −0.5 0 0.5 1−1

0

1

−0.01

−0.005

0

0.005

0.01

MATLAB trisurf plot of the discretization error u − uh (left)and of the total error u − u(217)

h (right).

Page 32: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

Conclusions

Spatial distribution of the algebraic error should be taken intoaccount when solving (large scale) mathematical modellingproblems in general.

In particular, for the FEM discretization:

I distribution of the algebraic error may significantly differ fromthe distribution of the discretization error;

I global values (norms) give no information about the localbehavior of errors;

I stopping criteria for (iterative) algebraic solvers should berelated to the spatial distribution of the total error in thefunctional space.

Page 33: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

Acknowledgement and references

Acknowledgementthe work has been supported by the ERC-CZ project LL1202 and bythe GAUK grant 695612.

ReferencesJ. Liesen, Z. Strakoš.Principles and Analysis of Krylov Subspace Methods, Chapter 5.Oxford University Press.

J. Papež, J. Liesen, Z. StrakošDistribution of the discretization and algebraic error in numerical solutionof partial differential equations.Preprint MORE/2012/03, submitted for publication.

Page 34: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

References

M. Arioli, J. Liesen, A. Międlar, and Z. Strakoš,Interplay between discretization and algebraic computation in adaptivenumerical solution of elliptic PDE problems.to appear in GAMM Mitteilungen.

R. Becker, C. Johnson, and R. Rannacher,Adaptive error control for multigrid finite element methods.Computing, 55 (1995), no. 4, pp. 271–288.

A. Ern and M. Vohralík,Adaptive inexact Newton methods with a posteriori stopping criteria fornonlinear diffusion PDEs.to appear in SIAM J. Sci. Comput.

P. Jiránek, Z. Strakoš, and M. Vohralík,A posteriori error estimates including algebraic error and stopping criteriafor iterative solvers,SIAM J. Sci. Comput., 32 (2010), pp. 1567–1590.

Page 35: OnSpatialDistributionoftheDiscretizationand ...OnSpatialDistributionoftheDiscretizationand AlgebraicErrorinNumericalSolutionofPartial DifferentialEquations JanPapež ZdeněkStrakoš

The end

Thank you for your attention!