# ppt

```Chapter 13 More about Boundary conditions
Speaker: Lung-Sheng Chien
Book: Lloyd N. Trefethen, Spectral Methods in MATLAB
Preliminary: Chebyshev node and diff. matrix [1]
 j 
Consider N  1 Chebyshev node on 1,1 , x j  cos 
 for j  0,1, 2, , N
 N 
Uniform division in arc
xN
x3 x2 x1 x0
1
xN / 2
1
x
Even case: N  6
1  x6 x5
x3  0
x4
x2
x1 x0  1
x
x1 x0  1
x
Odd case: N  5
1  x5
x4
x3
0
x2
Preliminary: Chebyshev node and diff. matrix [2]
 j 
Given N  1 Chebyshev nodes , x j  cos 
 and corresponding function value v j
 N 
N
We can construct a unique polynomial of degree N , called p  x    v j S j  x 
j 0
1 k  j is a basis.
S j  xk   
0 k  j
N
p  xi    v j S j
j 0
1
N
 xi    DijN v j
where differential matrix DN
j 0
 D  is expressed as
x j
2N 2 1
N
2N 2 1
N
D

, for j  1, 2,
D


,
D 
, NN
jj
2
6
2 1  x j 
6
N
00
c  1
DijN  i
, for i  j, i, j  0,1, 2,
c j xi  x j
i j
with identity D  
N
ii
,N
N

j 0, j i
DijN
Second derivative matrix is DN2  DN  DN
N
ij
, N 1
2 i  0, N
where ci  
1 otherwise
Preliminary: Chebyshev node and diff. matrix [3]
 
Let p  x  be the unique polynomial of degree  N with p  1  0 and p x j  v j
 
define w j  p x j
 
and z j  p x j
for 0  j  N
2
We abbreviate w  DN  v , then impose B.C. p  1  0 ,that is, v0  vN  0
In order to keep solvability, we neglect w0  wN ,that is, DN2  DN2 1: N 1,1: N 1
neglect
w0
w1
w2
wN 1
neglect
wN

DN2
v0
v1
v2
vN 1
vN
zero
zero
Similarly, we also modify differential matrix as DN  DN 1: N 1,1: N 1
Asymptotic behavior of spectrum of Chebyshev diff. matrix
In chapter 10, we have showed that spectrum of Chebyshev differential matrix DN2
(second order) approximates
uxx  u, 1  x  1, B.C. u  1  0
1
2
with eigenmode k  
2
4
Eigenvalue of DN2 is negative (real number) and max  0.048N 4
Large eigenmode of D 2
N
does not approximate to k  
Since ppw is too small such that
resolution is not enough
Mode N is spurious and localized near
boundaries x  1
2
4
k2
k2
Preliminary: DFT
v1, v2 ,
Given a set of data point
, vN   R
N
[1]
with N  2m is even, h 
 
2
N
Then DFT formula for v j
2
vˆk 
N
1
vj 
2
N
v
j 1
j
m

k  m 1
exp  ikx j 
for k  m, m  1,
vˆk exp  ikx j 
for j  1, 2,
, m  1, m
,N
Definition: band-limit interpolant of   function, is periodic sinc function SN  x 
m
sin  x / h 
h
1 sin  mx 
P  eikx 

2 k  m
 2 / h  tan  x / 2 2m tan  x / 2
SN  x 
If we write v j 
N
v 
k 1
k
j k
m
N
1
ikx
   v , then p  x  
P  e vˆk   vk S N  x  xk 
2 k  m
k 1
  v S   x
Also derivative is according to w j  p x j 
N
k 1
k
1
N
j
 xk 
Preliminary: DFT
[2]
sin  x / h 
, we have
Direct computation of derivative of S N  x  
 2 / h  tan  x / 2
0
j  0  mod N 

S N1  x j    1
j
 jh 

1
cot


  , j  0  mod N 

2
 2 

 

Example: D5  S5 x j  xk
1


0
S51   h  S51  2h  S51  3h  S51  4h  
 1

1
1
1
0
S5  h  S5  2h  S5  3h  
 S5  h 


  S51  2h  S51  h 
0
S51  h  S51  2h  
 1

1
1
1
S
3
h
S
2
h
S
h
0
S

h








5
5
5
 5

1
 S 1  4h  S 1  3h  S 1  2h 

S
h
0


5
5
5
5


is a Toeplitz matrix.
 1 2
j  0  mod N 
  2
6
3
h

 2
Second derivative is S N  x j   
j

1



, j  0  mod N 
 2sin 2  jh / 2 

Preliminary: DFT
[3]
 1 2
j  0  mod N 
  2
6
3
h

S N 2  x j   
j

1



, j  0  mod N 
 2sin 2  jh / 2 

  v S  x
For second derivative operation w j  p x j 
N
k 1
k
N
 xk    DN2  j , k  vk
N
 2
j
k 1
second diff. matrix is explicitly defined by using Toeplitz matrix (command in MATLAB)

DN2  S N 2  x j  xk 












 csc 2  2h / 2  / 2
csc2  h / 2  / 2
1 2
  2
6 3h
2
csc  h / 2  / 2
 csc 2  2h / 2  / 2
 
Symmetry property: DN2  DN2
T




2:N
 1 2

1


  toeplitz   6  3h 2 , 2sin 2 1: N  1 h / 2 
 







Preliminary: DFT
[4]
Eigenvalue of Fourier differentiation matrix DN is k  ik corresponding to eigenvector
k  exp ikx  for k   N  1, , N  1 and   0 has multiplicity 2
2
2
m
h
SN  x  
P  eikx and
2 k  m
w j   vk S N  x j  xk ,
N
1
k 1
h
SN  x  x j  
2
1
m 1

ike

ik x  x j
k  m 1
k 0


h
4
1
 
i0 x
when v  1 e
j 1
imeim x  x j   imeim x  x j  


m 1

k  m 1
k 0
ikeikx vˆk 
1
DN v   S N  xi  x j  v j 
2
j 1
N
 ikx
vˆk  h e j v j
vˆm  vˆ m
1
S
x

x
v




N
j
j
2
j 1
N
N
1
m 1

k  m 1
k 0
h
imeimx vˆm  imeimx vˆ m 
4
ikeikx vˆk
imx
and v  e
, we have DN v  0
How to deal with boundary conditions
• Method I: Restrict attention to interpolants that satisfy the boundary
conditions.
Example: chapter 7. Boundary value problems
Linear ODE:
uxx  e4 x ,
Nonlinear ODE: uxx  e ,
u
1  x  1, u  1  0
1  x  1, u  1  0
Eigenvalue problem: uxx  u,
1  x  1, u  1  0


Poisson equation: u xx  u yy  10sin 8 x  y  1 ,
Helmholtz equation: uxx  uyy  k 2u  f  x, y  ,
 1  x, y  1, u  0 on boundary
1  x, y  1, u  0 on boundary
• Method II: Do not restrict the interpolants, but add additional
equations to enforce the boundary condition.
Recall linear ODE in chapter 7
uxx  e4 x , 1  x  1, u  1  0 with exact solution u 
Chebyshev nodes:
1  x5 x4
0
x3
x1 x0  1
x2
1 Let p  x  be unique polynomial of degree  N
x
 
with p  1  0 and p x j  u j
for 1  j  N  1
2 Set

1 4x
e  x sinh  4   cosh  4 
16
Method I
w j  p  x j  for 1  j  N  1
neglect
w0
w1
w2
w3

DN2
w4
neglect
w5
DN2  DN2 1: N 1,1: N 1
u0
u1
u2
u3
u4
u5
zero
zero

Inhomogeneous boundary data
uxx  e4 x ,
[1]
1  x  1, u  1  0, u 1  1
Method I
1 Let p  x  be unique polynomial of degree  N
with p  1  0, p 1  1 and
p  x j   u j for 1  j  N  1
2 Set
w j  p  x j  for 1  j  N  1
neglect
w0
w1
w2
w3

u0
u1
u2
u3
u4
u5
DN2
w4
neglect
w5
or say
w1
w2
w3
w4

DN2 1: 4,1: 4
u1
u2
u3
u4

DN2 1: 4,0
1
zero
Inhomogeneous boundary data [2]
uxx  e4 x ,
1  x  1, u  1  0, u 1  1
Method of homogenization
uS 
x 1
satisfies uS  1  0, uS 1  1 , decompose u  uH  uS , then
2
d2
u  e4 x ,
2 H
dx
 1  x  1, uH  1  0 which can be solved by method I
Solution under N = 16
u1 : method I directly
u2 : method of homogenization
u2  u1  7.5336E 15
method I is good even for
inhomogeneous boundary data
exact solution u 
1 4x
x 1
e  x sinh  4   cosh  4  
16
2


Mixed type B.C.
uxx  e4 x ,
[1]
1  x  1, ux  1  0, u 1  0
Method I
1 Let p  x  be unique polynomial of degree  N
with px  1  0, p 1  0 and
p  x j   u j for 1  j  N  1
2 Set
How to do?
w j  p  x j  for 1  j  N  1
Method II
1
2
Let p  x  be unique polynomial of degree  N
p  x j   u j for 1  j  N
Set
with
p 1  0
and
easy to do
w j  p  x j  for 1  j  N  1
neglect
w0
w1
w2
w3
w4
neglect
w5

DN2
u0
u1
u2
u3
u4
u5
zero
Mixed type B.C.
3
[2]
 
Set z j  p x j , we add one more constraint (equation) zN  p  1  0
z0
z1
z2
z3
z4
zero
Active variable

u0
u1
u2
u3
u4
u5
DN
z5
 u1 | u2 | u3 | u4 | u5 
T
zero
with governing equation
 u1  
  
u
 DN2 1: 4,1: 5    2  

  u3   
 DN  5,1: 5    u  
 4 
u  
 5 
f1 

f2 
f3 

f4 
0 
from interior point
from Neumann condition
In general, replace 5 by N since the method works for N  5
Mixed type B.C.
uxx  e4 x ,
exact solution u 
[3]
1  x  1, ux  1  0, u 1  1

1 4x
e  4e 4  x  1  e 4
16
Solution under N = 16

Allen-Cahn (bistable equation)
Nonlinear reaction-diffusion equation: ut    uxx  u  u3 ,
where
[1]
1  x  1
 is a parameter
1 This equation has three constant steady state, u  0, u  1, u  1
3
3
( consider ODE ut  u  u , equilibrium occurs at zero forcing u  u  0 )
2
u  0 is unstable and u  1 is attractor.

uut  u 2 1  u 2
ut  u  u3
x : u
2


d 2
u  2u 2 1  u 2
dt
 dx
  2 x 1  x  is Logistic equation.
 dt
 x  0  0

x  0
ce2t
x t  
,
c

1  ce2t
1  x  0
1  x  0  0 
1  x  0


dx
0
dt
dx
0
dt


lim x  t   1 for
t 
x t 
x t 
1
x  0 : unstable
1
x  0  0
Allen-Cahn (bistable equation)
1  u  0  0 
2
for ut  u 1  u 
1  u  0

0  u  0  1 
1  u  0

du
dt
du
dt
du
dt
du
dt
[2]
0 
u t 
1
0 
u t 
1
u t 
1
0 
 0  u t 
u  0 : unstable
1
3 Solution tends to exhibit flat areas close to u  1 , separated by interfaces
That may coalesce or vanish on a long time scale, called metastability.
interface
boundary value: u t, x  1  1
Allen-Cahn : example 1
ut    uxx  u  u3 ,
[1]
1  x  1, u  1  1, u 1  1
 3
with parameter   0.01 and initial condition u  t  0   0.53x  0.47sin  
 2
Method I
1 Let p  x  be unique polynomial of degree  N

x

with p  1  1, p 1  1 and
p  x j   u j for 1  j  N  1
 
2 Set w j  p x j
w0
w1
w2
w3
neglect
for 1  j  N  1

u0
u1
u2
u3
u4
u5
DN2
w4
neglect
or say
w5
w1
w2
w3
w4

DN2 1: 4,1: 4
u1
u2
u3
u4

DN2 1: 4,0
1
-1

DN2 1: 4,5
Allen-Cahn : example 1
[2]
Temporal discretization: forward Euler with CFL condition dt  min  0.01, 50 N 4 /  
4
( eigenvalue of DN2 is negative (real number) and max  0.048N )
u1
u2
u3
u4
 k  1

u1
u2
u3
u4
u0  1  k 
k 
u1
u2
u3
u4
   DN2 1: 4,0:5
3

u1
u2
u3
u4
k 

u1
u2
u3
u4
k 
u5  1
dt
One can simplify above equation by using equilibrium of u  1 at boundary point.
1
dt
u0
u1
u2
u3
u4
u5
 k  1

u0
u1
u2
u3
u4
u5
k 

0


   DN2 1: 4, 0 : 5  


0


u0
u1
u2
u3
u4
u5
k 

u0
u1
u2
u3
u4
u5
k 

u0
u1
u2
u3
u4
u5
k 
3
Allen-Cahn : example 1
ut    uxx  u  u3 ,
[3]
1  x  1, u  1  1, u 1  1
 3
with parameter   0.01 and initial condition u  t  0   0.53x  0.47sin  
 2
Solution under N = 20

x

boundary value: u t, x  1  1
interface
Metastability up to t  45 followed by
rapid transition to a solution with
just one interface.
Allen-Cahn : example 2
ut    uxx  u  u3 ,
[1]
1  x  1, u  1, t   1, u 1, t   1  sin 2 t / 5
 3
with parameter   0.01 and initial condition u  t  0   0.53x  0.47sin  
 2
Method I
1 Let p  x  be unique polynomial of degree  N

x

with p  1  1, p 1  1  sin
2
 t / 5
 
and p x j  u j for 1  j  N  1
 
2 Set w j  p x j
u1
u2
u3
u4
 k  1

u1
u2
u3
u4
for 1  j  N  1
u0  1 sin tk / 5
2
k 
   DN2 1: 4,0:5
u1
u2
u3
u4
u5  1
dt

Second, set u0
k 1
 1  sin 2  tk 1 / 5
k 
3

u1
u2
u3
u4
k 

u1
u2
u3
u4
k 
Allen-Cahn : example 2
[2]
However we cannot simplify as following form
1
dt
u0
u1
u2
u3
u4
u5
 k  1

u0
u1
u2
u3
u4
u5
k 

0


   DN2 1: 4, 0 : 5  


0


u0
u1
u2
u3
u4
u5
k 

u0
u1
u2
u3
u4
u5
k 

u0
u1
u2
u3
u4
u5
2
since u 1, t   1  sin t / 5 is NOT an equilibrium.
Method II
1 Let p  x  be unique polynomial of degree  N
 
2 Set w j  p x j
 
with p x j  u j
for 0  j  N
for 0  j  N
3 Neglect u0 , uN computed from
2 , and reset u0  1  sin2 t / 5 , uN  1
k 
3
Allen-Cahn : example 2
u0
u1
u2
u3
u4
u5
 k  1
u0
u1
u2
u3
u4
u5
k 
Step 1:
1
dt
Step 2:
u0 k 1  1  sin 2  tk 1 / 5 , uN k 1  1

2
   DN
[3]
u0
u1
u2
u3
u4
u5
k 

u0
u1
u2
u3
u4
u5
k 

u0
u1
u2
u3
u4
u5
k 
Solution under N = 20, method II
Final interface is moved from
x  0 to x  0.4 and
transients vanish earlier at
t  30 instead of t  45
dt  0.01 and tplot  2
3
Allen-Cahn : example 2
[4]
graph concave up  uxx  0


0  u  1   u  u 1  u 2  0


ut    u xx  u 1  u 2  0 ?
Threshold is
  uxx  u  0
In fact we can estimate trend of transient at point x  0.2


ux x  0.2 
uxx  0.2 

0.5   0.5
0.2


5
ux 0.2  ux 0.2
0.2






and u x x  0.2  u x x  0.2  5
  50
, then   uxx  0.2  0.5


but u 1  u 2 |x 0.2  0.375
Laplace equation
sin 4  x 
y  1 and  1  x  0

1
subject to B.C. u  x, y    sin  3 y  x  1
5
otherwise
0,

uxx  uyy  0, 1  x, y  1
y
1  y0
y1
sin4  x 
y2
1
sin  3 y 
5
y3
y4
x
1  y5
x5 x4
1
boundary data
is continuous
0
x3 x2 x1 x0
1 Let P  x, y  
Method I
[1]
1
N 1
u
i , j 1
i, j
pi  x  p j  y  be unique polynomial, P  xi , y j   ui , j for
1  i, j  N  1 (interior point) and P  xi , y j   B.C . for i  0, N or j  0, N

2 Set wi , j  P xi , y j

for 1  i, j  N  1
Briefly speaking, method I take active variables as
However method 1 is not intuitive to write down linear system if we choose Kronecker-product
Laplace equation
Method II
Let P  x, y  
1
N 1
u
i , j 1
i, j
[2]
pi  x  p j  y  be unique polynomial, P  xi , y j   ui , j for
0  i, j  N (all points)


for 1  i, j  N  1
2
Set wi , j  P xi , y j
3
Additional constraints (equations) for boundary condition.
(interior points)
ui , j  B.C. for i  0, N or j  0, N
y
method II take active variables as
1  y0
y1
Technical problem:
y2
1. How to order the active variables
y3
y4
2. How to build up linear system (matrix)
x
1  y5
x5 x4
1
x3 x2 x1 x0
1
(including second derivative and additional
equation)
3. How to write down right hand side vector
Laplace equation : order active variable
[3]
MATLAB use column-major, so we index active variable by column-major
x   x0 | x1 | x2 | x3 | x4 | x5   1| 0.809 | 0.309 | 0.309 | 0.809 | 1
T
T
y
y2
column-major
y3
y4
x
1  y5
1
yx
y
1  y0
y1
x5 x4
and
x3 x2 x1 x0
1
1  y0
y1
31 25 19
13
7
1
32 26 20
14
8
2
y2
33 27 21
15
9
3
y3
y4
34 28 22
16 10
4
35 29 23
17 11
5
1  y5
36 30 24
18 12
6
x5 x4
1
x3 x2 x1 x0
1
x
Laplace equation : order active variable
[4]
Laplace equation : find boundary point
[5]
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)
x0
x1
x2
x3
x4
x5
x0
x1
x2
x3
x4
x5
Laplace equation : construct matrix
kron  D2, I6 
kron  I6 , D2
2

Set wi , j  P xi , y j

wi , j  P  xi , y j 
[7]
for 1  i, j  N  1
(interior points)
 w   kron  I 6 , D 2   kron  D 2, I 6   u  Lu
 a11 B a12 B

a12 B a22 B

Definition: Kronecker product is defined by A  B 


 am1 B am 2 B
a1n B 

a2 n B 


amn B 
Laplace equation : construct matrix
3
[8]
Additional constraints (equations) for boundary condition.
ui , j  B.C. for i  0, N or j  0, N
We need to replace equation of w  Lu on boundary points by ui , j  B.C.
Index of boundary points
L  k ,:  ekT for k  b
such that
 Lu  k   L  k,: u  ekT u  uk
(boundary point)
where size b  4  N 1  4  4N
four corner points
each edge has N-1 points
Laplace equation : right hand side vector
sin 4  x 
y  1 and  1  x  0

1
Boundary data: u  x, y    sin  3 y  x  1
5
otherwise
0,

identify
y  1 and  1  x  0
y
1  y0
y1
31 25 19
13
7
1
32 26 20
14
8
2
y2
33 27 21
15
9
3
y3
y4
34 28 22
16 10
4
35 29 23
17 11
5
1  y5
36 30 24
18 12
6
x5 x4
1
x3 x2 x1 x0
1
x
[9]
Laplace equation : right hand side vector
sin 4  x 
y  1 and  1  x  0

1
Boundary data: u  x, y    sin  3 y  x  1
5
otherwise
0,

identify x  1
y
1  y0
y1
31 25 19
13
7
1
32 26 20
14
8
2
y2
33 27 21
15
9
3
y3
y4
34 28 22
16 10
4
35 29 23
17 11
5
1  y5
36 30 24
18 12
6
x5 x4
1
x3 x2 x1 x0
1
x
[10]
Laplace equation : results
[11]
Solution under N = 5, method II
Solution under N = 24, method II
sin 4  x 
y  1 and  1  x  0

1
u  x, y    sin  3 y  x  1
5
otherwise
0,

Wave equation
[1]

Neumann in y
u y  x, 1, t   0
utt  uxx  uyy ,  3  x  3, 1  y  1 subject to B.C. 

u  3, y, t   u  3, y, t  Periodic in x
Separation of variables leads to
1 Periodic B.C. in x-coordinate  Fourier discretization in x
2 Chebyshev discretization in y, we must deal with Neumann B.C.
3 Leap-frog formula in time
u  n 1  2u  n   u  n 1
Leap-frog
utt  u
 t 
2
  t    4, 0 
 u  n 
2
eigenvalue of DN2 (chebyshev diff. matrix) is negative and max  0.048N 4
eigenvalue of DN , f (Fourier diff. matrix) is k  ik , k   N / 2  1,
, N / 2 1
2
eigenvalue of DN , f (Fourier diff. matrix) is negative and max    N / 2  1
Hence stability requirement of utt  uxx  uyy
9
t 
N
2
y
1  5N / N
2
x
4
y
2
2
2
is 0.048N y4   N x / 2  1   t   4

( author chooses t 

5
N y2  N x
)
Wave equation
[2]
1 Periodic B.C. in x-coordinate  Fourier discretization in x
x   x1 | x2 | x3 | x4 | x5 | x6    2, 1,0,1,2,3
2 Chebyshev discretization in y
y   y0 | y1 | y2 | y3 | y4 | y5   1| 0.809 | 0.309 | 0.309 | 0.809 | 1
T
T
Method II
1
Let p  y  be unique polynomial of degree  N
2
Set w j  p y j
 
 
with p y j  u j for 0  j  N y
for 0  j  N y

3 replace u  x, y0  , u x, yN y
 computed from
 DN u  x,:   DN u  x,:  0
 y
0  y
 Ny
Chebyshev diff. matrix DN 
y
2
by Neumann B.C.
Wave equation: order active variable
[3]
y
y
1  y0
y1
1  y0
y1
y2
column-major
y3
y4
1  y5
x
x0 x1
3
2

7
13
19 25 31
2
8
14
20 26 32
y2
3
9
15
21 27 33
y3
y4
4
10 16
22 28
34
5
11 17
23 29
35
6
12 18
24 30
36
1  y5
x2 x3 x4 x5 x6
1
0 1 2 3
x0 x1
3 2

In this example, we don’t arrange u xi , y j

1
 as vector
x
x2 x3 x4 x5 x6
1
0 1 2 3
vec  u  but keep in 2-dimensional form
say ui , j  u xi , y j , the same arrangement of xx and yy generated by meshgrid(x,y)
Wave equation: action of Chebyshev operator
y0
y1
y2
y3
[4]
y4
y5
y0
2
Ny
Chebyshev 2nd diff. matrix D

y1
y2
y4
y
D 
2
Ny
y0
y1
1
7
13
19 25 31
2
8
14
20 26 32
y2
3
9
15
21 27 33
y3
y4
4
10 16
22 28
34
5
11 17
23 29
35
y5
6
12 18
24 30
36
x0 x1
3 2
x2 x3 x4 x5 x6
1
0 1 2 3
x
 u1,0 u2,0 u3,0

 u1,1 u2,1 u3,1
 u1,2 u2,2 u3,2
2
 DN y  
 u1,3 u2,3 u3,3
 u1,4 u2,4 u3,4

 u1,5 u2,5 u3,5
u4,0
u5,0
u4,1
u4,2
u5,1
u5,2
u4,3
u5,3
u4,4
u4,5
u5,4
u5,5
u6,0 

u6,1 
u6,2 

u6,3 
u6,4 

u6,5 
ui , j  u  xi , y j  index ( i,j ) is logical index according to index of ordinates x, y
y3
y5
Wave equation: action of Fourier operator
x1
x2
x3
x4
[5]
x5
x6
x1
x
x3 2
x
x5 4
x6
Fourier 2nd diff. matrix DN2 
x
y5 y4 y3 y2 y1 y0
x0
4
3
2
1
x2
12 11 10
9
8
7
x3
18 17 16 15 14 13
x4
x5
24 23 22 21 20 19
x6
36 35 34 33 32 31
x1
DN2 x 
T
6
5
30 29 28 27 26 25
 u1,0 u2,0 u3,0 u4,0 u5,0 u6,0 


u
u
u
u
u
u
1,1
2,1
3,1
4,1
5,1
6,1


 u1,2 u2,2 u3,2 u4,2 u5,2 u6,2 
2
 DN x  

u
u
u
u
u
u
y
2,3
3,3
4,3
5,3
6,3 
 1,3
 u1,4 u2,4 u3,4 u4,4 u5,4 u6,4 


 u1,5 u2,5 u3,5 u4,5 u5,5 u6,5 
x
Take transpose
 
 D
2
Nx
T
Wave equation: action of operator
Let active variable be U
 u1,0

 u1,1
 u1,2

 u1,3
 u1,4

 u1,5
u2,0
u3,0
u4,0
u5,0
u2,1
u2,2
u3,1
u3,2
u4,1
u4,2
u5,1
u5,2
u2,3
u3,3
u4,3
u5,3
u2,4
u2,5
u3,4
u3,5
u4,4
u4,5
u5,4
u5,5
uxx  uyy
u6,0 

u6,1 
u6,2 
 , then operator for Laplacian is
u6,3 
u6,4 

u6,5 
LU  U  D  D U
2
Nx
[6]
2
Ny
D 
2
Nx
Combine with Leap-frog formula in time
U  k 1  2U  k   U  k 1
utt  uxx  uyy
 t 
2
 LU  k 
where initial condition is Gaussian pilse traveling rightward at speed 1


2
U  0  u  x, y,0  exp 8  x  1.5  y 2 




2
U  1  u  x, y, t   exp 8  x  t1.5  y 2 


Question: how to match Neumann boundary condition uy  x, 1, t   0
T
 DN2 x
Wave equation: Neumann B.C. in y-coordinate

3 replace u  x, y0  , u x, yN y
 computed from
2
[7]
by Neumann B.C.
 DN u  x,:   DN u  x,:  0
 y
0  y
 Ny
 DN yU :, x 
We require  DN U :, x    DN U :, x 
y
y

or say
0

 Ny
0
 U i ,0 


U
 i ,1 
 8.5 10.4721 2.8944 1.5279 1.1056 0.5   U i ,2   0 

 U    
0.5

1.1056
1.5279

2.8944
10.4721

8.5

  i ,3   0 
 U i ,4 


U
 i ,5 
for 1  i  6
Wave equation: Neumann B.C. in y-coordinate
[8]
 U i ,1 


 8.5 0.5   U i ,0 
 10.4721 2.8944 1.5279 1.1056   U i ,2 
or say 
 U    

0.5

8.5

  i ,5 
 1.1056 1.5279 2.8944 10.4721  U i ,3 


U
 i ,4 
written as
 U i ,1 


U
 U i ,0 
i
,2



  M BC 
U i ,3 
 U i ,5 


U
i
,4


1
where M BC
 8.5 0.5   10.4721 2.8944 1.5279 1.1056 
 
 

 0.5 8.5   1.1056 1.5279 2.8944 10.4721
Procedure of wave equation simulation
Given U  0 ,U  1
Step 1: time evolution by Leap-frog
Step 2: correct boundary data
U  k 1  2U  k   U  k 1
 t 

U  k 1 1, N y  1 , :

2
M
where M BC  DN y 1, N y  1 , 1, N y  1

1
 LU  k 
U  k 1  2 : N y , :
BC


DN y 1, N y  1 , 2 : N y

Wave equation: result
[9]
Solution under N x  50, N y  15 , method II
5
t 
 0.0182
N x  N y2
Theoretical optimal value is
t 
3
0.048 N   N x / 2  1
4
y
t 
2
0.048 N   N x / 2  1
4
y
2
 0.0365
2
 0.0547
(see exercise 13.4)
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.
ut    uxx  u  u3 ,
1  x  1, u  1  1, u 1  1
 3
with parameter   0.01 and initial condition u  t  0   0.53x  0.47sin  
 2

x

T  0.01  47.36
 3
u  t  0   0.53x  0.47sin  
 2
1
what is graph of T   
2
Asymptotic behavior of T   
as   0

x

Exercise 13.2
[2]
max T    47.36
min T    0.1927
(1) Resolution is adaptive and
(2) Monotone under tolerance 1.E  7
```