an error minimized pseudospectral penalty direct...

35
An Error Minimized Pseudospectral Penalty Direct Poisson Solver by Horng, Tzyy-Leng Dept. of Applied Mathematics Feng Chia University, Taichung, Taiwan [email protected] http://newton.math.fcu.edu.tw/~tlhorng and Teng, Chun-Hao Dept. of Applied Mathematics National Chiao Tung University, Hsin-Chu, Taiwan [email protected]

Upload: vuongkien

Post on 30-Aug-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

An Error Minimized PseudospectralPenalty Direct Poisson Solver

byHorng, Tzyy-Leng

Dept. of Applied MathematicsFeng Chia University, Taichung, Taiwan

[email protected]://newton.math.fcu.edu.tw/~tlhorng

andTeng, Chun-Hao

Dept. of Applied MathematicsNational Chiao Tung University, Hsin-Chu, Taiwan

[email protected]

AbstractThis paper presents a direct Poisson solver based on an error minimized Chebyshev pseudospectral penalty formulation for problems defined on rectangular domains. The current method is based on eigenvalue-eigenvector matrix diagonalization methods developed long time before and elaborated by Chen, Su, and Shizgal (2000) [1]. However, this kind of fast Poisson solvers utilizing pseudospectral discretization is usually restricted to periodic or Dirichlet boundary conditions only for efficient implementation. Enforcement of Neumann or Robin boundary conditions requests messy row operations that reduces the easiness of operation. The current method can easily accommodate all three types of boundary conditions: Dirichlet, Neumann, and Robin boundary conditions. The reason for that is that it employs penalty method. Besides, the penalty parameters are determined analytically such that the discrete L2 error is minimized. 2D and 3D numerical experiments are conducted and the results show that the penalty scheme computes numerical solutions with better accuracy, compared to the traditional approaches with boundary conditions enforced strongly. The current method can be extended to generally linear 2nd order elliptic-type partial differential boundary value problems with arbitrary coefficients with only one restriction that those arbitrary coefficients must be able to beseparable to coordinate-variable functions. Under this generalization, this method can be surely applied to solve famous Helmholtz equation too. As to computing efficiency, the asymptotic operation count for current method in 3D case is 2NxNyNz (Nx + Ny + Nz), and its counterpart for 2D case is 2NxNy(Nx + Ny). Obviously, it is far superior to method expressing Laplace operator in tensor product. For an FFT-based method the asymptotic operation count is basically 2NxNyNz (log(Nx) + log(Ny) + log(Nz)) for 3D case, and 2NxNy(log(Nx) + log(Ny)) for 2D case. Indeed, the current method which relies on extensive matrix-matrix multiplications is inferior to FFT-based methods in theory. However, this inferiority also depends on hardware. For moderate Nx, Ny, and Nz, it is not necessarily inferior in computers nowadays. Of course, for large grid resolution, FFTbasedmethods remain the the best choice if handling boundary conditions is not a problem.

[1] H. CHEN AND Y. SU AND B.D. SHIZGAL. A Direct Spectral Collocation Poisson Solver in Polar and Cylinder Coordinates. J. Comput. Phys. 160 (2000) 453-469.

Approximation by Chebyshev polynomials

0

1 Suppose that is approximated by a truncated series of Chebyshev

ˆ polynomials as ,

ˆ where denotes Chebyshev polynomial and expansion coefficient.

N

k kk

k k

u x

u x u T x

T x u

2 Choosing the Chebyshev Gauss-Lobatto collocations points:

cos , 0,1, , ,

3 We can form the following discrete transform and inverse transform

jjx j NN

0

0

2 1 ,

,

2, 0, 2, 0, where and .

1, otherwise 1, otherwise

N

k j k jjk j

N

j k k jk

j k

u u x T xc N c

u x u T x

j N k Nc c

,0

4 For pseudospectral method, interpolating at the collocation points , 0,1, , .

5 Hence, can be also expressed as

,

whe

j

N

N k kk

u xx j N

u x

u x L x u x

,

1 2

, 20

2

2

re is the Lagrange interpolating polynomial defined as

( 1) (1 ) ( ) .( )

6 Then, the derivatives and can be appr

N k

N kNl N

N kl k l k kl k

j j

L x

x x x T xL xx x c N x x

du d ux xdx dx

22, ,

2 20 0

,

oximated as

and ,

where is usually referred to the Chebyshev collocation

derivative matrix.

N NN k N k

j k j j k jk k

N kj

dL d Ldu d ux u x x x u x xdx dx dx dx

dLx

dx

Chebyshev Collocation Derivative Matrix

2 2

00 ,

1 The entries of first-order Chebyshev collocation derivative matrix with respect to , based on Gauss-Lobatto collocation points, are given as below:

2 1 2 1 , ,6 6

x x

x xx x N N

xN ND D

2

2 for 0 or , , 1, 2, , 1, where

1 otherwise2 1

1 , , and , 0,1, 2, , ,

here cos , 0,1,2, , are Chebyshev Gauss-Lobatt

j xx x ijj

j

i ji

x xijj i j

j xx

x i ND j N c

x

cD i j i j N

c x x

jx j NN

2

o collocation

points. Also, there is a version for avoiding round-off error when is large. (W. Don and S. Solomonoff in SIAM J. Sci. Comp. Vol. 6, pp. 1253--1268 (1994))

2 .

x

xx x

N

D D

Chebyshev Gauss-Lobatto collocation mesh

Example: 1D Poisson equation (PE) with Dirichlet BC’s

1 Consider an 1D Poisson equation with Dirichlet boundary conditions as follows, , 1,1 , 1 and 1 .

2 Discretization: ( The first/last row/column of can

xx

xx

u f x u g u g

D

1 1,0 1,1

22 2,0 2,

2 2 2,0 2,

1 1

be stripped due to Dirichlet boundary conditions.)

x

x

x x x x x

xx

xx xx N

xx xx N

xx ij

N N xx xxN N N

N N xx

f D g D guf D g D gu

Du f D g D gu f D

1,0 1,

,

where , , 1, 2, , 1.

(3) Exponential order of convergence.

x x xxxN N N

xx xx xijij

g D g

D D i j N

1 Consider a 2D Poisson problem with Dirichlet boundary conditions in a rectangular domain shown as follows, , , 1,1 1,1 ,

xx yyu u f x y

1, , 1, ,

, 1 , ,1 .

2 Discretizing +1 +1 collocation points in the and directions for

respectively, and

x x

y y

x y

u y g y u y g y

u x g x u x g x

N N x y u

( +1) ( +1)

keeping in the shape of a rectangular matrix:

, with , .

3 The first and last rows and columns of and can be stripped due to

y xt N Nt t

yy xx yy xx

xx yy

u

D u D u D u uD f u f R

D D

( -1) ( -1)

Dirichlet BCs, then we can obtain

, where , ,

where , , 1, 2, , 1, , , 1, 2, , 1,

y xN Ntyy xx

yy yy y xx xx xijijij ij

ij ij y

D u uD f u f R

D D i j N D D i j N

f f D

00( ) ( ) ( ) ( ) , with

1, 2, , 1; 1, 2, , 1.xy

y y x xy j yy j xx i xx ij jNi iN

y x

g x D g x D g y D g y

i N j N

Example: 2D Poisson equation with Dirichlet BC’s

References for Diagonalization Method (Dirichlet BC’s) 1 D. B. Haidvogel, Thomas Zang, The accurate solution of Poisson's equation by expansion in Chebyshev polynomials, J. Comput. Phys. 30 (1979), 167-180. (2D diagonalization under spectral me

thod)

(2) P. Haldenwang, G. Labrosse, and S. Abboudi, Chebyshev 3-D spectral and 2-D pseudospectral solvers for the Helmholtz equation, J. Comput. Phys., 55 (1984), 115-128.

3 Hwar C. Ku, Richard S. Hirsh, and Thomas D. Taylor, A pseudospectral method for solution of the three-dimensional incompressible Navier-Stokes equations, J. Comput. Phys. 10 (1987), 439-462. (earliest, 2D)

(4) D. Funaro and D. Gottlieb, A new method of imposing boundary conditions in pseudospectral approximations of hyperbolic equations, Mathematics of Computation, 51:184 (1988), 599-613. (penalty

method analysis)

5 U. Ehrenstein, R. Peyret, A Chebyshev collocation method for the Navier-Stokes equations with application to double-diffusive convection, International Journal for Numerical

Methods in Fluids 9 (1989), 427-452. (2D Helmholtz)

6 Henry H. Yang, Bernie Shizgal, Chebyshev pseudospectral multi-domain technique for viscous flow calculation, Comput. Methods Appl. Mech. Engrg. 118 (1994), 47-61. (2D Helmholtz, Neumann BC)

7 S. Zhao and M. J. Yedlin, A new iterative Chebyshev spectral method for solving the

elliptic equation , J. Comput. Phys. 113 (1994), 215-223. (2D)

(8) H. B. Chen, K. Nandakumar, W. H. Fin

u f

lay, and H. C. Ku, Three-dimensional viscous flow through a rotating channel: a pseudospectral matrix method approach, 23 (1996): 379-396. (3D Helmholtz, Dirichlet BC)

9 Y. Su, Collocation sp

ectral methods in the solution of Poisson equation, MS thesis, University of British Columbia, Canada, 1998. (deatiled review and 2D derivation)

10 Heli Chen, Yuhong Su, and B. D. Shizgal, A direc

t spectral collocation Poisson solver in polar and cylindrical coordinates, J. Comput. Phys. 160 (2000), 453-469. (2D/3D cylindrical coordinate and symbolic derivation)

11 Roger Peyret, Spect

ral methods for incompressible viscous flow, Springer-Verlag, New York, 2002. (2D, p 88) 12 S. Nguyen, C. Delcarte, A spectral collocation method to solve Helmholtz problems

with boundary conditions involving mixed tangential and normal derivatives, J. Comput. Phys. 200 (2004), 34-49. (complicated Helmholtz solver, single/multi-block)

Diagonalization via Eigenvector

1 2 1

1

2

1

1 , where ,

here and represent the eigenvalue and eigenvector of

and , , , .

2 Similarly,

,

i i

y

i

Ny

j j

yy y i y yy

N

i y yy

y y y

t txx x j x xx

D e e D Y Y

e D

Y e e e

D e e D X X

1

2

1

where .

xN

1

1

1 1 1

1 1 where and

i.e. , 1, 2, , 1 and 1,2, , 1,

where

tyy xx

tyy xx

yy

yy

i ij ij j ij y x

ijij ij

i j

D u uD f

D uX uD X fX

D uX uX fX

D YY uX uX fX

Y Y uX uX fXY uX Y uX Y fXV V B V Y uX B Y fX

v v b i N j N

bv v

1

and are the elements of and , respectively.

Once is solved, can be recovered from . The diagonalizationmethod so far only works easily for Dirichlet BC's. For non-Dirichlet BC's,such

ijb V B

V u u YVX

as Neumann and Robin BC's, it requests messy row operations.

Example: 1D Poisson equation with BC’s involving derivative

1 Consider an 1D Poisson equation with Dirichlet/Neumann boundary conditions as follows, , 1,1 , 1 and 1 .

2 Stripping off first/last row/column of xx x

xx

u f x u g u g

D

0

1 1 0,

1 1,

1 1

,

no longer works.(3) Discretization:

ˆ ˆ , where ,

here

x xx

x xx

x

x j

xx xx xx ijijN N

N jN N

N

N j

u gDu f

D D Du f Iu g

I

stands for the last row of the 1 1 identity matrix.x xN N

1 Consider a 2D Poisson equation with Dirichlet/Neumann boundary conditions as follows,

, , 1,1 1,1 ,

xx yyu u f x y

1, , 1, ,

, 1 , ,1 .

2 Following the idea of 1D case, discretizing +1 +1 collocation points in

and directio

x xx

y yy

x y

u y g y u y g y

u x g x u x g x

N N

x y

( +1) ( +1)

0,

,

ns respectively for , and keeping in the form of a rectangular matrix:ˆ ˆˆ ˆ , , ,

ˆ where

y x

y

N Ntyy xx

y j

yy yy ij

N j

u u

D u uD f u f R

D

D D

I

0,

,( +1) ( +1)( +1) ( +1)

( +1) ( +

ˆ, ,

or or

ˆ

or or

xx xy y

y x

x j

xx xx ij

N jN NN N

x y y y x y

x x

ijx x

x y y y x y

N N

D

D D

I

g g g g g gg g

ffg g

g g g g g g

1)

1, 2, , 1, here .

1,2, , 1y

x

i Nj N

Example: 2D Poisson equation with BC’s involving derivative

ˆˆ ˆ3 However, using 5 5 matrix as an example,

will become

tyy xx

y x xx y xx y xx y y

yy x yy

yy x yy

yy x yy

x xx xx xx

D u uD f

u u u u u u u u u uu u u u u u uu u u u u u uu u u u u u uu u u u u u u u u u

or or

,

or or

which is wrong at BC's. How to fix this? Resorting to Kronecker product ˆ

x y y y y x y

x x

x x

x x

x y y y y x y

g g g g g g gg f f f gg f f f gg f f f g

g g g g g g g

I D

ˆ is both time and memory consuming. yy xxD I

Diagonalization with Penalty Method

1 Consider the 2D Poisson equation with all kind of boundary conditions in a rectangular domain, i.e., 1, ( ), , 1 ( ), where

x x y yB u y g y B u x g x

, ,

and , , , and are specified constants. At least one of and

must be non-zero for a unique solution to exist.

2 At

x x x y y yx y

x x y y x

y

B B

this time, we can not strip first/last row/column of and

as we did for the case of Dirichlet BCs. We follow the previous idea but modify the substitution by penalty method shown as

yy xxD D

belows.

0,0, 0,

,, ,1 1

0,

3 Replace and by the following and , respectively

xx xx x

xx yy xx yy

x x xxx j xj j

xx xx ij

x x xxx N j xN j N j

N N

yy j

yy

D D D D

D I D

D D

D I D

D

D

0, 0,

,, ,1 1

,

where , , , and are the penalty weights, which are usually large numbers.

yy y

y y

y y yj y j

yy ij

y y yyy N j yN j N j

N N

x x y y

I D

D

D I D

4 Using 5 5 matrix as an example, will become

tyy xx

x x y y y y y y y y x x y y

x x x x

x x x x

x x

D u uD f

u B u B u u B u u B u u B u u B u B uu B u u u u u B uu B u u u u u B uu B u u u u u

x x

x x y y y y y y y y x x y y

x x y y y y y y y y x x y y

x x x x

x x x x

x x x

B uu B u B u u B u u B u u B u u B u B u

f g g f g f g f g f g gf g f f f f gf g f f f f gf g f f f f g

,

which well approximates with the specified BC's when 's are large enough.

x

x x y y y y y y y y x x y yf g g f g f g f g f g g

u f

Diagonalization via Eigenvector again

0 1

0

11 where

here and represent the eigenvalue and eigenvector of

and , , , .

2 Similarly,

i i

y

i

N y

j j

yy y i y yy

N

i y yy

y y y

t txx x j x xx

D e e D Y Y

e D

Y e e e

D e e D X X

0

1where .

xN

1

1

1 1 1

1 1 where and

i.e. , 0,1, , and 0,1, , ,

w

tyy xx

tyy xx

yy

yy

i ij j ij ij y x

ijij

i j

D u uD f

D uX uD X fX

D uX uX fX

D YY uX uX fX

Y Y uX uX fX

Y uX Y uX Y fX

V V B V Y uX B Y fX

v v b i N j N

bv

1

here and are the elements of and ,

respectively.Once is solved, can be recovered from .

ij ijv b V B

V u u YVX

3D Case

0,0, 0,

,, ,1 1

0,0, 0,

,, ,1 1

1

,

,

xx xx x

yy y

y y

x x xxx j xj j

xx xx ij

x x xxx N j xN j N j

N N

y y yyy j yj j

yy yy ij

y y yyy N j yN j N j

N N

D I D

D D

D I D

D I D

D D

D I D

0,0, 0,

,, ,1 1

,

zz zz z

z z zzz j zj j

zz zz ij

z z zzz N j zN j N j

N N

D I D

D D

D I D

1

0 0 0

1

0 0 0

1

0 0 0

(2)

,

,

.

y y y

x x x

z z z

N N N

yy lm m im mi yy lm mil ill i lN N N

t txx jn n ln nl xx jn nlj lj

j l j

N N Nt tzz ko o lo ol zz ko olk lk

k l k

D Y Y Y D Y

D X X X D X

D Z Z Z D Z

0 0 0

0 0 0 0 0

0 0 0 0

(3)

,

,

y x z

yx xz z

x xz z

N N Nt t

yy ljk ilk xx ijl zz ijkil lj lkl l l

NN NN N

yy ljk jn ko ilk n ln koilk j l k l

N NN N

ijl o lo jn ijk jn koj l k j

yy lmil

D u u D u D F

D u X Z u X Z

u Z X F X Z

D Y

1

0 0 0 0 0 0

0 0 0 0 ,

y yx xz z

x xz z

N NN NN N

ml ljk jn ko ilk ln ko nk j l m k l

N NN N

ijl jn lo o ijk jn koj l k j

Y u X Z u X Z

u X Z F X Z

1

0 0 0 0 0

0 0 0 0

1 1

0 0 0 0 0

,

yx xz z

x xz z

y yx xz

NN NN N

im m ml ljk jn ko ilk ln ko nk j l k l

N NN N

ijl jn lo o ijk jn koj l k j

N NN NN

m ml ljk jn ko mi ilk ln ko nk j l i k l

Y Y u X Z u X Z

u X Z F X Z

Y u X Z Y u X Z

0

1 1

0 0 0 0 0 0 ,

z

y yx xz z

N

N NN NN N

mi ijl jn lo o mi ijk jn koi l j i k j

Y u X Z Y F X Z

1 1

0 0 0 0 0 0

1 1

0 0 0 0 0 0 ,

Hence,

y yx xz z

y yx xz z

N NN NN N

m ml ljk jn ko n mi ilk ln koi k j i k l

N NN NN N

o mi ijl jn lo mi ijk jn koi l j i k j

mnom n o mno mno mno

m

Y u X Z Y u X Z

Y u X Z Y F X Z

BW B W

1 1

0 0 0 0 0 0

1 1

0 0 0

, , , ,

where , .

.

y yx xz z

y xz

n oN NN NN N

mno mi ilk ln ko mno mi ijk jn koi k l i k j

N NN

ijk im mno nj okm o n

m n o

W Y u X Z B Y F X Z

u Y W X Z

Error Minimization for Penalty Parameter

2

1 Taking 1D PE as example, ( ) ( ).

2 ( ) 16 sin 4 , so exact solution ( ) sin(4 ).

3 BC's: (a) ( 1) 0, (1) 4 , (b) ( 1) 4 , (1) (1) 4 .

u x f x

f x x u x x

u u u u u

Figure 1: BC (a), N=16. Figure (2): BC (b), N=16.

Error-Minimized Tau vs. Strongly Enforcement

Table 1: BC (a)

Table 2: BC (b)

Strongly-enforced BC is equivalen to .

Error-Minimized Tau Can Be Derived

Details see: Tzyy-Leng Horng and Chun-Hao Teng*, 2012, "An error minimized pseudospectral penalty direct Poisson solver," Journal of Computational Physics, 231(6):2498–2509.

Error-Minimized Tau Can Be Extended to Higher-Dimension PE

Taking 2D PE as an example, ( , ), with BC's

1, ( ), , 1 ( ).

There exists a unique set ( , ), ( , ), ( , ), ( , ) such that

( , ) ( , ) ( , ), and ( , ) (

xx yy

x x y y

x y x y

x y x

u u u f x y

B u y g y B u x g x

u x y u x y f x y f x y

u x y u x y u x y f x y f

, ) ( , ), with, subject to 1, ( ),

, subject to , 1 ( ),

So we can calculate error-minimized and in each direction alone according to previous formula.

y

x x x xxx

y y y yyy

x y f x yu f B u y g y

u f B u x g x

Numerical experiments for 2D PE 2

1 ( , ).

2 ( , ) 32 sin(4 )sin(4 ), so eaxct solution is ( , ) sin(4 )sin(4 ).

( 1, )(3) BC's: (a) ( 1, ) 4 sin(4 ),

( , 1) 4 sin(4 ).

u f x y

f x y x yu x y x y

u yu y yx

u x xy

BC's: (b) ( 1, ) 0, ( , 1) 0. u y u x

CT (Chebyshev tau): D.B. Haidvogel, T. Zang, The accurate solution of Poisson’s equation by expansion in Chebyshev polynomials, J. Comput. Phys. 30 (1979) 167–180.

CC (Chebyshev collocation): U. Ehrenstein, R. Peyret, A Chebyshev collocation method for the Navier–Stokes equations with application to double-diffusive convection, Int. J. Numer. Methods fluids 9 (1989) 427–452.

CG (Chebyshev Galerkin): J. Shen, Efficient spectral-Galerkin method II. Direct solvers of second and fourth order equations by using Chebyshev polynomials, SIAM J. Sci. Comput. 16 (1995) 74–87.

(1, )BC's: (c) 1, 0, 4 sin(4 ),

( ,1)( , 1) 0, ( ,1) 4 sin(4 ).

u yu y yx

u xu x u x xy

Numerical experiment for 3D PE 2

1 ( , , ).

2 ( , , ) 48 sin(4 )sin(4 )sin(4 ), so eaxct solution is ( , ) sin(4 )sin(4 )sin(4 ).

(1, , )(3) BC's: ( 1, , ) 0, 4 sin(4 )sin(4 ),

( , 1, ) 4 sin(4 )sin(4 ),

u f x y z

f x y z x y zu x y x y z

u y zu y z y zx

u x z x zy

( ,1, ) ( ,1, ) 4 sin(4 )sin(4 ),

( , , 1) ( , ,1)( , , 1) 4 sin(4 )sin(4 ), 4 sin(4 )sin(4 ).

u x zu x z x zy

u x y u x yu x y x y x yz z

Conclusion

1 Asymptotic operation account:

2D: 2 , 3D: 2 , compared with FFT-based method,

2D: 2 log log , 3D: 2 log log log .

(2) This method can be easily exten

x y x y x y z x y z

x y x y x y z x y z

N N N N N N N N N N

N N N N N N N N N N

1

ded to the following type of elliptic problem subjected to all kinds of BC's in a rectangular domain:

, , ,

where

x y z

x

L L L u f x y z

L a x

2 2

1 1 2 2 22 2

2

3 3 32

, ,

.

Sure, it includes Helmholtz equation. (3) So far, analytic formula for error-minimized tau can be only derived f

y

z

b x c x L a y b y c yx x y y

L a z b z c zz z

or PE.4 For all BC's being Neumann in PE, which has infinitely many solutions and the difference

of any two of them will be a constant, the current method will give you one of the solutions.5 The basis function is not limited to Chebyshev polynomials. It can be replaced by

Legendre polynomials or any other basis function as far as there is an associated collocation derivative matrix. It can be applied to finite difference too.(6) Sample matlab code is available at http://newton.math.fcu.edu.tw/~tlhorng/index_eng.html.

Thank you for your attention. Any question?