Uploaded by User20415

Partial differential equation

advertisement
A partial differential equation (PDE) is an
equation that involves an unknown function
and its partial derivatives.
Example :
 2 u( x, t )  u( x, t )

2
t
x
PDE involves two or more independent variables
(in the example x and t are independent variables)
2
 2 u ( x, t )
u xx 
x 2
 2 u ( x, t )
u xt 
x t
Order of the PDE  order of the highest order derivative.
3
A PDE is linear if it is linear in the unknown
function and its derivatives
Example of linear PDE :
2 u xx  1 u xt  3 utt  4 u x  cos(2t )  0
2 u xx  3 ut  4 u x  0
Examples of Nonlinear PDE
2 u xx  u xt 2  3 utt  0
u xx  2 u xt  3 ut  0
2 u xx  2 u xt ut  3 ut  0
4
 Three main ways to represent the solution
T ( x1 , t1 )
T=5.2
t1
T=3.5
x1
Different curves are
used for different
values of one of the
independent
variable
Three dimensional
plot of the function
T(x,t)
The axis represent
the independent
variables. The value
of the function is
displayed at grid
points
5
Different curve is
used for each value
of t
ice
ice
x
Thin metal rod insulated
everywhere except at the
edges. At t =0 the rod is
placed in ice
 2 T ( x, t )  T ( x, t )

0
2
x
t
T (0, t )  T (1, t )  0
T ( x,0)  sin( x)
Temperature
Temperature at
different x at t=0
Position x
Temperature at
different x at t=h
6
PDEs are used to model many systems in many different fields of science
and engineering.
Important Examples:
 Laplace Equation
 Heat Equation
 Wave Equation
7
 2u ( x , y , z )  2u ( x , y , z )  2u ( x , y , z )


0
2
2
2
x
y
z
Used to describe the steady state distribution of
heat in a body.
Also used to describe the steady state
distribution of electrical charge in a body.
8
  2u  2u  2u
 u( x, y , z, t )
   2  2  2
t
y
z
 x




The function u(x,y,z,t) is used to represent
the temperature at time t in a physical body
at a point with coordinates (x,y,z)
 is the thermal diffusivity. It is sufficient to
consider the case  = 1.
9
 T ( x, t )  2 T ( x, t )

t
x 2
x
T(x,t) is used to represent the temperature
at time t at the point x of the thin rod.
10
2
2
2

 2u ( x , y , z , t )

u

u

u
2
 c  2  2  2
2
t
y
z
 x




The function u(x,y,z,t) is used to represent the
displacement at time t of a particle whose
position at rest is (x,y,z) .
The constant c represents the propagation
speed of the wave.
11
CLASSIFICATION OF PDES
Linear Second order PDEs are important sets of equations that are used to
model many systems in many different fields of science and engineering.
Classification is important because:
 Each category relates to specific engineering problems.
 Different approaches are used to solve these categories.
12
A second order linear PDE (2 - independent variables)
A u xx  B u xy  C u yy  D  0,
A, B, and C are functions of x and y
D is a function of x, y , u, u x , and u y
is classified based on (B 2  4 AC) as follows :
B 2  4 AC  0
Elliptic
B 2  4 AC  0
Parabolic
B 2  4 AC  0
Hyperbolic
13
Laplace Equation
 2u ( x , y )  2 u ( x , y )

0
2
2
x
y
A  1, B  0, C  1  B 2  4 AC  0
 Laplace Equation is Elliptic
One possible solution : u( x, y )  e x sin y
u x  e x sin y , u xx  e x sin y
u y  e x cos y , u yy   e x sin y
u xx  u yy  0
14
 2u ( x , t )  u ( x , t )
Heat Equation 

0
2
t
x
A   , B  0, C  0  B 2  4 AC  0
 Heat Equation is Parabolic
______________________________________
 2u ( x , t )  2u ( x , t )
Wave Equation c

0
2
2
x
t
A  c 2  0, B  0, C  1  B 2  4 AC  0
 Wave Equation is Hyperbolic
2
15
BOUNDARY CONDITIONS FOR PDES
 To uniquely specify a solution to the PDE, a set of boundary
conditions are needed.
 Both regular and irregular boundaries are possible.
t
 2u ( x, t ) u( x, t )
Heat Equation : 

0
2
t
x
u(0, t )  0
u(1, t )  0
u( x,0)  sin( x )
region of
interest
1
x
16
THE SOLUTION METHODS FOR PDES
 Analytic solutions are possible for simple and special (idealized) cases
only.
 To make use of the nature of the equations, different methods are used to
solve different classes of PDEs.
 The methods discussed here are based on the finite difference technique.
17
PARABOLIC EQUATIONS
A second order linear PDE (2 - independent variables x , y )
A u xx  B u xy  C u yy  D  0,
A, B, and C are functions of x and y
D is a function of x, y, u, u x , and u y
is parabolic if
B 2  4 AC  0
19
Heat Equation :
 T ( x, t )  2 T ( x, t )

t
x 2
T (0, t )  T (1, t )  0
T ( x,0)  sin( x )
ice
ice
x
* Parabolic problem ( B 2  4 AC  0)
* Boundary conditions are needed to uniquely specify a solution.
20
 Divide the interval x into sub-intervals, each of width h
 Divide the interval t into sub-intervals, each of width k
 A grid of points is used for
the finite difference solution
 Ti,j represents T(xi, tj)
t
 Replace the derivates by
finite-difference formulas
x
21
Replace the derivatives by finite difference formulas
 2T
Central Difference Formula for 2 :
x
 2T ( x, t ) Ti 1, j  2Ti , j  Ti 1, j Ti 1, j  2Ti , j  Ti 1, j


2
2
x
( x )
h2
Forward Difference Formula for
T
:
t
T ( x, t ) Ti , j 1  Ti , j Ti , j 1  Ti , j


t
t
k
22
• Two solutions to the Parabolic Equation
(Heat Equation) will be presented:
1. Explicit Method:
Simple, Stability Problems.
2. Crank-Nicolson Method:
Involves the solution of a Tridiagonal system
of equations, Stable.
23
T ( x, t )  2T ( x, t )

t
x 2
T ( x, t  k )  T ( x, t ) T ( x  h, t )  2T ( x, t )  T ( x  h, t )

k
h2
k
T ( x, t  k )  T ( x, t )  2 T ( x  h, t )  2T ( x, t )  T ( x  h, t ) 
h
k
Define   2
h
T ( x, t  k )   T ( x  h, t )  (1  2  ) T ( x, t )   T ( x  h, t )
24
T ( x, t  k )   T ( x  h, t )  (1  2  ) T ( x, t )   T ( x  h, t )
means
T(x,t+k)
T(x-h,t)
T(x,t)
T(x+h,t)
25
T ( x, t  k ) can be computed directly using :
T ( x, t  k )   T ( x  h, t )  (1  2  ) T ( x, t )   T ( x  h, t )
Can be unstable errors are magnified 
1
h2
To guarantee stability, (1  2  )  0     k 
2
2
This means that k is much smaller than h
This makes it slow.
26
 Convergence
The solutions converge means that the solution obtained
using the finite difference method approaches the true
solution as the steps
approach zero.
 Stability:
x and t
An algorithm is stable if the errors at each stage of the
computation are not magnified as the computation
progresses.
27
Solve the PDE :
 2u(x,t) u(x,t)

0
2
t
 x
u(0, t )  u(1, t )  0
u( x,0)  sin( x )
ice
ice
x
Use h  0.25, k  0.25 to find u( x, t ) for x  [0,1], t  [0,1]
k
  2 4
h
28
 2 u( x, t )  u( x, t )

0
2
t
x
u ( x  h , t )  2u ( x , t )  u ( x  h , t ) u ( x , t  k )  u ( x , t )

0
2
k
h
16u ( x  h, t )  2u ( x, t )  u ( x  h, t )   4u ( x, t  k )  u ( x, t )   0
u ( x , t  k )  4 u ( x  h, t )  7 u ( x , t )  4 u ( x  h, t )
29
u ( x , t  k )  4 u ( x  h, t )  7 u ( x , t )  4 u ( x  h , t )
t=1.0
0
0
t=0.75
0
0
t=0.5
0
0
t=0.25
0
0
t=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x=0.0
x=0.25
x=0.5
x=0.75
x=1.0
30
u(0.25,0.25)  4 u(0,0)  7 u(0.25,0)  4 u(0.5,0)
 0  7 sin( / 4)  4 sin( / 2)  0.9497
t=1.0
0
0
t=0.75
0
0
t=0.5
0
0
t=0.25
0
0
t=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x=0.0
x=0.25
x=0.5
x=0.75
x=1.0
31
u(0.5,0.25)  4 u (0.25,0)  7 u(0.5,0)  4 u (0.75,0)
 4 sin( / 4)  7 sin( / 2)  4 sin(3 / 4)  0.1716
t=1.0
0
0
t=0.75
0
0
t=0.5
0
0
t=0.25
0
0
t=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x=0.0
x=0.25
x=0.5
x=0.75
x=1.0
32
The obtained results are probably not accurate
because : 1  2  7
For accurate results : 1  2  0
h 2 (0.25) 2
One needs to select k 

 0.03125
2
2
k
For example, choose k  0.025, then   2  0.4
h
33
u( x, t  k )  0.4 u( x  h, t )  0.2 u( x, t )  0.4 u( x  h, t )
t=0.10
0
0
t=0.075
0
0
t=0.05
0
0
t=0.025
0
0
t=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x=0.0
x=0.25
x=0.5
x=0.75
x=1.0
34
u(0.25,0.025)  0.4 u(0,0)  0.2 u(0.25,0)  0.4 u (0.5,0)
 0  0.2 sin( / 4)  0.4 sin( / 2)  0.5414
t=0.10
0
0
t=0.075
0
0
t=0.05
0
0
t=0.025
0
0
t=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x=0.0
x=0.25
x=0.5
x=0.75
x=1.0
35
u(0.5,0.025)  0.4 u(0.25,0)  0.2 u(0.5,0)  0.4 u(0.75,0)
 0.4 sin( / 4)  0.2 sin( / 2)  0.4 sin(3 / 4)  0.7657
t=0.10
0
0
t=0.075
0
0
t=0.05
0
0
t=0.025
0
0
t=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x=0.0
x=0.25
x=0.5
x=0.75
x=1.0
36
The method involves solving a Tridiagonal system of linear equations.
The method is stable (No magnification of error).
 We can use larger h, k (compared to the Explicit Method).
37
Based on the finite difference method
1. Divide the interval x into subintervals of width h
2. Divide the interval t into subintervals of width k
3. Replace the first and second partial derivatives with their
backward and central difference formulas respective ly :
u ( x, t ) u ( x, t )  u ( x, t  k )

t
k
 2 u ( x , t ) u ( x  h , t )  2u ( x , t )  u ( x  h , t )

2
x
h2
38
 2 u( x, t )  u( x, t )
Heat Equation :

becomes
2
t
x
u ( x  h , t )  2u ( x , t )  u ( x  h , t ) u ( x , t )  u ( x , t  k )

2
k
h
k
u( x  h, t )  2u( x, t )  u( x  h, t )   u( x, t )  u( x, t  k )
2
h
k
k
k
 2 u ( x  h, t )  (1  2 2 ) u ( x, t )  2 u( x  h, t )  u ( x, t  k )
h
h
h
39
k
then Heat equation becomes :
2
h
  u ( x  h, t )  (1  2 ) u ( x, t )   u ( x  h, t )  u ( x, t  k )
Define  
u(x-h,t)
u(x,t)
u(x+h,t)
u(x,t - k)
40
The equation :
  u( x  h, t )  (1  2 ) u( x, t )   u( x  h, t )  u( x, t  k )
can be rewritten as :
  ui 1, j  (1  2 ) ui , j   ui 1, j  ui , j 1
and can be expanded as a system of equations (fix j  1) :
  u0,1  (1  2 ) u1,1   u2,1  u1,0
  u1,1  (1  2 ) u2,1   u3,1  u2,0
  u2,1  (1  2 ) u3,1   u4,1  u3,0
  u3,1  (1  2 ) u4,1   u5,1  u4,0
41
  u( x  h, t )  (1  2 ) u( x, t )   u( x  h, t )  u( x, t  k )
can be expressed as a Tridiagonal system of equations :

1  2
  u1,1   u1,0   u0,1 

   1  2
 u  
u

2,0


  2,1   
u3,0

  1  2
   u3,1  


 u  u   u 


1

2

5,1 

  4,1   4,0
where u1,0 , u2,0 , u3,0 , and u4,0 are the initial temperature values
at x  x0  h, x0  2h, x0  3h, and x0  4h
u0,1 and u5,1 are the boundary values at x  x0 and x0  5h
42
The solution of the tridiagonal system produces :
The temperature values u1,1 , u2,1 , u3,1 , and u4,1 at t  t0  k
To compute the temperature values at t  t0  2k
Solve a second tridiagonal system of equations ( j  2)

1  2

   1  2





  1  2
 




1

2



To compute u1,2 , u2,2 , u3,2 , and u4,2
 u1, 2   u1,1   u0,2 
u  

u2,1
2
,
2
 

u3,1
u3,2  

  

u
u


u
5, 2 
 4, 2   4,1
Repeat the above step to compute temperature values at t0  3k , etc.
43
Solve the PDE :
 2u ( x, t ) u( x, t )

0
2
t
 x
u (0, t )  u(1, t )  0
u ( x,0)  sin( x )
Solve using Crank - Nicolson method
Use h  0.25, k  0.25 to find u ( x, t ) for x  [0,1], t  [0,1]
44
 2 u ( x, t )  u( x, t )

0
2
t
x
u ( x  h , t )  2u ( x , t )  u ( x  h , t ) u ( x , t )  u ( x , t  k )

2
k
h
16u ( x  h, t )  2u ( x, t )  u( x  h, t )   4u ( x, t )  u ( x, t  k )   0
k
4
2
h
 4 u ( x  h, t )  9 u ( x , t )  4 u ( x  h, t )  u ( x , t  k )
Define  
 4 ui 1, j  9 ui , j  4 ui 1, j  ui , j 1
45
 sin( / 4)
 4u0,1  9u1,1  4u2,1  u1,0  9u1,1  4u2,1
 4u1,1  9u2,1  4u3,1  u2,0  4u1,1  9u2,1  4u3,1  sin( / 2)
 4u2,1  9u3,1  sin(3 / 4)
 4u2,1  9u3,1  4u4,1  u3,0 
t4=1.0
0
t3=0.75
0
t2=0.5
0
u1,4
u2,4
u3,4
u1,3
u2,3
u3,3
u1,2
u2,2
u3,2
u1,1
u2,1
u3,1
0
0
0
t1=0.25
0
0
t0=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x0=0.0
x1=0.25
x2=0.5
x3=0.75
x4=1.0
46
The Solution of the PDE at t1  0.25 sec is the solution
of the following tridiagonal system of equations :
 9 4
  u1,1  sin(0.25 )
 4 9  4 u    sin(0.5 ) 

  2,1  

 4 9  u3,1  sin(0.75 )

 u1,1   0.21151
 
 u2,1   0.29912


u3,1   0.21151
47
 4u0, 2  9u1, 2  4u2,2  u1,1  9u1,2  4u2, 2
 0.21151
 4u1, 2  9u2,2  4u3, 2  u2,1  4u1,2  9u2, 2  4u3, 2  0.29912
 4u2,2  9u3,2  4u4, 2  u3,1 
t4=1.0
0
t3=0.75
0
t2=0.5
0
 4u2, 2  9u3, 2  0.21151
u1,4
u2,4
u3,4
u1,3
u2,3
u3,3
u1,2
u2,2
u3,2
u1,1
u2,1
u3,1
0
0
0
t1=0.25
0
0
t0=0
0
0
Sin(0.25π) Sin(0. 5π) Sin(0.75π)
x0=0.0
x1=0.25
x2=0.5
x3=0.75
x4=1.0
48
The Solution of the PDE at t2  0.5 sec is the solution
of the following tridiagonal system of equations :
 9 4
  u1,2   u1,1   0.21151
  4 9  4 u   u   0.29912

  2,2   2,1  

 4 9  u3,2  u3,1   0.21151

 u1,2  0.063267
 
 u2,2    0.089473


 u3,2  0.063267
49
The Solution of the PDE at t3  0.75 sec is the solution
of the following tridiagonal system of equations :
 9 4
  u1,3   u1,2  0.063267
 4 9  4 u   u   0.089473

  2, 3   2 , 2  

 4 9  u3,3  u3,2  0.063267

 u1,3  0.018924
 
 u2,3    0.026763


u3,3  0.018924
50
The Solution of the PDE at t4  1 sec is the solution
of the following tridiagonal system of equations :
 9 4
  u1,4   u1,3  0.018924
 4 9  4 u   u    0.026763

  2, 4   2,3  

 4 9  u3,4  u3,3  0.018924

 u1,4  0.0056606
 
 u2,4   0.0080053


u3,4  0.0056606
51
The Explicit Method:
• One needs to select small k to ensure stability.
• Computation per point is very simple but many
points are needed.
Cranks Nicolson:
•
Requires the solution of a Tridiagonal system.
•
Stable (Larger k can be used).
52
Download