chapter 13 more about boundary conditions speaker: lung-sheng chien book: lloyd n. trefethen,...

47
Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Upload: adrian-bishop

Post on 02-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Chapter 13 More about Boundary conditions

Speaker: Lung-Sheng Chien

Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Page 2: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Consider 1N Chebyshev node on 1,1 , cosj

jx

N

for 0,1,2, ,j N

Preliminary: Chebyshev node and diff. matrix [1]

x

0x1x2x3x/ 2NxNx

1 1

6N

0 1x 1x2x3 0x 4x5x61 x x

0 1x 1x2x03x4x51 x

x

5N

Even case:

Odd case:

Uniform division in arc

Page 3: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Preliminary: Chebyshev node and diff. matrix [2]

Given

1N Chebyshev nodes , cosj

jx

N

and corresponding function value jv

We can construct a unique polynomial of degree

N , called

0

N

j jj

p x v S x

1

0 j k

k jS x

k j

is a basis.

1

0 0

N NN

i j j i ij jj j

p x v S x D v

where differential matrix

NN ijD D is expressed as

2

00

2 1,

6N N

D

22 1

,6

NNN

ND

2

,2 1

jNjj

j

xD

x

for

1,2, , 1j N

1,

i j

N iij

j i j

cD

c x x

for

, , 0,1, 2, ,i j i j N where2 0,

1 otherwisei

i Nc

with identity 0,

NN Nii ij

j j i

D D

Second derivative matrix is 2N N ND D D

Page 4: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Preliminary: Chebyshev node and diff. matrix [3]

Let p x be the unique polynomial of degree

with

N

define 0 j N

, then impose B.C.

1 0p and j jp x v

j jw p x and j jz p x for

We abbreviate 2Nw D v 1 0p ,that is,

0 0Nv v

In order to keep solvability, we neglect

0 Nw w 2 2 1: 1,1: 1N ND D N N ,that is,

0w

1w

2w

1Nw

Nw

0v

1v

2v

1Nv

Nv

2ND

zero

zero

neglect

neglect

Similarly, we also modify differential matrix as 1: 1,1: 1N ND D N N

Page 5: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Asymptotic behavior of spectrum of Chebyshev diff. matrix

In chapter 10, we have showed that spectrum of Chebyshev differential matrix (second order) approximates

, 1 1, B.C. 1 0xxu u x u with eigenmode 2

2

4k k

Eigenvalue of

2ND

2ND is negative (real number) and 4

max 0.048N

Large eigenmode of 2ND does not approximate to

22

4k k

Since ppw is too small such that

resolution is not enough

1

2

Mode N is spurious and localized near boundaries 1x

Page 6: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Preliminary: DFT [1]

Definition: band-limit interpolant of

function , is periodic sinc function

NS x

sin / sin1

2 2 / tan / 2 2 tan / 2

mikx

Nk m

x h mxhS x P e

h x m x

If we write 1

N

j k j kk

v v v

, then 1

2

m Nikx

k k N kk m k

p x P e v v S x x

Also derivative is according to 1

1

N

j j k N j kk

w p x v S x x

Given a set of data point 1 2, , , NNv v v R with

2N m is even,

2h

N

Then DFT formula for jv

1

2ˆ exp

N

k j jj

v v ikxN

for

, 1, , 1,k m m m m

1

1ˆ exp

2

m

j k jk m

v v ikx

for

1,2, ,j N

Page 7: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Preliminary: DFT [2]

Direct computation of derivative of

sin /

2 / tan / 2N

x hS x

h x

, we have

1

0 0 mod

11 cot , 0 mod

2 2

jN j

j N

S x jhj N

1 1 1 15 5 5 5

1 1 1 15 5 5 5

1 1 1 1 15 5 5 5 5 5

1 1 1 15 5 5 5

1 1 1 15 5 5 5

0 2 3 4

0 2 3

2 0 2

3 2 0

4 3 2 0

j k

S h S h S h S h

S h S h S h S h

D S x x S h S h S h S h

S h S h S h S h

S h S h S h S h

Example:

is a Toeplitz matrix.

Second derivative is

2

22

2

1 0 mod

6 3

1, 0 mod

2sin / 2

jN j

j Nh

S x

j Njh

Page 8: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Preliminary: DFT [3]

2

22

2

1 0 mod

6 3

1, 0 mod

2sin / 2

jN j

j Nh

S x

j Njh

For second derivative operation

2 2

1 1

,N N

j j k N j k N kk k

w p x v S x x D j k v

second diff. matrix is explicitly defined by using Toeplitz matrix (command in MATLAB)

2

22:2

22 22 2

2

2

2

csc 2 / 2 / 2

csc / 2 / 211

,16 3 2sin 1: 1 / 2

6 3csc / 2 / 2

csc 2 / 2 / 2

N

N N j k

h

h

D S x x toeplitzh N h

hh

h

2 2 T

N ND DSymmetry property:

Page 9: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Preliminary: DFT [4]

Eigenvalue of Fourier differentiation matrix

ND is

k ik corresponding to eigenvector

expk ikx for

1, , 12 2

N Nk and

0 has multiplicity 2

1

1

,N

j k N j kk

w v S x x

2

mikx

Nk m

hS x P e

11

10

2 4j j j

mik x x im x x im x x

N jk mk

h hS x x ike ime ime

1

1

1 10

1ˆ ˆ ˆ

2 4

N mikx imx imx

N j j k m mj k m

k

hS x x v ike v ime v ime v

1

1

1 10

2

N mikx

N N i j j kj k m

k

D v S x x v ike v

1

ˆ j

Nikx

k jj

v h e v

and

ˆ ˆm mv v

when

01 i xv e and

imxv e , we have 0ND v

Page 10: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

How to deal with boundary conditions

• Method I: Restrict attention to interpolants that satisfy the boundary conditions.

Example: chapter 7. Boundary value problems

• Method II: Do not restrict the interpolants, but add additional equations to enforce the boundary condition.

4 , 1 1, 1 0xxxu e x u

, 1 1, 1 0uxxu e x u

, 1 1, 1 0xxu u x u

10sin 8 1 , 1 , 1, 0 on boundaryxx yyu u x y x y u

2 , , 1 , 1, 0 on boundaryxx yyu u k u f x y x y u Helmholtz equation:

Poisson equation:

Eigenvalue problem:

Nonlinear ODE:

Linear ODE:

Page 11: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Recall linear ODE in chapter 7

4 , 1 1, 1 0xxxu e x u

0 1x 1x2x03x4x51 x

xChebyshev nodes:

0w

1w

2w

3w

4w

5w

0u

1u

2u

3u

4u

5u

2ND

zero

zero

neglect

neglect

Let p x be unique polynomial of degree N with 1 0p and j jp x u

1 1j N

1

for

2 Set j jw p x 1 1j N for

2 2 1: 1,1: 1N ND D N N

Method I

with exact solution 41sinh 4 cosh 4

16xu e x

Page 12: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Inhomogeneous boundary data [1]

4 , 1 1, 1 0, 1 1xxxu e x u u

Let p x be unique polynomial of degree N with 1 0, 1 1p p and

j jp x u 1 1j N

1

for

2 Set j jw p x 1 1j N for

Method I

0w

1w

2w

3w

4w

5w

0u

1u

2u

3u

4u

5u

2ND

1

zero

neglect

neglect

1w

2w

3w

4w

2 1: 4,1: 4ND

1u

2u

3u

4u

2 1: 4,0NDor say

Page 13: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Inhomogeneous boundary data [2]

4 , 1 1, 1 0, 1 1xxxu e x u u

Method of homogenization

1

2S

xu

satisfies 1 0, 1 1S Su u , decompose H Su u u , then

2

42

, 1 1, 1 0xH H

du e x u

dx which can be solved by method I

1 :u method I directly

2 :u method of homogenization

2 1 7.5336 15u u E

Solution under N = 16

method I is good even for inhomogeneous boundary data

exact solution 41 1sinh 4 cosh 4

16 2x x

u e x

Page 14: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Mixed type B.C. [1]

4 , 1 1, 1 0, 1 0xxx xu e x u u

Let p x be unique polynomial of degree N with 1 0, 1 0xp p and

j jp x u 1 1j N

1

for

2 Set j jw p x 1 1j N for

Method I

How to do?

Method II

Let p x be unique polynomial of degree N with 1 0p and

j jp x u 1 j N for

Set j jw p x 1 1j N for

easy to do

1

2

0w

1w

2w

3w

4w

5w

0u

1u

2u

3u

4u

5u

2ND

zeroneglect

neglect

Page 15: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Mixed type B.C. [2]

Set j jz p x3 , we add one more constraint (equation) 1 0Nz p

0z

1z

2z

3z

4z

5z

0u

1u

2u

3u

4u

5u

ND

zero

zero

Active variable 1 2 3 4 5| | | |T

u u u u u with governing equation

1 1

2 22

3 3

4 4

5

1: 4,1: 5

5,1: 5

0

N

N

u f

u fD

u fD

u f

u

from Neumann condition

In general, replace 5 by N since the method works for 5N

from interior point

Page 16: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Mixed type B.C. [3]

Solution under N = 16

4 , 1 1, 1 0, 1 1xxx xu e x u u

exact solution 4 4 414 1

16xu e e x e

Page 17: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn (bistable equation) [1]

3 , 1 1t xxu u u u x Nonlinear reaction-diffusion equation:

where is a parameter

1 This equation has three constant steady state, 0, 1, 1u u u

( consider ODE3

tu u u , equilibrium occurs at zero forcing 3 0u u )

2 0u is unstable and 1u is attractor.

3tu u u 2 21tuu u u 2 2 22 1

du u u

dt

2:x u

2 1

0 0

dxx x

dtx

is Logistic equation.

2

2

0,

1 1 0

t

t

xcex t c

ce x

lim 1

tx t

for 0 0x

1 0 0x 0dx

dt 1x t

1 0x 0dx

dt 1x t

0 : unstablex

Page 18: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn (bistable equation) [2]

3 Solution tends to exhibit flat areas close to 1u , separated by interfaces

That may coalesce or vanish on a long time scale, called metastability.

interface

, 1 1u t x boundary value:

21tu u u

1 0 0u 0du

dt 1u t

1 0u 0du

dt 1u t

0 : unstableu 0 0 1u 0

du

dt 1u t

1 0u 0du

dt 1u t

for

Page 19: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn : example 1 [1]

3 , 1 1, 1 1, 1 1t xxu u u u x u u

with parameter 0.01 and initial condition 30 0.53 0.47sin

2u t x x

Let p x be unique polynomial of degree N with 1 1, 1 1p p and

j jp x u 1 1j N

1

for

2 Set j jw p x 1 1j N for

Method I

0w

1w

2w

3w

4w

5w

0u

1u

2u

3u

4u

5u

2ND

1

-1

neglect

neglect

1w

2w

3w

4w

2 1: 4,1: 4ND

1u

2u

3u

4u

2 1: 4,0NDor say 2 1: 4,5ND

Page 20: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn : example 1 [2]

Temporal discretization: forward Euler with CFL condition 4min 0.01, 50 /dt N

( eigenvalue of 2ND is negative (real number) and

4max 0.048N )

1u

2u

3u

4u

1k

2 1: 4,0 : 5ND

1u

2u

3u

4u

0 1u

5 1u

k

1u

2u

3u

4u

k

1u

2u

3u

4u

k3

1u

2u

3u

4u

k

dt

One can simplify above equation by using equilibrium of 1u at boundary point.

1

dt

1u

2u

3u

4u

0u

5u

1k

1u

2u

3u

4u

0u

5u

k

2

0

1: 4,0 : 5

0ND

1u

2u

3u

4u

0u

5u

k

1u

2u

3u

4u

0u

5u

k

1u

2u

3u

4u

0u

5u

k3

Page 21: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn : example 1 [3]

interface

, 1 1u t x boundary value:

Solution under N = 20

3 , 1 1, 1 1, 1 1t xxu u u u x u u

with parameter 0.01 and initial condition 30 0.53 0.47sin

2u t x x

Metastability up to

45t followed by

rapid transition to a solution with

just one interface.

Page 22: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn : example 2 [1]

3 2, 1 1, 1, 1, 1, 1 sin / 5t xxu u u u x u t u t t

with parameter 0.01 and initial condition 30 0.53 0.47sin

2u t x x

Let p x be unique polynomial of degree N with 21 1, 1 1 sin / 5p p t

and j jp x u 1 1j N

1

for

2 Set j jw p x 1 1j N for

Method I

1u

2u

3u

4u

1k

2 1: 4,0 : 5ND

1u

2u

3u

4u

20 1 sin / 5ku t

5 1u

k

1u

2u

3u

4u

k

1u

2u

3u

4u

k3

1u

2u

3u

4u

k

dt

1 20 11 sin / 5k

ku t Second, set

Page 23: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn : example 2 [2]

1

dt

1u

2u

3u

4u

0u

5u

1k

1u

2u

3u

4u

0u

5u

k

2

0

1: 4,0 : 5

0ND

1u

2u

3u

4u

0u

5u

k

1u

2u

3u

4u

0u

5u

k

1u

2u

3u

4u

0u

5u

k3

However we cannot simplify as following form

since 21, 1 sin / 5u t t is NOT an equilibrium.

Let p x be unique polynomial of degree N with j jp x u 0 j N for

Set j jw p x for

Method II

1

2 0 j N

3 Neglect 0 , Nu u computed from 2 , and reset 20 1 sin / 5 , 1Nu t u

Page 24: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

1

dt

1u

2u

3u

4u

0u

5u

1k

1u

2u

3u

4u

0u

5u

k

2ND

1u

2u

3u

4u

0u

5u

k

1u

2u

3u

4u

0u

5u

k

1u

2u

3u

4u

0u

5u

k3

Allen-Cahn : example 2 [3]

Step 1:

Step 2: 1 120 11 sin / 5 , 1k k

k Nu t u

Solution under N = 20, method II

Final interface is moved from

0x to 0.4x and

transients vanish earlier at

30t instead of 45t

0.01dt and 2tplot

Page 25: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Allen-Cahn : example 2 [4]

graph concave up 0xxu

0 1u 21 0u u u

21 0t xxu u u u ?

Threshold is 0xxu u

In fact we can estimate trend of transient at point 0.2x

0.5 0.50.2 5

0.2xu x and 0.2 0.2 5x xu x u x

0.2 0.20.2 50

0.2

x x

xx

u uu

, then 0.2 0.5xxu but 2

0.21 | 0.375xu u

Page 26: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation [1]

0, 1 , 1xx yyu u x y subject to B.C.

4sin 1 1 0

1, sin 3 1

50, otherwise

x y and x

u x y y x

x

y01 y

1y

2y

3y

4y

51 y 5x 4x 3x 2x 1x 0x

1 1

4sin x

1sin 3

5y

0

boundary data is continuous

Let 1

,, 1

,N

i j i ji j

P x y u p x p y

be unique polynomial,

and

,,i j i jP x y u

1 , 1i j N

1

2 Set , ,i j i jw P x y 1 , 1i j N for

Method I

for

(interior point) , . .i jP x y BC 0, 0,i N or j N for

Briefly speaking, method I take active variables as

However method 1 is not intuitive to write down linear system if we choose Kronecker-product

Page 27: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation [2]

x

y

01 y

1y

2y

3y

4y

51 y 5x 4x 3x 2x 1x 0x

1 1

0 ,i j N

Set 1 , 1i j N for

Method II

(all points)

1

2 (interior points)

3 Additional constraints (equations) for boundary condition.

, . .i ju BC 0, 0,i N or j N for

method II take active variables as

Technical problem:

1. How to order the active variables

2. How to build up linear system (matrix)

3. How to write down right hand side vector

(including second derivative and additional equation)

Let 1

,, 1

,N

i j i ji j

P x y u p x p y

be unique polynomial, ,,i j i jP x y u for

, ,i j i jw P x y

Page 28: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : order active variable [3]

MATLAB use column-major, so we index active variable by column-major

x

y

01 y

1y

2y

3y

4y

51 y 5x 4x 3x 2x 1x 0x

1 1

x

y

01 y

1y

2y

3y

4y

51 y 5x 4x 3x 2x 1x 0x

1 1

6

5

4

3

2

1

12

11

10

9

8

7

18

17

16

15

14

13

24

23

22

21

20

19

30

29

28

27

26

25

36

35

34

33

32

31

0 1 2 3 4 5| | | | | 1| 0.809 | 0.309 | 0.309 | 0.809 | 1T T

x x x x x x x and y x

column-major

Page 29: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : order active variable [4]

Page 30: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : find boundary point [5]

Page 31: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : find boundary point [6]

b is index set of boundary points, if we write down equations according to index of active variables, then we can use index set b to modify the linear system.

Chebyshev differentiation matrix:

(second order)

0x0x1x2x3x4x5x

1x 2x 3x 4x 5x

Page 32: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : construct matrix [7]

6 , 2kron I D 62,kron D I

Definition: Kronecker product is defined by

11 12 1

12 22 2

1 2

n

n

m m mn

a B a B a B

a B a B a BA B

a B a B a B

6 6, 2 2,w kron I D kron D I u Lu

Set 1 , 1i j N for2 (interior points) , ,i j i jw P x y

, ,i j i jw P x y

Page 33: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : construct matrix [8]

3 Additional constraints (equations) for boundary condition.

, . .i ju BC 0, 0,i N or j N for

We need to replace equation of w Lu on boundary points by , . .i ju BC

Index of boundary points

,: TkL k e for

k b

such that

,: Tk kLu k L k u e u u (boundary point)

where 4 1 4 4size b N N

four corner points

each edge has N-1 points

Page 34: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : right hand side vector [9]

Boundary data:

4sin 1 1 0

1, sin 3 1

50, otherwise

x y and x

u x y y x

1 1 0y and x

x

y

01 y

1y

2y

3y

4y

51 y 5x 4x 3x 2x 1x 0x

1 1

6

5

4

3

2

1

12

11

10

9

8

7

18

17

16

15

14

13

24

23

22

21

20

19

30

29

28

27

26

25

36

35

34

33

32

31

identify

Page 35: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : right hand side vector [10]

Boundary data:

4sin 1 1 0

1, sin 3 1

50, otherwise

x y and x

u x y y x

1x identify

x

y

01 y

1y

2y

3y

4y

51 y 5x 4x 3x 2x 1x 0x

1 1

6

5

4

3

2

1

12

11

10

9

8

7

18

17

16

15

14

13

24

23

22

21

20

19

30

29

28

27

26

25

36

35

34

33

32

31

Page 36: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Laplace equation : results [11]

Solution under N = 5, method II

Solution under N = 24, method II

4sin 1 1 0

1, sin 3 1

50, otherwise

x y and x

u x y y x

Page 37: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation [1]

, 3 3, 1 1tt xx yyu u u x y subject to B.C.

, 1, 0 Neumann in

3, , 3, , Periodic in

yu x t y

u y t u y t x

Periodic B.C. in x-coordinate

1

Separation of variables leads to

Fourier discretization in x

2 Chebyshev discretization in y, we must deal with Neumann B.C.

3 Leap-frog formula in time

ttu u Leap-frog

1 1

2

2n n nnu u u

ut

24,0t

eigenvalue of 2ND (chebyshev diff. matrix) is negative and 4

max 0.048N

eigenvalue of ,N fD (Fourier diff. matrix) is ,k ik / 2 1, , / 2 1k N N

eigenvalue of2

,N fD (Fourier diff. matrix) is negative and 2

max / 2 1N

Hence stability requirement of tt xx yyu u u is 2 240.048 / 2 1 4y xN N t

2 2 4

9

1 5 /y x y

tN N N

( author chooses

2

5

y x

tN N

)

Page 38: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation [2]

Periodic B.C. in x-coordinate

1 Fourier discretization in x

1 2 3 4 5 6| | | | | 2, 1,0,1,2,3x x x x x x x

2 Chebyshev discretization in y

0 1 2 3 4 5| | | | | 1| 0.809 | 0.309 | 0.309 | 0.809 | 1T T

y y y y y y y

Method II

Let p y be unique polynomial of degree N with j jp y u 0 yj N for

Set j jw p y 0 yj N for

1

2

3 replace 0, , ,yNu x y u x y computed from 2 by Neumann B.C.

0

,: ,: 0y y

yN N

ND u x D u x

yND Chebyshev diff. matrix

Page 39: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation: order active variable [3]

x0x 1x 2x 3x 4x 5x 6x

01 y

1y

2y

3y

4y

51 y

y

x

0x 1x 2x 3x 4x 5x 6x3 3

01 y

1y

2y

3y

4y

51 y

21

y

1

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

2 03 32112 0

column-major

In this example, we don’t arrange ,i ju x y as vector vec u but keep in 2-dimensional form

, ,i j i ju u x y say , the same arrangement of xx and yy generated by meshgrid(x,y)

Page 40: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation: action of Chebyshev operator [4]

2

yND Chebyshev 2nd diff. matrix

0y

0y1y

1y 2y

2y

3y

3y

4y

4y

5y

5y

2

yND

x

0x 1x 2x 3x 4x 5x 6x3 3

0y

1y

2y

3y

4y

5y

21

y

1

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

2 0

1,0 2,0 3,0 4,0 5,0 6,0

1,1 2,1 3,1 4,1 5,1 6,1

1,2 2,2 3,2 4,2 5,2 6,22

1,3 2,3 3,3 4,3 5,3 6,3

1,4 2,4 3,4 4,4 5,4 6,4

1,5 2,5 3,5 4,5 5,5 6,5

yN

u u u u u u

u u u u u u

u u u u u uD

u u u u u u

u u u u u u

u u u u u u

, ,i j i ju u x y index ( i,j ) is logical index according to index of ordinates x, y

Page 41: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation: action of Fourier operator [5]

2

xND Fourier 2nd diff. matrix

1x 2x 3x 4x 5x 6x

1x2x

3x4x

5x6x

x

0x

1x

2x

3x

4x

5x

6x

0y1y2y3y4y5y

y

123456

789101112

131415161718

192021222324

252627282930

313233343536

2

xND

1,0 2,0 3,0 4,0 5,0 6,0

1,1 2,1 3,1 4,1 5,1 6,1

1,2 2,2 3,2 4,2 5,2 6,22

1,3 2,3 3,3 4,3 5,3 6,3

1,4 2,4 3,4 4,4 5,4 6,4

1,5 2,5 3,5 4,5 5,5 6,5

x

T

N

u u u u u u

u u u u u u

u u u u u uD

u u u u u u

u u u u u u

u u u u u u

2

x

T

NDTake transpose

Page 42: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation: action of operator [6]

1,0 2,0 3,0 4,0 5,0 6,0

1,1 2,1 3,1 4,1 5,1 6,1

1,2 2,2 3,2 4,2 5,2 6,2

1,3 2,3 3,3 4,3 5,3 6,3

1,4 2,4 3,4 4,4 5,4 6,4

1,5 2,5 3,5 4,5 5,5 6,5

u u u u u u

u u u u u u

u u u u u uU

u u u u u u

u u u u u u

u u u u u u

Let active variable be , then operator for Laplacian is

xx yyu u 2 2

x yN NLU U D D U

tt xx yyu u u

Combine with Leap-frog formula in time

1 1

2

2k k kkU U U

LUt

where initial condition is Gaussian pilse traveling rightward at speed 1

20 2, ,0 exp 8 1.5U u x y x y 21 2, , exp 8 1.5U u x y t x t y

Question: how to match Neumann boundary condition , 1, 0yu x t

2 2

x x

T

N ND D

Page 43: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation: Neumann B.C. in y-coordinate [7]

3 replace 0, , ,yNu x y u x y computed from 2 by Neumann B.C.

0

,: ,: 0y y

yN N

ND u x D u x

:,yND U x

We require 0

:, :, 0y y

yN N

ND U x D U x

,0

,1

,2

,3

,4

,5

8.5 10.4721 2.8944 1.5279 1.1056 0.5 0

0.5 1.1056 1.5279 2.8944 10.4721 8.5 0

i

i

i

i

i

i

U

U

U

U

U

U

for 1 6i or say

Page 44: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

,1

,0 ,2

,5 ,3

,4

8.5 0.5 10.4721 2.8944 1.5279 1.1056

0.5 8.5 1.1056 1.5279 2.8944 10.4721

i

i i

i i

i

U

U U

U U

U

Wave equation: Neumann B.C. in y-coordinate [8]

or say

,1

,0 ,2

,5 ,3

,4

i

i iBC

i i

i

U

U UM

U U

U

18.5 0.5 10.4721 2.8944 1.5279 1.1056

0.5 8.5 1.1056 1.5279 2.8944 10.4721BCM

where written as

1 1

2

2k k kkU U U

LUt

Step 1: time evolution by Leap-frog

Step 2: correct boundary data

11, 1 , 1, 1 1, 1 ,2 :

y yBC N y y N y yM D N N D N N

1 11, 1 , : 2 : , : k ky BC yU N M U N

where

0 1,U U Given

Procedure of wave equation simulation

Page 45: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Wave equation: result [9]

Solution under

50, 15x yN N , method II

2

50.0182

x y

tN N

24

20.0365

0.048 / 2 1y x

tN N

24

30.0547

0.048 / 2 1y x

tN N

Theoretical optimal value is

(see exercise 13.4)

Page 46: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Exercise 13.2 [1]

The lifetime

T of metastable state depends strongly on the diffusion constant

T The value of t at which ,u x t first becomes monotonic in x.

3 , 1 1, 1 1, 1 1t xxu u u u x u u

with parameter 0.01 and initial condition 30 0.53 0.47sin

2u t x x

0.01 47.36T

30 0.53 0.47sin

2u t x x

1 what is graph of T

2 Asymptotic behavior of T

as 0

Page 47: Chapter 13 More about Boundary conditions Speaker: Lung-Sheng Chien Book: Lloyd N. Trefethen, Spectral Methods in MATLAB

Exercise 13.2 [2]

min 0.1927T

max 47.36T

(1) Resolution is adaptive and

(2) Monotone under tolerance 1. 7E